summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-05 22:09:37 +0000
committerKarl Berry <karl@freefriends.org>2022-04-05 22:09:37 +0000
commit44c7e92cd62a724d239c17b52359d86abaf22615 (patch)
treefd4cf4a728e8f20ed7d31171b6bcdb8002f30abc /Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls
parent43498062297432f6e77404bad0ad54f0fb991a05 (diff)
njuthesis (27mar22)
git-svn-id: svn://tug.org/texlive/trunk@62939 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls')
-rw-r--r--Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls106
1 files changed, 94 insertions, 12 deletions
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 <git+nju-lug-email-3104-issue-@yaoge123.cn>$
+\GetIdInfo $Id: njuthesis.dtx 0.16.1 2022-03-27 13:00:00 +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$
{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 }
{