summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/njuthesis/njuthesis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/unicodetex/latex/njuthesis/njuthesis.dtx')
-rw-r--r--macros/unicodetex/latex/njuthesis/njuthesis.dtx1385
1 files changed, 864 insertions, 521 deletions
diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.dtx b/macros/unicodetex/latex/njuthesis/njuthesis.dtx
index 649ca357dd..cf1443a781 100644
--- a/macros/unicodetex/latex/njuthesis/njuthesis.dtx
+++ b/macros/unicodetex/latex/njuthesis/njuthesis.dtx
@@ -20,6 +20,7 @@
% This work consists of the files njuthesis.dtx,
% and the derived files njuthesis.ins,
% njuthesis.cls,
+% njuthesis-doc.cls,
% njuthesis-graduate.def,
% njuthesis-postdoctoral.def,
% njuthesis-undergraduate.def,
@@ -73,6 +74,7 @@ To produce the documentation run the original source files ending with
\file{\jobname-undergraduate.def} {\from{\jobname.dtx}{def-u}}
\file{\jobname-graduate.def} {\from{\jobname.dtx}{def-g}}
\file{\jobname-postdoctoral.def} {\from{\jobname.dtx}{def-p}}
+ \file{\jobname-doc.cls} {\from{\jobname.dtx}{doc-cls}}
%<*internal>
\usedir{source/latex/njuthesis}
\file{\jobname.ins} {\from{\jobname.dtx}{install}}
@@ -88,6 +90,7 @@ To produce the documentation run the original source files ending with
\Msg{* The recommended directory is TDS:tex/latex/njuthesis *}
\Msg{* *}
\Msg{* njuthesis.cls *}
+\Msg{* njuthesis-doc.cls *}
\Msg{* njuthesis-graduate.def *}
\Msg{* njuthesis-postdoctoral.def *}
\Msg{* njuthesis-undergraduate.def *}
@@ -109,7 +112,7 @@ To produce the documentation run the original source files ending with
%
%<class>\NeedsTeXFormat{LaTeX2e}
%<*!(driver|install)>
-%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.2.1 2023-05-03 13:30:00
+%<+!driver>\GetIdInfo $Id: njuthesis.dtx 1.3.0 2023-06-06 11:30:00
%<+!driver> +0800 NJU LUG <git+nju-lug-email-3104-issue-@yaoge123.cn>$
%<class> {Thesis template for Nanjing University}
%<class>\ProvidesExplClass{njuthesis}
@@ -121,216 +124,15 @@ To produce the documentation run the original source files ending with
% ^^A 南京大学一百二十周年华诞邀您共襄盛举!
%<def-p> {Postdoctoral definition file for njuthesis}
%<def-p>\ProvidesExplFile{njuthesis-postdoctoral.def}
+%<doc-cls> {Documentation style for njuthesis}
+%<doc-cls>\ProvidesExplFile{njuthesis-doc.cls}
%<!driver> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
%</!(driver|install)>
%
%<*driver>
\ProvidesFile{njuthesis.dtx}
-\documentclass[fontset=fandol]{ctxdoc}
-\usepackage{listings,njuvisual,tabularray,unicode-math,xeCJKfntef,zhlineskip}
-\usepackage[firstpage=true]{background}
-\backgroundsetup{
- contents={\njuemblem[white!85!gray]{22cm}{!}},
- scale=1, angle=0, hshift=-4cm
-}
-\definecolor{tpblue}{HTML}{495A80}
-\renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}}
-\newcommand\tpbutton[1]{\textcolor{tpblue}{\bfseries #1}}
-\newcommand\tikzlogo{Ti\emph{k}Z}
-\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}}
-\hypersetup{
- pdftitle = {
- The njuthesis class -
- LaTeX thesis template for Nanjing University},
- citecolor = njublue,
- linkcolor = njuviolet,
- urlcolor = njumagenta}
-\UseTblrLibrary{booktabs,siunitx}
-\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable}
-\SetTblrStyle{caption-tag}{font=\bfseries}
-\SetTblrInner{row{1}={font=\bfseries}}
-\SetTblrInner[talltblr]{row{1}={font=\bfseries}}
-\DefTblrTemplate{caption-sep}{default}{\quad}
-\def\TA{\TblrNote{a}}
-\def\TB{\TblrNote{b}}
-\def\TC{\TblrNote{c}}
-\def\TD{\TblrNote{d}}
-\def\TE{\TblrNote{e}}
-\def\TL{\TeX~Live}
-\def\MacTeX{Mac\TeX}
-\def\biber{\hologo{biber}}
-\def\LaTeXe{\hologo{LaTeX2e}}
-\SetTextEnvironmentSinglespace{1.112}
-\SetMathEnvironmentSinglespace{1.112}
-\setsansfont{LexendDeca}
-\setmonofont{Iosevka}[
- UprightFont = Iosevka Light,
- ItalicFont = Iosevka Light Italic,
- BoldFont = Iosevka Semibold
-]
-\setCJKmainfont{Source Han Serif SC}[
- UprightFont = Source Han Serif SC SemiBold,
- ItalicFont = Source Han Serif SC Bold,
- BoldFont = Source Han Serif SC Heavy,
- Language = Chinese Simplified
-]
-\setmathfont{XITSMath-Regular}[
- BoldFont = XITSMath-Bold,
- Extension = .otf]
-\lstdefinestyle{style@base}
- {
- basewidth = 0.5 em,
- gobble = 3,
- lineskip = 3 pt,
- frame = l,
- framerule = 1 pt,
- framesep = 0 pt,
- xleftmargin = 2 em,
- xrightmargin = 3 em,
- escapeinside = {(*}{*)},
- breaklines = true,
- basicstyle = \small\ttfamily,
- keywordstyle = \bfseries\color{njuviolet},
- commentstyle = \itshape\color{white!50!gray},
- stringstyle = \color{nju-chem-red},
- backgroundcolor = \color{white!95!gray}
- }
-\lstdefinestyle{style@shell}
- {
- style = style@base,
- rulecolor = \color{njumagenta},
- language = bash,
- alsoletter = {-},
- emphstyle = \color{nju-cs-green}
- }
-\lstdefinestyle{style@latex}
- {
- style = style@base,
- rulecolor = \color{njublue},
- language = [LaTeX]TeX,
- alsoletter = {*, -, .},
- texcsstyle = *\color{njuviolet},
- emphstyle = [1]\color{nju-ai-orange},
- emphstyle = [2]\color{nju-cs-green},
- emphstyle = [3]\bfseries\color{njuyellow}
- }
-\lstnewenvironment{shellexample}[1][]{%
- \lstset{style=style@shell, #1}}{}
-\lstnewenvironment{latexexample}[1][]{%
- \lstset{style=style@latex, #1}}{}
-\makeatletter
-\ExplSyntaxOn
-\colorlet { at@guard } { njuviolet }
-\definecolor { angle@guard } { gray } { 0.7 }
-\definecolor { star@guard } { rgb } { 0.8 , 0 , 0 }
-\definecolor { u@guard } { HTML } { 5463FF }
-\definecolor { g@guard } { HTML } { 2B7A0B }
-\definecolor { p@guard } { HTML } { FF1818 }
-\definecolor { c@guard } { HTML } { FFC300 }
-\clist_const:Nn \c__njudoc_module_color_clist
- {
- { def-u } { u@guard },
- { def-g } { g@guard },
- { def-p } { p@guard },
- { class } { c@guard }
- }
-\cs_new_protected:Npn \__njudoc_compare_module:nnn #1#2#3
- { \str_if_eq:nnT {#1} {#2} { \color {#3} #1 } }
-\cs_new_protected:Npn \__njudoc_set_module_color:n #1
- {
- \clist_map_inline:Nn \c__njudoc_module_color_clist
- { \__njudoc_compare_module:nnn {#1} ##1 }
- }
-\cs_new_protected:Npn \__njudoc_module_angle:Nn #1#2
- {
- \group_begin: \color { angle@guard } \ttfamily \textlangle \group_end:
- \group_begin: \sffamily #2 \group_end:
- \group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end:
- }
-\cs_set_protected:Npn \__ctxdoc_module_angle:n #1
- { \__njudoc_module_angle:Nn \c_empty_tl {#1} }
-\cs_new_protected:Npn \__njudoc_colored_module_angle:NN #1#2
- {
- \seq_clear:N #2
- \seq_map_inline:Nn #1
- {
- \seq_gput_right:Nn #2
- { \__njudoc_set_module_color:n {##1} }
- }
- }
-\cs_new_protected:Npn \__njudoc_print_module:n #1
- {
- \__njudoc_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq
- \bool_lazy_or:nnTF
- { \str_if_empty_p:n { #1 } }
- { \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } }
- {
- \str_clear:N \l_tmpa_str
- \str_clear:N \l_tmpb_str
- }
- {
- \str_set:Nn \l_tmpa_str { ( }
- \str_set:Nn \l_tmpb_str { ) }
- }
- \__njudoc_module_angle:Nn \l_tmpb_str
- {
- \color { star@guard } #1
- \color { angle@guard } \l_tmpa_str
- \seq_use:Nn \l_tmpb_seq
- { \color { angle@guard } \orbar }
- }
- }
-\cs_new_protected_nopar:Npn \__njudoc_split_pm:n #1
- { \seq_set_split:Nnn \l_tmpa_seq { | } {#1} }
-\cs_new_protected_nopar:Npn \__njudoc_split_m:n #1
- {
- \tl_set:Nn \l_tmpa_str {#1}
- \clist_map_inline:nn { *, /, (, ) }
- { \str_remove_all:Nn \l_tmpa_str {##1} }
- \seq_set_split:NnV \l_tmpa_seq { | } \l_tmpa_str
- }
-\group_begin:
- \char_set_catcode_active:N \>
- \cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop
- {
- \__ctxdoc_output_module:nn
- { \__njudoc_split_m:n {#1} }
- { \__ctxdoc_module_push:n { \__njudoc_print_module:n { * } } }
- \__ctxdoc_output_line:n {#2}
- \__ctxdoc_star_format:
- }
- \cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop
- {
- \__ctxdoc_output_module:nn
- { \__njudoc_split_m:n {#1} }
- { \__ctxdoc_module_pop:n { \__njudoc_print_module:n { / } } }
- \__ctxdoc_output_line:n {#2}
- \__ctxdoc_slash_format:
- }
- \cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop
- {
- \tex_noindent:D
- \hbox_overlap_left:n
- {
- \__ctxdoc_output_module:nn
- { \__njudoc_split_pm:n {#1} }
- { \__njudoc_print_module:n { } }
- \skip_horizontal:n { \leftskip + \smallskipamount }
- }
- \group_begin:
- \__ctxdoc_pm_format:
- \__ctxdoc_output_line:n {#2}
- \group_end:
- }
-\group_end:
-\NewDocumentCommand \grd { m }
- { \__ctxdoc_module_angle:n { \color { njuviolet } #1 } }
-\NewDocumentCommand \sgrd { m }
- { \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } }
-\NewDocumentCommand \pgrd { m }
- { \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } }
-\ExplSyntaxOff
-\makeatother
+\PassOptionsToClass{codehigh}{njuthesis-doc}
+\documentclass{njuthesis-doc}
\begin{document}
\DocInput{njuthesis.dtx}
\PrintChanges
@@ -339,6 +141,15 @@ To produce the documentation run the original source files ending with
%</driver>
% \fi
%
+% \title{\color{njuviolet}{The \cls{njuthesis} class\\
+% \textbf{南京大学学位论文模板}}}
+%
+% \author{南京大学 Linux 用户组
+% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn}
+% {git+nju-lug-email-3104-issue-@yaoge123.cn}}}
+%
+% \date{v1.3.0 \quad 2023-06-06}
+%
% \changes{v0.1}{2021/09/04}{开始开发。}
% \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。}
% \changes{v0.3}{2021/09/09}{使用自动构建工具进行测试。}
@@ -373,15 +184,6 @@ To produce the documentation run the original source files ending with
% \changes{v1.1}{2023/01/05}{适配2023届本科生毕业毕业论文(设计)规范。}
% \changes{v1.1}{2023/01/05}{适配新版南大 \LaTeX 在线编辑器。}
%
-% \title{\color{njuviolet}{The \cls{njuthesis} class\\
-% \textbf{南京大学学位论文模板}}}
-%
-% \author{南京大学 Linux 用户组
-% \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn}
-% {git+nju-lug-email-3104-issue-@yaoge123.cn}}}
-%
-% \date{v1.2.1 \quad 2023-05-03}
-%
% \maketitle
%
% \let\abstractname\relax
@@ -1386,12 +1188,15 @@ To produce the documentation run the original source files ending with
% 院系。
% \end{function}
%
-% \begin{function}[updated=2021-10-01]{info/major,info/major*}
+% \begin{function}[updated=2023-05-11]{info/major,info/major*}
% \begin{syntax}
% \OPT{major} = \Arg{专业}
+% \OPT{major} = \Arg{专业,专业全称}
% \OPT{major*} = \Arg{专业}
% \end{syntax}
-% 专业。
+% 专业。研究生的专业型学位封面上,“专业学位类别(领域)”一栏默认会补全为
+% “专业硕/博士(\meta{专业})”。如果希望覆盖模板的自动处理,
+% 可以填写 \opt{info/major} 第二种写法的“专业全称”字段。
% \end{function}
%
% \begin{function}[updated=2021-10-01]{info/field,info/field*}
@@ -1469,7 +1274,7 @@ To produce the documentation run the original source files ending with
%
% \begin{function}[updated=2021-10-01]{info/secret-level}
% \begin{syntax}
-% \OPT{secret-level} = <不涉密|秘密|机密|绝密>
+% \OPT{secret-level} = \Arg{密级}
% \end{syntax}
% 研究生学位论文封面上的密级。
% \end{function}
@@ -1489,13 +1294,13 @@ To produce the documentation run the original source files ending with
% \end{function}
%
% \begin{function}[added=2023-04-24]{info/degree,info/degree*}
- % \begin{syntax}
- % \OPT{degree} = \Arg{中文学位名}
- % \OPT{degree*} = \Arg{英文学位名}
- % \end{syntax}
- % 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree}
- % 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。
- % \end{function}
+% \begin{syntax}
+% \OPT{degree} = \Arg{中文学位名}
+% \OPT{degree*} = \Arg{英文学位名}
+% \end{syntax}
+% 研究生国家图书馆封面英文封面上的学位名称。默认会由模板通过 \opt{degree}
+% 和 \opt{type} 文档类选项生成,也可以由本选项自定义名称。
+% \end{function}
%
%
% \subsubsection{输入示范}
@@ -1548,6 +1353,11 @@ To produce the documentation run the original source files ending with
% supervisor* = {Professor Li Chengdian},
% submit-date = {2021-09-12},
% defend-date = {2022-01-15},
+% clc = {0175.2},
+% udc = {004.72},
+% secret-level = {公开},
+% chairman = {张~教授},
+% reviewer = {王~教授,赵~副教授,李~助理研究员},
% email = {git+nju-lug-email-3104-issue-@yaoge123.cn}
% }
% \end{latexexample}
@@ -1559,12 +1369,7 @@ To produce the documentation run the original source files ending with
% \njusetup[info]{
% confer-date = {2022-05-20},
% bottom-date = {2022-05-21},
-% chairman = {张晓山~教授},
-% reviewer = {王瑞希~教授,郭德纲~副教授,华芈库~教授,戴菲菲~教授},
-% clc = {0175.2},
-% secret-level = {限制},
-% udc = {004.72},
-% supervisor-contact = {拉太赫科学与技术学院 枝江市结丘路 19 号 114514}
+% supervisor-contact = {化学化工学院 仙林大道 163 号 210046}
% }
% \end{latexexample}
%
@@ -1870,16 +1675,24 @@ To produce the documentation run the original source files ending with
% 定理计数器范围。
% \end{function}
%
+% \begin{function}[added=2023-05-07]{theorem/share-counter}
+% \begin{syntax}
+% \OPT{share-counter} = <\TFF>
+% \end{syntax}
+% 是否共享计数器。
+% \end{function}
+%
% 模板的默认设置等效于
%
% \begin{latexexample}[moretexcs={\njusetup,\bfseries,\itshape,\mdlgwhtsquare},
% emph={[2]theorem},emph={[3]style,header-font,body-font,qed-symbol,counter}]
% \njusetup[theorem]{
-% style = plain,
-% header-font = \normalfont \bfseries ,
-% body-font = \itshape ,
-% qed-symbol = \ensuremath { \mdlgwhtsquare },
-% counter = chapter
+% style = plain,
+% header-font = \normalfont \bfseries ,
+% body-font = \itshape ,
+% qed-symbol = \ensuremath { \mdlgwhtsquare },
+% counter = chapter,
+% share-counter = false
% }
% \end{latexexample}
%
@@ -1926,12 +1739,14 @@ To produce the documentation run the original source files ending with
% \opt{theorem/type} 保存的列表以及前方的样式设置并创建相应环境。
% 这也就意味着该选项在 \opt{theorem/type} 为空时会报错。
%
-% 在下面这个例子中,我们先创建了预置的七种环境,随后将定理内部文字字体改为
+% 在下面这个例子中,我们先创建了预置的七种环境。除了无编号的
+% \env{proof},其余六种共用一个计数器。随后我们将定理内部文字字体改为
% 宋体,定义了 \env{exercise} 和 \env{solution} 两种定理环境,后者没有编号。
%
% \begin{latexexample}[moretexcs={\njusetup,\normalfont},
% emph={[2]theorem},emph={[3]define,body-font,type}]
% \njusetup[theorem]{
+% share-counter = true ,
% define ,
% body-font = \normalfont ,
% type = {
@@ -2923,10 +2738,10 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\c_@@_today_tl}
+% \begin{variable}{\c_@@_name_today_tl}
% 编译当天日期,格式为 |yyyy-mm-dd|。
% \begin{macrocode}
-\tl_const:Nx \c_@@_today_tl
+\tl_const:Nx \c_@@_name_today_tl
{
\int_to_arabic:n { \c_sys_year_int } -
\int_to_arabic:n { \c_sys_month_int } -
@@ -3015,11 +2830,11 @@ To produce the documentation run the original source files ending with
% 用来定义默认名称的辅助函数。
% \begin{macrocode}
\cs_new_protected:Npn \@@_define_name:nn #1#2
- { \tl_const:cn { c_@@_name_ #1 _tl } { #2 } }
+ { \tl_const:cn { c_@@_name_ #1 _tl } {#2} }
\cs_new_protected:Npn \@@_define_name:nnn #1#2#3
{
- \tl_const:cn { c_@@_name_ #1 _tl } { #2 }
- \tl_const:cn { c_@@_name_ #1 _en_tl } { #3 }
+ \tl_const:cn { c_@@_name_ #1 _tl } {#2}
+ \tl_const:cn { c_@@_name_ #1 _en_tl } {#3}
}
% \end{macrocode}
% \end{macro}
@@ -3028,7 +2843,7 @@ To produce the documentation run the original source files ending with
% 用来定义默认样式的辅助函数。
% \begin{macrocode}
\cs_new_protected:Npn \@@_define_fmt:nn #1#2
- { \tl_const:cn { c_@@_fmt_ #1 _tl } { #2 } }
+ { \tl_const:cn { c_@@_fmt_ #1 _tl } {#2} }
% \end{macrocode}
% \end{macro}
%
@@ -3036,9 +2851,9 @@ To produce the documentation run the original source files ending with
% 用来定义默认间距的辅助函数。
% \begin{macrocode}
\cs_new_protected:Npn \@@_define_dim:nn #1#2
- { \dim_const:cn { c_@@_ #1 _dim } { #2 } }
+ { \dim_const:cn { c_@@_ #1 _dim } {#2} }
\cs_new_protected:Npn \@@_define_skip:nn #1#2
- { \skip_const:cn { c_@@_ #1 _skip } { #2 } }
+ { \skip_const:cn { c_@@_ #1 _skip } {#2} }
% \end{macrocode}
% \end{macro}
%
@@ -3064,9 +2879,9 @@ To produce the documentation run the original source files ending with
% \tn{baselineskip},抛弃 \cs{l__ctex_font_size_tl} 中的第二个值。
% \begin{macrocode}
\cs_new:Npn \@@_fontsize:nn #1#2
- { \fontsize { #1 } { #2 } \selectfont }
+ { \fontsize {#1} {#2} \selectfont }
\cs_new:Npn \@@_fontsize:nnn #1#2#3
- { \@@_fontsize:nn { #1 } { \fp_to_decimal:n { #3 * #1 } } }
+ { \@@_fontsize:nn {#1} { \fp_to_decimal:n { #3 * #1 } } }
% \end{macrocode}
% \end{macro}
%
@@ -3079,9 +2894,9 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new:Npn \@@_zihao:nn #1#2
{
- \prop_get:NnNTF \c__ctex_font_size_prop { #2 } \l__ctex_font_size_tl
- { \exp_after:wN \@@_fontsize:nnn \l__ctex_font_size_tl { #1 } }
- { \msg_error:nnn { ctex } { fontsize } { #2 } }
+ \prop_get:NnNTF \c__ctex_font_size_prop {#2} \l__ctex_font_size_tl
+ { \exp_after:wN \@@_fontsize:nnn \l__ctex_font_size_tl {#1} }
+ { \msg_error:nnn { ctex } { fontsize } {#2} }
}
% \end{macrocode}
% 默认行距倍数为 1.3。
@@ -3099,8 +2914,8 @@ To produce the documentation run the original source files ending with
\cs_new:Npo \@@_set_ccglue:n #1
{
\sys_if_engine_xetex:TF
- { \skip_set:Nn \l__ctex_ccglue_skip { #1 } }
- { \ltjsetparameter { kanjiskip = { #1 } } }
+ { \skip_set:Nn \l__ctex_ccglue_skip {#1} }
+ { \ltjsetparameter { kanjiskip = {#1} } }
}
% \end{macrocode}
% \end{macro}
@@ -3116,9 +2931,9 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_box_ulined:NN #1#2
{
\mode_leave_vertical:
- \rule [ \c_@@_ruledpi_dim ] { #1 } { \c_@@_rulehti_dim }
+ \rule [ \c_@@_ruledpi_dim ] {#1} { \c_@@_rulehti_dim }
\skip_horizontal:n { -#1 }
- \hbox_to_wd:nn { #1 } { \tex_hfil:D #2 \tex_hfil:D }
+ \hbox_to_wd:nn {#1} { \tex_hfil:D #2 \tex_hfil:D }
}
\cs_generate_variant:Nn \@@_box_ulined:NN { Nc }
% \end{macrocode}
@@ -3132,32 +2947,39 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_box_spread:NNn,\@@_box_spread:NNv,\@@_box_spread:NNx}
+% \begin{macro}{\@@_box_spread:NNNn}
% \changes{v0.19}{2022/05/16}{对超出盒子宽度的文字进行水平压缩。}
% 分散对齐的水平盒子,拉伸算法来自 \cls{fduthesis}。
% 在文字宽度小于给定宽度时,在字符中间填补 \tn{hfil} 以增大字距。
% 在文字宽度超出限制时,进行整体水平压缩。
% \begin{arguments}
+% \item 临时 |dim| 型变量
% \item 宽度,|dim| 型变量
% \item 格式
% \item 内容,不可带有格式
% \end{arguments}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_box_spread:NNn #1#2#3
+\cs_new_protected:Npn \@@_box_spread:NNNn #1#2#3#4
{
\mode_leave_vertical:
- \@@_get_width:Nn \l_@@_tmp_skip { #2 #3 }
- \hbox_to_wd:nn { #1 }
+ \@@_get_width:Nn #1 { #3 #4 }
+ \hbox_to_wd:nn {#2}
{
- \dim_compare:nTF { \l_@@_tmp_skip > #1 }
+ \dim_compare:nTF { #1 > #2 }
{
\tex_hfil:D \scalebox
- { \dim_to_decimal_in_unit:nn { #1 } { \l_@@_tmp_skip } }
- [ 1.0 ] { #2 #3 } \tex_hfil:D
+ { \dim_to_decimal_in_unit:nn {#2} {#1} }
+ [ 1.0 ] { #3 #4 } \tex_hfil:D
}
- { #2 \tl_map_inline:nn { #3 } { ##1 \tex_hfil:D } \tex_unskip:D }
+ { #3 \tl_map_inline:nn {#4} { ##1 \tex_hfil:D } \tex_unskip:D }
}
}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_box_spread:NNn,\@@_box_spread:NNv,\@@_box_spread:NNx}
+% \begin{macrocode}
+\cs_new:Npn \@@_box_spread:NNn { \@@_box_spread:NNNn \l_@@_tmp_skip }
\cs_generate_variant:Nn \@@_box_spread:NNn { NNv }
\cs_generate_variant:Nn \@@_box_spread:NNn { NNx }
% \end{macrocode}
@@ -3184,32 +3006,37 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_box_multiline:NNNn,\@@_box_multiline:NNn}
+% \begin{macro}{\@@_box_multiline:NNNNn}
% 多行固定长度的下划线内容。
% \begin{arguments}
% \item 用于存储条目数量的 |int| 型变量
+% \item 用于存储条目内容的 |tl| 型变量
% \item 内容,|clist| 型变量
% \item 宽度,|dim| 型变量
% \item 条目数量
% \end{arguments}
% 默认绘制 4 条下划线。在评阅者人数超过 4 人时添加额外的条目。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_box_multiline:NNNn #1#2#3#4
+\cs_new_protected:Npn \@@_box_multiline:NNNNn #1#2#3#4#5
{
- \int_set:Nn #1 { \int_max:nn { \clist_count:N #2 } { #4 } }
- \int_step_inline:nn { #1 }
+ \int_set:Nn #1 { \int_max:nn { \clist_count:N #3 } {#5} }
+ \int_step_inline:nn {#1}
{
- \clist_pop:NN #2 \l_@@_tmpa_tl
% \end{macrocode}
% \changes{v1.1}{2022/11/29}{修复空返回值在国家图书馆封面引发的死循环。}
% 防止空的返回值引发死循环。
% \begin{macrocode}
- \quark_if_no_value:NT \l__nju_tmpa_tl
- { \tl_set_eq:NN \l_@@_tmpa_tl \c_empty_tl }
- \@@_box_ulined:NN #3 \l_@@_tmpa_tl \tex_par:D
+ \clist_pop:NNF #3 #2 { \tl_set_eq:NN #2 \c_empty_tl }
+ \@@_box_ulined:NN #4 #2 \tex_par:D
}
}
-\cs_new:Npn \@@_box_multiline:NNn { \@@_box_multiline:NNNn \l_@@_tmpa_int }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_box_multiline:NNn}
+% \begin{macrocode}
+\cs_new:Npn \@@_box_multiline:NNn
+ { \@@_box_multiline:NNNNn \l_@@_tmpa_int \l_@@_tmpa_tl }
% \end{macrocode}
% \end{macro}
%
@@ -3222,7 +3049,7 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_uline:n #1
{
\mode_leave_vertical:
- \rule [ \c_@@_ruledpi_dim ] { #1 } { \c_@@_rulehti_dim }
+ \rule [ \c_@@_ruledpi_dim ] {#1} { \c_@@_rulehti_dim }
\skip_horizontal:n { -#1 }
}
% \end{macrocode}
@@ -3237,9 +3064,9 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_uuline:N #1
{
\mode_leave_vertical:
- \rule [ \c_@@_ruledpii_dim ] { #1 } { \c_@@_rulehtii_dim }
+ \rule [ \c_@@_ruledpii_dim ] {#1} { \c_@@_rulehtii_dim }
\skip_horizontal:n { -#1 }
- \rule [ \c_@@_ruledpiii_dim ] { #1 } { \c_@@_rulehtii_dim }
+ \rule [ \c_@@_ruledpiii_dim ] {#1} { \c_@@_rulehtii_dim }
\skip_horizontal:n { -#1 }
}
% \end{macrocode}
@@ -3300,7 +3127,7 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new_protected:Npn \@@_get_width_print:Nn #1#2
{
- \@@_get_width:Nn #1 { #2 }
+ \@@_get_width:Nn #1 {#2}
\dim_set:Nn #1 { \textwidth - #1 } #2
}
\cs_generate_variant:Nn \@@_get_width_print:Nn { Nv }
@@ -3318,7 +3145,7 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_uline_entry:Nn #1#2
{
\@@_get_width_print:Nv #1 { c_@@_name_ #2 _tl }
- \@@_box_ulined_info:Nn #1 { #2 }
+ \@@_box_ulined_info:Nn #1 {#2}
}
% \end{macrocode}
% \end{macro}
@@ -3334,7 +3161,7 @@ To produce the documentation run the original source files ending with
{
\@@_get_width_print:Nv #1 { c_@@_name_ #2 _tl }
\dim_sub:Nn #1 { \textwidth / 2 }
- \@@_box_ulined_info:Nn #1 { #2 }
+ \@@_box_ulined_info:Nn #1 {#2}
}
% \end{macrocode}
% \end{macro}
@@ -3354,40 +3181,29 @@ To produce the documentation run the original source files ending with
% 其中,变量类型 |w| 表明参数符合特定语法格式,其参数必须经过完全展开。
% \begin{macrocode}
\cs_new:Npn \@@_date:www #1-#2-#3 \q_stop
- { \__zhnum_date_aux:nnn { #1 } { #2 } { #3 } }
+ { \__zhnum_date_aux:nnn {#1} {#2} {#3} }
\cs_new:Npn \@@_date_en:www #1-#2-#3 \q_stop
- { \clist_item:Nn \c_@@_name_month_en_clist { #2 } ~#3 , ~#1 }
+ { \clist_item:Nn \c_@@_name_month_en_clist {#2} ~#3 , ~#1 }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_date:n,\@@_date_en:n}
-% 从 ISO 格式的日期字符串生成中英文日期文本。
+% \begin{macro}{\@@_date:nn}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_date:n #1 { \@@_date:nn { #1 } { } }
-\cs_new_protected:Npn \@@_date_en:n #1 { \@@_date:nn { #1 } { _en } }
+\cs_new:Npn \@@_date:nn { \@@_date:nnn { } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\exp_last_unbraced:cV,\@@_date:nn}
+% \begin{macro}{\@@_date:nnn}
% \changes{v0.20}{2022/05/24}{可在日期项留空以使用空白的年月日字样。}
% 用于日期格式转化的辅助命令。在传入的字符串为空时生成空白字样。
% \begin{macrocode}
-\cs_generate_variant:Nn \exp_last_unbraced:NV { cV }
-\cs_new_protected:Npn \@@_date:nn #1#2
+\cs_new:Npn \@@_date:nnn #1#2#3
{
- \tl_set:Nv \l_@@_tmpa_tl { g_@@_info_ #1 date_raw_tl }
- \tl_new:c { g_@@_info_ #1 date #2 _tl }
- \tl_set:cx { g_@@_info_ #1 date #2 _tl }
+ \tl_set:cx { g_@@_info_ #2 date #1 _tl }
{
- \tl_if_empty:NTF \l_@@_tmpa_tl
- { \@@_name:n { blankdate #2 } }
-% \end{macrocode}
-% |w| 后的参数需要使用非括号包裹的形式完全展开。
-% \begin{macrocode}
- {
- \exp_last_unbraced:cV { @@_date #2 :www }
- \l_@@_tmpa_tl \q_stop
- }
+ \tl_if_empty:nTF {#3}
+ { \@@_name:n { blankdate #1 } }
+ { \use:c { @@_date #1 :www } #3 \q_stop }
}
}
% \end{macrocode}
@@ -3397,7 +3213,7 @@ To produce the documentation run the original source files ending with
% 封装 \LaTeX{} 的钩子管理机制,等效于 \tn{AtBeginDocument}。
% \begin{macrocode}
\cs_new_protected:Npn \@@_at_begin_document:n #1
- { \hook_gput_next_code:nn { begin document } { #1 } }
+ { \hook_gput_next_code:nn { begin document } {#1} }
% \end{macrocode}
% \end{macro}
%
@@ -3526,7 +3342,7 @@ To produce the documentation run the original source files ending with
% 这里需要存储 \tn{prevdepth} 的值,以使 \tn{parbox} 后行距正确。
% \footnote{\url{https://tex.stackexchange.com/q/34971/}}
% \begin{macrocode}
- \parbox [ t ] { #3 }
+ \parbox [ t ] {#3}
{
\c_@@_fmt_covertitle_tl \@@_uline_title:
\dim_gset_eq:NN \l_@@_tmpa_dim \tex_prevdepth:D
@@ -3550,8 +3366,8 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new_protected:Npn \@@_cover_entry:NNNNn #1#2#3#4#5
{
- \@@_box_spread_name:NNn #2 #4 { #5 } #1
- \@@_box_ulined_info:Nn #3 { #5 } \tex_par:D
+ \@@_box_spread_name:NNn #2 #4 {#5} #1
+ \@@_box_ulined_info:Nn #3 {#5} \tex_par:D
}
\cs_new:Npn \@@_cover_entry:NNNn { \@@_cover_entry:NNNNn \@@_hskip: }
% \end{macrocode}
@@ -3569,10 +3385,10 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new_protected:Npn \@@_cover_entry:NNNnn #1#2#3#4#5
{
- \@@_box_spread_name:NNn #1 #3 { #4 } \@@_hskip:
- \@@_box_ulined_info:Nn #2 { #4 } \@@_hskip:
- \@@_box_spread_name:NNn #1 #3 { #5 } \@@_hskip:
- \@@_box_ulined_info:Nn #2 { #5 } \tex_par:D
+ \@@_box_spread_name:NNn #1 #3 {#4} \@@_hskip:
+ \@@_box_ulined_info:Nn #2 {#4} \@@_hskip:
+ \@@_box_spread_name:NNn #1 #3 {#5} \@@_hskip:
+ \@@_box_ulined_info:Nn #2 {#5} \tex_par:D
}
% \end{macrocode}
% \end{macro}
@@ -3594,7 +3410,7 @@ To produce the documentation run the original source files ending with
{ \clist_item:cn { g_@@_info_ #4 _clist } { 1 } }
\tl_set:Nn \l_@@_tmpb_tl
{ \clist_item:cn { g_@@_info_ #4 _clist } { 2 } }
- \@@_box_spread_name:NNn #1 #3 { #4 } \@@_hskip:
+ \@@_box_spread_name:NNn #1 #3 {#4} \@@_hskip:
\@@_box_ulined:NN #2 \l_@@_tmpa_tl \@@_hskip:
\@@_box_spread_name:NNn #1 #3 { supvtitle } \@@_hskip:
\@@_box_ulined:NN #2 \l_@@_tmpb_tl \tex_par:D
@@ -3607,9 +3423,9 @@ To produce the documentation run the original source files ending with
% 此时 \tn{njuemblem}、\tn{njuname} 和相关长度都是没有定义的。
% \begin{macrocode}
\cs_new_protected:Npn \@@_emblem:N #1
- { \njuemblem [ \c_@@_fmt_emblemcolor_tl ] { #1 } { ! } }
+ { \njuemblem [ \c_@@_fmt_emblemcolor_tl ] {#1} { ! } }
\cs_new_protected:Npn \@@_name:N #1
- { \njuname [ \c_@@_fmt_namecolor_tl ] { #1 } { ! } }
+ { \njuname [ \c_@@_fmt_namecolor_tl ] {#1} { ! } }
% \end{macrocode}
% \end{macro}
%
@@ -3623,7 +3439,7 @@ To produce the documentation run the original source files ending with
{
\phantomsection
\@@_bookmark:Nnn \g_@@_abs_showentry_bool {#1} {#2}
- \@@_chapter_header:n { #1 }
+ \@@_chapter_header:n {#1}
}
\cs_generate_variant:Nn \@@_abs_bookmark:nn { Vn }
% \end{macrocode}
@@ -3659,7 +3475,7 @@ To produce the documentation run the original source files ending with
{
\vbox_set:Nn \l_@@_tmpa_box
{
- \@@_get_width:Nn \tex_hangindent:D { #3 }
+ \@@_get_width:Nn \tex_hangindent:D {#3}
\int_set:Nn \tex_hangafter:D { -1 }
\skip_set_eq:NN \tex_leftskip:D #2
\skip_set_eq:NN \tex_rightskip:D \tex_leftskip:D
@@ -3670,7 +3486,7 @@ To produce the documentation run the original source files ending with
\int_gzero:N \l_@@_tmpa_int
\@@_breakpar_loop:n { \int_gincr:N \l_@@_tmpa_int }
}
- \@@_breakpar_print:nn { #3 }
+ \@@_breakpar_print:nn {#3}
{
% \end{macrocode}
% 在使用自然断行算法后,研究生的摘要标题可选择 \opt{strict}
@@ -3900,6 +3716,13 @@ To produce the documentation run the original source files ending with
requires~ loading~ the~ class~ with~ "ntheorem"~ option~
set~ to~ "true".
}
+\@@_msg:nn { missing-symbol }
+ {
+ \string\mdwhtsquare\ and~ \string\checkmark\ are~ not~
+ contained~ in~ the~ standard~ amsmath~ package.~ You~
+ should~ redefine~ them~ with~ other~ packages~ loaded~
+ to~ properly~ generate~ the~ declaration~ page.
+ }
\@@_msg:nn { missing-title }
{
Thesis~ title~ should~ not~ be~ left~ blank.\\
@@ -4117,7 +3940,7 @@ To produce the documentation run the original source files ending with
\cs_new_protected:cpn { @@_loadpkg_ #2 : }
{
\bool_if:cT { g_@@_opt_load_ #2 _bool }
- { \RequirePackage { #1 } }
+ { \RequirePackage {#1} }
}
\clist_put_right:Nn \g_@@_name_optional_pkg_clist {#1}
}
@@ -4240,10 +4063,10 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\NewDocumentCommand \njusetup { o m }
{
- \tl_if_novalue:nTF { #1 }
- { \@@_keys_set:nn { nju } { #2 } }
+ \tl_if_novalue:nTF {#1}
+ { \@@_keys_set:nn { nju } {#2} }
{
- \tl_if_in:nnTF { #1 } { / }
+ \tl_if_in:nnTF {#1} { / }
{ \@@_keys_set:nn { nju } { #1 = {#2} } }
{ \@@_keys_set:nn { nju / #1 } {#2} }
}
@@ -4263,7 +4086,7 @@ To produce the documentation run the original source files ending with
% 定义修改默认样式的接口。
% \begin{macrocode}
\NewDocumentCommand \njusetformat { m m }
- { \tl_gset:cn { c_@@_fmt_ #1 _tl } { #2 } }
+ { \tl_gset:cn { c_@@_fmt_ #1 _tl } {#2} }
% \end{macrocode}
% \end{macro}
%
@@ -4274,9 +4097,9 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\NewDocumentCommand \njusetlength { s m m }
{
- \bool_if:nTF { #1 }
- { \skip_gset:cn { c_@@_ #2 _skip } { #3 } }
- { \dim_gset:cn { c_@@_ #2 _dim } { #3 } }
+ \bool_if:nTF {#1}
+ { \skip_gset:cn { c_@@_ #2 _skip } {#3} }
+ { \dim_gset:cn { c_@@_ #2 _dim } {#3} }
}
% \end{macrocode}
% \end{macro}
@@ -4305,7 +4128,7 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_tokenlist:nnnnn #1#2#3#4#5
{
- \bool_if:nTF { #1 }
+ \bool_if:nTF {#1}
{ \tl_set_eq:NN \l_@@_tmpb_tl \c_@@_name_suffix_en_tl }
{ \tl_clear:N \l_@@_tmpb_tl }
\tl_gset:cn { c_@@_ #5 _ #2 #3 \l_@@_tmpb_tl _tl } {#4}
@@ -4392,7 +4215,15 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\bool_if:NTF \g_@@_opt_load_um_bool
{ \RequirePackage { unicode-math } }
- { \RequirePackage { amsmath } }
+ {
+ \RequirePackage { amsmath }
+ \bool_if:NT \g_@@_opt_decl_bool
+ {
+ \msg_warning:nn { njuthesis } { missing-symbol }
+ \cs_new:Npn \mdwhtsquare { }
+ \cs_new:Npn \checkmark { }
+ }
+ }
% \end{macrocode}
%
% 载入各种宏包。
@@ -4466,7 +4297,7 @@ To produce the documentation run the original source files ending with
% 检查宏包版本是否过时。
% \begin{macrocode}
%<*class>
-\cs_new_protected:Npn \@@_check_pkg_version:nnn #1#2#3
+\cs_new:Npn \@@_check_pkg_version:nnn #1#2#3
{
\@ifpackagelater {#1} {#2}
{ } { \msg_error:nnnn { njuthesis } { package-too-old } {#1} {#3} }
@@ -4491,9 +4322,9 @@ To produce the documentation run the original source files ending with
% \item 产生冲突的宏包
% \end{arguments}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_check_pkg_conflict:nn #1#2
+\cs_new:Npn \@@_check_pkg_conflict:nn #1#2
{
- \ctex_at_begin_package:nn { #2 }
+ \ctex_at_begin_package:nn {#2}
{ \msg_warning:nnnn { njuthesis } { package-conflict } {#1} {#2} }
}
% \end{macrocode}
@@ -4508,7 +4339,7 @@ To produce the documentation run the original source files ending with
amscd, amsfonts, amssymb, bbm, bm, eucal,
eufrak, mathrsfs, newtxmath, upgreek
}
- { \@@_check_pkg_conflict:nn { unicode-math } { #1 } }
+ { \@@_check_pkg_conflict:nn { unicode-math } {#1} }
}
% \end{macrocode}
%
@@ -4538,8 +4369,8 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\clist_map_inline:Nn \g_@@_config_clist
{
- \msg_info:nnn { njuthesis } { load-config } { #1 }
- \file_input:n { #1 }
+ \msg_info:nnn { njuthesis } { load-config } {#1}
+ \file_input:n {#1}
}
% \end{macrocode}
%
@@ -4585,18 +4416,33 @@ To produce the documentation run the original source files ending with
% \end{macro}
%
% \begin{macro}{info/department,info/department*,
-% info/major,info/major*,info/field,info/field*}
+% info/major*,info/field,info/field*}
% 院系、专业、方向。
% \begin{macrocode}
department .tl_set:N = \g_@@_info_dept_tl ,
department* .tl_set:N = \g_@@_info_dept_en_tl ,
- major .tl_set:N = \g_@@_info_major_tl ,
major* .tl_set:N = \g_@@_info_major_en_tl ,
field .tl_set:N = \g_@@_info_field_tl ,
field* .tl_set:N = \g_@@_info_field_en_tl ,
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{info/major}
+% \changes{v1.3}{2023/05/11}{专业型研究生封面可额外修改专业名称。}
+% 专业。
+% \begin{macrocode}
+ major .code:n =
+ {
+ \clist_pop:NN \l_keys_value_tl \g_@@_info_major_tl
+ \clist_pop:NNF \l_keys_value_tl \g_@@_info_majorc_tl
+ {
+ \tl_set:Nn \g_@@_info_majorc_tl
+ { 工程 \g_@@_info_type_tl( \g_@@_info_major_tl ) }
+ }
+ },
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{info/supervisor,info/supervisor*}
% \changes{v0.13}{2021/12/11}{修改了导师选项的变量名称。}
% \changes{v0.14}{2022/01/12}{精简导师信息选项。}
@@ -4615,43 +4461,7 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{info/submit-date}
-% \changes{v0.14}{2022/01/14}{精简提交日期选项。}
-% 提交日期,初始值为编译当天日期。
-% \begin{macrocode}
- submit-date .tl_set:N = \g_@@_info_submitdate_raw_tl ,
- submit-date .initial:V = \c_@@_today_tl ,
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{info/defend-date}
-% \changes{v0.14}{2022/01/14}{精简答辩日期选项。}
-% 答辩日期。
-% \begin{macrocode}
- defend-date .tl_set:N = \g_@@_info_defenddate_raw_tl ,
- defend-date .initial:V = \c_@@_today_tl ,
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{info/defend-date}
-% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的学位授予日期设置项。}
-% 学位授予日期。
-% \begin{macrocode}
- confer-date .tl_set:N = \g_@@_info_conferdate_raw_tl ,
- confer-date .initial:V = \c_@@_today_tl ,
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{info/bottom-date}
-% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的底部日期设置项。}
-% 底部日期。
-% \begin{macrocode}
- bottom-date .tl_set:N = \g_@@_info_bottomdate_raw_tl ,
- bottom-date .initial:V = \c_@@_today_tl ,
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{info/defend-date,info/chairman,info/reviewer}
+% \begin{macro}{info/chairman,info/reviewer}
% 答辩委员会信息。
% \begin{macrocode}
chairman .tl_set:N = \g_@@_info_chairman_tl ,
@@ -4703,9 +4513,42 @@ To produce the documentation run the original source files ending with
% 覆盖预定义的学位字段。
% \begin{macrocode}
degree .tl_set:N = \g_@@_info_degree_tl ,
- degree* .tl_set:N = \g_@@_info_degree_en_tl
+ degree* .tl_set:N = \g_@@_info_degree_en_tl ,
+% \end{macrocode}
+% \end{macro}
+%
+% 提交日期,初始值为编译当天日期。
+% \begin{macrocode}
}
% \end{macrocode}
+%
+% \changes{v1.3}{2023/05/18}{日期字段直接在输入键值时处理。}
+%
+% \begin{macro}{info/submit-date}
+% \changes{v0.14}{2022/01/14}{精简提交日期选项。}
+% \begin{macro}{info/defend-date}
+% \changes{v0.14}{2022/01/14}{精简答辩日期选项。}
+% \begin{macro}{info/confer-date}
+% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的学位授予日期设置项。}
+% \begin{macro}{info/bottom-date}
+% \changes{v0.19}{2022/05/23}{新增国家图书馆封面的底部日期设置项。}
+% \begin{variable}{\g_@@_info_submitdate_tl,\g_@@_info_defenddate_tl,
+% \g_@@_info_bottomdate_tl,\g_@@_info_conferdate_tl}
+% 日期。
+% \begin{macrocode}
+\clist_map_inline:nn { submit, defend, confer, bottom }
+ {
+ \keys_define:nn { nju / info }
+ {
+ #1-date .code:n = \@@_date:nn {#1} {##1},
+ #1-date .initial:V = \c_@@_name_today_tl
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+% \end{macro}
+% \end{macro}
+% \end{macro}
% \end{macro}
%
% 将指定信息项归入 \opt{anonymous} 组,以在盲审模式下选择性屏蔽。
@@ -4744,49 +4587,23 @@ To produce the documentation run the original source files ending with
%</class>
% \end{macrocode}
%
-% \begin{macrocode}
-%<*(def-u|def-g|def-p)>
-\ctex_at_end_preamble:n
- {
-% \end{macrocode}
-% \begin{variable}{\g_@@_info_submitdate_tl}
-% 将 ISO 格式的原始日期字符串格式化为中文日期表示。
-% \begin{macrocode}
- \@@_date:n { submit }
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{
-% \g_@@_info_submitdate_en_tl,
-% \g_@@_info_defenddate_tl}
-% 英文提交日期以及答辩日期仅用于研究生封面。
+% \begin{variable}{\g_@@_info_submitdate_en_tl}
+% 研究生封面额外需要英文日期。
% \begin{macrocode}
%<*def-g>
- \@@_date_en:n { submit }
- \@@_date:n { defend }
+\cs_set:Npn \@@_date:nn #1#2
+ { \@@_date:nnn { } {#1} {#2} \@@_date:nnn { _en } {#1} {#2} }
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{
-% \g_@@_info_bottomdate_tl,
-% \g_@@_info_conferdate_tl,
-% \g_@@_info_confer_tl}
-% 底部日期以及学位授予日期仅用于国家图书馆封面。
+% \begin{variable}{\g_@@_info_confer_tl}
% \begin{macrocode}
- \bool_if:NT \g_@@_opt_nlcover_bool
- {
- \@@_date:n { bottom }
- \@@_date:n { confer }
- \tl_new:N \g_@@_info_confer_tl
- \tl_set:Nn \g_@@_info_confer_tl
- {
- \textbf { \c_@@_name_nju_tl } \hfil
- \g_@@_info_conferdate_tl
- }
- }
-%</def-g>
+\tl_new:N \g_@@_info_confer_tl
+\tl_set:Nn \g_@@_info_confer_tl
+ {
+ \textbf { \c_@@_name_nju_tl } \hfil
+ \g_@@_info_conferdate_tl
}
-%</(def-u|def-g|def-p)>
% \end{macrocode}
% \end{variable}
%
@@ -4796,7 +4613,6 @@ To produce the documentation run the original source files ending with
% \begin{variable}{\g_@@_info_type_tl}
% 文档类型字样。
% \begin{macrocode}
-%<*def-g>
\tl_new:N \g_@@_info_type_tl
\tl_set:Nx \g_@@_info_type_tl
{ \clist_item:Nn \c_@@_name_type_clist { \g_@@_info_type_int } }
@@ -4867,7 +4683,7 @@ To produce the documentation run the original source files ending with
{
\__fontspec_main_setmainfont:nn { } { Times~New~Roman }
\__fontspec_main_setsansfont:nn { } { Arial }
- \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } { #1 }
+ \__fontspec_main_setmonofont:nn { Scale = MatchLowercase } {#1}
}
\cs_new_protected:Npn \@@_loadfont_latin_win:
{ \@@_loadfont_latin:n { Courier~New } }
@@ -4929,25 +4745,26 @@ To produce the documentation run the original source files ending with
% \begin{macro}{\@@_hide_no_script_msg:}
% 隐藏 |does not contain script "CJK"| 警告。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_hide_no_script_msg:
+\cs_new:Npn \@@_hide_no_script_msg:
{ \msg_redirect_name:nnn { fontspec } { no-script } { info } }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_loadfont_cjk_win:}
+% \begin{macro}{\@@_loadfont_cjk_win:N,\@@_loadfont_cjk_win:}
% Windows 中文字体。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_loadfont_cjk_win:
+\cs_new:Npn \@@_loadfont_cjk_win:N #1
{
- \setCJKmainfont { SimSun }
- [ \c_@@_name_fakebold_tl, ItalicFont = KaiTi ]
- \setCJKsansfont { SimHei } [ \c_@@_name_fakebold_tl ]
- \setCJKmonofont { FangSong } [ \c_@@_name_fakebold_tl ]
- \setCJKfamilyfont { zhsong } { SimSun } [ \c_@@_name_fakebold_tl ]
- \setCJKfamilyfont { zhhei } { SimHei } [ \c_@@_name_fakebold_tl ]
- \setCJKfamilyfont { zhfs } { FangSong } [ \c_@@_name_fakebold_tl ]
- \setCJKfamilyfont { zhkai } { KaiTi } [ \c_@@_name_fakebold_tl ]
+ \setCJKmainfont { SimSun } [ #1, ItalicFont = KaiTi ]
+ \setCJKsansfont { SimHei } [#1]
+ \setCJKmonofont { FangSong } [#1]
+ \setCJKfamilyfont { zhsong } { SimSun } [#1]
+ \setCJKfamilyfont { zhhei } { SimHei } [#1]
+ \setCJKfamilyfont { zhfs } { FangSong } [#1]
+ \setCJKfamilyfont { zhkai } { KaiTi } [#1]
}
+\cs_new:Npn \@@_loadfont_cjk_win:
+ { \@@_loadfont_cjk_win:N \c_@@_name_fakebold_tl }
% \end{macrocode}
% \end{macro}
%
@@ -5023,9 +4840,9 @@ To produce the documentation run the original source files ending with
% \footnote{\XeTeX 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。}
% \begin{macrocode}
\sys_if_engine_xetex:T
- { \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } }
+ { \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 ]
@@ -5107,7 +4924,7 @@ To produce the documentation run the original source files ending with
% \changes{v1.2}{2023/04/30}{在研究生模板载入华文中宋。}
% 研究生封面额外需要的华文中宋。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_loadfont_stzhongs:
+\cs_new:Npn \@@_loadfont_stzhongs:
{
\fontspec_font_if_exist:nTF { 华文中宋 }
{
@@ -5131,7 +4948,7 @@ To produce the documentation run the original source files ending with
\cs_new:Npn \@@_define_math_font:nn #1#2
{
\cs_new:cpn { @@_loadfont_math_ #1 : }
- { \__um_setmathfont:nn { } { #2 } }
+ { \__um_setmathfont:nn { } {#2} }
}
% \end{macrocode}
% \end{macro}
@@ -5512,7 +5329,7 @@ To produce the documentation run the original source files ending with
% 封装 \pkg{hyperref} 的 PDF 书签命令。
% \begin{macrocode}
\cs_new:Npn \@@_bookmark_pdf_nosec:nn #1#2
- { \pdfbookmark [0] { #1 } { #2 } }
+ { \pdfbookmark [0] {#1} {#2} }
\cs_new:Npn \@@_bookmark_pdf:nn #1#2
{ \phantomsection \@@_bookmark_pdf_nosec:nn {#1} {#2} }
% \end{macrocode}
@@ -5524,8 +5341,8 @@ To produce the documentation run the original source files ending with
\cs_new:Npn \@@_bookmark:Nnn #1#2#3
{
\bool_if:NTF #1
- { \_@@_bookmark_toc:n { #2 } }
- { \_@@_bookmark_pdf_nosec:nn { #2 } { #3 } }
+ { \_@@_bookmark_toc:n {#2} }
+ { \_@@_bookmark_pdf_nosec:nn {#2} {#3} }
}
% \end{macrocode}
% \end{macro}
@@ -5535,9 +5352,9 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\cs_new:Npn \@@_chapter:Nnn #1#2#3
{
- \chapter * { #2 }
- \@@_bookmark:Nnn #1 { #2 } { #3 }
- \@@_chapter_header:n { #2 }
+ \chapter * {#2}
+ \@@_bookmark:Nnn #1 {#2} {#3}
+ \@@_chapter_header:n {#2}
}
\cs_new:Npn \@@_chapter:n #1
{ \@@_chapter:Nnn \c_true_bool {#1} { } }
@@ -5553,7 +5370,7 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_chapter_header:n #1
{
\bool_if:NTF \g_@@_opt_twoside_bool
- { \markboth { #1 } { #1 } }
+ { \markboth {#1} {#1} }
{ \markboth { \hfill #1 \hfill } { } }
}
% \end{macrocode}
@@ -5562,7 +5379,7 @@ To produce the documentation run the original source files ending with
% \begin{macro}{\njuchapter}
% 封装无编号章环境,供用户在正文中使用。
% \begin{macrocode}
-\NewDocumentCommand \njuchapter { m } { \@@_chapter:n { #1 } }
+\NewDocumentCommand \njuchapter { m } { \@@_chapter:n {#1} }
% \end{macrocode}
% \end{macro}
%
@@ -5609,7 +5426,7 @@ To produce the documentation run the original source files ending with
{ chapter/format = \c_@@_fmt_toctitle_tl }
\@@_chapter:cnn { g_@@_ #2 _showentry_bool } {#1} {#2}
\group_end:
- \@starttoc { #2 }
+ \@starttoc {#2}
}
\cs_generate_variant:Nn \@@_make_toc:nn { vn }
% \end{macrocode}
@@ -5626,8 +5443,8 @@ To produce the documentation run the original source files ending with
toc-entry .bool_set:c = { g_@@_ #3 _showentry_bool },
toc-entry .initial:n = true
}
- \exp_args:Nc \RenewDocumentCommand { #1 } { }
- { \@@_make_toc:vn { #2 name } { #3 } }
+ \exp_args:Nc \RenewDocumentCommand {#1} { }
+ { \@@_make_toc:vn { #2 name } {#3} }
}
% \end{macrocode}
% \end{macro}
@@ -5763,7 +5580,7 @@ To produce the documentation run the original source files ending with
\bool_if:NT \g_@@_opt_load_blx_bool
{
\NewDocumentCommand \addbibresource { m }
- { \clist_gput_right:Nn \g_@@_blx_resource_clist { #1 } }
+ { \clist_gput_right:Nn \g_@@_blx_resource_clist {#1} }
}
% \end{macrocode}
% \end{macro}
@@ -5861,7 +5678,7 @@ To produce the documentation run the original source files ending with
% \item 标签名
% \end{arguments}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_cref_name:n #1
+\cs_new:Npn \@@_cref_name:n #1
{ \crefname {#1} { \@@_name:n {#1} } { \@@_name:n {#1} } }
% \end{macrocode}
% \end{macro}
@@ -5880,7 +5697,7 @@ To produce the documentation run the original source files ending with
% 修改 \pkg{cleveref} 的标签名称。
% \begin{macrocode}
\clist_map_inline:nn { figure, table, appendix, proof }
- { \@@_cref_name:n { #1 } }
+ { \@@_cref_name:n {#1} }
}
% \end{macrocode}
%
@@ -5984,7 +5801,7 @@ To produce the documentation run the original source files ending with
{
\group_begin:
\bool_set_eq:NN \l__circledtext_negative_bool #1
- \__circledtext_handle:Vn \g_@@_fn_ctext_option_clist { #2 }
+ \__circledtext_handle:Vn \g_@@_fn_ctext_option_clist {#2}
\group_end:
}
\cs_generate_variant:Nn \@@_fn_number_circled:Nn { NV }
@@ -6143,6 +5960,13 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\l_@@_thm_share_tl}
+% 存储共享的计数器名称。
+% \begin{macrocode}
+\tl_new:N \l_@@_thm_share_tl
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
\keys_define:nn { nju / theorem }
{
@@ -6185,6 +6009,15 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{theorem/share-counter}
+% \changes{v1.3}{2023/05/07}{批量创建定理类环境时可以共享计数器。}
+% 是否在分组内使用同一计数器。
+% \begin{macrocode}
+ share-counter .bool_set:N = \l_@@_thm_share_bool,
+ share-counter .initial:n = false,
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{theorem/define}
% 创建定理类环境。
% \begin{macrocode}
@@ -6193,21 +6026,30 @@ To produce the documentation run the original source files ending with
{
\clist_if_empty:NT \g_@@_thm_type_clist
{ \msg_error:nn { njuthesis } { empty-theorem-type } }
+ \tl_clear:N \l_@@_thm_share_tl
\clist_map_inline:Nn \g_@@_thm_type_clist
- { \@@_thm_define:nn ##1 }
+ { \@@_thm_define:Nnn \l_@@_thm_share_tl ##1 }
}
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_thm_define:nn}
+% \begin{macro}{\@@_thm_define:Nnn}
% 配置定理环境。
% \begin{arguments}
+% \item 共享的计数器名称,|tl| 型变量
% \item 环境名与类型标识,|clist| 型变量
% \item 定理头名称
% \end{arguments}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_thm_define:nn #1#2
+\cs_new:Npn \@@_thm_define:Nnn
+ { \@@_thm_define:NNNNnn \l_@@_tmp_clist \l_@@_tmpa_tl \l_@@_tmpb_tl }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_thm_define:NNNNnn}
+% \begin{macrocode}
+\cs_new:Npn \@@_thm_define:NNNNnn #1#2#3#4#5#6
{
\bool_if:NF \g_@@_opt_load_nthm_bool
{ \msg_error:nn { njuthesis } { missing-ntheorem } }
@@ -6218,19 +6060,30 @@ To produce the documentation run the original source files ending with
% 拆分环境名与类型标识。这里是考虑到标识符不一定出现在环境名中,
% 典型如 \env{proof} 环境默认无编号但也不含星号。
% \begin{macrocode}
- \clist_set:Nn \l_@@_tmp_clist { #1 }
- \clist_pop:NN \l_@@_tmp_clist \l_@@_tmpa_tl
- \clist_pop:NN \l_@@_tmp_clist \l_@@_tmpb_tl
+ \clist_set:Nn #1 {#5}
+ \clist_pop:NN #1 #2
+ \clist_pop:NN #1 #3
% \end{macrocode}
% 判断是否需要证毕符号或编号。
% \begin{macrocode}
- \tl_if_in:NnT \l_@@_tmpb_tl { + }
+ \tl_if_in:NnT #3 { + }
{ \exp_args:NV \theoremsymbol \l_@@_thm_qed_symbol_tl }
- \tl_if_in:NnTF \l_@@_tmpb_tl { * }
- { \@@_thm_new:VVn \l_@@_tmpa_tl \c_novalue_tl {#2} }
- { \@@_thm_new:VVn \l_@@_tmpa_tl \l_@@_thm_counter_tl {#2} }
+ \tl_if_in:NnTF #3 { * }
+ { \@@_thm_new:VVVn #2 \c_novalue_tl #4 {#6} }
+ { \@@_thm_new:VVVn #2 \l_@@_thm_counter_tl #4 {#6} }
+% \end{macrocode}
+% 存储共享的计数器。
+% \begin{macrocode}
+ \bool_if:NT \l_@@_thm_share_bool
+ {
+ \tl_gset_eq:NN #4 #2
+ \bool_gset_false:N \l_@@_thm_share_bool
+ }
+% \end{macrocode}
+% 设置 \pkg{cleveref} 引用名。
+% \begin{macrocode}
\bool_if:NT \g_@@_opt_load_cref_bool
- { \crefname { \l_@@_tmpa_tl } {#2} {#2} }
+ { \exp_args:NV \crefname #2 {#6} {#6} }
% \end{macrocode}
% 清除保存的证毕符号。
% \begin{macrocode}
@@ -6239,7 +6092,7 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_thm_new:nnn,\@@_thm_new:VVn}
+% \begin{macro}{\@@_thm_new:nnnn,\@@_thm_new:VVVn}
% 包装 \tn{newtheorem} 以便展开输入的变量。根据 \file{interface3.pdf}
% 手册 5.3 节最后一段建议的展开顺序,这里将 |V| 型参数放在靠前的位置。
% \begin{arguments}
@@ -6250,17 +6103,21 @@ To produce the documentation run the original source files ending with
% 根据环境结束命令是否存在可以判断该环境是否有定义,
% 相应地可以利用局部定义切换定义和重定义环境的命令。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_thm_new:nnn #1#2#3
+\cs_new_protected:Npn \@@_thm_new:nnnn #1#2#3#4
{
\group_begin:
\cs_if_exist:cT { end #1 }
{ \cs_set_eq:NN \newtheorem \renewtheorem }
\tl_if_novalue:nTF {#2}
- { \newtheorem * {#1} {#3} }
- { \newtheorem {#1} {#3} [#2] }
+ { \newtheorem * {#1} {#4} }
+ {
+ \tl_if_empty:nTF {#3}
+ { \newtheorem {#1} {#4} [#2] }
+ { \newtheorem {#1} [#3] {#4} }
+ }
\group_end:
}
-\cs_generate_variant:Nn \@@_thm_new:nnn { VVn }
+\cs_generate_variant:Nn \@@_thm_new:nnnn { VVVn }
% \end{macrocode}
% \end{macro}
%
@@ -6295,8 +6152,8 @@ To produce the documentation run the original source files ending with
% 封装 \tn{unimathsetup}。
% \begin{macrocode}
\bool_if:NTF \g_@@_opt_load_um_bool
- { \cs_new:Npn \@@_um_setup:n #1 { \keys_set:nn { unicode-math } {#1} } }
- { \cs_new:Npn \@@_um_setup:n #1 { } }
+ { \cs_new:Npn \@@_um_setup:n #1 { \keys_set:nn { unicode-math } {#1} } }
+ { \cs_new_eq:NN \@@_um_setup:n \use_none:n }
% \end{macrocode}
% \end{macro}
%
@@ -6451,26 +6308,30 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
+% \changes{v1.3}{2023/05/22}{禁用 \pkg{unicode-math} 时不配置数学字体。}
% 在 |\begin{document}| 处载入字体以兼容 \pkg{mathtools},
% 并设置小于等于号和实部符号等的样式。
% \begin{macrocode}
-\@@_at_begin_document:n
+\bool_if:NT \g_@@_opt_load_um_bool
{
- \use:c { @@_loadfont_math_ \g_@@_font_math_tl : }
- \bool_if:NT \g_@@_opt_math_leq_bool
- {
- \cs_set_eq:NN \le \leqslant
- \cs_set_eq:NN \ge \geqslant
- \cs_set_eq:NN \leq \leqslant
- \cs_set_eq:NN \geq \geqslant
- }
- \bool_if:NT \g_@@_opt_math_re_bool
+ \@@_at_begin_document:n
{
- \cs_set:Npn \Re { \operatorname { Re } }
- \cs_set:Npn \Im { \operatorname { Im } }
+ \use:c { @@_loadfont_math_ \g_@@_font_math_tl : }
+ \bool_if:NT \g_@@_opt_math_leq_bool
+ {
+ \cs_set_eq:NN \le \leqslant
+ \cs_set_eq:NN \ge \geqslant
+ \cs_set_eq:NN \leq \leqslant
+ \cs_set_eq:NN \geq \geqslant
+ }
+ \bool_if:NT \g_@@_opt_math_re_bool
+ {
+ \cs_set:Npn \Re { \operatorname { Re } }
+ \cs_set:Npn \Im { \operatorname { Im } }
+ }
+ \bool_if:NT \g_@@_opt_math_vec_bool
+ { \cs_set_eq:NN \vec \symbf }
}
- \bool_if:NT \g_@@_opt_math_vec_bool
- { \cs_set_eq:NN \vec \symbf }
}
%</class>
% \end{macrocode}
@@ -6523,12 +6384,13 @@ To produce the documentation run the original source files ending with
% \end{macro}
%
% \begin{macro}{u/cover/info}
+% \changes{v1.3}{2023/05/25}{将本科生封面信息恢复至 v1.1 的宋体格式。}
% 本科生封面信息栏实例。
% \begin{macrocode}
\@@_declare_element:nn { u / cover / info }
{
content = \@@_u_cover_info:,
- format = \zihao { 3 } \kaishu
+ format = \zihao { 3 }
}
% \end{macrocode}
% \end{macro}
@@ -6564,10 +6426,10 @@ To produce the documentation run the original source files ending with
%
% \begin{macro}{\@@_u_cover_info:}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_u_cover_info:
+\cs_new:Npn \@@_u_cover_info:
{
\@@_u_cover_info:NNNN \c_@@_clabelwd_dim \c_@@_crulewd_dim
- \c_@@_hsep_dim \c_empty_tl
+ \c_@@_hsep_dim \kaishu
}
% \end{macrocode}
% \end{macro}
@@ -6737,14 +6599,17 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_g_cover_info:NNNN}
+% \begin{macro}{\@@_g_cover_info:NNNNN}
% 研究生封面中部信息栏。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_g_cover_info:NNNN #1#2#3#4
+\cs_new_protected:Npn \@@_g_cover_info:NNNNN #1#2#3#4#5
{
- \@@_cover_entry_title:NNNN #1 #2 #3 #4
- \clist_map_inline:nn { author, major, field, supvfull }
- { \@@_cover_entry:NNNNn #1 #2 #3 #4 { ##1 } }
+ \bool_if:NTF \g_@@_opt_academic_bool
+ { \clist_set:Nn #1 { author, major, field, supvfull } }
+ { \clist_set:Nn #1 { author, majorc, field, supvfull } }
+ \@@_cover_entry_title:NNNN #2 #3 #4 #5
+ \clist_map_inline:Nn #1
+ { \@@_cover_entry:NNNNn #2 #3 #4 #5 { ##1 } }
}
% \end{macrocode}
% \end{macro}
@@ -6754,7 +6619,7 @@ To produce the documentation run the original source files ending with
\cs_new:Npn \@@_g_cover_info:
{
\tl_set:Nn \l_@@_tmpa_tl { \skip_horizontal:n { .7 cm } }
- \@@_g_cover_info:NNNN \l_@@_tmpa_tl
+ \@@_g_cover_info:NNNNN \l_@@_tmpa_clist \l_@@_tmpa_tl
\c_@@_clabelwd_dim \c_@@_crulewd_dim \c_@@_fmt_coverlabel_tl
}
% \end{macrocode}
@@ -6797,7 +6662,7 @@ To produce the documentation run the original source files ending with
\@@_cover_entry:NNNNn \c_empty_tl #1 #2 #3 { chairman }
\tex_par:D
\@@_box_spread_name:NNn #1 #3 { reviewer }
- \parbox [ t ] { #2 }
+ \parbox [ t ] {#2}
{
\@@_box_multiline:NNn \g_@@_info_reviewer_clist #2 { 5 }
\dim_gset_eq:NN \l_@@_tmpa_dim \tex_prevdepth:D
@@ -7159,20 +7024,21 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\@@_declare_element:nn { g / decl / auth / date }
{
- content = \@@_authdecl_secretlv_g:,
+ content = \@@_g_decl_auth_secretlv:,
format = \zihao { 5 } ,
align = l
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_degree_checkbox:Nn}
+% \begin{macro}{\@@_degree_checkbox:nn}
+% \changes{v1.3}{2023/06/04}{修复研究生出版授权书的打勾机制。}
% 信息栏的学位复选框。打勾符号对应 |U+2713|。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_degree_checkbox:Nn #1#2
+\cs_new_protected:Npn \@@_degree_checkbox:nn #1#2
{
\bool_lazy_and:nnTF
- { \g_@@_opt_academic_bool && #1 }
+ { #1 \g_@@_opt_academic_bool }
{ \int_compare_p:n { \g_@@_info_type_int = #2 } }
{
\makebox [ 0 pt ] [l] { \ensuremath { \mdwhtsquare } }
@@ -7200,13 +7066,13 @@ To produce the documentation run the original source files ending with
\c_@@_name_ida_tl & \g_@@_info_id_tl &
\c_@@_name_depta_tl & \g_@@_info_dept_tl &
\c_@@_name_year_tl &
- \tl_range:Nnn \g_@@_info_submitdate_raw_tl {1} {4} \\
+ \tl_range:Nnn \g_@@_info_submitdate_tl {1} {4} \\
\c_@@_name_degreea_tl &
{
- \@@_degree_checkbox:Nn \c_true_bool { 2 } 学术学位硕士 \qquad
- \@@_degree_checkbox:Nn \c_false_bool { 2 } 专业学位硕士 \\
- \@@_degree_checkbox:Nn \c_true_bool { 3 } 学术学位博士 \qquad
- \@@_degree_checkbox:Nn \c_false_bool { 3 } 专业学位博士
+ \@@_degree_checkbox:nn { } { 2 } 学术学位硕士 \qquad
+ \@@_degree_checkbox:nn { ! } { 2 } 专业学位硕士 \\
+ \@@_degree_checkbox:nn { } { 3 } 学术学位博士 \qquad
+ \@@_degree_checkbox:nn { ! } { 3 } 专业学位博士
} \\
\c_@@_name_email_tl & \g_@@_info_email_tl \\
\c_@@_name_supvb_tl &
@@ -7229,10 +7095,10 @@ To produce the documentation run the original source files ending with
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_authdecl_secretlv_g:}
+% \begin{macro}{\@@_g_decl_auth_secretlv:}
% 保密信息内容。
% \begin{macrocode}
-\cs_new_protected:Npn \@@_authdecl_secretlv_g:
+\cs_new_protected:Npn \@@_g_decl_auth_secretlv:
{
\c_@@_name_secretstatus_tl \tex_par:D
\ensuremath { \mdwhtsquare } \c_@@_name_secretfree_tl \tex_par:D
@@ -7485,6 +7351,7 @@ To produce the documentation run the original source files ending with
{
element = { title, top, middle, emblem-img, bottom },
prefix = g / cover-en /,
+ format = \linespread { 1.3 },
top-skip = 0 pt plus 1.2 fil
}
% \end{macrocode}
@@ -7569,24 +7436,28 @@ To produce the documentation run the original source files ending with
% \end{macro}
%
% \begin{macro}{\@@_make_cover:}
-% 生成本科生或研究生的普通封面。
+% \changes{v1.3}{2023/05/24}{修复非研究生类型时调用 \opt{nl-cover} 选项的错误。}
+% 调用实例生成封面。
% \begin{macrocode}
%<*(def-u|def-g|def-p)>
\cs_new_protected:Npn \@@_make_cover:
{
%<def-u> \UseInstance { nju } { cover-u }
-%<def-g> \clist_map_inline:nn { front, back, en }
-%<def-g> { \UseInstance { nju } { cover-g- ##1 } }
%<def-p> \UseInstance { nju } { cover-p }
- }
% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_make_cover_nl:}
-% 生成研究生的国家图书馆封面。
+% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面,
+% 反之生成普通封面。
% \begin{macrocode}
-%<def-g>\cs_new_protected:Npn \@@_make_cover_nl:
-%<def-g> { \UseInstance { nju } { cover-nl } }
+%<*def-g>
+\bool_if:NTF \g_@@_opt_nlcover_bool
+ { \UseInstance { nju } { cover-nl } }
+ {
+ \UseInstance { nju } { cover-g-front }
+ \UseInstance { nju } { cover-g-back }
+ \UseInstance { nju } { cover-g-en }
+ }
+%</def-g>
+ }
% \end{macrocode}
% \end{macro}
%
@@ -7636,7 +7507,7 @@ To produce the documentation run the original source files ending with
\cs_new_protected:Npn \@@_new_img_cmd:nn #1#2
{
\exp_args:Nc \NewDocumentCommand { nju #1 } { o m m }
- { \includegraphics [ width = ##2, height = ##3 ] { #2 } }
+ { \includegraphics [ width = ##2, height = ##3 ] {#2} }
}
% \end{macrocode}
% \end{macro}
@@ -7701,13 +7572,7 @@ To produce the documentation run the original source files ending with
\bool_if:NF \g_@@_opt_draft_bool
{
\pagenumbering { gobble }
-% \end{macrocode}
-% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面,
-% 反之生成普通封面。
-% \begin{macrocode}
- \bool_if:NTF \g_@@_opt_nlcover_bool
- { \@@_make_cover_nl: }
- { \@@_make_cover: }
+ \@@_make_cover:
}
% \end{macrocode}
% 生成封面后清除标题中的换行控制符,便于在摘要中输出。
@@ -7993,7 +7858,7 @@ To produce the documentation run the original source files ending with
% \begin{macrocode}
\__nju_cs_clear:N \makelabel
}
- \item \clist_use:cn { g_@@_info_keywords #1 _clist } { #2 }
+ \item \clist_use:cn { g_@@_info_keywords #1 _clist } {#2}
\endlist
}
%</class>
@@ -8168,7 +8033,7 @@ To produce the documentation run the original source files ending with
% 自动结束上一个 \env{refsection},与章末参考文献表格式兼容更好。
% \begin{macrocode}
\newrefsection
- \nocite { #2 }
+ \nocite {#2}
\printbibliography [ heading = subbibliography, title = #1 ]
\endrefsection
\group_end:
@@ -8229,7 +8094,7 @@ To produce the documentation run the original source files ending with
\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } }
{
\@@_chapter:V \c_@@_name_notation_tl
- \@@_make_notation:nn { #1 } { #2 }
+ \@@_make_notation:nn {#1} {#2}
}
{ \endlist \cleardoublepage }
% \end{macrocode}
@@ -8241,7 +8106,7 @@ To produce the documentation run the original source files ending with
\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } }
{
\chapter * { \c_@@_name_notation_tl }
- \@@_make_notation:nn { #1 } { #2 }
+ \@@_make_notation:nn {#1} {#2}
}
{ \endlist \cleardoublepage }
%</class>
@@ -8322,6 +8187,10 @@ To produce the documentation run the original source files ending with
% 用于国家图书馆封面的专业名称字样
% \begin{macrocode}
%<def-g> { major b } { 专业名称 },
+% \end{macrocode}
+% 用于专业学位封面的专业名称字样
+% \begin{macrocode}
+%<def-g> { major c } { 专业学位类别(领域) },
{ notation } { 符号表 },
%<def-u> { orig decl }
%<def-u> { 南京大学本科毕业论文(设计) \\ 诚信承诺书 },
@@ -8427,14 +8296,6 @@ To produce the documentation run the original source files ending with
{ \@@_define_name:nnn #1 }
% \end{macrocode}
%
-% 对专业硕士的封面条目进行临时修改。
-% \begin{macrocode}
-%<*def-g>
-\bool_if:NF \g_@@_opt_academic_bool
- { \tl_set:Nn \c_@@_name_major_tl { 专业学位类别(领域) } }
-%</def-g>
-% \end{macrocode}
-%
% \subsubsection{文本}
% \label{subsubsec:constant-text}
%
@@ -8588,19 +8449,32 @@ To produce the documentation run the original source files ending with
%<def-g|def-p> { pagestyle } { headings },
{ abslabel } { \bfseries },
{ abslabel_en } { },
- { cover title } { },
+%<def-u> { cover title } { \bfseries },
+%<def-g> { cover title } { },
%<def-u> { cover label } { \kaishu },
%<def-g> { cover label } { \bfseries },
%<def-p> { cover label } { },
+% \end{macrocode}
+% 调用 \pkg{njuvisual} 时的校徽颜色。
+% \begin{macrocode}
{ emblem color } { black },
{ name color } { black },
+% \end{macrocode}
+% 各级标题样式。
+% \begin{macrocode}
{ section } { \bigger \normalfont \sffamily },
{ chapter } { \c_@@_fmt_section_tl \centering },
- { chapterintoc } { \c_@@_fmt_section_tl },
{ subsection } { \c_@@_fmt_section_tl },
{ subsubsection } { \c_@@_fmt_section_tl },
{ paragraph } { \c_@@_fmt_section_tl },
{ subparagraph } { \c_@@_fmt_section_tl },
+% \end{macrocode}
+% 目录中的章标题样式。
+% \begin{macrocode}
+ { chapterintoc } { \c_@@_fmt_section_tl },
+% \end{macrocode}
+% “目录”二字的样式。
+% \begin{macrocode}
{ toc title } { \centering \zihao { 3 } \bfseries },
{ header } { \small \kaishu },
{ footer } { \small \rmfamily }
@@ -8609,5 +8483,474 @@ To produce the documentation run the original source files ending with
%</(def-u|def-g|def-p)>
% \end{macrocode}
%
+%
+% \subsection{手册文档类 \cls{njuthesis-doc}}
+% \changes{v1.3}{2023/05/12}{将手册样式设置拆分为单独的 \cls{njuthesis-doc} 文档类。}
+%
+% \begin{macrocode}
+%<*doc-cls>
+%<@@=njudoc>
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\RequirePackage { l3keys2e }
+% \end{macrocode}
+%
+% \subsubsection{选项}
+%
+% \begin{macrocode}
+\keys_define:nn { njudoc }
+ {
+ codehigh .bool_set:N = \g_@@_codehigh_bool,
+ codehigh .initial:n = false
+ }
+\ProcessKeysOptions { njudoc }
+% \end{macrocode}
+%
+% \subsubsection{载入宏包}
+%
+% \begin{macrocode}
+\PassOptionsToPackage { fontset = fandol } { ctex }
+\PassOptionsToPackage { firstpage = true } { background }
+% \end{macrocode}
+%
+% 载入基础文档类。
+% \begin{macrocode}
+\LoadClass { ctxdoc }
+% \end{macrocode}
+%
+% 载入宏包。
+% \begin{macrocode}
+\RequirePackage
+ {
+ background,
+ codehigh,
+ listings,
+ njuvisual,
+ tabularray,
+ unicode-math,
+ zhlineskip
+ }
+\sys_if_engine_xetex:TF
+ {
+ \RequirePackage { xeCJKfntef }
+ \renewcommand\emph[1]{\CJKunderdot[textformat=\itshape]{#1}}
+ }
+ {
+ \RequirePackage { lua-ul }
+ \NewDocumentCommand \CJKunderline { o m } { \underLine {#1} }
+ \NewDocumentCommand \CJKunderdot { o m } { \underLine {#1} }
+ \NewDocumentCommand \CJKsout { o m }
+ { \textcolor { black!50 } {#1} }
+ }
+% \end{macrocode}
+%
+% \subsubsection{杂项}
+%
+% 封面背景图案。
+% \begin{macrocode}
+\backgroundsetup{
+ contents={\njuemblem[white!85!gray]{22cm}{!}},
+ scale=1, angle=0, hshift=-4cm
+}
+% \end{macrocode}
+%
+% 文档命令。
+% \begin{macrocode}
+\definecolor{tpblue}{HTML}{495A80}
+\newcommand\tpbutton[1]{\textcolor{tpblue}{\bfseries #1}}
+\newcommand\tikzlogo{Ti\emph{k}Z}
+\newcommand\OPT[1]{\textcolor{njuyellow}{\bfseries#1}}
+% \end{macrocode}
+%
+% \pkg{hyperref} 设置。
+% \begin{macrocode}
+\hypersetup{
+ pdftitle = {
+ The~ njuthesis~ class~ -~
+ LaTeX~ thesis~ template~ for~ Nanjing~ University},
+ citecolor = njublue,
+ linkcolor = njuviolet,
+ urlcolor = njumagenta}
+% \end{macrocode}
+%
+% \pkg{tabularray} 设置。
+% \begin{macrocode}
+\UseTblrLibrary{booktabs,siunitx}
+\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable}
+\SetTblrStyle{caption-tag}{font=\bfseries}
+\SetTblrInner{row{1}={font=\bfseries}}
+\SetTblrInner[talltblr]{row{1}={font=\bfseries}}
+\DefTblrTemplate{caption-sep}{default}{\quad}
+% \end{macrocode}
+%
+% \pkg{tabularray} 表格标签简写。
+% \begin{macrocode}
+\def\TA{\TblrNote{a}}
+\def\TB{\TblrNote{b}}
+\def\TC{\TblrNote{c}}
+\def\TD{\TblrNote{d}}
+\def\TE{\TblrNote{e}}
+% \end{macrocode}
+%
+%
+% \TeX{} 相关的名称简写。
+% \begin{macrocode}
+\def\TL{\TeX~Live}
+\def\MacTeX{Mac\TeX}
+\def\biber{\hologo{biber}}
+\def\LaTeXe{\hologo{LaTeX2e}}
+% \end{macrocode}
+%
+% \pkg{zhlineskip} 设置。
+% \begin{macrocode}
+\SetTextEnvironmentSinglespace{1.112}
+\SetMathEnvironmentSinglespace{1.112}
+% \end{macrocode}
+%
+% \subsubsection{字体设置}
+%
+% \begin{macrocode}
+\setmainfont { texgyretermes }
+ [
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic
+ ]
+% \end{macrocode}
+%
+% 需要 \pkg{lexend}。
+% \begin{macrocode}
+\setsansfont{LexendDeca}
+% \end{macrocode}
+%
+% Iosevka。
+% \begin{macrocode}
+\fontspec_font_if_exist:nT { Iosevka }
+ {
+ \setmonofont { Iosevka }
+ [
+ UprightFont = *~Light,
+ ItalicFont = *~Light~Italic,
+ BoldFont = *~Semibold
+ ]
+ }
+% \end{macrocode}
+%
+% 思源宋体。
+% \begin{macrocode}
+\fontspec_font_if_exist:nT { Source~ Han~ Serif~ SC }
+ {
+ \setCJKmainfont{ Source~ Han~ Serif~ SC }
+ [
+ UprightFont = *~SemiBold,
+ ItalicFont = *~Bold,
+ BoldFont = *~Heavy,
+ Language = Chinese~Simplified
+ ]
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\setCJKsansfont { FandolHei-Regular }
+ [
+ Extension = .otf,
+ BoldFont = FandolHei-Bold
+ ]
+\setCJKmonofont { FandolFang-Regular }
+ [ Extension = .otf ]
+% \end{macrocode}
+%
+% XITS。
+% \begin{macrocode}
+\setmathfont{XITSMath-Regular}[
+ BoldFont = XITSMath-Bold,
+ Extension = .otf]
+% \end{macrocode}
+%
+% \pkg{listings} 设置。
+% \begin{macrocode}
+\lstdefinestyle{style@base}
+ {
+ basewidth = 0.5 em,
+ gobble = 3,
+ lineskip = 3 pt,
+ frame = l,
+ framerule = 1 pt,
+ framesep = 0 pt,
+ xleftmargin = 2 em,
+ xrightmargin = 3 em,
+ escapeinside = {(*}{*)},
+ breaklines = true,
+ basicstyle = \small\ttfamily,
+ keywordstyle = \bfseries\color{njuviolet},
+ commentstyle = \itshape\color{white!50!gray},
+ stringstyle = \color{nju-chem-red},
+ backgroundcolor = \color{white!95!gray}
+ }
+\lstdefinestyle{style@shell}
+ {
+ style = style@base,
+ rulecolor = \color{njumagenta},
+ language = bash,
+ alsoletter = {-},
+ emphstyle = \color{nju-cs-green}
+ }
+\lstdefinestyle{style@latex}
+ {
+ style = style@base,
+ rulecolor = \color{njublue},
+ language = [LaTeX]TeX,
+ alsoletter = {*, -, .},
+ texcsstyle = *\color{njuviolet},
+ emphstyle = [1]\color{nju-ai-orange},
+ emphstyle = [2]\color{nju-cs-green},
+ emphstyle = [3]\bfseries\color{njuyellow}
+ }
+% \end{macrocode}
+%
+% 代码框环境。
+% \begin{macrocode}
+\lstnewenvironment{shellexample}[1][]{%
+ \lstset{style=style@shell, #1}}{}
+\lstnewenvironment{latexexample}[1][]{%
+ \lstset{style=style@latex, #1}}{}
+% \end{macrocode}
+%
+%
+% \subsubsection{标签颜色设置}
+%
+% 我们对每个 guard 进行特定的颜色标记,
+% 而不是 \cls{ctxdoc} 中使用深浅表明嵌套关系。
+%
+% \begin{macrocode}
+\colorlet { at@guard } { njuviolet }
+\definecolor { angle@guard } { gray } { 0.7 }
+\definecolor { star@guard } { rgb } { 0.8 , 0 , 0 }
+\definecolor { u@guard } { HTML } { 5463FF }
+\definecolor { g@guard } { HTML } { 2B7A0B }
+\definecolor { p@guard } { HTML } { FF1818 }
+\definecolor { c@guard } { HTML } { FFC300 }
+% \end{macrocode}
+%
+% \begin{variable}{\c@@_module_color_prop}
+% 存储 guard 名称和对应的颜色。
+% \begin{macrocode}
+\prop_const_from_keyval:Nn \c@@_module_color_prop
+ {
+ def-u = u@guard,
+ def-g = g@guard,
+ def-p = p@guard
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_set_module_color:n}
+%
+% \begin{macrocode}
+\cs_new:Npn \@@_set_module_color:Nn #1#2
+ {
+ \prop_get:NnNF \c@@_module_color_prop {#2} #1
+ { \tl_set:Nn #1 { c@guard } }
+ \exp_args:NV \color #1 #2
+ }
+\cs_new:Npn \@@_set_module_color:n
+ { \@@_set_module_color:Nn \l_tmpa_tl }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_angle:Nn}
+% 生成完整的带颜色的 guard 标签。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_module_angle:Nn #1#2
+ {
+ \group_begin: \color { angle@guard } \ttfamily \textlangle \group_end:
+ \group_begin: \sffamily #2 \group_end:
+ \group_begin: \color { angle@guard } #1 \ttfamily \textrangle \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\__ctxdoc_module_angle:n}
+% 补丁。
+% \begin{macrocode}
+\cs_set:Npn \__ctxdoc_module_angle:n
+ { \@@_module_angle:Nn \c_empty_tl }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_colored_module_angle:NN}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_colored_module_angle:NN #1#2
+ {
+ \seq_clear:N #2
+ \seq_map_inline:Nn #1
+ {
+ \seq_gput_right:Nn #2
+ { \@@_set_module_color:n {##1} }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_print_module:n}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_print_module:n #1
+ {
+ \@@_colored_module_angle:NN \l_tmpa_seq \l_tmpb_seq
+ \bool_lazy_or:nnTF
+ { \str_if_empty_p:n {#1} }
+ { \int_compare_p:n { \seq_count:N \l_tmpb_seq = 1 } }
+ {
+ \str_clear:N \l_tmpa_str
+ \str_clear:N \l_tmpb_str
+ }
+ {
+ \str_set:Nn \l_tmpa_str { ( }
+ \str_set:Nn \l_tmpb_str { ) }
+ }
+ \@@_module_angle:Nn \l_tmpb_str
+ {
+ \color { star@guard } #1
+ \color { angle@guard } \l_tmpa_str
+ \seq_use:Nn \l_tmpb_seq
+ { \color { angle@guard } \orbar }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@@_split_pm:n,\@@_split_pm:V}
+% 通过竖线分割 guard 标签。
+% \begin{macrocode}
+\cs_new:Npn \@@_split_pm:n
+ { \seq_set_split:Nnn \l_tmpa_seq { | } }
+\cs_generate_variant:Nn \@@_split_pm:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_split_m:n}
+%
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_split_m:n #1
+ {
+ \tl_set:Nn \l_tmpa_str {#1}
+ \clist_map_inline:nn { *, /, (, ) }
+ { \str_remove_all:Nn \l_tmpa_str {##1} }
+ \@@_split_pm:V \l_tmpa_str
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macrocode}
+\group_begin:
+ \char_set_catcode_active:N \>
+% \end{macrocode}
+%
+% \begin{macro}{\__ctxdoc_module_star:w}
+% \begin{macrocode}
+ \cs_gset_protected:Npn \__ctxdoc_module_star:w #1 > #2 \q_stop
+ {
+ \__ctxdoc_output_module:nn
+ { \@@_split_m:n {#1} }
+ { \__ctxdoc_module_push:n { \@@_print_module:n { * } } }
+ \__ctxdoc_output_line:n {#2}
+ \__ctxdoc_star_format:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\__ctxdoc_module_slash:w}
+% \begin{macrocode}
+ \cs_gset_protected:Npn \__ctxdoc_module_slash:w #1 > #2 \q_stop
+ {
+ \__ctxdoc_output_module:nn
+ { \@@_split_m:n {#1} }
+ { \__ctxdoc_module_pop:n { \@@_print_module:n { / } } }
+ \__ctxdoc_output_line:n {#2}
+ \__ctxdoc_slash_format:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\__ctxdoc_module_pm:w}
+% \begin{macrocode}
+ \cs_gset_protected:Npn \__ctxdoc_module_pm:w #1 > #2 \q_stop
+ {
+ \tex_noindent:D
+ \hbox_overlap_left:n
+ {
+ \__ctxdoc_output_module:nn
+ { \@@_split_pm:n {#1} }
+ { \@@_print_module:n { } }
+ \skip_horizontal:n { \leftskip + \smallskipamount }
+ }
+ \group_begin:
+ \__ctxdoc_pm_format:
+ \__ctxdoc_output_line:n {#2}
+ \group_end:
+ }
+\group_end:
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\grd,\sgrd,\pgrd}
+% 在手册中生成带颜色的 guard 标记。
+% \begin{macrocode}
+\NewDocumentCommand \grd { m }
+ { \__ctxdoc_module_angle:n { \color { njuviolet } #1 } }
+\NewDocumentCommand \sgrd { m }
+ { \__ctxdoc_module_angle:n { \color { star@guard } * \color{ c@guard } #1 } }
+\NewDocumentCommand \pgrd { m }
+ { \__ctxdoc_module_angle:n { \color { #1 @guard } def- #1 } }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{语法高亮}
+%
+% \begin{macro}{\@@_output_line:}
+% \cls{ctxdoc} 将 \file{.dtx} 文件中读取的代码行存储在
+% \cs{l__ctxdoc_verbatim_line_tl},我们使用 \pkg{codehigh} 提供的内部函数
+% 将其转化为带有语法高亮的格式并输出。默认读取的代码行尾带有 |^^M|,
+% 直接输入高亮函数会导致代码快尾部有额外空行,需要手动删去。
+% \begin{macrocode}
+\cs_generate_variant:Nn \tl_remove_once:Nn { NV }
+\cs_set_protected_nopar:Npn \@@_output_line:N #1
+ {
+ \tex_noindent:D
+ \__ctxdoc_replace_at_at:N #1
+ \tl_remove_once:NV #1 \c__ctxdoc_active_cr_tl
+ \__codehigh_parse_code:nN { latex / latex3 } #1
+ \tex_par:D
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\__ctxdoc_output_line:}
+% 在 \XeTeX{} 引擎下,\pkg{codehigh} 调用的 \pkg{l3regex} 模块有严重的性能问题。
+% 我们仅仅在需要时启用高亮。
+% \begin{macrocode}
+\bool_if:NT \g_@@_codehigh_bool
+ {
+ \cs_set:Npn \__ctxdoc_output_line:
+ { \@@_output_line:N \l__ctxdoc_verbatim_line_tl }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macrocode}
+%</doc-cls>
+% \end{macrocode}
+%
% \end{implementation}
%