From 44c7e92cd62a724d239c17b52359d86abaf22615 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 5 Apr 2022 22:09:37 +0000 Subject: njuthesis (27mar22) git-svn-id: svn://tug.org/texlive/trunk@62939 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/njuthesis/njuthesis-graduate.def | 46 +++++---- .../latex/njuthesis/njuthesis-undergraduate.def | 24 ++++- .../texmf-dist/tex/latex/njuthesis/njuthesis.cls | 106 ++++++++++++++++++--- 3 files changed, 140 insertions(+), 36 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis-graduate.def b/Master/texmf-dist/tex/latex/njuthesis/njuthesis-graduate.def index 157092684d5..b9dcd1d837a 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis-graduate.def +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis-graduate.def @@ -23,7 +23,7 @@ %% To produce the documentation run the original source files ending with %% `.dtx' through XeTeX. %% -\GetIdInfo $Id: njuthesis.dtx 0.16.0 2022-03-19 12:00:00 +0800 NJU LUG $ +\GetIdInfo $Id: njuthesis.dtx 0.16.1 2022-03-27 13:00:00 +0800 NJU LUG $ {Graduate definition file for njuthesis} \ProvidesExplFile{njuthesis-graduate.def} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -165,7 +165,7 @@ \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_clc_tl } \hfill \__nju_spread_box:nnV { 3.2 em } { } \c__nju_name_seclv_tl \__nju_hskip: \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_seclv_tl } \\ - V { 3.2 em } { } { \c__nju_name_udc_tl } \__nju_hskip: + \__nju_spread_box:nnV { 3.2 em } { } \c__nju_name_udc_tl \__nju_hskip: \__nju_ulined_center_box:nn { 9 em } { \l__nju_info_udc_tl } \hfill \null } \cs_new_protected:Npn \__nju_cover_title_nl: @@ -258,8 +258,8 @@ { content = \__nju_abs_info_g:n { : }, format = \zihao { 4 } \kaishu, - align = l, - bottom-skip = 1 cm + bottom-skip = 2 cm, + align = l } \__nju_declare_element:nn { abstract / en / title } { @@ -271,20 +271,29 @@ { content = \__nju_abs_info_en_g:n { :~ }, format = \zihao { 4 }, - align = l, + bottom-skip = 2 cm, + align = l + } +\__nju_declare_element:nn { abstract / mark } + { + content = \c__nju_name_abstract_b_tl, + format = \sffamily \zihao { -3 }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { abstract / en / mark } + { + content = \c__nju_name_abstract_b_en_tl, + format = \sffamily \zihao { -3 }, bottom-skip = 1 cm } \cs_new_protected:Npn \__nju_abs_info_g:n #1 { - \__nju_full_uline:NV \l__nju_tmp_dim + \__nju_uline_list:xnn { \clist_item:Nn \c__nju_name_type_clist { \g__nju_info_type_int } \c__nju_name_title_a_tl #1 } - \__nju_ulined_center_box:nn { \l__nju_tmp_dim } - { \tl_range:Nnn \l__nju_info_title_tl { 1 } { 20 } } \\ - \__nju_uline:n { \textwidth } \__nju_qquad: - \tl_range:Nnn \l__nju_info_title_tl { 21 } { -1 } \\ + { \l__nju_info_title_tl } { \g__nju_abs_title_left_skip } \__nju_full_uline:NV \l__nju_tmp_dim { \__nju_ulined_center_box:nn { 11 em } { \l__nju_info_major_tl } @@ -301,28 +310,25 @@ } \cs_new_protected:Npn \__nju_abs_info_en_g:n #1 { - \__nju_full_uline:NV \l__nju_tmp_dim - { \clist_item:Nn \c__nju_name_type_en_clist - { \g__nju_info_type_int } #1 } - \__nju_ulined_center_box:nn { \l__nju_tmp_dim } - { \tl_range:Nnn \l__nju_info_title_en_tl { 1 } { 40 } } \\ - \__nju_uline:n { \textwidth } \__nju_qquad: - \tl_range:Nnn \l__nju_info_title_en_tl { 41 } { -1 } + \__nju_uline_list:xnn { \l__nju_info_type_en_tl #1 } + { \l__nju_info_title_en_tl } { \g__nju_abs_title_left_skip } \clist_map_inline:nn { major, author, supv_full } - { \\ + { \__nju_uline_entry:Nnnn \l__nju_tmp_dim - { ##1 _en } { ##1 _en } { #1 } + { ##1 _en } { ##1 _en } { #1 } \par } } \cs_new_protected:Npn \__nju_make_abstract: { \UseInstance { nju } { abstract / title } \UseInstance { nju } { abstract / info } + \UseInstance { nju } { abstract / mark } } \cs_new_protected:Npn \__nju_make_abstract_en: { \UseInstance { nju } { abstract / en / title } \UseInstance { nju } { abstract / en / info } + \UseInstance { nju } { abstract / en / mark } } \clist_map_inline:nn { @@ -342,6 +348,8 @@ { abstract } { 摘要 } { ABSTRACT }, % 用于书签的摘要名称字样 { abstract_a } { 中文摘要 } { ABSTRACT }, + % 用于小标题的摘要名称字样 + { abstract_b } { 摘\qquad{}要 } { ABSTRACT }, { appendix } { 附录 } { appendix }, { dept } { 院系 } { DEPARTMENT }, { figure } { 图 } { figure }, diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis-undergraduate.def b/Master/texmf-dist/tex/latex/njuthesis/njuthesis-undergraduate.def index 590a83fc8c6..bdbf15f9ae5 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis-undergraduate.def +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis-undergraduate.def @@ -23,7 +23,7 @@ %% To produce the documentation run the original source files ending with %% `.dtx' through XeTeX. %% -\GetIdInfo $Id: njuthesis.dtx 0.16.0 2022-03-19 12:00:00 +0800 NJU LUG $ +\GetIdInfo $Id: njuthesis.dtx 0.16.1 2022-03-27 13:00:00 +0800 NJU LUG $ {Undergraduate definition file for njuthesis} \ProvidesExplFile{njuthesis-undergraduate.def} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -99,8 +99,8 @@ { content = \__nju_abs_info_ug:nn { } { : }, format = \zihao { -4 } \kaishu, - align = l, - bottom-skip = 1 cm + bottom-skip = 1 cm, + align = l } \__nju_declare_element:nn { abstract / en / title } { @@ -112,8 +112,8 @@ { content = \__nju_abs_info_ug:nn { _en } { :~ }, format = \zihao { -4 }, - align = l, - bottom-skip = 1 cm + bottom-skip = 1 cm, + align = l } \cs_new_protected:Npn \__nju_abs_info_ug:nn #1#2 { @@ -126,6 +126,18 @@ { \__nju_name:n { ##1 #1 } #2 \__nju_info:n { ##1 #1 } \\ } \__nju_name:n { abstract #1 } #2 } +\__nju_declare_element:nn { abstract / mark } + { + content = \c__nju_name_abstract_b_tl, + format = \sffamily \zihao { -3 }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { abstract / en / mark } + { + content = \c__nju_name_abstract_b_en_tl, + format = \sffamily \zihao { -3 }, + bottom-skip = 1 cm + } \cs_new_protected:Npn \__nju_make_abstract: { \UseInstance { nju } { abstract / title } @@ -154,6 +166,8 @@ { abstract } { 摘要 } { ABSTRACT }, % 用于书签的摘要名称字样 { abstract_a } { 中文摘要 } { ABSTRACT }, + % 用于小标题的摘要名称字样 + { abstract_b } { 摘\qquad{}要 } { ABSTRACT }, { appendix } { 附录 } { appendix }, { dept } { 院系 } { DEPARTMENT }, { figure } { 图 } { figure }, diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls index 28129f7a647..8d68ed28e3a 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls @@ -24,7 +24,7 @@ %% `.dtx' through XeTeX. %% \NeedsTeXFormat{LaTeX2e} -\GetIdInfo $Id: njuthesis.dtx 0.16.0 2022-03-19 12:00:00 +0800 NJU LUG $ +\GetIdInfo $Id: njuthesis.dtx 0.16.1 2022-03-27 13:00:00 +0800 NJU LUG $ {Thesis template for Nanjing University} \ProvidesExplClass{njuthesis} {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -65,6 +65,7 @@ \tl_new:N \l__nju_info_degree_tl \tl_new:N \l__nju_info_diploma_tl \tl_new:N \l__nju_info_type_tl +\tl_new:N \l__nju_info_type_en_tl \bool_new:N \g__nju_twoside_bool \bool_set_true:N \g__nju_twoside_bool \bool_new:N \l__nju_second_supv_bool @@ -124,7 +125,7 @@ \cs_new_protected:Npn \__nju_ulined_center_box:nn #1#2 { \mode_leave_vertical: - \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \rule [ -0.55 ex ] { #1 } { 0.4 pt } \skip_horizontal:n { -#1 } \hbox_to_wd:nn { #1 } { \hfil #2 \hfil } } @@ -156,7 +157,7 @@ \cs_new_protected:Npn \__nju_uline:n #1 { \mode_leave_vertical: - \rule [ -0.5 ex ] { #1 } { 0.4 pt } + \rule [ -0.55 ex ] { #1 } { 0.4 pt } \skip_horizontal:n { -#1 } } \cs_new_protected:Npn \__nju_uuline:n #1 @@ -194,6 +195,12 @@ { \__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 } +\msg_new:nnn { njuthesis } { missing-title } + { + The~ title~ should~ not~ be~ left~ blank.\\ + Please~ check~ whether~ you~ have~ fill~ in~ + both~ Chinese~ and~ English~ titles. + } \cs_new_protected:Npn \__nju_split_title:n #1 { \tl_if_in:nnTF { #1 } { \\ } @@ -210,6 +217,8 @@ \cs_generate_variant:Nn \__nju_split_title:n { V } \cs_new_protected:Npn \__nju_multiline_title:nnn #1#2#3 { + \tl_if_empty:NT \l__nju_info_title_tl + { \msg_error:nn { njuthesis } { missing-title } } \__nju_split_title:V \l__nju_info_title_tl \__nju_spread_box:nnV { #2 } { \kaishu } \c__nju_name_title_tl \__nju_hskip: @@ -262,6 +271,47 @@ \__nju_uuline:n { \l__nju_tmp_dim } #1 } \cs_generate_variant:Nn \__nju_abs_title:n { V } +\cs_new_protected:Npn \__nju_uline_box: + { \vtop{\box1\kern-\prevdepth\kern0.5ex\hrule} } +\msg_new:nnn { njuthesis } { abs-title-too-long } + { + Your~ title~ is~ too~ long~ to~ fit~ in~ two~ lines.\\ + I~ have~ drawn~ additional~ lines~ to~ contain~ it,~ + which~ will~ probably~ make~ your~ abstract~ page~ + look~ slightly~ different~ from~ the~ standard.\\ + You~ can~ use~ the~ "style/abstract-title"~ key~ + to~ disable~ this~ message. + } +\cs_new_protected:Npn \__nju_uline_list:nnn #1#2#3 + { + \hbox_set:Nn \l__nju_tmp_box {#1} + \setbox0=\vbox{\hangindent=\wd\l__nju_tmp_box \hangafter=-1 + \leftskip=#3 \rightskip=\leftskip \parindent=\z@ #2\par + \global\setbox2=\hbox{} + \int_gzero:N \l__nju_tmp_int + \loop + \setbox1=\lastbox \unskip\unpenalty + \unless\ifvoid1 + \global\setbox2=\hbox{\__nju_uline_box:\penalty0\unhbox2} + \int_gincr:N \l__nju_tmp_int + \repeat + } + { + \noindent\copy\l__nju_tmp_box\unhbox2 + \bool_if:NT \g__nju_strict_abs_title_bool + { + \int_case:nnF { \l__nju_tmp_int } + { + { 0 } { \msg_error:nn { njuthesis } { missing-title } } + { 1 } { \__nju_uline:n { \textwidth } } + { 2 } { \prg_do_nothing: } + } + { \msg_warning:nn { njuthesis } { abs-title-too-long } } + \par + } + } + } +\cs_generate_variant:Nn \__nju_uline_list:nnn { xnn } \DeclareObjectType { nju } { \c_zero_int } \DeclareTemplateInterface { nju } { element } { \c_zero_int } { @@ -436,16 +486,17 @@ { \file_input:n { njuthesis- graduate.def } } \msg_new:nnn { njuthesis } { load-config } { I~ am~ loading~ config~ file~ "#1". } -\clist_if_empty:NF \g__nju_config_clist +\clist_map_inline:Nn \g__nju_config_clist { - \msg_info:nnx { njuthesis } { load-config } { \g__nju_config_tl } - \clist_map_inline:Nn \g__nju_config_clist { \file_input:n { #1 } } + \msg_info:nnn { njuthesis } { load-config } { #1 } + \file_input:n { #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, + title* .initial:n = { Empty }, 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, @@ -482,7 +533,9 @@ { \tl_set:Nn \l__nju_info_diploma_tl { ug } } { \tl_set:Nn \l__nju_info_diploma_tl { g } } \tl_set:Nx \l__nju_info_type_tl - { \clist_item:Nn \c__nju_name_type_clist { \g__nju_info_type_int } } + { \clist_item:Nn \c__nju_name_type_clist { \g__nju_info_type_int } } +\tl_set:Nx \l__nju_info_type_en_tl + { \clist_item:Nn \c__nju_name_type_en_clist { \g__nju_info_type_int } } \tl_put_left:Nx \l__nju_info_type_tl { \tl_use:c { c__nju_name_ \l__nju_info_diploma_tl _tl } } \ctex_at_end_preamble:n @@ -1059,11 +1112,23 @@ \exp_args:NV \pagestyle \c__nju_pagestyle_tl \pagenumbering { Roman } } +\__nju_declare_element:nn { abstract / mark } + { + content = \c__nju_name_abstract_b_tl, + format = \sffamily \zihao { -3 }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { abstract / en / mark } + { + content = \c__nju_name_abstract_b_en_tl, + format = \sffamily \zihao { -3 }, + bottom-skip = 1 cm + } \cs_new_protected:Npn \__nju_print_keywords:nn #1#2 { \tl_set:Nv \l__nju_tmp_tl { c__nju_name_keywords #1 _tl } \__nju_get_text_width:NV \l__nju_tmp_dim \l__nju_tmp_tl - \list { } + \list { \l__nju_tmp_tl } { \labelwidth \l__nju_tmp_dim \labelsep \c_zero_dim @@ -1072,14 +1137,31 @@ \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 } + \item \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } \endlist } +\skip_new:N \g__nju_abs_title_left_skip \keys_define:nn { nju / style } { - abstract-in-toc .bool_gset:N = \g__nju_abs_in_toc_bool, - abstract-in-toc .initial:n = true + abstract-in-toc .bool_gset:N = \g__nju_abs_in_toc_bool, + abstract-in-toc .initial:n = true, + abstract-title .choice:, + abstract-title / strict .code:n = + { + \bool_gset_true:N \g__nju_strict_abs_title_bool + \skip_gset:Nn \g__nju_abs_title_left_skip { 1 em } + }, + abstract-title / centered .code:n = + { + \bool_gset_true:N \g__nju_strict_abs_title_bool + \skip_gset:Nn \g__nju_abs_title_left_skip { 0 pt plus 1 fill } + }, + abstract-title / natural .code:n = + { + \bool_gset_false:N \g__nju_strict_abs_title_bool + \skip_gset:Nn \g__nju_abs_title_left_skip { 0 pt plus 1 fill } + }, + abstract-title .initial:n = strict } \NewDocumentEnvironment { abstract } { +b } { -- cgit v1.2.3