diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls | 716 |
1 files changed, 419 insertions, 297 deletions
diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls index ec1568b5bcc..8f3b2043967 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls @@ -6,8 +6,9 @@ %% %% njuthesis.dtx (with options: `class') %% -%% Copyright (C) 2021 -%% by Nanjing University Linux User Group <nju.lug@yaoge123.cn> +%% Copyright (C) 2021 - 2022 +%% by Nanjing University Linux User Group +%% <git+nju-lug-email-3104-issue-@yaoge123.cn> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3c of this license @@ -19,13 +20,13 @@ %% and version 1.3 or later is part of all distributions of LaTeX version %% 2005/12/01 or later. %% -%% To produce the documentation run the original source files ending with `.dtx' -%% through XeTeX. +%% To produce the documentation run the original source files ending with +%% `.dtx' through XeTeX. %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo $Id: njuthesis.dtx 0.13.0 2021-12-13 16:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ - { Thesis template for Nanjing University } +\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 } \ProvidesExplClass{njuthesis} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \RequirePackage { xtemplate, l3keys2e } @@ -65,36 +66,52 @@ \int_new:N \l__nju_tmp_int \seq_new:N \l__nju_tmp_seq \tl_new:N \l__nju_tmp_tl -\clist_const:Nn \c__nju_name_type_clist - { 毕业论文, 毕业设计 } -\clist_const:Nn \c__nju_name_type_en_clist - { THESIS, DESIGN } -\clist_const:Nn \c__nju_name_degree_clist - { 学士, 硕士, 硕士专业, 博士 } -\clist_const:Nn \c__nju_name_degree_en_clist - { Bachelor, Master, Master, Doctor~of~Philosophy } \int_new:N \l__nju_info_degree_int -\tl_new:N \l__nju_info_degree_tl \int_new:N \l__nju_info_diploma_int -\tl_new:N \l__nju_info_diploma_tl \int_new:N \l__nju_info_type_int +\tl_new:N \l__nju_info_degree_tl +\tl_new:N \l__nju_info_diploma_tl \tl_new:N \l__nju_info_type_tl +\bool_new:N \g__nju_twoside_bool +\bool_set_true:N \g__nju_twoside_bool \bool_new:N \l__nju_second_supv_bool \tl_new:N \l__nju_info_supv_full_tl \tl_new:N \l__nju_info_supv_full_en_tl \bool_new:N \g__nju_load_sys_font_bool \tl_new:N \g__nju_latin_font_tl \tl_new:N \g__nju_cjk_font_tl +\tl_new:N \l__nju_info_sm_date_tl +\tl_new:N \l__nju_info_sm_date_en_tl +\tl_new:N \l__nju_info_df_date_tl +\tl_const:Nx \c__nju_today_tl + { + \int_to_arabic:n { \c_sys_year_int } - + \int_to_arabic:n { \c_sys_month_int } - + \int_to_arabic:n { \c_sys_day_int } + } +\clist_const:Nn \c__nju_name_type_clist + { 毕业论文, 毕业设计 } +\clist_const:Nn \c__nju_name_type_en_clist + { THESIS, DESIGN } +\clist_const:Nn \c__nju_name_degree_clist + { 学士, 硕士, 硕士专业, 博士 } +\clist_const:Nn \c__nju_name_degree_en_clist + { Bachelor, Master, Master, Doctor~of~Philosophy } +\clist_const:Nn \c__nju_month_en_clist + { + January, February, March, April, May, June, + July, August, September, October, November, December + } \cs_new:Nn \__nju_quad: { \skip_horizontal:n { 1 em } } \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_define_name:nn #1#2 - { \tl_const:cn { c__nju_name_ #1 _tl } {#2} } + { \tl_const:cn { c__nju_name_ #1 _tl } { #2 } } \cs_new_protected:Npn \__nju_define_name:nnn #1#2#3 { - \tl_const:cn { c__nju_name_ #1 _tl } {#2} - \tl_const:cn { c__nju_name_ #1 _en_tl } {#3} + \tl_const:cn { c__nju_name_ #1 _tl } { #2 } + \tl_const:cn { c__nju_name_ #1 _en_tl } { #3 } } \cs_new:Npn \__nju_name:n #1 { \tl_use:c { c__nju_name_ #1 _tl } } \cs_new:Npn \__nju_info:n #1 { \tl_use:c { l__nju_info_ #1 _tl } } @@ -103,14 +120,14 @@ \mode_leave_vertical: \rule [ -0.5 ex ] { #1 } { 0.4 pt } \skip_horizontal:n { -#1 } - \hbox_to_wd:nn {#1} { \hfil #2 \hfil } + \hbox_to_wd:nn { #1 } { \hfil #2 \hfil } } \cs_generate_variant:Nn \tl_map_inline:nn { xn } \cs_new_protected:Npn \__nju_spread_box:nnn #1#2#3 { \mode_leave_vertical: - \hbox_to_wd:nn {#1} - { #2 \tl_map_inline:xn {#3} { ##1 \hfil } \unskip } + \hbox_to_wd:nn { #1 } + { #2 \tl_map_inline:xn { #3 } { ##1 \hfil } \unskip } } \cs_new_protected:Npn \__nju_multiline_box:nnnn #1#2#3#4 { @@ -124,8 +141,10 @@ } \cs_new_protected:Npn \__nju_put_inempty_seg:nnn #1#2#3 { - \tl_set:Nx \l__nju_tmp_tl { \tl_range:Nnn { #1 } { #2 } { #2 + #3 - 1 } } - \tl_if_empty:NF \l__nju_tmp_tl { \clist_put_right:NV \l__nju_tmp_clist { \l__nju_tmp_tl } } + \tl_set:Nx \l__nju_tmp_tl + { \tl_range:Nnn { #1 } { #2 } { #2 + #3 - 1 } } + \tl_if_empty:NF \l__nju_tmp_tl + { \clist_put_right:NV \l__nju_tmp_clist { \l__nju_tmp_tl } } } \cs_new_protected:Npn \__nju_uline:n #1 { @@ -164,40 +183,68 @@ \dim_sub:Nn #1 { \textwidth / 2 } \__nju_ulined_center_box:nn { #1 } { \__nju_info:n { #3 } } } +\cs_new:Npn \__nju_date:www #1-#2-#3 \q_stop + { \__zhnum_date_aux:nnn { #1 } { #2 } { #3 } } +\cs_new:Npn \__nju_date_en:www #1-#2-#3 \q_stop + { \clist_item:Nn \c__nju_month_en_clist { #2 } ~#3 , ~#1 } \keys_define:nn { nju } { - degree .choices:nn = { ug, mg, mf, phd } - { \int_set_eq:NN \l__nju_info_degree_int \l_keys_choice_int + degree .choices:nn = { ug, mg, mf, phd } + { + \int_set_eq:NN \l__nju_info_degree_int \l_keys_choice_int \tl_set:Nn \l__nju_info_degree_tl - { \clist_item:Nn \c__nju_name_degree_clist { \l__nju_info_degree_int } } + { + \clist_item:Nn \c__nju_name_degree_clist + { \l__nju_info_degree_int } + } \int_compare:nTF { \l__nju_info_degree_int == 1 } { \tl_set:Nn \l__nju_info_diploma_tl { ug } } - { \tl_set:Nn \l__nju_info_diploma_tl { g } } }, - degree .initial:n = ug, - type .choices:nn = { thesis, design } - { \int_set_eq:NN \l__nju_info_type_int \l_keys_choice_int + { \tl_set:Nn \l__nju_info_diploma_tl { g } } + }, + degree .initial:n = ug, + type .choices:nn = { thesis, design } + { + \int_set_eq:NN \l__nju_info_type_int \l_keys_choice_int \tl_set:Nn \l__nju_info_type_tl { \clist_item:Nn \c__nju_name_type_clist { \l__nju_info_type_int } } \tl_put_left:Nn \l__nju_info_type_tl - { \tl_use:c { c__nju_name_ \l__nju_info_diploma_tl _tl } } }, - type .initial:n = thesis, - nlcover .bool_set:N = \g__nju_nlcover_bool, - nlcover .initial:n = false, - latin-font .choices:nn = - { gyre, mac, win, none } - { \tl_set_eq:NN \g__nju_latin_font_tl \l_keys_choice_tl }, - cjk-font .choices:nn = - { fandol, founder, mac, noto, win, none } - { \tl_set_eq:NN \g__nju_cjk_font_tl \l_keys_choice_tl }, + { \tl_use:c { c__nju_name_ \l__nju_info_diploma_tl _tl } } + }, + type .initial:n = thesis, + nlcover .bool_set:N = \g__nju_nlcover_bool, + nlcover .initial:n = false, + decl-page .bool_set:N = \g__nju_orig_decl_bool, + decl-page .initial:n = false, + draft .bool_gset:N = \g__nju_draft_bool, + draft .initial:n = false, + oneside .value_forbidden:n = true, + twoside .value_forbidden:n = true, + oneside .bool_gset_inverse:N = \g__nju_twoside_bool, + latin-font .choices:nn = + { gyre, mac, win, none } + { \tl_set_eq:NN \g__nju_latin_font_tl \l_keys_choice_tl }, + cjk-font .choices:nn = + { fandol, founder, mac, noto, source, win, none } + { \tl_set_eq:NN \g__nju_cjk_font_tl \l_keys_choice_tl }, } \ProcessKeysOptions { nju } +\keys_define:nn { nju } + { + bib .meta:nn = { nju / bib } { #1 }, + info .meta:nn = { nju / info } { #1 }, + style .meta:nn = { nju / style } { #1 } + } +\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } } \clist_map_inline:nn { - { id } { 学号 }, - { orig_decl } { 学位论文原创性声明 }, - { pdf_creator } { LaTeX~ with~ njuthesis~ class }, - { supv_ii } { 第二导师 }, - { supv_ttl } { 职称 } + { acknowledgement } { 致\hspace{2em}谢 }, + { id } { 学号 }, + { orig_date } { 日期 }, + { paperlist } { 发表文章目录 }, + { pdf_creator } { LaTeX~ with~ njuthesis~ class }, + { preface } { 前\hspace{2em}言 }, + { supv_ii } { 第二导师 }, + { supv_ttl } { 职称 } } { \__nju_define_name:nn #1 } \clist_map_inline:nn @@ -216,13 +263,15 @@ { \clist_map_inline:nn { - { author_full } { 本科生姓名 }, - { grade } { 年级 }, - { sm_date } { 提交日期 }, - { supv } { 导师 }, - { title } { 题目 }, - { type } { 本科生毕业论文(设计、作品)}, - { ug } { 本科 } + { author_full } { 本科生姓名 }, + { grade } { 年级 }, + { orig_decl } { 本科毕业论文(设计)诚信承诺书 }, + { orig_sign } { 作者签名 }, + { sm_date } { 提交日期 }, + { supv } { 导师 }, + { title } { 题目 }, + { type } { 本科生毕业论文(设计、作品) }, + { ug } { 本科 } } { \__nju_define_name:nn #1 } \clist_map_inline:nn @@ -232,6 +281,14 @@ { supv_full } { 指导教师(姓名、职称) } { MENTOR } } { \__nju_define_name:nnn #1 } + \tl_const:Nn \c__nju_orig_decl_text_tl + { + 本人郑重承诺:所呈交的毕业论文(设计)(题目:)是在指导教师的指导下 + 严格按照学校和院系有关规定由本人独立完成的。本毕业论文(设计)中引用 + 他人观点及参考资源的内容均已标注引用,如出现侵犯他人知识产权的行为, + 由本人承担相应法律责任。本人承诺不存在抄袭、伪造、篡改、代写、买卖毕 + 业论文(设计)等违纪行为。 + } } { \clist_map_inline:nn @@ -250,8 +307,8 @@ { grade } { 级 }, { major_s } { 专业 }, { major_nl } { 专业名称 }, - { orig_sign } { 研究生签名: }, - { orig_date } { 日期: }, + { orig_decl } { 学位论文原创性声明 }, + { orig_sign } { 研究生签名 }, { reviewer } { 评阅人: }, { seclv } { 密级 }, { sign } { (签字) }, @@ -279,14 +336,14 @@ the~ graduate~ school~ of~ Nanjing~ University \\ in~ partial~ fulfilment~ of~ the~ requirements~ for~ the~ degree~ of } - } -\tl_const:Nn \c__nju_orig_decl_text_tl - { - 本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作 - 所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或 - 集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构 - 的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已 - 在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。 + \tl_const:Nn \c__nju_orig_decl_text_tl + { + 本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作 + 所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或 + 集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构 + 的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已 + 在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。 + } } \clist_const:Nn \c__nju_theorem_type_clist { axiom, corollary, definition, example, lemma, theorem } @@ -301,7 +358,6 @@ { theorem } { 定理 } { Theorem } } { \__nju_define_name:nnn #1 } -\keys_define:nn { nju } { info.meta:nn = { nju / info } { #1 } } \keys_define:nn { nju / info } { title .tl_set:N = \l__nju_info_title_tl, @@ -319,17 +375,14 @@ 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 .tl_set:N = \l__nju_info_supv_tl, + supervisor .clist_set:N = \l__nju_info_supv_clist, supervisor* .tl_set:N = \l__nju_info_supv_en_tl, - supervisor-title .tl_set:N = \l__nju_info_supv_ttl_tl, - supervisor-title* .tl_set:N = \l__nju_info_supv_ttl_en_tl, - supervisor-ii .tl_set:N = \l__nju_info_supv_ii_tl, + supervisor-ii .clist_set:N = \l__nju_info_supv_ii_clist, supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, - supervisor-ii-title .tl_set:N = \l__nju_info_supv_ii_ttl_tl, - supervisor-ii-title*.tl_set:N = \l__nju_info_supv_ii_ttl_en_tl, - submit-date .tl_set:N = \l__nju_info_sm_date_tl, - submit-date* .tl_set:N = \l__nju_info_sm_date_en_tl, - defend-date .tl_set:N = \l__nju_info_df_date_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, @@ -337,35 +390,30 @@ udc .tl_set:N = \l__nju_info_udc_tl, supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, } -\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } } \bool_set:Nn \l__nju_second_supv_bool - { ! \tl_if_empty_p:N \l__nju_info_supv_ii_tl } + { ! \clist_if_empty_p:N \l__nju_info_supv_ii_clist } \tl_set:Nn \l__nju_info_supv_full_tl { - \l__nju_info_supv_tl \__nju_hskip: - \l__nju_info_supv_ttl_tl + \clist_use:Nn \l__nju_info_supv_clist { \__nju_hskip: } \bool_if:NT \l__nju_second_supv_bool { - \__nju_quad: \l__nju_info_supv_ii_tl - \__nju_hskip: \l__nju_info_supv_ii_ttl_tl + \__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_ttl_en_tl \__nju_hskip: \l__nju_info_supv_en_tl \bool_if:NT \l__nju_second_supv_bool - { - \__nju_quad: \l__nju_info_supv_ii_ttl_en_tl - \__nju_hskip: \l__nju_info_supv_ii_en_tl - } + { \__nju_quad: \l__nju_info_supv_ii_en_tl } } \PassOptionsToClass { a4paper, - twoside, UTF8, scheme=chinese, + \bool_if:NTF \g__nju_twoside_bool { twoside, } { oneside, } + \bool_if:NT \g__nju_draft_bool { draft, } linespread=1.625, fontset=none, zihao=-4 @@ -373,40 +421,36 @@ { ctexbook } \clist_map_inline:nn { - { no-math } { fontspec }, - { perpage } { footmisc }, - { amsmath, thmmarks } { ntheorem }, - { hyphens } { url }, + { no-math } { fontspec }, + { perpage } { footmisc }, + { amsmath, thmmarks } { ntheorem }, + { hyphens } { url }, { warnings-off={ mathtools-colon, mathtools-overbracket } } { unicode-math }, { capitalise, nameinlink, noabbrev } - { cleveref } + { cleveref } } { \PassOptionsToPackage #1 } \LoadClass { ctexbook } [ 2018/04/01 ] \RequirePackage { geometry, - caption, - setspace, fancyhdr, - hologo, - url, - emptypage, + setspace, njuvisual, amsmath, mathtools, unicode-math, ntheorem, - graphicx, - wrapfig, booktabs, - multirow, - listings, + caption, + graphicx, enumitem, + url, hyperref, cleveref } +\bool_if:NT \g__nju_twoside_bool { \RequirePackage{ emptypage } } \sys_if_engine_xetex:T { \RequirePackage{xeCJKfntef} @@ -486,20 +530,18 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_win: { - \setCJKmainfont{SimSun}[ - AutoFakeBold=2.17, - ItalicFont=KaiTi] - \setCJKsansfont{SimHei} - \setCJKmonofont{FangSong} - \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhhei}{SimHei} - \setCJKfamilyfont{zhfs}{FangSong} - \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] + \setCJKmainfont { SimSun } + [ AutoFakeBold = 2.17, ItalicFont = KaiTi ] + \setCJKsansfont { SimHei } [ AutoFakeBold = 2.17 ] + \setCJKmonofont { FangSong } [ AutoFakeBold = 2.17 ] + \setCJKfamilyfont { zhsong } { SimSun } [ AutoFakeBold = 2.17 ] + \setCJKfamilyfont { zhhei } { SimHei } [ AutoFakeBold = 2.17 ] + \setCJKfamilyfont { zhfs } { FangSong } [ AutoFakeBold = 2.17 ] + \setCJKfamilyfont { zhkai } { KaiTi } [ AutoFakeBold = 2.17 ] } \cs_new_protected:Npn \__nju_load_cjk_font_mac: { - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} + \msg_redirect_name:nnn { fontspec } { no-script } { info } \setCJKmainfont{Songti~SC~Light}[ BoldFont=Songti~SC~Bold, ItalicFont=Kaiti~SC, @@ -541,77 +583,101 @@ { \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} } - \setCJKmainfont{FZSSK}[% 方正书宋 - Extension=.ttf, - BoldFont=FZXBSK,% 方正小标宋 - ItalicFont=FZKTK]% 方正楷体 - \setCJKsansfont{FZXH1K}[% 方正细黑一 - Extension=.ttf, - BoldFont=FZHTK]% FZHTK 方正黑体 - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - \setCJKfamilyfont{zhsong} - {FZSSK}[ - Extension=.ttf, - BoldFont=FZXBSK] - \setCJKfamilyfont{zhhei} - {FZHTK}[ - Extension=.ttf, - AutoFakeBold=2.17] - \setCJKfamilyfont{zhfs} - {FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai} - {FZKTK}[Extension=.ttf] + \setCJKmainfont { FZShuSong-Z01 } + [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] + \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] + \setCJKmonofont { FZFangSong-Z02 } + \setCJKfamilyfont { zhsong } { FZShuSong-Z01 } + [ BoldFont = FZXiaoBiaoSong-B05 ] + \setCJKfamilyfont { zhhei } { FZHei-B01 } + [AutoFakeBold=2.17] + \setCJKfamilyfont { zhkai } { FZKai-Z03 } + [AutoFakeBold=2.17] + \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } \defaultCJKfontfeatures{} } \cs_new_protected:Npn \__nju_load_cjk_font_noto: { - % 思源宋体 - \setCJKmainfont[ - UprightFont=NotoSerifSC-Regular, - BoldFont=NotoSerifSC-Bold, - ItalicFont=NotoSerifSC-Regular, - BoldItalicFont=NotoSerifSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Serif~SC} - - % 思源黑体 - \setCJKsansfont[ - UprightFont=NotoSansSC-Regular, - BoldFont=NotoSansSC-Bold, - ItalicFont=NotoSansSC-Regular, - BoldItalicFont=NotoSansSC-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Sans~SC} - - \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 - - \setCJKfamilyfont{zhsong}{Noto~Serif~SC} - \setCJKfamilyfont{zhhei}{Noto~Sans~SC} - \setCJKfamilyfont{zhfs}{FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai}{FZKTK}[Extension=.ttf] + \setCJKmainfont + [ + UprightFont = NotoSerifCJKsc-Regular, + BoldFont = NotoSerifCJKsc-Bold, + ItalicFont = NotoSerifCJKsc-Regular, + BoldItalicFont = NotoSerifCJKsc-Bold, + ItalicFeatures = FakeSlant, + BoldItalicFeatures = FakeSlant + ] { Noto~Serif~CJK~SC } + \setCJKsansfont + [ + UprightFont = NotoSansCJKsc-Regular, + BoldFont = NotoSansCJKsc-Bold, + ItalicFont = NotoSansCJKsc-Regular, + BoldItalicFont = NotoSansCJKsc-Bold, + ItalicFeatures = FakeSlant, + BoldItalicFeatures = FakeSlant + ] { Noto~Sans~CJK~SC } + \setCJKmonofont { Noto~Sans~Mono~CJK~SC } + \setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC } + \setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC } + \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } + \setCJKfamilyfont { zhkai } { FZKai-Z03 } + [AutoFakeBold=2.17] + } +\cs_new_protected:Npn \__nju_load_cjk_font_source: + { + \setCJKmainfont + [ + UprightFont = SourceHanSerifSC-Regular, + BoldFont = SourceHanSerifSC-Bold, + ItalicFont = SourceHanSerifSC-Regular, + BoldItalicFont = SourceHanSerifSC-Bold, + ItalicFeatures = FakeSlant, + BoldItalicFeatures = FakeSlant + ] { Source~Han~Serif~SC } + \setCJKsansfont + [ + UprightFont = SourceHanSansSC-Regular, + BoldFont = SourceHanSansSC-Bold, + ItalicFont = SourceHanSansSC-Regular, + BoldItalicFont = SourceHanSansSC-Bold, + ItalicFeatures = FakeSlant, + BoldItalicFeatures = FakeSlant + ] { Source~Han~Sans~SC } + \setCJKmonofont { FZFangSong-Z02 } + \setCJKfamilyfont { zhsong } { Source~Han~Serif~SC } + \setCJKfamilyfont { zhhei } { Source~Han~Sans~SC } + \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } + \setCJKfamilyfont { zhkai } { FZKai-Z03 } + [AutoFakeBold=2.17] + } +\cs_new_protected:Npn \__nju_load_math_font: + { + % \setmathfont{STIXTwoMath-Regular}[Extension = .otf] + \setmathfont{XITSMath-Regular}[ + BoldFont = XITSMath-Bold, + Extension = .otf] + \setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}] + \setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}] } \cs_new_protected:Npn \__nju_load_font: { \use:c { __nju_load_latin_font_ \g__nju_latin_font_tl : } \use:c { __nju_load_cjk_font_ \g__nju_cjk_font_tl : } - \NewDocumentCommand \songti { } { \CJKfamily{zhsong} } - \NewDocumentCommand \heiti { } { \CJKfamily{zhhei} } - \NewDocumentCommand \fangsong { } { \CJKfamily{zhfs} } - \NewDocumentCommand \kaishu { } { \CJKfamily{zhkai} } - \RenewDocumentCommand \large { } { \zihao{4} } + \__nju_load_math_font: + \NewDocumentCommand \songti { } { \CJKfamily { zhsong } } + \NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } + \NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } + \NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } + \RenewDocumentCommand \large { } { \zihao { 4 } } } \__nju_load_font: -\setmathfont{XITSMath-Regular}[ - BoldFont = XITSMath-Bold, - Extension = .otf] -\setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}] -\setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}] \geometry { vmargin = 2.5 cm, hmargin = 3.2 cm, headheight = 15 pt } +\bool_if:NT \g__nju_draft_bool { \geometry { showframe } } \fancypagestyle { plain } { \fancyhf { } @@ -639,11 +705,17 @@ { \cleardoublepage \int_compare:nTF { \l__nju_info_degree_int == 1 } - { \pagestyle{plain} } { \pagestyle{headings} } - \pagenumbering{arabic} - \normalfont\normalsize + { \pagestyle { plain } } { \pagestyle { headings } } + \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 } + } \ctexset { chapter/beforeskip = 10 pt, @@ -653,29 +725,20 @@ subsection/format = \c__nju_sec_format_tl, subsubsection/format = \c__nju_sec_format_tl } -\cs_new_protected:Npn \__nju_chapter_in_toc:n #1 - { \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } } -\NewDocumentCommand \njuchapter { m } - { - \chapter*{#1} - \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1} - \@mkboth{#1}{#1} - } \ctexset { - contentsname = {目\hspace{2em}录}, - listfigurename = {插图清单}, - listtablename = {表格清单}, + contentsname = { 目\hspace{2em}录 }, + listfigurename = { 插图目录 }, + listtablename = { 表格目录 }, chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline {#1} #2 } -\tl_const:Nn \c__nju_toc_title_tl { \centering \zihao{3} \bf } \cs_new_protected:Npn \__nju_modify_toc_title:nn #1#2 { \group_begin: - \ctexset { chapter/format = \c__nju_toc_title_tl } + \ctexset { chapter/format = \centering \zihao{3} \bf } \njuchapter { #1 } \group_end: - \@starttoc{#2} + \@starttoc { #2 } } \RenewDocumentCommand \tableofcontents { } { \__nju_modify_toc_title:nn { \contentsname } { toc } } @@ -683,52 +746,60 @@ { \__nju_modify_toc_title:nn { \listfigurename } { lof } } \RenewDocumentCommand \listoftables { } { \__nju_modify_toc_title:nn { \listtablename } { lot } } -\RequirePackage[ - style=gb7714-2015, - %style=numeric-comp, - %citestyle=authortitle-icomp, - % citestyle=numeric-comp, - %bibstyle=authoryear, - % bibstyle=numeric, - sorting=none, - %sorting=nyt, - %sortcites=true, - %autocite=footnote, - backend=biber, % Compile the bibliography with biber - hyperref=true, - backref=false, - citecounter=true, - pagetracker=true, - citetracker=true, - ibidtracker=context, - autopunct=true, - autocite=plain, - % gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' - % in reference entries, GitHub Issue (#47) - % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author - % names in reference entries, GitHub Issue (#23) -]{biblatex} -\ctexset{ bibname = {参考文献} } -\defbibheading { njubib } [ \bibname ] { \njuchapter { #1 } } -\DeclarePrintbibliographyDefaults { heading = njubib } -\AtEveryBibitem +\keys_define:nn { nju / bib } + { + style .choice:, + style / numeric .code:n = + { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015 } }, + style / author-year .code:n = + { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015ay } }, + style .initial:n = numeric, + resource .clist_set:N = \l__nju_bib_resource_clist + } +\NewDocumentCommand \addbibresource { m } + { \clist_gput_right:Nn \l__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 + } +\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 + { \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 } { - \clist_map_inline:nn - { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } - { \clearfield { #1 } } - \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} + \__nju_biblatex_pre_setup: + \RequirePackage { biblatex } + \__nju_biblatex_post_setup: } \ctex_at_end_preamble:n { - \tl_set_eq:NN \l__nju_tmp_tl \l__nju_info_title_tl - \tl_remove_all:Nn \l__nju_tmp_tl { ! } + \pdfstringdefDisableCommands + { \cs_set_eq:NN \\ \prg_do_nothing: } \hypersetup { bookmarksnumbered = true, psdextra = true, unicode = true, hidelinks, - pdftitle = \l__nju_tmp_tl, + pdftitle = \l__nju_info_title_tl, pdfauthor = \l__nju_info_author_tl, pdfkeywords = \l__nju_info_keywords_clist, pdfcreator = \c__nju_name_pdf_creator_tl @@ -737,22 +808,20 @@ \cs_new_protected:Npn \__nju_cref_name:n #1 { \clist_map_inline:nn { #1 } - { \crefname { ##1 } { \__nju_name:n { ##1 } } { \__nju_name:n { ##1 _en } } } - } -\cs_new_protected:Npn \__nju_cref_name:N #1 - { - \clist_map_inline:Nn #1 - { \crefname { ##1 } { \__nju_name:n { ##1 } } { \__nju_name:n { ##1 _en } } } + { + \crefname { ##1 } + { \__nju_name:n { ##1 } } { \__nju_name:n { ##1 _en } } + } } -\crefdefaultlabelformat{#2#1#3\,} +\crefdefaultlabelformat { #2#1#3\, } \crefformat { equation } { 公式~#2#1#3~ } \crefformat { chapter } { 第#2#1#3章 } \crefformat { section } { 第~#2#1#3~节 } \crefformat { subsection } { 第~#2#1#3~小节 } \crefformat { subsubsection } { 第~#2#1#3~小节 } \__nju_cref_name:n { figure, table, appendix, proof } -\__nju_cref_name:N \c__nju_theorem_type_clist -\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} +\exp_args:NV \__nju_cref_name:n \c__nju_theorem_type_clist +\DeclareGraphicsExtensions { .pdf, .eps, .jpg, .png } \DeclareCaptionStyle{njucap} { font = small, @@ -762,32 +831,7 @@ } \captionsetup [ figure ] { style = njucap } \captionsetup [ table ] { style = njucap } -\lstdefinestyle { njulisting } - { - basewidth = 0.5 em, - lineskip = 3 pt, - basicstyle = \tiny\tt, - keywordstyle = \bf, - commentstyle = \it\color{gray}, - numbers = left, - captionpos = t, - breaklines = true, - xleftmargin = 2 em, - xrightmargin = 2 em - } -\lstset - { - style = njulisting, - flexiblecolumns - } -\ExplSyntaxOff -\lstMakeShortInline[ - style=njulisting, - basicstyle=\normalsize\tt, - columns=fixed]| -\ExplSyntaxOn \setlist { noitemsep } -\NewDocumentCommand\mathbi{m}{\textbf{\em #1}} \cs_new_protected:Npn \__nju_new_theorem:N #1 { \theoremsymbol { } @@ -799,9 +843,9 @@ \__nju_new_theorem:N \c__nju_theorem_type_clist \cs_new_protected:Npn \__nju_split_title:n #1 { - \tl_if_in:VnTF { #1 } { ! } + \tl_if_in:VnTF { #1 } { \\ } { - \seq_set_split:NnV \l__nju_tmp_seq { ! } { #1 } + \seq_set_split:NnV \l__nju_tmp_seq { \\ } { #1 } \clist_set_from_seq:NN \l__nju_tmp_clist \l__nju_tmp_seq } { @@ -822,35 +866,86 @@ { \__nju_spread_box:nnn { #2 } { \kaishu } { \__nju_name:n { #1 } } \__nju_hskip: - \__nju_ulined_center_box:nn { #3 } { \__nju_info:n { #1 } } + \__nju_ulined_center_box:nn { #3 } { \__nju_info:n { #1 } } \__nju_vskip: } \cs_new_protected:Npn \__nju_cover_bientry:nnnn #1#2#3#4 { \__nju_spread_box:nnn { #3 } { \kaishu } { \__nju_name:n { #1 } } \__nju_hskip: - \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #1 } } + \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #1 } } \skip_horizontal:n { 0.5 em } \__nju_spread_box:nnn { #3 } { \kaishu } { \__nju_name:n { #2 } } \__nju_hskip: - \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #2 } } + \__nju_ulined_center_box:nn { #4 } { \__nju_info:n { #2 } } \__nju_vskip: } +\cs_new_protected:Npn \__nju_cover_supv_entry:nnn #1#2#3 + { + \__nju_spread_box:nnn { #2 } { \kaishu } { \__nju_name:n { #1 } } + \__nju_hskip: + \__nju_ulined_center_box:nn { #3 } + { \clist_item:cn { l__nju_info_ #1 _clist } { 1 } } + \skip_horizontal:n { 0.5 em } + \__nju_spread_box:nnn { #2 } { \kaishu } { \c__nju_name_supv_ttl_tl } + \__nju_hskip: + \__nju_ulined_center_box:nn { #3 } + { \clist_item:cn { l__nju_info_ #1 _clist } { 2 } } + \__nju_vskip: + } +\keys_define:nn { nju / style } + { + emblem-img .tl_set:N = \l__nju_emblem_img_tl, + name-img .tl_set:N = \l__nju_name_img_tl + } +\ctex_at_end_preamble:n + { + \tl_if_empty:NF \l__nju_emblem_img_tl + { + \RenewDocumentCommand \njuemblem { o m m } + { \includegraphics [ width = #2, height = #3 ] + { \l__nju_emblem_img_tl } } + } + \tl_if_empty:NF \l__nju_name_img_tl + { + \RenewDocumentCommand \njuname { o m m } + { \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 { 9em } { \bf } { \l__nju_info_type_tl } } + { \__nju_spread_box:nnn { 9 em } { \bf } { \l__nju_info_type_tl } } \cs_new_protected:Npn \__nju_cover_info_ug:nnn #1#2#3 { \begin{minipage} [ c ] { #1 + #2 + 0.3 em } \raggedleft - \__nju_cover_entry:nnn { dept } { #1 } { #2 } - \__nju_cover_entry:nnn { major } { #1 } { #2 } - \__nju_multiline_title:nnn { \bf } { #1 } { #2 } + \__nju_cover_entry:nnn { dept } { #1 } { #2 } + \__nju_cover_entry:nnn { major } { #1 } { #2 } + \__nju_multiline_title:nnn { \bf } { #1 } { #2 } \__nju_cover_bientry:nnnn { grade } { id } { #1 } { #3 } - \__nju_cover_entry:nnn { author } { #1 } { #2 } - \__nju_cover_bientry:nnnn { supv } { supv_ttl } { #1 } { #3 } - \tl_if_blank:VF { \l__nju_info_supv_ii_tl } - { \__nju_cover_bientry:nnnn { supv_ii } { supv_ttl } { #1 } { #3 } } - \__nju_cover_entry:nnn { sm_date } { #1 } { #2 } + \__nju_cover_entry:nnn { author } { #1 } { #2 } + \__nju_cover_supv_entry:nnn { supv } { #1 } { #3 } + \bool_if:NT \l__nju_second_supv_bool + { \__nju_cover_supv_entry:nnn { supv_ii } { #1 } { #3 } } + \__nju_cover_entry:nnn { sm_date } { #1 } { #2 } \end{minipage} } \cs_new_protected:Npn \__nju_cover_title_g: @@ -924,6 +1019,10 @@ } \cs_new_protected:Npn \__nju_cover_info_nl: { + \tl_set:Nn \l__nju_info_supv_tl + { \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_ulined_center_box:nn { \textwidth } { \__nju_info:n { supv_ttl } \__nju_quad: \__nju_info:n { supv_cont } } \\ @@ -946,9 +1045,9 @@ { \newpage \null \skip_horizontal:n { -1 cm } - \njuemblem [ black] { ! } { 3.35 cm } + \njuemblem [ black ] { ! } { 3.35 cm } \begin{center} - \njuname[black]{!}{3cm} \__nju_vskip: + \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 @@ -1007,38 +1106,52 @@ } \cs_new_protected:Npn \__nju_make_orig_decl: { - \normalfont \normalsize \chapter* { \c__nju_name_nju_tl \c__nju_name_orig_decl_tl } \thispagestyle { empty } \c__nju_orig_decl_text_tl \vfil \begin{flushright} - \__nju_name:n { orig_sign } \__nju_uline:n { 7 em } \__nju_vskip: - \__nju_name:n { orig_date } \__nju_uline:n { 7 em } + \clist_set:Nn \l__nju_tmp_clist { orig_sign, id, orig_date } + \int_compare:nF { \l__nju_info_degree_int == 1 } + { \clist_remove_all:Nn \l__nju_tmp_clist { id } } + \clist_map_inline:Nn \l__nju_tmp_clist + { \__nju_vskip: \__nju_name:n { ##1 } : \__nju_uline:n { 7 em } } \end{flushright} \vfil } \RenewDocumentCommand \maketitle { } { - \pagestyle{empty} - \bool_if:NTF \g__nju_nlcover_bool - { \__nju_make_cover_nl: \__nju_make_orig_decl: } - { \use:c { __nju_make_cover_ \l__nju_info_diploma_tl : } } - \tl_remove_all:Nn \l__nju_info_title_tl { ! } + \bool_if:NF \g__nju_draft_bool + { + \pagestyle { empty } + \bool_if:NTF \g__nju_nlcover_bool + { \__nju_make_cover_nl: } + { \use:c { __nju_make_cover_ \l__nju_info_diploma_tl : } } + \bool_if:NT \g__nju_orig_decl_bool { \__nju_make_orig_decl: } + } + \tl_remove_all:Nn \l__nju_info_title_tl { \\ } \cleardoublepage - \pagestyle{plain} - \pagenumbering{Roman} + \pagestyle { plain } + \pagenumbering { Roman } \normalfont \normalsize } \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:n #1 +\cs_new_protected:Npn \__nju_abs_info_style_en: #1 + { \zihao{ #1 } } +\cs_new_protected:Npn \__nju_abs_bookmark: { - \pdfbookmark [ 0 ] - { \__nju_name:n { abstract #1 } } { abstract #1 } + \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 @@ -1138,32 +1251,41 @@ } \NewDocumentEnvironment{abstract} { +b } { - \newpage - \__nju_abs_bookmark:n { } + \cleardoublepage + \__nju_abs_bookmark: \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { } { : } - \group_begin: \normalfont \zihao { -4 } #1 + \group_begin: \kaishu \zihao { -4 } #1 } { \__nju_print_keywords:nn { } { ; } \group_end: } \NewDocumentEnvironment{abstract*} { +b } { - \newpage - \__nju_abs_bookmark:n { _en } + \cleardoublepage + \__nju_abs_bookmark_en: \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { _en } { :~ } - \group_begin: \normalfont \zihao{ -4 } #1 - } + \group_begin: \kaishu \zihao{ -4 } #1 + } { \__nju_print_keywords:nn { _en } { ;~ } \group_end: } -\NewDocumentEnvironment{preface} { +b } - { \njuchapter { 前\hspace{2em}言 } #1 } { } -\NewDocumentEnvironment{acknowledgement} { +b } - { \njuchapter { 致\hspace{2em}谢 } #1 } { } -\NewDocumentCommand\njupaperlist { t* m } +\NewDocumentEnvironment { preface } { +b } + { \njuchapter { \c__nju_name_preface_tl } #1 } { } +\NewDocumentEnvironment { acknowledgement } { +b } + { \njuchapter { \c__nju_name_acknowledgement_tl } #1 } { } +\NewDocumentCommand \njupaperlist + { O { \c__nju_name_paperlist_tl } m } { + \group_begin: + \RenewDocumentCommand \mkbibnamegiven { m } + { \ifitemannotation { thesisauthor } + { \njuline { \bf ##1 } } { ##1 } } + \RenewDocumentCommand \mkbibnamefamily { m } + { \ifitemannotation { thesisauthor } + { \njuline { \bf ##1 } } { ##1 } } + \RenewDocumentCommand \mkbibdateshort { m m m } + { \textbf { \thefield { ##1 } } } \begin{refsection} - \nocite{#2} - \bool_if:NTF { #1 } - { \printbibliography[heading=subbibliography,title=合作文章目录] } - { \printbibliography[heading=subbibliography,title=发表文章目录] } + \nocite { #2 } + \printbibliography [ heading = subbibliography, title = #1 ] \end{refsection} + \group_end: } \endinput %% |