diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-20 21:21:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-20 21:21:30 +0000 |
commit | 36c40243665f27f57f0167810c4e29d88347ee0a (patch) | |
tree | 8fcae6f4fbe1df6885e5ba65a030f3258da32dcd /Master/texmf-dist/tex/latex | |
parent | c7c1e843dca195d32cb6d976f4f75ffd942d573a (diff) |
njuthesis (20feb22)
git-svn-id: svn://tug.org/texlive/trunk@62107 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls | 792 |
1 files changed, 523 insertions, 269 deletions
diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls index 8f3b2043967..19383bdf427 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls @@ -25,10 +25,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo $Id: njuthesis.dtx 0.14.0 2022-01-16 00:00:00 +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$ - { Thesis template for Nanjing University } +\GetIdInfo $Id: njuthesis.dtx 0.15.0 2022-02-20 10:30:00 +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$ + {Thesis template for Nanjing University} \ProvidesExplClass{njuthesis} -{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} + {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \RequirePackage { xtemplate, l3keys2e } \msg_new:nnn { njuthesis } { l3-too-old } { @@ -49,7 +49,7 @@ The~ njuthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\ "#1"~ is~ not~ supported~ at~ present.~ - You~ must~ change your~ typesetting~ engine~ + You~ must~ change~ your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". } \sys_if_engine_xetex:F @@ -106,6 +106,13 @@ \cs_new:Nn \__nju_qquad: { \skip_horizontal:n { 2 em } } \cs_new:Nn \__nju_vskip: { \skip_vertical:n { 1 ex } } \cs_new:Nn \__nju_hskip: { \skip_horizontal:n { 0.3 em } } +\cs_new_protected:Npn \__nju_vskip:N #1 + { + \hrule height \c_zero_dim + \nobreak + \skip_vertical:n { - \baselineskip - \lineskip } + \skip_vertical:N #1 + } \cs_new_protected:Npn \__nju_define_name:nn #1#2 { \tl_const:cn { c__nju_name_ #1 _tl } { #2 } } \cs_new_protected:Npn \__nju_define_name:nnn #1#2#3 @@ -172,12 +179,12 @@ \dim_set:Nn #1 { \textwidth - #1 } #2 } \cs_generate_variant:Nn \__nju_full_uline:Nn { NV } -\cs_new_protected:Npn \__nju_uline_entry:nnnn #1#2#3#4 +\cs_new_protected:Npn \__nju_uline_entry:Nnnn #1#2#3#4 { \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } \__nju_ulined_center_box:nn { #1 } { \__nju_info:n { #3 } } } -\cs_new_protected:Npn \__nju_uline_bientry:nnnn #1#2#3#4 +\cs_new_protected:Npn \__nju_uline_bientry:Nnnn #1#2#3#4 { \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } \dim_sub:Nn #1 { \textwidth / 2 } @@ -239,6 +246,7 @@ { { acknowledgement } { 致\hspace{2em}谢 }, { id } { 学号 }, + { notation } { 符号表 }, { orig_date } { 日期 }, { paperlist } { 发表文章目录 }, { pdf_creator } { LaTeX~ with~ njuthesis~ class }, @@ -300,8 +308,8 @@ { confer } { 学位授予单位和日期 }, { df_date } { 论文答辩日期 }, { degree } { 申请学位级别 }, - { degree_l } { (申请 }, - { degree_r } { 学位) }, + { apply } + { (申请 \l__nju_info_degree_tl 学位) }, { field } { 研究方向 }, { g } { 研究生 }, { grade } { 级 }, @@ -358,55 +366,6 @@ { theorem } { 定理 } { Theorem } } { \__nju_define_name:nnn #1 } -\keys_define:nn { nju / info } - { - title .tl_set:N = \l__nju_info_title_tl, - title .initial:n = { 空 }, - title* .tl_set:N = \l__nju_info_title_en_tl, - keywords .clist_set:N = \l__nju_info_keywords_clist, - keywords* .clist_set:N = \l__nju_info_keywords_en_clist, - grade .tl_set:N = \l__nju_info_grade_tl, - student-id .tl_set:N = \l__nju_info_id_tl, - author .tl_set:N = \l__nju_info_author_tl, - author* .tl_set:N = \l__nju_info_author_en_tl, - department .tl_set:N = \l__nju_info_dept_tl, - department* .tl_set:N = \l__nju_info_dept_en_tl, - major .tl_set:N = \l__nju_info_major_tl, - major* .tl_set:N = \l__nju_info_major_en_tl, - field .tl_set:N = \l__nju_info_field_tl, - field* .tl_set:N = \l__nju_info_field_en_tl, - supervisor .clist_set:N = \l__nju_info_supv_clist, - supervisor* .tl_set:N = \l__nju_info_supv_en_tl, - supervisor-ii .clist_set:N = \l__nju_info_supv_ii_clist, - supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, - submit-date .tl_set:N = \l__nju_info_sm_date_raw_tl, - submit-date .initial:V = \c__nju_today_tl, - defend-date .tl_set:N = \l__nju_info_df_date_raw_tl, - defend-date .initial:V = \c__nju_today_tl, - chairman .tl_set:N = \l__nju_info_chairman_tl, - reviewer .clist_set:N = \l__nju_info_reviewer_clist, - clc .tl_set:N = \l__nju_info_clc_tl, - secret-level .tl_set:N = \l__nju_info_seclv_tl, - udc .tl_set:N = \l__nju_info_udc_tl, - supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, - } -\bool_set:Nn \l__nju_second_supv_bool - { ! \clist_if_empty_p:N \l__nju_info_supv_ii_clist } -\tl_set:Nn \l__nju_info_supv_full_tl - { - \clist_use:Nn \l__nju_info_supv_clist { \__nju_hskip: } - \bool_if:NT \l__nju_second_supv_bool - { - \__nju_quad: - \clist_use:Nn \l__nju_info_supv_ii_clist { \__nju_hskip: } - } - } -\tl_set:Nn \l__nju_info_supv_full_en_tl - { - \l__nju_info_supv_en_tl - \bool_if:NT \l__nju_second_supv_bool - { \__nju_quad: \l__nju_info_supv_ii_en_tl } - } \PassOptionsToClass { a4paper, @@ -446,7 +405,6 @@ caption, graphicx, enumitem, - url, hyperref, cleveref } @@ -476,6 +434,76 @@ } \sys_if_engine_luatex:T { \__nju_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } } +\keys_define:nn { nju / info } + { + title .tl_set:N = \l__nju_info_title_tl, + title .initial:n = { 空 }, + title* .tl_set:N = \l__nju_info_title_en_tl, + keywords .clist_set:N = \l__nju_info_keywords_clist, + keywords* .clist_set:N = \l__nju_info_keywords_en_clist, + grade .tl_set:N = \l__nju_info_grade_tl, + student-id .tl_set:N = \l__nju_info_id_tl, + author .tl_set:N = \l__nju_info_author_tl, + author* .tl_set:N = \l__nju_info_author_en_tl, + department .tl_set:N = \l__nju_info_dept_tl, + department* .tl_set:N = \l__nju_info_dept_en_tl, + major .tl_set:N = \l__nju_info_major_tl, + major* .tl_set:N = \l__nju_info_major_en_tl, + field .tl_set:N = \l__nju_info_field_tl, + field* .tl_set:N = \l__nju_info_field_en_tl, + supervisor .clist_set:N = \l__nju_info_supv_clist, + supervisor* .tl_set:N = \l__nju_info_supv_en_tl, + supervisor-ii .clist_set:N = \l__nju_info_supv_ii_clist, + supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, + submit-date .tl_set:N = \l__nju_info_sm_date_raw_tl, + submit-date .initial:V = \c__nju_today_tl, + defend-date .tl_set:N = \l__nju_info_df_date_raw_tl, + defend-date .initial:V = \c__nju_today_tl, + chairman .tl_set:N = \l__nju_info_chairman_tl, + reviewer .clist_set:N = \l__nju_info_reviewer_clist, + clc .tl_set:N = \l__nju_info_clc_tl, + secret-level .tl_set:N = \l__nju_info_seclv_tl, + udc .tl_set:N = \l__nju_info_udc_tl, + supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, + } +\ctex_at_end_preamble:n + { + \bool_set:Nn \l__nju_second_supv_bool + { ! \clist_if_empty_p:N \l__nju_info_supv_ii_clist } + \tl_set:Nx \l__nju_info_supv_full_tl + { + \clist_use:Nn \l__nju_info_supv_clist { \__nju_hskip: } + \bool_if:NT \l__nju_second_supv_bool + { + \__nju_quad: + \clist_use:Nn \l__nju_info_supv_ii_clist { \__nju_hskip: } + } + } + \tl_set:Nx \l__nju_info_supv_full_en_tl + { + \l__nju_info_supv_en_tl + \bool_if:NT \l__nju_second_supv_bool + { \__nju_quad: \l__nju_info_supv_ii_en_tl } + } + \tl_set:Nn \l__nju_info_sm_date_tl + { + \exp_last_unbraced:NV + \__nju_date:www \l__nju_info_sm_date_raw_tl \q_stop + } + \int_compare:nF { \l__nju_info_degree_int == 1 } + { + \tl_set:Nn \l__nju_info_sm_date_en_tl + { + \exp_last_unbraced:NV + \__nju_date_en:www \l__nju_info_sm_date_raw_tl \q_stop + } + \tl_set:Nn \l__nju_info_df_date_tl + { + \exp_last_unbraced:NV + \__nju_date:www \l__nju_info_df_date_raw_tl \q_stop + } + } + } \tl_if_empty:NTF \g__nju_latin_font_tl { \bool_gset_true:N \g__nju_load_sys_font_bool } { @@ -528,6 +556,8 @@ Scale=MatchLowercase, Ligatures=CommonOff] } +\cs_new_protected:Npn \__nju_diable_no_script_msg: + { \msg_redirect_name:nnn { fontspec } { no-script } { info } } \cs_new_protected:Npn \__nju_load_cjk_font_win: { \setCJKmainfont { SimSun } @@ -541,7 +571,7 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_mac: { - \msg_redirect_name:nnn { fontspec } { no-script } { info } + \__nju_diable_no_script_msg: \setCJKmainfont{Songti~SC~Light}[ BoldFont=Songti~SC~Bold, ItalicFont=Kaiti~SC, @@ -556,8 +586,7 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_fandol: { - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} + \__nju_diable_no_script_msg: \setCJKmainfont{FandolSong-Regular}[ Extension=.otf, BoldFont=FandolSong-Bold, @@ -579,10 +608,10 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_founder: { + \sys_if_engine_xetex:T + { \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } } \sys_if_engine_luatex:T - { - \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} - } + { \defaultCJKfontfeatures { JFM = { zh_CN/{quanjiao,fzpr} } } } \setCJKmainfont { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] @@ -678,110 +707,160 @@ headheight = 15 pt } \bool_if:NT \g__nju_draft_bool { \geometry { showframe } } +\cs_new_protected:Npn \__nju_fancy_head:nn #1#2 + { \fancyhead [#1] { \small \kaishu \nouppercase {#2} } } \fancypagestyle { plain } { \fancyhf { } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } + \fancyfoot [ C ] { \zihao { 5 } \rmfamily \thepage } + \tl_set:Nn \headrulewidth { \c_zero_dim } + \tl_set:Nn \footrulewidth { \c_zero_dim } } -\fancypagestyle{headings} +\cs_new_protected:Npn \__nju_set_heading_g: { - \fancyhf { } - \fancyhead [ CO ] { \leftmark } - \fancyhead [ CE ] { \rightmark } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0.4 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } - \setlength { \headheight } { 20 pt } + \bool_if:NTF \g__nju_twoside_bool + { + \__nju_fancy_head:nn { EL } { \leftmark } + \__nju_fancy_head:nn { OR } { \rightmark } + } + { + \__nju_fancy_head:nn { L } { \leftmark } + \__nju_fancy_head:nn { R } { \rightmark } + } + \tl_set:Nn \headrulewidth { 0.4 pt } + \dim_set:Nn \headheight { 20 pt } } \RenewDocumentCommand \frontmatter { } { \cleardoublepage - \pagestyle{empty} - \pagenumbering{Roman} + \pagestyle { empty } + \pagenumbering { Roman } } \RenewDocumentCommand \mainmatter { } { \cleardoublepage - \int_compare:nTF { \l__nju_info_degree_int == 1 } - { \pagestyle { plain } } { \pagestyle { headings } } + \pagestyle { plain } + \int_compare:nF { \l__nju_info_degree_int == 1 } + { \__nju_set_heading_g: } \pagenumbering { arabic } \normalfont \normalsize } \tl_const:Nn \c__nju_sec_format_tl { \large \normalfont \sffamily } -\NewDocumentCommand \njuchapter { m } - { - \chapter* { #1 } - \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } - \@mkboth { #1 } { #1 } +\cs_new_protected:Npn \__nju_add_tocline:n #1 + { \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } } +\cs_generate_variant:Nn \__nju_add_tocline:n { V } +\cs_new_protected:Npn \__nju_chapter:n #1 + { + \chapter * { #1 } + \__nju_add_tocline:n { #1 } + \__nju_chapter_header:n { #1 } + } +\cs_generate_variant:Nn \__nju_chapter:n { V } +\cs_new_protected:Npn \__nju_chapter_header:n #1 + { + \bool_if:NTF \g__nju_twoside_bool + { \markboth { #1 } { #1 } } + { \markboth { \hfill #1 \hfill } { } } + } +\NewDocumentCommand \njuchapter { m } { \__nju_chapter:V { #1 } } +\keys_set:nn { ctex } + { + chapter / beforeskip = 10 pt, + chapter / afterskip = 60 pt, + chapter / format = \c__nju_sec_format_tl \centering, + section / format = \c__nju_sec_format_tl, + subsection / format = \c__nju_sec_format_tl, + subsubsection / format = \c__nju_sec_format_tl, + contentsname = { 目\hspace{2em}录 }, + listfigurename = { 插图目录 }, + listtablename = { 表格目录 }, + chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline { #1 } #2 } -\ctexset +\keys_define:nn { nju / style } { - chapter/beforeskip = 10 pt, - chapter/afterskip = 60 pt, - chapter/format = \centering \c__nju_sec_format_tl, - section/format = \c__nju_sec_format_tl, - subsection/format = \c__nju_sec_format_tl, - subsubsection/format = \c__nju_sec_format_tl + toc-in-toc .bool_gset:N = \g__nju_toc_in_toc_bool, + toc-in-toc .initial:n = true } -\ctexset +\cs_new_protected:Npn \__nju_make_toc:nn #1#2 { - contentsname = { 目\hspace{2em}录 }, - listfigurename = { 插图目录 }, - listtablename = { 表格目录 }, - chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline {#1} #2 - } -\cs_new_protected:Npn \__nju_modify_toc_title:nn #1#2 -{ - \group_begin: - \ctexset { chapter/format = \centering \zihao{3} \bf } - \njuchapter { #1 } - \group_end: - \@starttoc { #2 } -} + \group_begin: + \keys_set:nn { ctex } + { chapter/format = \centering \zihao { 3 } \bfseries } + \bool_if:NTF \g__nju_toc_in_toc_bool + { \__nju_chapter:n { #1 } } + { + \chapter * { #1 } + \pdfbookmark [0] { #1 } { #2 } + \__nju_chapter_header:n { #1 } + } + \group_end: + \@starttoc { #2 } + } +\cs_generate_variant:Nn \__nju_make_toc:nn { Vn } \RenewDocumentCommand \tableofcontents { } - { \__nju_modify_toc_title:nn { \contentsname } { toc } } + { \__nju_make_toc:Vn \contentsname { toc } } \RenewDocumentCommand \listoffigures { } - { \__nju_modify_toc_title:nn { \listfigurename } { lof } } + { \__nju_make_toc:Vn \listfigurename { lof } } \RenewDocumentCommand \listoftables { } - { \__nju_modify_toc_title:nn { \listtablename } { lot } } + { \__nju_make_toc:Vn \listtablename { lot } } +\clist_new:N \g__nju_biblatex_option_clist +\clist_new:N \g__nju_bib_resource_clist +\msg_new:nnn { njuthesis } { extra-bib-style } + { + Wrongly-placed~ bib~ style.\\ + Please~ use~ the~ `bib/style`~ field. + } \keys_define:nn { nju / bib } { style .choice:, style / numeric .code:n = - { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015 } }, + { + \clist_gput_right:Nn \g__nju_biblatex_option_clist + { style = gb7714-2015 } + }, style / author-year .code:n = - { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015ay } }, + { + \clist_gput_right:Nn \g__nju_biblatex_option_clist + { style = gb7714-2015ay } + }, + style / unknown .code:n = + { + \clist_gput_right:Nx \g__nju_biblatex_option_clist + { style = \l_keys_value_tl } + }, style .initial:n = numeric, - resource .clist_set:N = \l__nju_bib_resource_clist + option .code:n = + { + \tl_if_in:VnTF \l_keys_value_tl { style = } + { \msg_error:nn { njuthesis } { extra-bib-style } } + { + \clist_gput_right:NV \g__nju_biblatex_option_clist + \l_keys_value_tl + } + }, + resource .code:n = + { + \clist_gput_right:NV \g__nju_bib_resource_clist + \l_keys_value_tl + }, } \NewDocumentCommand \addbibresource { m } - { \clist_gput_right:Nn \l__nju_bib_resource_clist { #1 } } + { \clist_gput_right:Nn \g__nju_bib_resource_clist { #1 } } \cs_new_protected:Npn \__nju_biblatex_pre_setup: { \cs_undefine:N \addbibresource - \clist_put_right:Nn \l__nju_tmp_clist { backend = biber } - \exp_args:NV \PassOptionsToPackage \l__nju_tmp_clist { biblatex } - \clist_clear:N \l__nju_tmp_clist + \clist_gput_right:Nn \g__nju_biblatex_option_clist { backend = biber } + \exp_args:NV \PassOptionsToPackage + \g__nju_biblatex_option_clist { biblatex } } \cs_new_protected:Npn \__nju_biblatex_post_setup: { - \defbibheading { njubib } [ \bibname ] { \njuchapter { ##1 } } - \DeclarePrintbibliographyDefaults { heading = njubib } - \clist_map_inline:Nn \l__nju_bib_resource_clist + \defbibheading { njubibintoc } [ \bibname ] { \__nju_chapter:V { ##1 } } + \tl_if_eq:NnTF \blx@refsecreset@level { 2 } + { \DeclarePrintbibliographyDefaults { heading = subbibintoc } } + { \DeclarePrintbibliographyDefaults { heading = njubibintoc } } + \clist_map_inline:Nn \g__nju_bib_resource_clist { \addbibresource { ##1 } } - \AtEveryBibitem - { - \clist_map_inline:nn - { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } - { \clearfield { ##1 } } - % \ifentrytype{online} { } - % { - % \ifentrytype{misc} { } - % \clearfield{urldate} { \clearfield{url} } - % } - } } \BeforeBeginEnvironment { document } { @@ -893,6 +972,76 @@ { \clist_item:cn { l__nju_info_ #1 _clist } { 2 } } \__nju_vskip: } +\DeclareObjectType { nju } { \c_zero_int } +\DeclareTemplateInterface { nju } { element } { \c_zero_int } + { + content : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + bottom-skip : skip = \c_zero_skip, + align : choice { l, r, c, n } = c + } +\DeclareTemplateCode { nju } { element } { \c_zero_int } + { + content = \l__njuelem_content_tl, + format = \l__njuelem_format_tl, + bottom-skip = \l__njuelem_bottom_skip, + align = + { + l = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \flushleft + \tl_set_eq:NN \l__njuelem_end_align_tl \endflushleft }, + r = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \flushright + \tl_set_eq:NN \l__njuelem_end_align_tl \endflushright }, + c = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \center + \tl_set_eq:NN \l__njuelem_end_align_tl \endcenter }, + n = + { \tl_clear:N \l__njuelem_begin_align_tl + \tl_clear:N \l__njuelem_end_align_tl } + } + } + { + \AssignTemplateKeys + \group_begin: + \l__njuelem_begin_align_tl + \l__njuelem_format_tl + \l__njuelem_content_tl \par + \l__njuelem_end_align_tl + \group_end: + \__nju_vskip:N \l__njuelem_bottom_skip + } +\DeclareTemplateInterface { nju } { page } { \c_zero_int } + { + element : commalist = \c_empty_clist, + prefix : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + top-skip : skip = \c_zero_skip, + bottom-skip : skip = \c_zero_skip + } +\DeclareTemplateCode { nju } { page } { \c_zero_int } + { + element = \l__njupage_element_clist, + prefix = \l__njupage_prefix_tl, + format = \l__njupage_format_tl, + top-skip = \l__njupage_top_skip, + bottom-skip = \l__njupage_bottom_skip + } + { + \AssignTemplateKeys + \newpage + \__nju_vskip:N \l__njupage_top_skip + \group_begin: + \l__njupage_format_tl + \clist_map_inline:Nn \l__njupage_element_clist + { \UseInstance { nju } { \l__njupage_prefix_tl ##1 } } + \group_end: + \__nju_vskip:N \l__njupage_bottom_skip + } +\cs_new_protected:Npn \__nju_declare_element:nn #1#2 + { \DeclareInstance { nju } {#1} { element } {#2} } +\cs_new_protected:Npn \__nju_declare_page:nn #1#2 + { \DeclareInstance { nju } {#1} { page } {#2} } \keys_define:nn { nju / style } { emblem-img .tl_set:N = \l__nju_emblem_img_tl, @@ -912,30 +1061,34 @@ { \includegraphics [ width = #2, height = #3 ] { \l__nju_name_img_tl } } } - \tl_set:Nn \l__nju_info_sm_date_tl - { - \exp_last_unbraced:NV - \__nju_date:www \l__nju_info_sm_date_raw_tl \q_stop - } - \int_compare:nF { \l__nju_info_degree_int == 1 } - { - \tl_set:Nn \l__nju_info_sm_date_en_tl - { - \exp_last_unbraced:NV - \__nju_date_en:www \l__nju_info_sm_date_raw_tl \q_stop - } - \tl_set:Nn \l__nju_info_df_date_tl - { - \exp_last_unbraced:NV - \__nju_date:www \l__nju_info_df_date_raw_tl \q_stop - } - } } -\cs_new_protected:Npn \__nju_cover_title_ug: - { \__nju_spread_box:nnn { 9 em } { \bf } { \l__nju_info_type_tl } } +\__nju_declare_element:nn { cover / ug / emblem-img } + { + content = \njuemblem [ black ] { ! } { 3.35 cm }, + bottom-skip = 1 cm, + align = l + } +\__nju_declare_element:nn { cover / ug / name-img } + { + content = \njuname [ black ] { ! } { 3 cm }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / ug / title } + { + content = + \__nju_spread_box:nnn { 9 em } { \bf } { \l__nju_info_type_tl }, + format = \zihao { -1 }, + bottom-skip = 0 pt plus 1.5 fill + } +\__nju_declare_element:nn { cover / ug / info } + { + content = + \__nju_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em }, + format = \zihao { 3 } + } \cs_new_protected:Npn \__nju_cover_info_ug:nnn #1#2#3 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \__nju_cover_entry:nnn { dept } { #1 } { #2 } \__nju_cover_entry:nnn { major } { #1 } { #2 } @@ -948,20 +1101,50 @@ \__nju_cover_entry:nnn { sm_date } { #1 } { #2 } \end{minipage} } -\cs_new_protected:Npn \__nju_cover_title_g: +\__nju_declare_element:nn { cover / g / emblem-img } + { + content = \njuemblem [ black ] { ! } { 1.9 cm }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / g / name-img } + { + content = \njuname [ black ] { 4.4 cm } { ! }, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / type } + { + content = + \__nju_spread_box:nnn { 9 em } { } { \l__nju_info_type_tl }, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / g / degree } { - \__nju_spread_box:nnn { 9em } { } { \l__nju_info_type_tl } \__nju_vskip: - \c__nju_name_degree_l_tl \l__nju_info_degree_tl \c__nju_name_degree_r_tl + content = \c__nju_name_apply_tl, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm plus 1.5 fil } +\__nju_declare_element:nn { cover / g / info } + { + content = \__nju_cover_info_g:nn { 6.2 em } { 18 em }, + bottom-skip = 0 pt plus 1.5 fil + } +\__nju_declare_element:nn { cover / g / date } + { content = \l__nju_info_sm_date_tl } \cs_new_protected:Npn \__nju_cover_info_g:nn #1#2 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \__nju_multiline_title:nnn { } { #1 } { #2 } \clist_map_inline:nn { author, major, field, supv_full } { \__nju_cover_entry:nnn { ##1 } { #1 } { #2 } } \end{minipage} } +\__nju_declare_element:nn { cover / g / back } + { + content = \__nju_cover_back_g:, + align = l + } \cs_new_protected:Npn \__nju_cover_back_g: { \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_id_tl } @@ -973,29 +1156,82 @@ \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_supv_full_tl } { : \__nju_quad: } \skip_horizontal:n { 8 em } \c__nju_name_sign_tl } -\cs_new_protected:Npn \__nju_cover_en_g: - { - \parbox { \textwidth } - { \centering \bf \sffamily \zihao { 2 } \l__nju_info_title_en_tl } - \skip_vertical:n { 1 cm } - \group_begin: \zihao { 4 } { by } \group_end: \__nju_vskip: - \group_begin: - \bf \sffamily \zihao { 4 } \l__nju_info_author_en_tl - \group_end: \skip_vertical:n { 1 cm } - \group_begin: \zihao { 4 } { Supervised~ by } \group_end: \__nju_vskip: - \group_begin: - \sffamily \zihao { 4 } \l__nju_info_supv_full_en_tl - \group_end: \vfill +\__nju_declare_element:nn { cover / g / en / title } + { + content = \l__nju_info_title_en_tl, + format = \bf \sffamily \zihao { 2 }, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / en / top } + { + content = + { by } + \skip_vertical:N \c_zero_skip + \textbf { \sffamily \l__nju_info_author_en_tl } + \skip_vertical:n { .5 cm } + { Supervised~ by } + \skip_vertical:N \c_zero_skip + \textsf { \l__nju_info_supv_full_en_tl }, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / g / en / middle } + { + content = \c__nju_cover_en_text_tl \__nju_vskip: \textsc { \clist_item:Nn \c__nju_name_degree_en_clist { \l__nju_info_degree_int } } \__nju_vskip: { in } \__nju_vskip: - \l__nju_info_major_en_tl \skip_vertical:n { 1 cm } - \njuemblem [ black ] { ! } { 2.5 cm } \__nju_vskip: - \l__nju_info_dept_en_tl \\ \c__nju_name_nju_en_tl - \skip_vertical:n { 1 cm } + \l__nju_info_major_en_tl, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / en / emblem-img } + { + content = \njuemblem [ black ] { ! } { 2.5 cm }, + bottom-skip = 1.5 cm + } +\__nju_declare_element:nn { cover / g / en / bottom } + { + content = + \l__nju_info_dept_en_tl \skip_vertical:N \c_zero_skip + \c__nju_name_nju_en_tl \skip_vertical:n { 1 cm } \l__nju_info_sm_date_en_tl } +\__nju_declare_element:nn { cover / nl / top } + { + content = \__nju_cover_top_nl:, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / nl / name } + { + content = + \__nju_spread_box:nnn { 6 em } { } { \c__nju_name_title_tl }, + format = \zihao { -0 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / nl / title } + { + content = \__nju_cover_title_nl:, + format = \zihao { 1 }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / nl / middle } + { + content = \__nju_cover_info_nl:, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / nl / bottom } + { + content = \__nju_cover_bottom_nl:, + bottom-skip = 1 cm, + align = r + } +\__nju_declare_element:nn { cover / nl / date } + { + content = \__nju_qquad: 年 \__nju_quad: 月 \__nju_quad: 日, + format = \kaishu \zihao { 3 } + } \cs_new_protected:Npn \__nju_cover_top_nl: { \__nju_spread_box:nnn { 3.2 em } { } { \c__nju_name_clc_tl } \__nju_hskip: @@ -1007,15 +1243,14 @@ } \cs_new_protected:Npn \__nju_cover_title_nl: { - \noindent \kaishu \zihao { -0 } \skip_vertical:n { -1 cm } - \__nju_spread_box:nnn { 6 em } { } { \c__nju_name_title_tl } - \__nju_vskip: \zihao { 1 } \__nju_split_title:n { \l__nju_info_title_tl } \__nju_multiline_box:nnnn { \l__nju_tmp_int } \l__nju_tmp_clist { 3 } { 15 em } - \__nju_vskip: \zihao{4} \c__nju_name_title_nl_tl - \__nju_vskip: \zihao{1} + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } \c__nju_name_title_nl_tl } + \skip_vertical:N \c_zero_skip \__nju_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl } - \__nju_vskip: \zihao{4} { ( } \c__nju_name_author_tl { ) } + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } { ( } \c__nju_name_author_tl { ) } } } \cs_new_protected:Npn \__nju_cover_info_nl: { @@ -1023,13 +1258,13 @@ { \clist_item:Nn \l__nju_info_supv_clist { 1 } } \tl_set:Nn \l__nju_info_supv_ttl_tl { \clist_item:Nn \l__nju_info_supv_clist { 2 } } - \__nju_uline_entry:nnnn \l__nju_tmp_dim { supv_info } { supv } { } \\ + \__nju_uline_entry:Nnnn \l__nju_tmp_dim { supv_info } { supv } { } \\ \__nju_ulined_center_box:nn { \textwidth } { \__nju_info:n { supv_ttl } \__nju_quad: \__nju_info:n { supv_cont } } \\ - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { degree } { degree } { } - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { major_nl } { major } { } \\ - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { sm_date } { sm_date } { } - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { df_date } { df_date } { } \\ + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { degree } { degree } { } + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { major_nl } { major } { } \\ + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { sm_date } { sm_date } { } + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { df_date } { df_date } { } \\ \__nju_full_uline:Nn \l__nju_tmp_dim { \c__nju_name_confer_tl } \__nju_uline:n { \l__nju_tmp_dim } } @@ -1041,69 +1276,47 @@ \__nju_multiline_box:nnnn { \l__nju_tmp_int } { \l__nju_info_reviewer_clist } { 4 } { 9 em } } -\cs_new_protected:Npn \__nju_make_cover_ug: +\__nju_declare_page:nn { cover-ug-default } { - \newpage - \null \skip_horizontal:n { -1 cm } - \njuemblem [ black ] { ! } { 3.35 cm } - \begin{center} - \njuname [ black ] { ! } { 3 cm } \__nju_vskip: - \group_begin: \zihao { -1 } \__nju_cover_title_ug: \group_end: - \skip_vertical:n { 1.5 cm } \vfil - \zihao{3} \__nju_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em } \vfil - \end{center} + element = { emblem-img, name-img, title, info }, + prefix = cover / ug /, + bottom-skip = 0.5 cm plus 1.5 fill } -\cs_new_protected:Npn \__nju_make_cover_g: +\__nju_declare_page:nn { cover-g-front-default } { - \newpage - \begin{center} - \null \skip_vertical:n { 1 cm } - \njuemblem [ black ] { ! } { 1.9 cm } \skip_vertical:n { 0.5 cm } - \njuname [ black ] { 4.4 cm } { ! } \__nju_vskip: - \group_begin: - \zihao { -1 } \bf \kaishu \__nju_cover_title_g: - \group_end: - \skip_vertical:n { 3 cm } \vfil - \group_begin: - \zihao { 3 } \kaishu - \__nju_cover_info_g:nn { 6.2 em } { 18 em } \vfil - \skip_vertical:n { 2 cm } \l__nju_info_sm_date_tl - \group_end: - \end{center} - \newpage - \noindent \null \skip_vertical:n { 18 cm } - \group_begin: - \zihao { 3 } \kaishu \__nju_cover_back_g: - \group_end: - \newpage - \noindent \null \skip_vertical:n { 2 cm } - \begin{center} - \__nju_cover_en_g: - \end{center} + element = { emblem-img, name-img, type, degree, info, date }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 1.5 cm } -\cs_new_protected:Npn \__nju_make_cover_nl: +\__nju_declare_page:nn { cover-g-back-default } { - \pdfbookmark [ 0 ] { 国家图书馆封面 } { nlcover } - \noindent \null - \begin{center} - \zihao{ -4 } \skip_vertical:n { -2 cm } - \__nju_cover_top_nl: - \end{center} - \begin{center} - \skip_vertical:n { -2 cm } - \__nju_cover_title_nl: - \end{center} - \group_begin: - \kaishu \zihao { 4 } \noindent \__nju_cover_info_nl: - \group_end: - \begin{flushright} - \__nju_cover_bottom_nl: - \end{flushright} - \begin{center} - \kaishu \zihao{3} \__nju_qquad: 年 \__nju_quad: 月 \__nju_quad: 日 - \end{center} - \skip_vertical:n { -1 cm } + element = { back }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 20 cm } +\__nju_declare_page:nn { cover-g-en-default } + { + element = { title, top, middle, emblem-img, bottom }, + prefix = cover / g / en /, + top-skip = 0 pt plus 1.2 fil + } +\__nju_declare_page:nn { cover-nl-default } + { + element = { top, name, title, middle, bottom, date }, + prefix = cover / nl /, + format = \kaishu + } +\cs_new_protected:Npn \__nju_make_cover_ug: + { \UseInstance { nju } { cover-ug-default } } +\cs_new_protected:Npn \__nju_make_cover_g: + { + \clist_map_inline:nn { front, back, en } + { \UseInstance { nju } { cover-g- ##1 -default } } + } +\cs_new_protected:Npn \__nju_make_cover_nl: + { \UseInstance { nju } { cover-nl-default } } \cs_new_protected:Npn \__nju_make_orig_decl: { \chapter* { \c__nju_name_nju_tl \c__nju_name_orig_decl_tl } @@ -1123,7 +1336,8 @@ { \bool_if:NF \g__nju_draft_bool { - \pagestyle { empty } + \pagestyle { empty } + \pagenumbering { gobble } \bool_if:NTF \g__nju_nlcover_bool { \__nju_make_cover_nl: } { \use:c { __nju_make_cover_ \l__nju_info_diploma_tl : } } @@ -1135,29 +1349,29 @@ \pagenumbering { Roman } \normalfont \normalsize } +\keys_define:nn { nju / style } + { + abstract-in-toc .bool_gset:N = \g__nju_abs_in_toc_bool, + abstract-in-toc .initial:n = true + } +\cs_new_protected:Npn \__nju_abs_bookmark:nn #1#2 + { + \phantomsection + \bool_if:NTF \g__nju_abs_in_toc_bool + { \__nju_add_tocline:n { #1 } } + { \pdfbookmark [0] { #1 } { #2 } } + } +\cs_generate_variant:Nn \__nju_abs_bookmark:nn { Vn } \cs_new_protected:Npn \__nju_abs_title_uuline:n #1 { \bf \kaishu \zihao { -2 } \__nju_uuline:n { #1 } } \cs_new_protected:Npn \__nju_abs_info_style:n #1 { \noindent \zihao{ #1 } \kaishu } \cs_new_protected:Npn \__nju_abs_info_style_en: #1 { \zihao{ #1 } } -\cs_new_protected:Npn \__nju_abs_bookmark: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c__nju_sec_format_tl \c__nju_name_lang_tl \c__nju_name_abstract_tl } - } -\cs_new_protected:Npn \__nju_abs_bookmark_en: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c__nju_sec_format_tl \c__nju_name_abstract_en_tl } - } -\cs_generate_variant:Nn \clist_map_inline:nn { Vn } \cs_new_protected:Npn \__nju_abs_title_ug:n #1 { - \__nju_name:n { nju } \__nju_name:n { type } - \__nju_name:n { lang #1 } \__nju_name:n { abstract } + \clist_map_inline:nn { nju, type, lang #1, abstract } + { \__nju_name:n { ##1 } } } \cs_new_protected:Npn \__nju_abs_info_ug:nn #1#2 { @@ -1214,18 +1428,27 @@ \tl_range:Nnn \l__nju_info_title_en_tl { 41 } { -1 } \clist_map_inline:nn { major, author, supv_full } { \\ - \__nju_uline_entry:nnnn \l__nju_tmp_dim { ##1 _en } { ##1 _en } { #2 } + \__nju_uline_entry:Nnnn \l__nju_tmp_dim { ##1 _en } { ##1 _en } { #2 } } } } \cs_new_protected:Npn \__nju_print_keywords:nn #1#2 { - \skip_vertical:n { 2 ex } - \group_begin: - \noindent \bf \heiti - \use:c { c__nju_name_keywords #1 _tl } - \group_end: - \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } + \exp_args:NNc + \tl_set_eq:NN \l__nju_tmp_tl { c__nju_name_keywords #1 _tl } + \__nju_get_text_width:Nn \l__nju_tmp_dim { \l__nju_tmp_tl } + \list { } + { + \labelwidth \l__nju_tmp_dim + \labelsep \c_zero_dim + \leftmargin \c_zero_dim + \rightmargin \c_zero_dim + \advance \leftmargin \l__nju_tmp_dim + \cs_set_eq:NN \makelabel \textbf + } + \item [ \l__nju_tmp_tl ] + \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } + \endlist } \cs_new_protected:Npn \__nju_make_abs_ug:nn #1#2 { @@ -1249,26 +1472,29 @@ \__nju_abs_info_g:nn { #1 } { #2 } \group_end: \__nju_vskip: } -\NewDocumentEnvironment{abstract} { +b } +\NewDocumentEnvironment { abstract } { +b } { \cleardoublepage - \__nju_abs_bookmark: + \thispagestyle { plain } + \__nju_abs_bookmark:Vn + { \c__nju_name_lang_tl \c__nju_name_abstract_tl } { abstract } \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { } { : } \group_begin: \kaishu \zihao { -4 } #1 } { \__nju_print_keywords:nn { } { ; } \group_end: } -\NewDocumentEnvironment{abstract*} { +b } +\NewDocumentEnvironment { abstract* } { +b } { \cleardoublepage - \__nju_abs_bookmark_en: + \thispagestyle { plain } + \__nju_abs_bookmark:Vn { \c__nju_name_abstract_en_tl } { abstract-en } \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { _en } { :~ } - \group_begin: \kaishu \zihao{ -4 } #1 + \group_begin: \zihao{ -4 } #1 } { \__nju_print_keywords:nn { _en } { ;~ } \group_end: } \NewDocumentEnvironment { preface } { +b } - { \njuchapter { \c__nju_name_preface_tl } #1 } { } + { \__nju_chapter:V { \c__nju_name_preface_tl } #1 } { } \NewDocumentEnvironment { acknowledgement } { +b } - { \njuchapter { \c__nju_name_acknowledgement_tl } #1 } { } + { \__nju_chapter:V { \c__nju_name_acknowledgement_tl } #1 } { } \NewDocumentCommand \njupaperlist { O { \c__nju_name_paperlist_tl } m } { @@ -1287,6 +1513,34 @@ \end{refsection} \group_end: } +\cs_new_protected:Npn \__nju_notation_label:n #1 { #1 \hfil } +\cs_new_protected:Npn \__nju_make_notation:nn #1#2 + { + \dim_set:Nn \l__nju_tmp_dim { \textwidth - #1 - #2 } + \list { } + { + \labelwidth #2 + \labelsep \c_zero_dim + \itemsep \c_zero_dim + \parsep \c_zero_dim + \leftmargin .5\l__nju_tmp_dim + \rightmargin \leftmargin + \advance \leftmargin #2 + \cs_set_eq:NN \makelabel \__nju_notation_label:n + } + } +\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } } + { + \__nju_chapter:V { \c__nju_name_notation_tl } + \__nju_make_notation:nn { #1 } { #2 } + } + { \endlist } +\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } } + { + \chapter * { \c__nju_name_notation_tl } + \__nju_make_notation:nn { #1 } { #2 } + } + { \endlist } \endinput %% %% End of file `njuthesis.cls'. |