From e40ca5f6d9078173240b437a77d0fcc762e69bd4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 6 Aug 2021 03:00:56 +0000 Subject: CTAN sync 202108060300 --- macros/unicodetex/latex/nwafuthesis/README.md | 33 + macros/unicodetex/latex/nwafuthesis/build-win.bat | 7 + macros/unicodetex/latex/nwafuthesis/build.sh | 9 + .../unicodetex/latex/nwafuthesis/logo/building.jpg | Bin 0 -> 218987 bytes macros/unicodetex/latex/nwafuthesis/logo/motto.png | Bin 0 -> 23297 bytes .../latex/nwafuthesis/logo/nwafu-bar.pdf | Bin 0 -> 694569 bytes .../latex/nwafuthesis/logo/nwafu-circle.pdf | Bin 0 -> 656165 bytes .../latex/nwafuthesis/nwafuthesis-doc.dtx | 2115 ++++++ .../unicodetex/latex/nwafuthesis/nwafuthesis.dtx | 7911 ++++++++++++++++++++ .../unicodetex/latex/nwafuthesis/nwafuthesis.pdf | Bin 0 -> 1748925 bytes 10 files changed, 10075 insertions(+) create mode 100644 macros/unicodetex/latex/nwafuthesis/README.md create mode 100755 macros/unicodetex/latex/nwafuthesis/build-win.bat create mode 100755 macros/unicodetex/latex/nwafuthesis/build.sh create mode 100644 macros/unicodetex/latex/nwafuthesis/logo/building.jpg create mode 100644 macros/unicodetex/latex/nwafuthesis/logo/motto.png create mode 100644 macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf create mode 100644 macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf create mode 100644 macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx create mode 100644 macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx create mode 100644 macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf (limited to 'macros/unicodetex') diff --git a/macros/unicodetex/latex/nwafuthesis/README.md b/macros/unicodetex/latex/nwafuthesis/README.md new file mode 100644 index 0000000000..61ae19da66 --- /dev/null +++ b/macros/unicodetex/latex/nwafuthesis/README.md @@ -0,0 +1,33 @@ +The nwafuthesis Class +LaTeX thesis template for Northwest A&F University, China, v1.00 + +Overview +This template supports doctoral or master dissertion and undergraduate thesis in Chinese. With the help of modern LaTeX3 technology, nwafuthesis aims to create a simple interface, a normative format, as well as a hackable class for the users. + +At present, nwafuthesis only supports XETEX and LuaTEX engines. nwafuthesis only allows UTF-8 encoding. + +The documentation can be found in nwafuthesis.pdf (in Chinese). + +Gitee re­pos­i­tory: https://gitee.com/nwafu_nan/nwafuthesis-l3. + +Installation +To install nwafuthesis, you can use one of the following methods: + +If you are running TEX Live or MikTeX, the simplest way is to run + tlmgr install nwafuthesis +Get the source from Gitee: + git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git +Run build-win.bat (on Windows) or build.sh (on Linux) to generate the templates file. This file would be found in a same folder. You can enjoy nwafuthesis here at once. + +For permanent installation, you may move the following files into a directory where LaTeX will find them (e.g. TEXMF/tex/LaTeX/nwafuthesis/): + +nwafuthesis.cls +Do not forget to update the filename database afterwards. + +Contributing +Issues and pull requests are always welcome. + +License +This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. + +Copyright (C) 2017–2021 by Nan Geng . diff --git a/macros/unicodetex/latex/nwafuthesis/build-win.bat b/macros/unicodetex/latex/nwafuthesis/build-win.bat new file mode 100755 index 0000000000..e8f223950b --- /dev/null +++ b/macros/unicodetex/latex/nwafuthesis/build-win.bat @@ -0,0 +1,7 @@ +xetex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx &&\ +makeindex -s gind.ist -o nwafuthesis.ind nwafuthesis.idx &&\ +makeindex -s gglo.ist -o nwafuthesis.gls nwafuthesis.glo &&\ +xelatex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx diff --git a/macros/unicodetex/latex/nwafuthesis/build.sh b/macros/unicodetex/latex/nwafuthesis/build.sh new file mode 100755 index 0000000000..1e20a7b795 --- /dev/null +++ b/macros/unicodetex/latex/nwafuthesis/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +xetex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx &&\ +makeindex -s gind.ist -o nwafuthesis.ind nwafuthesis.idx &&\ +makeindex -s gglo.ist -o nwafuthesis.gls nwafuthesis.glo &&\ +xelatex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx &&\ +xelatex nwafuthesis.dtx diff --git a/macros/unicodetex/latex/nwafuthesis/logo/building.jpg b/macros/unicodetex/latex/nwafuthesis/logo/building.jpg new file mode 100644 index 0000000000..0feb871593 Binary files /dev/null and b/macros/unicodetex/latex/nwafuthesis/logo/building.jpg differ diff --git a/macros/unicodetex/latex/nwafuthesis/logo/motto.png b/macros/unicodetex/latex/nwafuthesis/logo/motto.png new file mode 100644 index 0000000000..ebf42d0f3e Binary files /dev/null and b/macros/unicodetex/latex/nwafuthesis/logo/motto.png differ diff --git a/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf new file mode 100644 index 0000000000..13837d2d69 Binary files /dev/null and b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf differ diff --git a/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf new file mode 100644 index 0000000000..d615a4932e Binary files /dev/null and b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf differ diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx b/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx new file mode 100644 index 0000000000..ded7e6aa8f --- /dev/null +++ b/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx @@ -0,0 +1,2115 @@ +% \iffalse meta-comment +% +% Copyright (C) 2019--2022 by Nan Geng +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Nan Geng. +% +% \fi +% +% \EnableImplementation +% +% \begin{implementation} +% +% 代码部分的页边距 +% \newgeometry{ +% left = 2.25 in, +% right = 1.00 in, +% top = 1.25 in, +% bottom = 1.00 in, +% marginpar = 2.25 in +% } +% +% \subsection{模板文档样式 \cls{nwafudoc}} +% +% \changes{v0.4}{2017/07/29}{在 \cls{ctxdoc} 的基础上完成 +% \cls{nwafudoc} 文档类,用于模板手册的编写。} +% +% 编写 \LaTeX{} 宏包文档,传统上会采用 \pkg{doc} 宏包或 +% \cls{ltxdoc} 文档类。而对于使用 \LaTeX3 开发的宏包,\cls{l3doc} +% 文档类将是一个更好的选择。\CTeX{} 宏集所附带的 +% \href{https://github.com/CTeX-org/ctex-kit/blob/master/tool/ctxdoc.cls} +% {\cls{ctxdoc}} 文档类,则在 \cls{l3doc} 的基础上进行了一些修正, +% 特别是重新实现了 \env{macrocode} 环境,使之能更好地应用于中文 +% 文档。\cls{ctxdoc} 的主要功能如下: +% +% \begin{itemize} +% \item 注释使用灰色、倾斜字体,以便与一般代码区分; +% \item 模块、名字空间等使用彩色标注,并添加超链接; +% \item 自动更新行号宽度; +% \item 边注中的长命令使用盒子进行缩放,防止溢出; +% \item 修订记录中将显示修改日期; +% \item 添加中文支持。 +% \end{itemize} +% +% 然而,\cls{ctxdoc} 主要供内部使用,代码较为混乱和随意。 +% 本模板的文档样式(\cls{nwafudoc})为适应具体需求,对其代码 +% 进行了整理,添加了相关注释,并做了一些改动: +% +% \begin{itemize} +% \item 允许模块标记 |<*|\meta{module}|>| 和 +% || 出现在行号左侧; +% \item 不再以直立、倾斜字体区分不同嵌套层次的模块; +% \item 调整索引中版本号的排序方式; +% \item 新增一系列实用命令; +% \item 修改文档字体、配色等。 +% \end{itemize} +% +% 本文档样式的核心代码主要来自 \cls{ctxdoc} 文档类 v2.4.10。 +% 在此,本人要向原开发者 +% \href{https://github.com/CTeX-org/}{CTEX.ORG} +% 团队表示由衷的感谢。 +% +% 以下为 \cls{nwafudoc} 的具体实现。 +% +% \subsubsection{载入宏包、文档类} +% +% \begin{macrocode} +%<*doc> +\ExplSyntaxOff +% \end{macrocode} +% +% 无需载入 \pkg{thumbpdf}。 +% \begin{macrocode} +\@namedef{ver@thumbpdf.sty}{9999/99/99} +% \end{macrocode} +% +% 关闭 \pkg{xparse} 中的命令声明信息。 +% \begin{macrocode} +\PassOptionsToPackage{log-declarations = false}{xparse} +% \end{macrocode} +% +% 载入宏包和文档类。 +% \begin{macrocode} +\LoadClass[a4paper, full]{l3doc} +\RequirePackage[UTF8, heading, sub3section]{ctex} +% \end{macrocode} +% 与 \pkg{hypdoc}(由 \cls{l3doc} 调用)冲突,导致脚注超链接 +% 无法正常跳转。暂时禁用。 +% \begin{macrocode} +% \RequirePackage[stable, bottom]{footmisc} +\RequirePackage{% + caption, + geometry, + graphicx, + listings, + makecell, + siunitx, + tabularx, + threeparttable, + unicode-math, + xcolor, + xcolor-material, + xunicode, + zref-base +} +% \end{macrocode} +% +% \subsubsection{\env{macrocode} 环境} +% +% \paragraph{继承的代码} +% +% \begin{macro}[int]{\macro@code} +% 在 \pkg{doc} 宏包中,\env{macrocode} 环境的核心功能由命令 +% \tn{macro@code} 负责实现,而 \tn{xmacro@code} 只用来结束 +% \env{macrocode} 环境。但在 \cls{l3doc} 以及 \cls{ctxdoc} 中, +% \tn{xmacro\-@\-code} 则基本接管了 \tn{macro@code} 的功能。 +% 后者此时只起辅助作用。 +% \begin{macrocode} +\def\macro@code{% +% \end{macrocode} +% 调整前后间距,禁止 \env{macrocode} 环境前的分页。 +% \begin{macrocode} + \topsep \MacrocodeTopsep + \@beginparpenalty \predisplaypenalty +% \end{macrocode} +% 将列表前后的附加垂直空白设为 0。根据 \cls{ctxdoc} 修改。 +% \begin{macrocode} + \partopsep \z@skip +% \if@inlabel\leavevmode\fi +% \end{macrocode} +% 构建 \env{trivlist} 环境,设置段间距为 0。 +% 之后修改字体,并调节左右间距。\tn{MacroIndent} 会根据代码行数 +% 更新,具体细节见后文。 +% \tn{macro@font} 用来在不同模块见切换字体。本文档类不使用 +% \tn{AltMacroFont},因此这里改用 \tn{MacroFont} 代替。 +% \begin{macrocode} + \trivlist \parskip \z@ \item[]% +% \macro@font + \MacroFont + \leftskip\@totalleftmargin \advance\leftskip\MacroIndent + \rightskip\z@ \parindent\z@ \parfillskip\@flushglue +% \end{macrocode} +% 按照 \LaTeXe{} 中 \tn{verbatim} 环境中定义 \tn{par},使得空行 +% 可以原样输出,否则空行会被吃掉。 +% \begin{macrocode} + \blank@linefalse \def\par{\ifblank@line + \leavevmode\fi + \blank@linetrue\@@par + \penalty\interlinepenalty} +% \end{macrocode} +% \tn{obeylines} 将把回车符 |^^M| 变成 \tn{par}。 +% 接下来将所有特殊符号的类别码设为 12,即“其他”类。 +% \begin{macrocode} + \obeylines + \let\do\do@noligs \verbatim@nolig@list + \let\do\@makeother \dospecials +% \end{macrocode} +% 相当于退出 |\begin{list}| 和 |\begin{minipage}|。 +% \begin{macrocode} + \global\@newlistfalse + \global\@minipagefalse +% \end{macrocode} +% 初始化交叉引用功能。 +% \begin{macrocode} + \init@crossref} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%<@@=nwafudoc> +\ExplSyntaxOn +% \end{macrocode} +% +% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpb_tl} +% 临时变量。 +% \begin{macrocode} +\tl_new:N \l_@@_tmpa_tl +\tl_new:N \l_@@_tmpb_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_patch_cmd:Nnn,\@@_preto_cmd:Nn,\@@_appto_cmd:Nn} +% 补丁工具。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_cmd:Nnn #1#2#3 + { + \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \@@_preto_cmd:Nn #1#2 + { + \ctex_preto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \@@_appto_cmd:Nn #1#2 + { + \ctex_appto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \paragraph{代码行处理} +% +% \begin{macro}[int]{\xmacro@code,\sxmacro@code} +% 重新实现 \env{macrocode} 与 \env{macrocode*} 环境的核心功能, +% 将对代码逐行处理。后者会将空格显示为“\verb*| |”。 +% \begin{macrocode} +\cs_set_protected_nopar:Npn \xmacro@code + { \@@_marco_code:w } +\cs_set_protected_nopar:Npn \sxmacro@code + { + \fontspec_print_visible_spaces: + \xmacro@code + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_marco_code:w} +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_marco_code:w + { +% \end{macrocode} +% 根据 \tn{codeline@index} 是否为 |true| 选择是否显示行号。 +% \begin{macrocode} + \ifcodeline@index + \@@_marco_code_every_par:n { \@@_code_line_no: } + \else: + \@@_marco_code_every_par:n { } + \fi: +% \end{macrocode} +% 设置代码段结束标记为“\verb*|% \end{macrocode}^^M|”。 +% \begin{macrocode} + \@@_make_finish_tag:x { \@currenvir } +% \end{macrocode} +% 开始 \env{macrocode}。 +% \begin{macrocode} + \@@_macro_code_start:w + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_marco_code_every_par:n} +% 在每段之前插入内容。这里每段即相当于每行。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_marco_code_every_par:n #1 + { + \everypar + { + \everypar {#1} + \if@inlabel + \global \@inlabelfalse \@noparlistfalse + \llap { \box \@labels \hskip \leftskip } + \fi + #1 + } + } +% \end{macrocode} +% \end{macro} +% +% 设置 \tn{endlinechar} 为 $-1$,表示行末不插入任何字符 +% (实际上相当于在行尾插入注释符 |%|)。 +% \begin{macrocode} +\group_begin: + \int_set:Nn \tex_endlinechar:D { -1 } +% \end{macrocode} +% +% \begin{variable}{\c_@@_active_space_tl} +% 活动字符类的空格(ASCII 码为 32)。 +% \begin{macrocode} + \use:n + { + \char_set_catcode_active:n { 32 } + \tl_const:Nn \c_@@_active_space_tl + } + { } +\group_end: +% \end{macrocode} +% \end{variable} +% +% ASCII 码 13 是回车符 |^^M|。将其设置为活动字符。 +% \begin{macrocode} +\group_begin: + \char_set_catcode_active:n { 13 } +% \end{macrocode} +% +% \begin{macro}{\@@_make_finish_tag:n,\@@_make_finish_tag:x} +% \env{macrocode} 结尾标记。展开后变成 +% “\verb*|% \end{#1}^^M|”。 +% \begin{macrocode} + \cs_new_protected:Npx \@@_make_finish_tag:n #1 + { + \tl_set:Nn \exp_not:N \l_@@_macro_code_finish_tl + { + \c_percent_str + \prg_replicate:nn { 4 } + { \exp_not:o { \c_@@_active_space_tl } } + \exp_not:o { \active@escape@char } end + \c_left_brace_str #1 \c_right_brace_str + \exp_not:N ^^M + } + } + \cs_generate_variant:Nn \@@_make_finish_tag:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_macro_code_start:w} +% 开始代码环境。此命令主要是为了防止 |\begin{macrocode}| +% 后出现多余的空行。 +% \begin{macrocode} + \cs_new_protected:Npn \@@_macro_code_start:w #1 + { + \str_if_eq:nnTF {#1} { ^^M } + { \@@_macro_code_read_line:w } + { \@@_macro_code_read_line:w #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_macro_code_read_line:w} +% 逐行读取代码,并连同行尾回车符一并存入 +% \cs{l_@@_macro_code_line_tl}。如果该行与结束标记 +% “\verb*|% \end{macrocode}^^M|”相同,则结束此 +% \env{macrocode};否则继续处理该行代码。 +% \begin{macrocode} + \cs_new_protected:Npn \@@_macro_code_read_line:w #1 ^^M + { + \tl_set:Nn \l_@@_macro_code_line_tl { #1 ^^M } + \tl_if_eq:NNTF + \l_@@_macro_code_line_tl \l_@@_macro_code_finish_tl + { \exp_args:Nx \end { \@currenvir } } + { + \@@_macro_code_process_line: + \@@_macro_code_read_line:w + } + } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.4}{2017/08/09}{[\pkg{nwafudoc}] 修复 \cls{ctxdoc} +% 文档类 v2.4.10 之前版本中行距偏小的问题,见 ctex-kit +% \href{https://github.com/CTeX-org/ctex-kit/issues/303}{\#303}。} +% +% \begin{macro}{\@@_swap_cr:,\@@_swap_cr_aux:w} +% 把 \cs{l_@@_macro_code_line_tl} 中的回车符 |^^M| 挪到外面。 +% \begin{macrocode} + \cs_new_protected:Npn \@@_swap_cr: + { + \exp_after:wN + \@@_swap_cr_aux:w \l_@@_macro_code_line_tl + } + \cs_new_protected:Npn \@@_swap_cr_aux:w #1 ^^M + { + \group_insert_after:N ^^M + \tl_set:Nn \l_@@_macro_code_line_tl {#1} + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\c_@@_active_cr_tl} +% 活动字符类的回车符。 +% \begin{macrocode} + \tl_const:Nn \c_@@_active_cr_tl { ^^M } +\group_end: +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_macro_code_line_tl, +% \l_@@_macro_code_finish_tl, +% \g_@@_macro_code_verbatim_stop_tl} +% 分别用来存储代码行、\env{macrocode} 结束标记以及抄录停止标记。 +% \begin{macrocode} +\tl_new:N \l_@@_macro_code_line_tl +\tl_new:N \l_@@_macro_code_finish_tl +\tl_new:N \g_@@_macro_code_verbatim_stop_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_process_normal_line:} +% 普通代码行根据开头字符分别处理。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_process_normal_line: + { + \str_case_e:nnF + { \str_head:N \l_@@_macro_code_line_tl } + { +% \end{macrocode} +% 以 |%| 开头的行先由 \cs{tl_tail:N} 去掉 |%|,之后再检查 |<|。 +% \begin{macrocode} + { \c_percent_str } + { + \@@_check_angle:x + { \tl_tail:N \l_@@_macro_code_line_tl } + } +% \end{macrocode} +% 以 |#| 开头的行按注释的格式输出。 +% \begin{macrocode} + { \c_hash_str } + { \@@_output_comment_line: } + } +% \end{macrocode} +% 其余正常输出。 +% \begin{macrocode} + { \@@_output_line: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_process_verbatim_line:} +% 处理抄录代码行(不检查 |%| 与 |<|)。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_process_verbatim_line: + { +% \end{macrocode} +% 将该行与抄录停止标记进行比较。 +% \begin{macrocode} + \tl_if_eq:NNTF \l_@@_macro_code_line_tl + \g_@@_macro_code_verbatim_stop_tl +% \end{macrocode} +% 若相同,则结束抄录环境,清空抄录停止标记,并输出该标记; +% \begin{macrocode} + { + \tl_gclear:N \g_@@_macro_code_verbatim_stop_tl + \cs_gset_eq:NN \@@_macro_code_process_line: + \@@_process_normal_line: + \@@_output_module:nn + { \color { verb@guard } } + { + \@@_swap_cr: + \@@_module_pop:n { \l_@@_macro_code_line_tl } + } + } +% \end{macrocode} +% 否则直接输出抄录代码。 +% \begin{macrocode} + { \tl_use:N \l_@@_macro_code_line_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_macro_code_process_line:} +% 处理代码行。该命令的作用如下: +% \begin{itemize} +% \item 正常情况下,等同于 \cs{@@_process_normal_line:}; +% \item 在 \cs{DontCheckModules} 之后,等价于 +% \cs{@@_output_line:},即不检查模块标记,直接输出; +% \item 在抄录环境中,等价于 \cs{@@_process_verbatim_line:}, +% 此时将不再特殊处理以 |%| 开头的代码行。 +% \end{itemize} +% \begin{macrocode} +\cs_new_eq:NN \@@_macro_code_process_line: + \@@_process_normal_line: +% \end{macrocode} +% \end{macro} +% +% \paragraph{模块标记处理} +% +% \begin{macro}{\CheckModules,\DontCheckModules} +% 选择是否检查模块标记。这两个命令在 \pkg{doc} 宏包中已有定义, +% 此处重新声明。 +% \begin{macrocode} +\DeclareDocumentCommand \CheckModules { } + { + \cs_set_eq:NN \@@_macro_code_process_line: + \@@_process_normal_line: + } +\DeclareDocumentCommand \DontCheckModules { } + { + \cs_set_eq:NN \@@_macro_code_process_line: + \@@_output_line: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_check_angle:n,\@@_check_angle:x} +% 检查第一个字符是否是 |<|。若是,则检查模块;否则立刻输出改行。 +% 该函数的参数不带 |%|。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_check_angle:n #1 + { + \str_if_eq:eeTF { \str_head:n {#1} } { < } + { \@@_check_module:x { \tl_tail:n {#1} } } + { \@@_output_comment_line: } + } +\cs_generate_variant:Nn \@@_check_angle:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_check_module:n,\@@_check_module:x} +% 检查紧跟 |<| 之后的字符。共有四种情况: +% \begin{itemize} +% \item |*|:模块开始(|%<*|\meta{module}|>|); +% \item |/|:模块结束(|%|); +% \item |@|:名字空间(|%<@@=|\meta{namespace}|>|); +% \item |<|:抄录环境开始(|%<<|\meta{end-tag})。 +% \end{itemize} +% 若不是这几种情况,则为单独一行的独立模块 +% (|%<|\meta{module}|>|)。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_check_module:n #1 + { + \str_case_e:nnF { \str_head:n {#1} } + { + { * } { \@@_module_star:w } + { / } { \@@_module_slash:w } + { @ } { \@@_module_at:w } + { < } { \@@_module_verb:w } + } + { \@@_module_pm:w } +% \end{macrocode} +% 参数 |#1| 将被上面几个 |:w| 型函数吃掉。 +% \begin{macrocode} + #1 \q_stop + } +\cs_generate_variant:Nn \@@_check_module:n { x } +% \end{macrocode} +% \end{macro} +% +% 设置 |>| 为活动字符。 +% \begin{macrocode} +\group_begin: + \char_set_catcode_active:N \> +% \end{macrocode} +% +% \begin{macro}{\@@_module_star:w} +% 模块开始标记。 +% \begin{arguments} +% \item |*|\meta{module} +% \item 之后的代码 +% \end{arguments} +% \begin{macrocode} + \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop + { +% \end{macrocode} +% 临时变量 \cs{l_@@_tmp_tl} 保存 |<*|\meta{module}|>| +% 之后的部分,即真实代码。 +% \begin{macrocode} + \tl_set:Nn \l_@@_tmpa_tl {#2} +% \end{macrocode} +% 判断该行是否为空(只含一个回车符 |^^M|)。 +% \begin{macrocode} + \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl +% \end{macrocode} +% 若是,则将 |<|\meta{module}|>| 放在行号的右侧; +% \begin{macrocode} + { + \@@_output_module:nn + { \@@_star_color: } + { + \@@_module_push:n + { \@@_module_angle:n {#1} } + } + } +% \end{macrocode} +% 否则放在左侧,并输出相应代码。 +% \begin{macrocode} + { + \@@_output_module_left:nn + { \@@_star_color: } + { + \@@_module_push:n + { \@@_module_angle:n {#1} } + } + } + \@@_output_line:n {#2} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_slash:w} +% 模块结束标记。结构与 \cs{@@_module_star:w} 相同。 +% \begin{arguments} +% \item |/|\meta{module} +% \item 之后的代码 +% \end{arguments} +% \begin{macrocode} + \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop + { + \tl_set:Nn \l_@@_tmpa_tl {#2} + \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl + { + \@@_output_module:nn + { \@@_slash_color: } + { + \@@_module_pop:n + { \@@_module_angle:n {#1} } + } + } + { + \@@_output_module_left:nn + { \@@_slash_color: } + { + \@@_module_pop:n + { \@@_module_angle:n {#1} } + } + } + \@@_output_line:n {#2} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_at:w} +% 名字空间。 +% \begin{arguments} +% \item 名字空间的名称(不含 |@@=|) +% \item 之后的代码 +% \end{arguments} +% \begin{macrocode} + \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop + { + \@@_output_module:nn + { \color { at@guard } } + { \@@_module_angle:n { @ @ = #1 } } +% \end{macrocode} +% 设置名字空间为 |#1|。\cls{l3doc} 中将名字空间称为 +% “模块”(module),注意不要混淆。 +% \begin{macrocode} + \tl_gset:Nn \g__codedoc_module_name_tl {#1} + \@@_output_line:n {#2} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_verb:w} +% 抄录开始。|#1|: |<|\meta{end-tag},只有一个 |<|。 +% \meta{end-tag} 的最后会带有一个回车符 |^^M|。 +% \begin{macrocode} + \cs_new_protected:Npn \@@_module_verb:w #1 \q_stop + { +% \end{macrocode} +% 重定义 \cs{@@_macro_code_process_line:},用以输出抄录行。 +% \begin{macrocode} + \cs_gset_eq:NN \@@_macro_code_process_line: + \@@_process_verbatim_line: +% \end{macrocode} +% 设置抄录停止标记。用 \cs{tl_tail:n} 去掉开头的 |<|。 +% \begin{macrocode} + \tl_gset:Nx \g_@@_macro_code_verbatim_stop_tl + { \c_percent_str \tl_tail:n {#1} } +% \end{macrocode} +% 输出 |%<<|\meta{end-tag}。 +% \begin{macrocode} + \@@_output_module:nn + { \color { verb@guard } } + { + \@@_swap_cr: + \@@_module_push:n { \l_@@_macro_code_line_tl } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_pm:w} +% 处理单独一行的模块。|<|\meta{module}|>| 放在行号的左侧。 +% \begin{arguments} +% \item \meta{module} +% \item 之后的代码 +% \end{arguments} +% \begin{macrocode} + \cs_new_protected:Npn \@@_module_pm:w #1 > #2 \q_stop + { + \@@_output_module_left:nn + { \@@_pm_color: } + { \@@_module_angle:n {#1} } + \@@_output_line:n {#2} + } +\group_end: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_output_line:n,\@@_output_line:} +% 输出代码行。参数将被存入 \cs{l_@@_macro_code_line_tl}, +% 再由不带参数的版本调用。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_output_line:n #1 + { + \tl_set:Nn \l_@@_macro_code_line_tl {#1} +% \end{macrocode} +% 若为空行(只含一个 |^^M|),则直接输出(换行)。 +% \begin{macrocode} + \tl_if_eq:NNTF + \l_@@_macro_code_line_tl \c_@@_active_cr_tl + { \tl_use:N \l_@@_macro_code_line_tl } + { +% \end{macrocode} +% 检查开头是否为 |%|,据此分别处理。 +% \begin{macrocode} + \str_if_eq:eeTF + { \str_head:N \l_@@_macro_code_line_tl } { \c_percent_str } + { \@@_output_comment_line: } { \@@_output_line: } + } + } +\cs_new_protected_nopar:Npn \@@_output_line: + { + \tex_noindent:D +% \end{macrocode} +% 此处将把 |@@| 替换为相应的名字空间。 +% \begin{macrocode} + \@@_replace_at_at:N \l_@@_macro_code_line_tl + \tl_use:N \l_@@_macro_code_line_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_output_comment_line:} +% 输出注释代码行。用灰色、斜体显示。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_output_comment_line: + { + \tex_noindent:D + \group_begin: + \__nwafudoc_swap_cr: + \color { code@gray } \slshape \@@_output_line: + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_replace_at_at:N, +% \@@_replace_at_at_aux:Nn,\@@_replace_at_at_aux:No} +% 把 |@@| 替换为相应的名字空间。其名称存放在全局变量 +% \cs{g__codedoc_module_name_tl} 中。 +% 它为空时(|%<@@=>|),不做替换。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_replace_at_at:N #1 + { + \tl_if_empty:NF \g__codedoc_module_name_tl + { \@@_replace_at_at_aux:No #1 \g__codedoc_module_name_tl } + } +\cs_new_protected:Npn \@@_replace_at_at_aux:Nn #1#2 + { +% \end{macrocode} +% 以下代码分别对应两种名字空间的替换: +% \begin{itemize} +% \item 内部变量:|\|\meta{type}|_@@_|\meta{name} $\to$ +% |\|\meta{type}|__|\meta{namespace}|_|\meta{name}; +% \item 内部函数:|\@@_|\meta{name}” $\to$ +% |\__|\meta{namespace}|_|\meta{name}”)。 +% \end{itemize} +% \begin{macrocode} + \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + } +\cs_generate_variant:Nn \@@_replace_at_at_aux:Nn { No } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_push:n, +% \@@_module_push_aux:nn,\@@_module_push_aux:on} +% 将模块名压入栈中。此处的栈主要用来处理模块名(包括抄录标记) +% 之间的超链接。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_module_push:n + { \@@_module_push_aux:on { \int_use:N \c@HD@hypercount } } +\cs_new_protected:Npn \@@_module_push_aux:nn #1 + { + \seq_gpush:Nn \g_@@_module_dest_seq {#1} + \hypersetup { hidelinks } + \exp_args:Nx \hdclindex + { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { } + } +\cs_generate_variant:Nn \@@_module_push_aux:nn { on } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_pop:n, +% \@@_module_pop_aux:nn,\@@_module_pop_aux:on} +% 将模块名释放出栈。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_module_pop:n + { + \seq_gpop:NNTF \g_@@_module_dest_seq \l_@@_tmpa_tl + { \@@_module_pop_aux:on { \l_@@_tmpa_tl } } + { \BOOM \use:n } + } +\cs_new_protected:Npn \@@_module_pop_aux:nn #1 + { + \zref@labelbylist { HD.#1 } { nwafudoc } + \hypersetup { hidelinks } + \hdclindex {#1} { } + } +\cs_generate_variant:Nn \@@_module_pop_aux:nn { on } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\g_@@_module_dest_seq} +% 存放模块名的序列(栈)。 +% \begin{macrocode} +\seq_new:N \g_@@_module_dest_seq +% \end{macrocode} +% \end{variable} +% +% 处理行号超链接。使用 \pkg{zref} 宏包。 +% \begin{macrocode} +\zref@newlist { nwafudoc } +\zref@newprop { guard@end } [ 1 ] + { \int_eval:n { \c@HD@hypercount - 1 } } +\zref@addprop { nwafudoc } { guard@end } +% \end{macrocode} +% +% \paragraph{格式处理} +% +% \begin{macro}{\MacroFont} +% 代码部分的字体。 +% \begin{macrocode} +\cs_set_protected:Npn \MacroFont + { + \linespread { 1.05 } + \small \ttfamily \mdseries \upshape + \@@_verb_addon: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_output_module:nn,\@@_output_module_left:nn} +% 输出模块名(分行内和行号左侧两种)。 +% \begin{arguments} +% \item 颜色等样式 +% \item 模块名 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_output_module:nn #1#2 + { + \tex_noindent:D + \group_begin: + #1 + \footnotesize \normalfont \sffamily #2 + \group_end: + } +\cs_new_protected:Npn \@@_output_module_left:nn #1#2 + { + \tex_noindent:D + \hbox_overlap_left:n + { + \@@_output_module:nn {#1} {#2} + \skip_horizontal:n { \leftskip + \smallskipamount } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_star_color:,\@@_slash_color:,\@@_pm_color:} +% 选择模块标记的颜色。模块标记的颜色会根据嵌套层次而改变。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_star_color: + { + \seq_gpop:NNTF \g_@@_star_color_seq \current@color + { \set@color } + { \@@_select_color: } + \seq_gpush:No \g_@@_slash_color_seq { \current@color } + } +\cs_new_protected_nopar:Npn \@@_slash_color: + { + \seq_gpop:NNTF \g_@@_slash_color_seq \current@color + { + \set@color + \seq_gpush:No \g_@@_star_color_seq { \current@color } + } +% TODO: 需要报错:star 与 slash 没有匹配 + { \BOOM } + } +\cs_new_protected_nopar:Npn \@@_pm_color: + { + \seq_get:NNTF \g_@@_star_color_seq \current@color + { \set@color } + { + \@@_select_color: + \seq_gpush:No \g_@@_star_color_seq { \current@color } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\g_@@_star_color_seq,\g_@@_slash_color_seq} +% 存放模块标记颜色的序列。 +% \begin{macrocode} +\seq_new:N \g_@@_star_color_seq +\seq_new:N \g_@@_slash_color_seq +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_select_color:} +% \begin{macro}[int]{guard@series} +% 设置模块标记的色系。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_select_color: + { \color { guard@series!!+ } } +\definecolorseries { guard@series } + { cmyk } { last } { blue } { purple } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% 设置色系的增量大小。可选参数 |3| 意味着基色(blue)与 +% 末色(purple)之间将等分为三份。该数字比嵌套最大深度小 1。 +% \begin{macrocode} +\resetcolorseries [ 3 ] { guard@series } +% \end{macrocode} +% +% \begin{macro}[int]{verb@guard,at@guard,code@gray} +% 设置颜色。 +% \begin{macrocode} +\definecolor { verb@guard } { named } { MaterialLime600 } +\definecolor { at@guard } { named } { MaterialPink } +\definecolor { code@gray } { named } { MaterialGrey } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_module_angle:n} +% 输出“$\langle\cdots\rangle$”。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_module_angle:n #1 + { < #1 > } +% { \textlangle #1 \textrangle } +% { \ensuremath \langle #1 \ensuremath \rangle } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_code_line_no:} +% 行号。设置为阿拉伯数字。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_code_line_no: + { + \int_gincr:N \c@CodelineNo + \hbox_overlap_left:n + { + \hbox_to_wd:nn + { \MacroIndent } + { + \HD@target + \tex_hss:D \@@_code_line_no_style: + \theCodelineNo \enspace + } + \tex_kern:D \@totalleftmargin + } + } +\tl_set:Nn \theCodelineNo { \arabic { CodelineNo } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_code_line_no_style:} +% 行号格式。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_code_line_no_style: + { \color { code@gray } \normalfont \sffamily \tiny } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\HD@SetMacroIndent} +% 设置代码缩进(行号一栏的宽度)。该命令会写进 |.aux| 辅助文件, +% 以便在二次编译时确定最大行号宽度。 +% \begin{macrocode} +\cs_set_protected:Npn \HD@SetMacroIndent #1 + { + \group_begin: + \settowidth \MacroIndent + { + \@@_code_line_no_style: + \prg_replicate:nn { \tl_count:n {#1} } { 0 } + \enspace + } + \dim_gset_eq:NN \MacroIndent \MacroIndent + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{\env{function} 环境} +% +% \begin{macro}{\@@_verb_addon:, +% \@@_disable_ecglue:, +% \@@_plain_punct_style:} +% \begin{macro}[int]{\meta@font@select} +% 调整文字间距,以便于让 CJK 字符占的宽度等于西文等宽字体中两个 +% 空格的宽度。需要按编译情况分别定义。 +% \begin{macrocode} +\sys_if_engine_xetex:TF + { + \cs_set_eq:NN \@@_verb_addon: \xeCJKVerbAddon + \cs_set:Nn \@@_plain_punct_style: + { \xeCJKsetup { PunctStyle = plain } } + \cs_set:Nn \@@_disable_ecglue: + { \xeCJKsetup { CJKecglue } } + \@@_appto_cmd:Nn \meta@font@select + { \mode_if_inner:T { \@@_disable_ecglue: } } + } + { + \cs_set_eq:NN \@@_verb_addon: \prg_do_nothing: + \cs_set_eq:NN \@@_plain_punct_style: \prg_do_nothing: + \cs_set:Nn \@@_disable_ecglue: + { \ltjsetparameter { autoxspacing = false } } + \@@_appto_cmd:Nn \meta@font@select + { \@@_disable_ecglue: } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{environment}{function} +% \begin{macro}{\@@_fix_previous_depth:} +% 调整 \env{function} 环境前后间距。 +% \begin{macrocode} +\BeforeBeginEnvironment { function } + { \par \nointerlineskip } +\AtEndEnvironment { function } + { + \par + \cs_gset:Nx \@@_fix_previous_depth: + { \prevdepth = \the \prevdepth \space } + } +\AfterEndEnvironment { function } + { \@@_fix_previous_depth: } +% \end{macrocode} +% \end{macro} +% \end{environment} +% +% \begin{environment}{syntax} +% \begin{environment}{nwafusyntax} +% 在 \env{syntax} 和 \env{nwafusyntax} 环境前设置若干活动字符。 +% \texttt{\textbar} 用于分隔多个选项,无需倾斜;|| 表示选项, +% |(xxx)| 表示默认选项。原来的括号用宏保存,并且使用直立字体。 +% \env{syntax} 环境另需要额外调整行距、标点样式及字符间距。 +% \begin{macrocode} +\AtBeginEnvironment { syntax } + { + \linespread { 1.2 } + \@@_plain_punct_style: + \@@_disable_ecglue: +% \char_set_catcode_active:N | +% \char_set_catcode_active:N ( +% \char_set_active_eq:NN | \orbar +% \char_set_active_eq:NN ( \defaultval@aux + } +\AtBeginEnvironment { nwafusyntax } + { + \cs_set:Npn \lparen { \textup { ( } } + \cs_set:Npn \rparen { \textup { ) } } + \char_set_catcode_active:N | + \char_set_catcode_active:N < + \char_set_catcode_active:N ( + \char_set_active_eq:NN | \orbar + \char_set_active_eq:NN < \syntaxopt@aux + \char_set_active_eq:NN ( \defaultval@aux + } +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \subsubsection{修订记录索引项} +% +% \begin{macro}{\@@_ltx_changes:nnn} +% 保存 \pkg{doc} 中 \tn{changes@} 的定义。 +% \begin{macrocode} +\cs_new_eq:NN \@@_ltx_changes:nnn \changes@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\changes@} +% \changes{v0.4}{2017/07/30}{调整索引排序方式。} +% 重定义 \tn{changes@},在版本号一行显示修改日期。 +% \begin{macrocode} +\cs_set_protected:Npn \changes@ #1#2 + { + \@@_save_version_date:nn {#1} {#2} + \@@_ltx_changes:nnn {#1} {#2} + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\g_@@_version_date_prop} +% 存放版本号与对应的修改日期。 +% key = 版本号,value = \{ 开始日期,结束日期 \}。 +% 开始日期与结束日期可以相同。 +% \begin{macrocode} +\prop_new:N \g_@@_version_date_prop +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_save_version_date:nn} +% |nn| 版本最终将被 \tn{changes@} 调用。 +% \begin{arguments} +% \item 版本号 +% \item 日期 +% \end{arguments} +% 它们分别对应 \tn{change} 的前两个参数(第三个是说明文字)。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_save_version_date:nn #1#2 + { + \prop_get:NnNTF \g_@@_version_date_prop + {#1} \l_@@_tmpa_tl + { +% \end{macrocode} +% \cs{l_@@_tmp_tl} 相当于两个参数(开始日期、结束日期), +% 因此需要提前展开。 +% \begin{macrocode} + \exp_after:wN + \@@_save_version_date_aux:nnnn \l_@@_tmpa_tl + {#2} {#1} + } + { \@@_save_version_date_aux:nnn {#1} {#2} {#2} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_save_version_date_aux:nnnn} +% \begin{arguments} +% \item 原开始日期 +% \item 原结束日期(显然应有 |#1| < |#2|) +% \item 新读入的日期 +% \item 版本号 +% \end{arguments} +% 如果 |#3| < |#1|,则读入日期 |#3|、|#2|; +% 如果 |#3| > |#2|,则读入日期 |#1|、|#3|。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_save_version_date_aux:nnnn #1#2#3#4 + { + \@@_if_date_later:nnTF {#1} {#3} + { \@@_save_version_date_aux:nnn {#4} {#3} {#2} } + { + \@@_if_date_later:nnT {#3} {#2} + { \@@_save_version_date_aux:nnn {#4} {#1} {#3} } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_save_version_date_aux:nnn} +% 将版本号和日期存入 \cs{g_@@_version_date_prop}。 +% \begin{arguments} +% \item 版本号 +% \item 开始日期 +% \item 结束日期 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_save_version_date_aux:nnn #1#2#3 + { \prop_gput:Nnn \g_@@_version_date_prop {#1} { {#2} {#3} } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[TF]{\@@_if_date_later:nn} +% \begin{macro}{\@@_parse_date:w} +% 比较两个日期。如果 |#1| 在 |#2| 之后,则为 |true|;反之为 |false|。 +% 日期的格式为 YYYY/MM/DD。比较方法是直接将日期化成 8 位数字, +% 所以月、日前的 0 不可以省略。 +% \begin{macrocode} +\prg_new_conditional:Npnn \@@_if_date_later:nn #1#2 { TF, T } + { + \if_int_compare:w + \@@_parse_date:w #1 / / / 0 \q_stop > + \@@_parse_date:w #2 / / / 0 \q_stop \exp_stop_f: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \@@_parse_date:w #1/#2/#3/ #4 \q_stop + { #1#2#3 } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\CTEX@versionitem} +% 版本条目标签。如果版本号不在 \cs{g_@@_version_date_prop} 的 +% key 里面,则利用未定义的 \cs{BOOM} 报错。 +% \begin{macrocode} +\cs_new_protected:Npn \CTEX@versionitem #1 \efill + { + \@idxitem + \prop_get:NnNTF \g_@@_version_date_prop + {#1} \l_@@_tmpa_tl + { + \exp_after:wN + \@@_print_version_date:nnn \l_@@_tmpa_tl + {#1} + } + { \BOOM } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_version_date:nnn} +% 输出版本号和日期。如果开始日期和结束日期相同,则只输出一项。 +% \begin{arguments} +% \item 开始日期 +% \item 结束日期 +% \item 版本号 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_version_date:nnn #1#2#3 + { + \noindent + \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } } + \textbf {#3} \hfill + \hbox:n + { + \footnotesize + \str_if_eq:nnTF {#1} {#2} + { ( #1 ) } { ( #1 ~ -- ~ #2 ) } + } + \par \nopagebreak + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\HDorg@theglossary} +% 该命令由 \pkg{hypdoc} 宏包定义,用于存放标准文档类 \cls{book} +% 中定义的 \tn{theindex} 命令。 +% 此处的补丁将在版本号一行最后加上修改日期。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \HDorg@theglossary + { \let \item \@idxitem } + { \let \item \CTEX@versionitem } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@wrglossary} +% 该命令由 \LaTeXe{} 内核定义,又由 \pkg{hypdoc} 宏包作了修改。 +% 此处的补丁使得修订记录条目的页码能够指向对应行。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \@wrglossary + { hdpindex } + { + \ifnum \c@HD@hypercount = \z@ + hdpindex + \else + hdclindex { \the \c@HD@hypercount } + \fi + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{命令补丁} +% +% \paragraph{\LaTeXe{} 补丁} +% +% \begin{macro}[int]{\@addtocurcol} +% 调整浮动体、代码等与文字的间距。 +% 见 \url{http://tex.stackexchange.com/a/40896}。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \@addtocurcol + { \vskip \intextsep } + { + \edef \save@first@penalty { \the \lastpenalty } \unpenalty + \ifnum \lastpenalty = \@M + \unpenalty + \else + \penalty \save@first@penalty \relax + \fi + \ifnum \outputpenalty < -\@Mii + \addvspace\intextsep + \vskip\parskip + \else + \addvspace\intextsep + \fi + } +\ctex_patch_cmd:Nnn \@addtocurcol + { + \vskip \intextsep + \ifnum \outputpenalty < -\@Mii + \vskip -\parskip + \fi + } + { + \ifnum \outputpenalty < -\@Mii + \aftergroup \vskip \aftergroup \intextsep + \aftergroup \nointerlineskip + \else + \vskip \intextsep + \fi + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@getpen} +% 将换行或换页的最大罚值由 \num{10000} 改为 \num{10001}。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \@getpen { \@M } { \@Mi } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\l@section,\l@subsection} +% 修改目录条目的缩进。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em } +\ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@thehead} +% 修改页眉,禁用 \tn{MakeUppercase}。 +% \begin{macrocode} +\@@_preto_cmd:Nn \@thehead + { \cs_set_eq:cN { MakeUppercase \space } \@iden } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thebibliography} +% \begin{macro}[int]{\HDorg@thebibliography} +% 参考文献一节需要编号。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \HDorg@thebibliography + { \section* } { \section } +\cs_set_eq:NN \thebibliography \HDorg@thebibliography +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\GlossaryParms} +% 修改修订记录中的一些缩进。 +% \begin{macrocode} +\@@_appto_cmd:Nn \GlossaryParms + { + \raggedcolumns + \cs_set_eq:NN \Hy@writebookmark \HDorg@writebookmark + \cs_set:Npn \@idxitem { \par \hangindent 2em } + \cs_set:Npn \subitem { \@idxitem \hspace* { 1em } } + \cs_set:Npn \subsubitem { \@idxitem \hspace* { 2em } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\HoLogo@LaTeXe} +% 由于使用了 \pkg{unicode-math},需要额外修改 \pkg{hologo} 中的 +% \tn{LaTeXe} 命令,以使粗体正常显示。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \HoLogo@LaTeXe + { \hbox { \HOLOGO@MathSetup 2 $ _{ \textstyle \varepsilon } $ } } + { + \hbox + { + \mathsurround 0pt \relax + 2 + \if b \expandafter \@car \f@series \@nil + $ _{ \textstyle \symbf { \varepsilon } } $ + \else + $ _{ \textstyle \varepsilon } $ + \fi + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SpecialMainEnvIndex} +% 索引汉化。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \SpecialMainEnvIndex + { (environment) } { ~ 环境 } +\ctex_patch_cmd:Nnn \SpecialMainEnvIndex + { environments: } { 环境: } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\HDorg@SpecialEnvIndex} +% \pkg{hypdoc} 宏包重新定义了 \tn{SpecialEnvIndex} 命令,因此需要 +% 修改内部定义。 +% \begin{macrocode} +\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex + { (environment) } { ~ 环境 } +\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex + { environments: } { 环境: } +% \end{macrocode} +% \end{macro} +% +% \paragraph{\cls{l3doc} 补丁} +% +% \begin{macrocode} +%<@@=codedoc> +% \end{macrocode} +% +% \begin{macro}{\list} +% \cls{l3doc} 会设置列表环境中 \tn{listparindent} |=| \tn{z@}, +% 这里将其恢复。 +% \begin{macrocode} +\cs_set_eq:NN \list \@@_oldlist:nn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_function_descr_start:w} +% 抑制首段的 \tn{parskip}。 +% \begin{macrocode} +\__nwafudoc_patch_cmd:Nnn \@@_function_descr_start:w + { \noindent } + { \skip_vertical:n { -\parskip } \noindent } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_function_assemble:} +% 在 \cls{l3doc} 中,\env{function} 环境里的 \env{syntax} 和 +% \env{descr} 盒子中间存在一段 \tn{med\-skip\-amount} 的距离。 +% 但是如果 \env{syntax} 盒子为空(未使用 \env{syntax} 环境), +% 就会显得不好看。此时通过把 \tn{medskipamount} 设置为零来修正。 +% 若盒子非空,则把 \tn{parskip} 还回去。 +% \begin{macrocode} +\__nwafudoc_preto_cmd:Nn \@@_function_assemble: + { + \box_if_empty:NTF \g_@@_syntax_box + { \skip_zero:N \medskipamount } + { \skip_add:Nn \medskipamount { \parskip } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_typeset_functions:} +% 调整 \env{function} 环境的字体。 +% \begin{macrocode} +\__nwafudoc_patch_cmd:Nnn \@@_typeset_functions: + { \small \ttfamily } { \footnotesize \ttfamily } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_typeset_functions:,\@@_macro_init:, +% \@@_macro_dump:} +% 左侧边注的函数列表采用单倍行距。 +% \begin{macrocode} +\__nwafudoc_preto_cmd:Nn \@@_typeset_functions: + { \MacroFont } +\__nwafudoc_patch_cmd:Nnn \@@_macro_init: + { \hbox:n } { \MacroFont \hbox:n } +\__nwafudoc_patch_cmd:Nnn \@@_macro_dump: + { \hbox_unpack_drop:N } { \MacroFont \hbox_unpack_drop:N } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_meta_original:n} +% 改用文本模式显示尖括号。 +% \begin{macrocode} +\__nwafudoc_patch_cmd:Nnn \@@_meta_original:n + { \ensuremath \langle } { \textlangle } +\__nwafudoc_patch_cmd:Nnn \@@_meta_original:n + { \ensuremath \rangle } { \textrangle } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_macro_end_style:n} +% 禁止显示 \env{macro} 环境最后的 “(\emph{End definition for ...})”。 +% \begin{macrocode} +\cs_set_eq:NN \@@_macro_end_style:n \use_none:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_typeset_TF:} +% 关闭 |TF| 上的超链接,并且保证颜色与函数主体一致。 +% \begin{macrocode} +\cs_set_protected:Npn \@@_typeset_TF: + { + \group_begin: + \exp_args:No \@@_if_macro_internal:nT \l_@@_tmpa_tl + { \color [ gray ] { 0.5 } } + \itshape TF + \makebox [ 0 pt ] [ r ] + { + \color { red } + \underline { \phantom { \itshape TF } \kern -0.1 em } + } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_macro_typeset_one:nN} +% 在 \env{macro} 环境的侧边栏中,\cls{l3doc} 根据命令的长短,分别用 +% 普通字体和紧缩字体输出。然而很长的命令还是会超出页边。这里用缩放 +% 盒子的手段使得长命令也可正常显示。 +% \begin{macrocode} +\cs_set_protected:Npn \@@_macro_typeset_one:nN #1#2 + { + \vbox_set:Nn \l_@@_macro_box + { + \MacroFont + \vbox_unpack_drop:N \l_@@_macro_box + \hbox_set:Nn \l_tmpa_box + { \@@_print_macroname:nN {#1} #2 } +% \end{macrocode} +% \tn{marginparwidth} 和 \tn{marginparsep} 分别是边注的宽度及其到 +% 版心的距离,\tn{la\-bel\-sep} 则是编号盒子右端与条目首行文本之间 +% 的距离。 +% \begin{macrocode} + \dim_set:Nn \l_tmpa_dim + { \marginparwidth - \labelsep - \marginparsep } + \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim + { + \box_resize_to_wd_and_ht:Nnn \l_tmpa_box + { \l_tmpa_dim } { \box_ht:N \l_tmpa_box } + } + \hbox_overlap_left:n + { + \box_use:N \l_tmpa_box + \skip_horizontal:n { \marginparsep - \labelsep } + } + } + \int_incr:N \l_@@_macro_int + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_macroname:nN} +% 该函数不再需要根据命令的长短切换字体。 +% \begin{macrocode} +\cs_set_protected:Npn \@@_print_macroname:nN #1#2 + { + \strut + \@@_get_hyper_target:xN + { + \exp_not:n {#1} + \bool_if:NT #2 { \tl_to_str:n {TF} } + } + \l_@@_tmpa_tl + \cs_if_exist:cTF { r@ \l_@@_tmpa_tl } + { \exp_args:NNo \label@hyperref [ \l_@@_tmpa_tl ] } + { \use:n } + { + \tl_set:Nn \l_@@_tmpa_tl {#1} +% \end{macrocode} +% 命令中的空格改用“\textvisiblespace”显示。 +% \begin{macrocode} + \tl_replace_all:Non \l_@@_tmpa_tl + { \c_catcode_other_space_tl } + { \fontspec_visible_space: } + \@@_macroname_prefix:o \l_@@_tmpa_tl + \@@_macroname_suffix:N #2 + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_special_index_module:nnnnN} +% 索引汉化。 +% \begin{macrocode} +\cs_set_protected:Npn \@@_special_index_module:nnnnN #1#2#3#4#5 + { + \use:x + { + \exp_not:n { \@@_special_index_aux:nnnnnnn {#1} {#2} } + \tl_if_empty:nTF {#3} + { { } { } { } { } } + { + \str_if_eq:eeTF {#3} { TeX } + { + { TeX~ and~ LaTeX2e } + { \string \TeX{}~ 和~ \string \LaTeXe{} } + } + { {#3} { \string \pkg {#3} } } + \bool_if:NTF #5 + { { commands~ internal } { ~ 内部命令: } } + { { commands } { ~ 命令: } } + } + } + {#4} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_special_index_aux:nnnnnnn} +% 该函数在 \cls{l3doc} 中本来只有 6 个参数。这里增加了一个,用来辅助 +% 排序。 +% \begin{arguments} +% \item 键(即宏名称字符串,用来排序) +% \item 宏名称 +% \item 索引头排序字符串(排序) +% \item 索引头文字 +% \item 索引头后缀字符串(排序,新增) +% \item 索引头后缀文字 +% \item 索引类型(\opt{main}/\opt{usage} 等) +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_special_index_aux:nnnnnnn #1#2#3#4#5#6#7 + { + \tl_set:Nn \l_@@_index_escaped_key_tl {#1} + \@@_quote_special_char:N \l_@@_index_escaped_key_tl + \@@_special_index_set:Nn + \l_@@_index_escaped_macro_tl {#2} + \str_if_eq:onTF { \@currenvir } { macrocode } + { \codeline@wrindex } + { + \str_case:nnF {#7} + { + { main } { \codeline@wrindex } + { usage } { \index } + } + { \HD@target \index } + } + { + \tl_if_empty:nF { #3 #4 #5 #6 } + { #3 #5 \actualchar #4 #6 \levelchar } + \l_@@_index_escaped_key_tl + \actualchar + { + \token_to_str:N \verbatim@font \c_space_tl + \l_@@_index_escaped_macro_tl + } + \encapchar + hdclindex { \the \c@HD@hypercount } {#7} + } + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{杂项} +% +% \begin{macro}{\StopSpecialIndexModule, +% \@@_special_index_module:nnnnN} +% 不对 \cs{cs} 和 \cs{tn} 等编索引。用于目录、索引等。 +% \begin{macrocode} +\DeclareDocumentCommand \StopSpecialIndexModule { } + { + \cs_set_eq:NN + \@@_special_index_module:nnnnN \use_none:nnnnn + } +\tl_map_inline:nn { \actualchar \encapchar \levelchar } + { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\meta} +% 重定义 \cs{meta} 命令,需要禁用中文、西文之间的空格。 +% \begin{macrocode} +\RenewDocumentCommand \meta { m } + { + \group_begin: + \sys_if_engine_xetex:T { \xeCJKsetup { CJKecglue = { } } } + \@@_meta:n {#1} + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% 重定向 \cls{l3doc} 中的一些提示信息。 +% \begin{macrocode} +\msg_redirect_name:nnn { l3doc } { foreign-internal } { log } +\msg_redirect_name:nnn { l3doc } { print-changes-howto } { log } +\msg_redirect_name:nnn { l3doc } { print-index-howto } { log } +% \end{macrocode} +% +% \begin{macrocode} +%<@@=> +\ExplSyntaxOff +% \end{macrocode} +% +% \subsubsection{排版样式设置} +% +% 目录中禁止对 \cs{cs} 和 \cs{tn} 等的索引。 +% \begin{macrocode} +\AtBeginDocument{% + \addtocontents{toc}{\StopSpecialIndexModule}} +% \end{macrocode} +% +% 设置 PDF 字符串中的命令替换。 +% \begin{macrocode} +\pdfstringdefDisableCommands{% + \let\path\meta + \let\opt\@firstofone} +% \end{macrocode} +% +% \begin{macro}[int]{\@multitoc@starttoc,\@starttoc} +% 目录分栏,相当于调用 \pkg{multitoc} 宏包。 +% \begin{macrocode} +\let\@multitoc@starttoc\@starttoc +\renewcommand*\@starttoc[1]{% + \begin{multicols}{2}% + \@multitoc@starttoc{#1}% + \end{multicols}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@makefntext} +% 调整脚注文本缩进。 +% \begin{macrocode} +\renewcommand\@makefntext[1]{\parindent 0em\noindent\@makefnmark~#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IndexLayout,\indexname} +% 调整索引外观。 +% \begin{macrocode} +\IndexPrologue{% + \section{\indexname}% + \textit{意大利体的数字表示对应索引项出现的页码; + 带下划线的数字表示定义对应索引项的代码行号; + 其他则表示使用对应索引项的代码行号.}} +\def\IndexLayout{% + \newgeometry{% + left = 0.85 in, + right = 0.85 in, + top = 1.25 in, + bottom = 1.00 in}% + \setlength\IndexMin{0.5\textheight}% + \ctexset{section/numbering=false}% + \StopSpecialIndexModule} +\def\indexname{代码索引} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\usage} +% 控制“描述对应索引项的页码”样式。在 \pkg{doc} 宏包中的定义为 +% \tn{textit}。 +% \begin{macrocode} +% \def\usage#1{\textsf{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glossaryname} +% 调整修订记录外观。 +% \begin{macrocode} +\GlossaryPrologue{\section{\glossaryname}} +\def\glossaryname{修订记录} +% \end{macrocode} +% \end{macro} +% +% 版式排版格式。 +% \begin{macrocode} +\ctexset{% + section/name = {第,节}, + section/format+ = \raggedright, + paragraph/runin = false, + paragraph/numbering = false, + punct = kaiming} +\setcounter{secnumdepth}{4} +\setcounter{tocdepth}{3} +\pagestyle{plain} +% \end{macrocode} +% +% 单位设置(\pkg{siunitx} 宏包)。 +% \begin{macrocode} +\sisetup{% + number-math-rm = \ensuremath, + inter-unit-product = \ensuremath{{}\cdot{}}, + group-digits = true, + group-minimum-digits = 4, + group-separator = \text{~}, + range-phrase = \symbol{"FF5E}, + separate-uncertainty = true} +% \end{macrocode} +% +% 超链接设置(\pkg{hyperref} 宏包)。 +% \begin{macrocode} +\hypersetup{% + bookmarksdepth = 4, + bookmarksnumbered = true, + colorlinks = true, + citecolor = MaterialGreen, + linkcolor = MaterialPink, + urlcolor = MaterialIndigo} +% \end{macrocode} +% +% 浮动体标题设置(\pkg{caption} 宏包)。 +% \begin{macrocode} +\captionsetup{labelsep = quad, labelfont+ = bf} +% \end{macrocode} +% +% 设置标准列表环境样式。 +% \begin{macrocode} +\setlist{noitemsep, topsep=\smallskipamount} +\setlist[1]{labelindent=\parindent} +\setlist[enumerate]{leftmargin=*} +\setlist[itemize]{leftmargin=*} +% \end{macrocode} +% +% \begin{environment}{optdesc} +% 用于描述各选项。设置条目间距为 \tn{marginparsep},与 +% \cls{l3doc} 一致。 +% \begin{macrocode} +\newlist{optdesc}{description}{3} +\setlist[optdesc]{% + font=\mdseries\small\ttfamily, align=right, + listparindent=\parindent, + labelsep=\marginparsep, labelindent=-\marginparsep, + leftmargin=*} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{tablenotes} +% \begin{variable}{tpt@id} +% 重新定义 \pkg{threeparttable} 包的 \env{tablenotes} 环境, +% 用于表格的注释。 +% \begin{macrocode} +\renewlist{tablenotes}{description}{1} +\setlist[tablenotes]{% + format=\normalfont\tnote@item, align=right, + listparindent=\parindent, labelindent=\tabcolsep, + leftmargin=*, rightmargin=\tabcolsep, + after=\@noparlisttrue} +\AtBeginEnvironment{tablenotes}{% + \setlength\parindent{2\ccwd}% + \normalfont\footnotesize} +\AtBeginEnvironment{threeparttable}{% + \stepcounter{tpt@id}% + \edef\curr@tpt@id{tpt@\arabic{tpt@id}}} +\newcounter{tpt@id} +% \end{macrocode} +% \end{variable} +% \end{environment} +% +% \begin{macro}[int]{\tnote@item,\TPTtagStyle} +% 为 \tn{tnote} 增加超链接。 +% \begin{macrocode} +\def\tnote@item#1{% + \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1} +\def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UrlAlphabet,\UrlDigits} +% 网址断行。\tn{UrlOrds}、\tn{UrlAlphabet} 和 \tn{UrlDigits} +% 分别记录了特殊符号、字母和数字,把它们依次附加在 \pkg{url} 宏包 +% 提供的命令 \tn{UrlBreaks} 之后,即可允许在这些位置处断行。与 +% \cs{nwafu_allow_url_break:} 的原理是相同的。 +% \begin{macrocode} +\def\UrlAlphabet{% + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j% + \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t% + \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D% + \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N% + \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X% + \do\Y\do\Z} +\def\UrlDigits{% + \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0} +\g@addto@macro\UrlBreaks{\UrlOrds} +\g@addto@macro\UrlBreaks{\UrlAlphabet} +\g@addto@macro\UrlBreaks{\UrlDigits} +% \end{macrocode} +% \end{macro} +% +% 不对下列各项添加索引。 +% \begin{macrocode} +\DoNotIndex{\begin,\end, + \a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m, + \n,\o,\p,\q,\r,\s,\t,\u,\v,\w,\x,\y,\z, + \A,\B,\C,\D,\E,\F,\G,\H,\I,\J,\K,\L,\M, + \N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z, + \0,\1,\2,\3,\4,\5,\6,\7,\8,\9} +% \end{macrocode} +% +% 启用索引、交叉引用、历史记录。 +% \begin{macrocode} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +% \end{macrocode} +% +% \subsubsection{文档层命令} +% +% \begin{macro}{\exptarget,\rexptarget,\expstar,\rexpstar, +% \__codedoc_typeset_exp:,\__codedoc_typeset_rexp:} +% 部分命令之后的特殊符号($\symbol{"263A}$ 或 $\symbol{"263B}$),表明其不同用法。 +% 这里的“exp”和“rexp”分别源自 \LaTeX3 中的“expandable” +% 和“restricted-expandable”。 +% \begin{macrocode} +\newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}} +\newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}} +\newcommand*\expstar{\hyperlink{expstar}{$\symbol{"263B}$}} +\newcommand*\rexpstar{\hyperlink{rexpstar}{$\symbol{"263A}$}} +\ExplSyntaxOn +\cs_set_eq:NN \__codedoc_typeset_exp: \expstar +\cs_set_eq:NN \__codedoc_typeset_rexp: \rexpstar +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\marg,\oarg,\parg} +% 几种命令参数: +% \begin{itemize} +% \item 必选参数:|{|\meta{arg}|}|; +% \item 可选参数:|[|\meta{arg}|]|; +% \item 图形参数:|(|\meta{arg}|)|。 +% \end{itemize} +% \begin{macrocode} +\renewcommand*\marg[1]{\{\meta{#1}\}} +\renewcommand*\oarg[1]{[\meta{#1}]} +\renewcommand*\parg[1]{(\meta{#1})} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\opt} +% 选项名。 +% \begin{macrocode} +\DeclareDocumentCommand\opt{m}{\texttt{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\kvopt} +% \meta{key} |=| \meta{value} 型选项。 +% \begin{macrocode} +\DeclareDocumentCommand\kvopt{mm} + {\texttt{#1\breakablethinspace=\breakablethinspace#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\breakablethinspace} +% 允许换行的细间距。 +% \begin{macrocode} +\def\breakablethinspace{\hskip 0.16667em\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\syntaxopt,\defaultval} +% \begin{macro}[int]{\syntaxopt@aux,\defaultval@aux} +% \env{syntax} 中的选项及命令选项。 +% |aux| 结尾的两个命令用于定义利用 |<>| 和 |()| 的简写形式。 +% \begin{macrocode} +\def\syntaxopt#1{\textit{#1}} +\def\defaultval#1{\textbf{\textup{#1}}} +\def\syntaxopt@aux#1>{\syntaxopt{#1}} +\def\defaultval@aux#1){\defaultval{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\orbar,\TF,\TTF,\TFF} +% \env{syntax} 中的选项分隔符,以及 \opt{true} 或 \opt{false} +% 选项的几种快捷方式。 +% \begin{macrocode} +\def\orbar{\textup{\textbar}} +\def\TF{true\orbar false} +\def\TTF{\defaultval{true}\orbar false} +\def\TFF{true\orbar\defaultval{false}} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{arguments} +% 放在 \env{macro} 环境中,用于描述对应命令的参数。 +% \cls{l3doc} 中的定义 \opt{labelsep} 设置不太合理,会使标签被覆盖, +% 这里重新定义。 +% \begin{macrocode} +\DeclareDocumentEnvironment{arguments}{} + {\enumerate[% + label={\texttt{\#\arabic*:~}}, labelsep=0pt, nolistsep]}% + {\endenumerate} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\TeX,\LaTeX,\LaTeXe, +% \pdfTeX,\pdfLaTeX,\XeTeX,\XeLaTeX,\LuaTeX,\LuaLaTeX, +% \AmSLaTeX,\TeXLive,\MiKTeX,\BibTeX,\biber,\TikZ} +% \TeX{} 相关标志。 +% \begin{macrocode} +\def\TeX{\hologo{TeX}} +\def\LaTeX{\hologo{LaTeX}} +\def\LaTeXe{\hologo{LaTeXe}} +\def\pdfTeX{\hologo{pdfTeX}} +\def\pdfLaTeX{\hologo{pdfLaTeX}} +\def\XeTeX{\hologo{XeTeX}} +\def\XeLaTeX{\hologo{XeLaTeX}} +\def\LuaTeX{\hologo{LuaTeX}} +\def\LuaLaTeX{\hologo{LuaLaTeX}} +\def\AmSLaTeX{\hologo{AmSLaTeX}} +\def\TeXLive{\TeX\ Live} +\def\MiKTeX{\hologo{MiKTeX}} +\def\BibTeX{\hologo{BibTeX}} +\def\BibTeX{\hologo{BibTeX}} +\def\biber{\hologo{biber}} +% \end{macrocode} +% 该定义来自 \file{pgfmanual-en-macros.tex}。 +% \begin{macrocode} +\def\TikZ{Ti\emph{k}Z} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cs,\tn} +% \begin{macro}[int]{\codedoc@cs,\codedoc@tn} +% 控制序列。 +%^^A Colors are used for debug. +% \begin{macrocode} +% \let\codedoc@cs=\cs +% \let\codedoc@tn=\tn +% \renewcommand*\cs[2][]{% +% \textcolor{MaterialIndigo}{\codedoc@cs[#1]{#2}}} +% \renewcommand*\tn[2][]{% +% \textcolor{MaterialPink}{\codedoc@tn[#1]{#2}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\file,\env,\pkg,\cls} +% 文件、环境、宏包、文档类。 +% \begin{macrocode} +% \renewcommand*\file[1]{% +% \textcolor{MaterialGrey900}{\texttt{#1}}} +\renewcommand*\env[1]{\textbf{\texttt{#1}}} +% \renewcommand*\pkg[1]{\textsf{#1}} +% \renewcommand*\cls[1]{\textit{\textsf{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bashcmd} +% Bash 中的命令。 +% \begin{macrocode} +\newcommand*\bashcmd[1]{\texttt{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\scite} +% 位于上标的文献引用。 +% \begin{macrocode} +\newcommand*\scite[1]{\textsuperscript{\cite{#1}}} +% \end{macrocode} +% \end{macro} +% +% \paragraph{示例代码环境} +% +% \pkg{listings} 宏包中连字符 |-| 原本以数学模式输出,此处改为普通文本。 +% 见 \url{https://tex.stackexchange.com/a/33188}。 +% \begin{macrocode} +\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} +\@empty\z@\@empty +% \end{macrocode} +% +% \changes{v0.5}{2017/09/05}{[\pkg{nwafudoc}] 移除 \pkg{listings} +% 关键字定义文件。} +% +% 定义几种代码样式。 +% \begin{macro}[int]{style@base} +% \begin{macrocode} +\lstdefinestyle{style@base} + { + basewidth = 0.5 em, + gobble = 3, + lineskip = 2 pt, + frame = l, + framerule = 1 pt, + framesep = 0 pt, + escapeinside = {(*}{*)}, + basicstyle = \small\ttfamily\color{MaterialGrey900}, + keywordstyle = \bfseries\color{MaterialIndigo}, + commentstyle = \itshape\color{MaterialGrey600}, + stringstyle = \color{MaterialRed}, + backgroundcolor = \color{MaterialGrey50} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{style@shell} +% \begin{macrocode} +\lstdefinestyle{style@shell} + { + style = style@base, + rulecolor = \color{MaterialPink}, + language = bash, + alsoletter = {-}, + emphstyle = \color{MaterialGreen800} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{style@latex} +% \begin{macrocode} +\lstdefinestyle{style@latex} + { + style = style@base, + rulecolor = \color{MaterialIndigo}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + texcsstyle = *\color{MaterialDeepOrange}, + emphstyle = [1]\color{MaterialGreen800}, + emphstyle = [2]\color{MaterialTeal} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{style@syntax} +% \begin{macrocode} +\lstdefinestyle{style@syntax} + { + basewidth = 0.5 em, + gobble = 6, + escapeinside = {(*}{*)}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + basicstyle = \footnotesize\ttfamily\color{MaterialGrey900}, + keywordstyle = \bfseries\color{MaterialIndigo}, + commentstyle = \itshape\color{MaterialGrey600}, + texcsstyle = *\color{MaterialDeepOrange}, + emphstyle = [1]\color{MaterialGreen800}, + emphstyle = [2]\color{MaterialTeal} + } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{shellexample} +% \begin{environment}{latexexample} +% Shell 和 \LaTeX{} 示例代码。 +% \begin{macrocode} +\lstnewenvironment{shellexample}[1][]{% + \lstset{style=style@shell, #1}}{} +\lstnewenvironment{latexexample}[1][]{% + \lstset{style=style@latex, #1}}{} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{environment}{nwafusyntax} +% 语法说明。用于代替 \cls{l3doc} 中的 \env{syntax} 环境。 +% \begin{macrocode} +\lstnewenvironment{nwafusyntax}[1][]{% + \lstset{style=style@syntax, #1}\vspace{-1.8ex}}{} +% +% \end{macrocode} +% \end{environment} +% +% \changes{v0.7c}{2019/03/15}{不再附带 \pkg{latexmk} 配置文件。} +% +% \clearpage +% +% \end{implementation} +% diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx new file mode 100644 index 0000000000..65e14263b3 --- /dev/null +++ b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx @@ -0,0 +1,7911 @@ +% \iffalse meta-comment +% !TeX program = XeLaTeX +% !TeX encoding = UTF-8 +% +% Copyright (C) 2019--2022 by Nan Geng +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Nan Geng. +% +% This work consists of the files nwafuthesis.dtx, +% nwafuthesis-doc.dtx, +% and the derived files nwafuthesis.ins, +% nwafuthesis.cls, +% nwafudoc.cls, +% +%<*internal> +\iffalse +% +% +%<*internal> +\fi +\begingroup + \def\NameOfLaTeXe{LaTeX2e} +\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else +\csname fi\endcsname +% +% +%<*install> +\input l3docstrip.tex +\keepsilent +\askforoverwritefalse + +\preamble + + Copyright (C) 2019--2022 by Nan Geng + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. The latest version of this license is in: + + http://www.latex-project.org/lppl.txt + + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Nan Geng. + + This work consists of the files nwafuthesis.dtx, + nwafuthesis-doc.dtx, + and the derived files nwafuthesis.ins, + nwafuthesis.cls, + nwafudoc.cls, + +\endpreamble + +\generate{ + \usedir{tex/latex/nwafuthesis} + \file{\jobname.cls} {\from{\jobname.dtx}{class}} + \file{nwafudoc.cls} {\from{\jobname.dtx}{doc} + \from{\jobname-doc.dtx}{doc}} +% +%<*internal> + \usedir{source/latex/nwafuthesis} + \file{\jobname.ins} {\from{\jobname.dtx}{install}} +% +%<*install> + \usedir{doc/latex/nwafuthesis} + \nopreamble\nopostamble +} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* files into a directory searched by TeX: *} +\Msg{* *} +\Msg{* The recommended directory is TDS:tex/latex/nwafuthesis *} +\Msg{* *} +\Msg{* nwafuthesis.cls *} +\Msg{* nwafudoc.cls *} +\Msg{* *} +\Msg{* To produce the documentation, run the file nwafuthesis.dtx*} +\Msg{* through XeLaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile +% +% +%<*internal> +\fi +% +% +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} +%<*!(driver|install)> +%\GetIdInfo $Id: nwafuthesis.dtx 1.00 2021-05-12 15:30:00Z Nan Geng $ +% {Thesis template for Northwest A\&F University} +%\ProvidesExplClass{\ExplFileName} +% {Definition file for nwafuthesis} +%\ProvidesExplFile{\ExplFileName.def} +% {Documentation class for nwafuthesis} +%\ProvidesExplClass{nwafudoc} +% {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% +%<*driver> +% \PassOptionsToPackage{showframe}{geometry} +\documentclass{nwafudoc} +\usepackage{multirow,xeCJKfntef,xpinyin,csquotes} +\hypersetup{ + pdftitle = {nwafuthesis: 西北农林科技大学学位论文模板}, + pdfauthor = {耿楠} + } +% 全角标点放在引号中,需要改成半角式,否则间距过大,不好看 +\def\FSID{“{\xeCJKsetup{PunctStyle=banjiao}。}”} % U+3002 +\def\FSFW{“{\xeCJKsetup{PunctStyle=banjiao}.}”} % U+FF0E +\def\COFW{“{\xeCJKsetup{PunctStyle=banjiao}:}”} % U+FF1A +\def\SCFW{“{\xeCJKsetup{PunctStyle=banjiao};}”} % U+FF1B + +% nwafuthesis的LOGO +\newcommand{\nwafuthesis}{% + \makebox{\rmfamily% + N\hspace{-0.2ex}\raisebox{-0.5ex}{W}\raisebox{0.5ex}{\hspace{-0.2ex}\textsc{AFU}}\hspace{0.3ex}% + \textsc{Thesis}}} + +\title{\textcolor{MaterialIndigo800}{% + \textbf{\nwafuthesis: 西北农林科技大学学位论文 + \xpinyin[font=\sffamily,format=\color{MaterialIndigo800}]{模}{mu2}板}}} +\author{耿楠} +\date{\today\quad v1.00% + \thanks{\url{https://gitee.com/nwafu_nan/nwafuthesis-l3}.}} + +\begin{document} +\DisableImplementation +% \EnableImplementation +% \def\nwafuCODEDOC{} + \DocInput{nwafuthesis.dtx} + \DocInput{nwafuthesis-doc.dtx} +\IndexLayout +\PrintChanges +\PrintIndex +\end{document} +% +% \fi +% +% \changes{v1.00}{2021/06/06}{开始发布测试。} +% \changes{v1.00}{2021/05/12}{开始编写模板。} +% +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +%^^A 禁止使用 " 符号作为抄录文本缩略符 +% \DeleteShortVerb\" +% +%^^A 封面与目录的页边距 +% \newgeometry{ +% left = 1.25 in, +% right = 1.25 in, +% top = 1.25 in, +% bottom = 1.00 in +% } +% +% \maketitle +% \vfill +% \begin{center} +% \includegraphics[width=0.20\textwidth]{logo/nwafu-circle.pdf}\\[3ex] +% \includegraphics[width=0.5\textwidth]{logo/motto} +% \end{center} +% \vfill +% \begin{center} +% \includegraphics[width=0.6\textwidth]{logo/building} +% \end{center} +% \vfill +% \begin{center} +% \bfseries\zihao{1}经国本\qquad{}解民生\qquad{}尚科学 +% \end{center} +% \vfill +% \thispagestyle{empty} +% \clearpage +% +% \pagenumbering{Roman} +% \tableofcontents +% \clearpage +% +% \pagenumbering{arabic} +% \EnableDocumentation +%^^A \DisableDocumentation +% +% \begin{documentation} +% +%^^A 用户手册的页边距 +% \newgeometry{ +% left = 1.65 in, +% right = 0.80 in, +% top = 1.25 in, +% bottom = 1.00 in +% } +% +% \section{简介} +% +% 目前,西北农林科技大学 \LaTeX{} 学位论文模板是由信息工程学院 +% 耿楠老师编写的\cls{nwafuthesis}模板。 +% 该模板是基于\LaTeXe{}开发,虽然一直在维护,但由于初期开发代码的不规范, +% 其维护成本较高,为此,在借鉴\scite{fduthesis}的基础上, +% 用 \LaTeX3 \scite{source3}根据\scite{西北农林科技大学研究生论文写作指南}和 +% \scite{西北农林科技大学本科生论文撰写规范} +% 重构了\cls{nwafuthesis}模板,以适应 \TeX{} 技术的发展。 +% 同时\cls{nwafuthesis}还构建了一套简洁的用户接口,以方便用户使用。 +% 新模板更加稳定,普适性更强,运行效率更高。 +% +% \subsection*{\LaTeX{} 入门} +% +% 本文档并非是一份 \LaTeX{} 零基础教程。如果是完完全全的新手, +% 建议先阅读相关入门文档,如刘海洋编著的《\LaTeX{} 入门》 +% \scite{刘海洋2013latex入门} 第一章,或大名鼎鼎的“\pkg{lshort}” +% \scite{lshort} 及其中文翻译版 \scite{lshort-zh-cn}。当然, +% 网络上诸如耿楠录制的\LaTeX{}教学系列视频等入门教程多如牛毛,可以自行选取学习。 +% +% \subsection*{关于本文档} +% +% 本文采用不同字体表示不同内容。无衬线字体表示宏包名称,如 +% \pkg{xeCJK} 宏包、\cls{nwafuthesis} 文档类等;等宽字体表示代码或 +% 文件名,如 \cs{nwafuset} 命令、\env{abstract} 环境、\TeX{} 文档 +% \file{thesis.tex} 等;带有尖括号的楷体(或西文斜体)表示命令参数, +% 如 \meta{模板选项}、\meta{English title} 等。在使用时,不必输入参数两侧 +% 的尖括号。示例代码进行了语法高亮处理,以方便阅读。 +% +% 在用户手册中,带有蓝色侧边线的为 \LaTeX{} 代码,而带有粉色侧边线 +% 的则为电脑命令行代码,请注意区分。模板提供的选项、命令、环境等, +% 均用横线框起,同时给出使用语法和相关说明。 +% +% 手册中的代码实现部分主要面向对 \LaTeX{} 宏包开发感兴趣的用户。 +% 如果有任何改进意见或者功能需求,欢迎前往 Gitee 仓库提交issue。 +% +% 文档的最后还提供了版本历史和代码索引,以供查阅。 +% +% \section{安装} +% +% \changes{v1.00}{2021/08/05}{修改安装说明,提交ctan。} +% \subsection{获取 \cls{nwafuthesis}} +% +% \subsubsection{标准安装} +% +% 如果没有特殊理由,强烈建议使用宏包管理器安装 \cls{nwafuthesis}。 +% 例如在 \TeXLive{} 中,执行(可能需要管理员权限) +% \begin{shellexample}[morekeywords={tlmgr,install}] +% tlmgr install nwafuthesis +% \end{shellexample} +% 即可完成安装。 +% +% 当然,在 \TeXLive{} 和 \MiKTeX{} 中,也可以通过图形界面进行安装, +% 此处不再赘述,请参阅软件帮助。 +% +% \subsubsection{手动安装} +% +% 可以从\cls{nwafuthesis}源代码直接生成模板(不推荐): +% +% \begin{itemize} +% \item 打开 \href{https://gitee.com/nwafu_nan/nwafuthesis-l3}^^A +% {Gitee仓库主页},点击“克隆/下载”,并选择“下载ZIP”, +% 下载 \file{nwafuthesis-master.zip};如果的电脑中安装有 git +% 程序,也可通过以下命令直接克隆代码仓库: +% \begin{shellexample}[gobble=7,alsoletter={.},^^A +% morekeywords={git,clone}] +% git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git +% \end{shellexample} +% \item 在解压后的目录中或进入克隆后的仓库目录,然后执行以下命令以生成 +% 模板的各组件: +% \begin{shellexample}[gobble=7,morekeywords={xetex}] +% xetex nwafuthesis.dtx +% \end{shellexample} +% \item 将生成的文档类(\file{.cls})复制到 \TeX{} 发行版本地 TDS 树 +% 的 \path{texmf-local/tex/latex/nwafuthesis/} 目录下,并执行 +% \bashcmd{mktexlsr} 刷新文件名数据库,方可完成安装。 +% \end{itemize} +% +% \subsubsection{扁平化安装} +% +% 如果您不希望安装本模板,但需要立刻使用,也可以使用模板提供的安装脚本。 +% +% \begin{itemize} +% \item 打开 \href{https://gitee.com/nwafu_nan/nwafuthesis-l3}^^A +% {Gitee仓库主页},点击“克隆/下载”,并选择“下载ZIP”, +% 下载 \file{nwafuthesis-master.zip};如果的电脑中安装有 git +% 程序,也可通过以下命令直接克隆代码仓库: +% \begin{shellexample}[gobble=7,alsoletter={.},^^A +% morekeywords={git,clone}] +% git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git +% \end{shellexample} +% \item 在解压后的目录中或进入克隆后的仓库目录,然后执行以下命令以生成 +% 模板的各组件: +% \begin{itemize} +% \item Windows系统: +% \begin{shellexample}[gobble=11,morekeywords={build-win}] +% build-win +% \end{shellexample} +% \item Linux系统: +% \begin{shellexample}[gobble=11,morekeywords={build.sh}] +% ./build.sh +% \end{shellexample} +% \end{itemize} +% \item 将生成的文档类文件(\file{nwafuthesis.cls})复制到 +% 论文撰写工作目录,然后开始撰写论文。 +% \end{itemize} +% +% \subsection{模板组成} +% +% 本模板主要包含核心文档类、示例项目以及用户文档等几个 +% 部分,其具体组成见表~\ref{tab:nwafuthesis-components}。 +% +% \begin{table}[ht] +% \caption{\cls{nwafuthesis} 的主要组成部分} +% \label{tab:nwafuthesis-components} +% \centering +% \begin{tabular}{lp{20em}} +% \toprule +% \textbf{文件} & \textbf{功能说明} \\ +% \midrule +% \file{nwafuthesis.cls} & 模板文档类 \\ +% \file{nwafudoc.cls} & 编译该用户手册时需要的文档类 \\ +% \file{nwafuthesis.pdf} & 用户手册 \\ +% \file{main.tex} & 空白模板,可以此为基础撰写论文 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \section{使用说明} +% +% \subsection{基本用法} +% +% 以下是一份简单的 \TeX{} 文档,它演示了 \cls{nwafuthesis} +% 的最基本用法: +% \begin{latexexample}[deletetexcs={\documentclass},% +% moretexcs={\chapter},morekeywords={\documentclass},% +% emph={[2]document}] +% % main.tex +% \documentclass{nwafuthesis} +% \begin{document} +% \chapter{欢迎} +% \section{欢迎使用nwafuthesis!} +% 你好,\LaTeX{}! +% \end{document} +% \end{latexexample} +% +% 按照 \ref{subsec:编译方式}~小节中的方式编译该文档,应当得到 +% 一篇包含封面、独创声明等在内的空白论文(研究生7页,本科生3页)。 +% +% +% \subsection{编译方式} \label{subsec:编译方式} +% +% 本模板不支持 \pdfTeX{} 引擎,请使用 \XeLaTeX{} 或 \LuaLaTeX{} +% 编译,推荐使用 \XeLaTeX{}编译。为了生成正确的目录、脚注、参考文献以及交叉引用, +% 至少需要连续编译四次。 +% +% 假设\TeX{} 源文件名为 \file{main.tex},使用 \XeLaTeX{} 编译论文。 +% 则在命令行中可以顺序执行: +% \begin{shellexample}[morekeywords={xelatex}] +% xelatex main +% biber main +% xelatex main +% xelatex main +% \end{shellexample} +% 或使用带有参数\meta{-xelatex}的 \pkg{latexmk}命令: +% \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}] +% latexmk -xelatex main +% \end{shellexample} +% +% 如果使用 \LuaLaTeX{} 编译论文,请在命令行中顺序执行: +% \begin{shellexample}[morekeywords={lualatex}] +% lualatex main +% biber main +% lualatex main +% lualatex main +% \end{shellexample} +% 或者执行带有\meta{-lualatex}的latexmk命令 +% \begin{shellexample}[morekeywords={latexmk},emph={-lualatex}] +% latexmk -lualatex main +% \end{shellexample} +% +% 由于我校参考文献格式的特殊性,本模板基于 +% 胡振震编写的符合GB/T7714-2015的biblatex样式文件\scite{biblatex-gb7714-2015} +% 实现了参考文献排版,并在后台强制使用biber引擎编译参考文献。 +% 因此,在第2次编译时,请务必\textbf{使用biber进行编译}。 +% +% 关于如何配置TeXStudio等IDE工具,以实现正确编译,请 +% 参阅其使用说明书。 +% +% \subsection{模板选项} +% +% 所谓\enquote{模板选项}是指在用\tn{documentclass}命令引入文档类时能够指定的选项: +% \begin{latexexample}[deletetexcs={\documentclass},% +% morekeywords={\documentclass}] +% \documentclass(*\oarg{模板选项}*){nwafuthesis} +% \end{latexexample} +% +% 有些模板选项为布尔型,只能取 \opt{true} 或 \opt{false}。 +% 对于这些选项,\kvopt{\meta{选项}}{true} 中的“|= true|” +% 可以省略。 +% +% \begin{function}[added=2021-05-12]{type} +% \begin{nwafusyntax}[emph={[1]type}] +% type = (**) +% \end{nwafusyntax} +% 选择论文类型。三种选项分别代表博士学位论文、硕士学位论文和本科 +% 毕业论文。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{oneside,twoside} +% 指明论文的单双面模式,默认为 \opt{twoside}。 +% \end{function} +% +% 无论是双面模式(\opt{twoside}),还是单面模式(\opt{oneside}), +% 第一章都是从奇数页开始,而其后各章都是接上一章另起一页起排。 +% 本模板中,目录、摘要、主要符号表对照表、附录、参考文献、致谢、 +% 个人简历等均视作章,也按相同方式排版。 +% +% 对于研究生学位论文,奇数页页眉是章名称,偶数页页眉是 +% “西北农林科技大学博士(或硕士)学位论文”。 +% 对于本科生生毕业论文(设计),奇数页页眉是章名称,偶数页页眉是 +% 论文(设计)题目。 +% +% \begin{function}[added=2021-05-12]{draft} +% \begin{nwafusyntax}[emph={[1]draft}] +% draft = (*<\TFF>*) +% \end{nwafusyntax} +% 选择是否开启草稿模式,默认关闭。 +% \end{function} +% +% 草稿模式为全局选项,会影响到很多宏包的工作方式。 +% 开启之后,主要的变化有: +% \begin{itemize} +% \item 将行溢出的盒子显示为黑色方块; +% \item 不插入图片,只输出一个占位方框; +% \item 关闭超链接渲染,也不生成 PDF 书签; +% \item 显示页面边框。 +% \end{itemize} +% +% \subsection{参数设置} +% +% \begin{function}[added=2021-05-12]{\nwafuset} +% \begin{nwafusyntax}[morekeywords={\nwafuset}] +% \nwafuset(*\marg{键值列表}*) +% \end{nwafusyntax} +% 本模板提供了一系列选项,以实现论文格式和作者、指导教师等 +% 基本信息的配置。载入\pkg{nwafuthesis}文档类之后,以下 +% 所有选项均可通过统一的\cs{nwafuset}命令进行设置。 +% \end{function} +% +% \cs{nwafuset} 的参数是一组由(英文)逗号隔开的选项列表,列表中的 +% 选项通常是 \kvopt{\meta{key}}{\meta{value}} 形式。部分选项的 +% \meta{value} 可以省略。对于同一项,后续设置会覆盖以前的设置。 +% 在下文的说明中,将用\textbf{粗体}表示默认值。 +% +% \cs{nwafuset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种 +% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意, +% 参数列表中\textbf{不可以出现空行}。 +% +% 与模板选项相同,布尔型的参数 \kvopt{\meta{选项}}{true} +% 中的“|= true|”可以省略。 +% +% 另有一些选项包含子选项,如 \opt{style} 、\opt{abstract}和 \opt{info} 等。它们可以 +% 按如下两种等价方式来设定: +% \begin{latexexample}[morekeywords={\nwafuset},% +% emph={[1]style,cjk-font,font-size,info,title,title*,author,author*,department}] +% \nwafuset{ +% style = {cjk-font = adobe, font-size = -4}, +% info = { +% title = {说C解C}, +% title* = {C Story}, +% author = {耿楠}, +% author* = {Nan Geng}, +% department = {信息工程学院} +% } +% } +% \end{latexexample} +% 或者 +% \begin{latexexample}[morekeywords={\nwafuset},% +% emph={[1]style,cjk-font,font-size,info,title,title*,author,author*,department}] +% \nwafuset{ +% style/cjk-font = adobe, +% style/font-size = -4, +% info/title = {说C解C}, +% info/title* = {C Story}, +% info/author = {耿楠}, +% info/author* = {Nan Geng}, +% info/department = {信息工程学院} +% } +% \end{latexexample} +% +% 注意 “|/|” 的前后均不可以出现空白字符。 +% +% \subsubsection{论文格式} \label{subsubsec:论文格式} +% +% \begin{function}[added=2021-05-12]{style} +% \begin{nwafusyntax}[emph={[1]style}] +% style = (*\marg{键值列表}*) +% style/(*\meta{key}*) = (*\meta{value}*) +% \end{nwafusyntax} +% 该选项包含多个子项目,用于设置字体、字号等论文格式,具体内容见下。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{style/font} +% \begin{nwafusyntax}[emph={[1]font}] +% font = (**) +% \end{nwafusyntax} +% 设置西文字体(包括数学字体)。具体配置见表~\ref{tab:font}。 +% 该选项若未指定,则由根据操作系统进行选择,Windows取times*,MacOS取times*,Linux取times。 +% \end{function} +% +% \begin{table}[ht] +% \begin{threeparttable} +% \caption{西文字体配置} +% \label{tab:font} +% \centering +% \begin{tabular}{ccccc} +% \toprule +% & \strong{正文字体} & \strong{无衬线字体} & \strong{等宽字体} & \strong{数学字体} \\ +% \midrule +% |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\ +% |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\ +% |lm| & LM Roman & LM Sans & LM Mono & LM Math \\ +% |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\ +% |times| & XITS & TG Heros & TG Cursor & XITS Math \\ +% |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\ +% \bottomrule +% \end{tabular} +% \begin{tablenotes} +% \item[a] “LM”是 Latin Modern 的缩写。 +% \item[b] “TG”是 TeX Gyre 的缩写。 +% \item[c] 本行中,Times New Roman、Arial 和 Courier New 是商业字体, +% 在 Windows 和 macOS 系统上均默认安装。 +% \end{tablenotes} +% \end{threeparttable} +% \end{table} +% +% \begin{function}[added=2021-05-12]{style/cjk-font} +% \begin{nwafusyntax}[emph={[1]cjk-font}] +% cjk-font = (**) +% \end{nwafusyntax} +% 设置中文字体。具体配置见表~\ref{tab:cjk-font}。 +% 该选项若未指定,则由根据操作系统进行选择,Windows取windows,MacOS取mac,Linux取fandol。 +% \end{function} +% +% \begin{table}[ht] +% \caption{中文字体配置} +% \label{tab:cjk-font} +% \centering +% \begin{tabular}{cccc} +% \toprule +% & \strong{正文字体(宋体)} & \strong{无衬线字体(黑体)} & \strong{等宽字体(仿宋)} \\ +% \midrule +% \multirow{2}*{|adobe|} & Adobe 宋体 & Adobe 黑体 & Adobe 仿宋 \\ +% & Adobe Song Std & Adobe Heiti Std & Adobe Fangsong Std \\ +% \multirow{2}*{|fandol|} & Fandol 宋体 & Fandol 黑体 & Fandol 仿宋 \\ +% & FandolSong & FandolHei & FandolFang \\ +% \multirow{2}*{|founder|} & 方正书宋 & 方正黑体 & 方正仿宋 \\ +% & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\ +% \multirow{2}*{|mac|} & (华文)宋体-简 & (华文)黑体-简 & 华文仿宋 \\ +% & Songti SC & Heiti SC & STFangsong \\ +% \multirow{2}*{|sinotype|} & 华文宋体 & 华文黑体 & 华文仿宋 \\ +% & STSong & STHeiti & STFangsong \\ +% \multirow{2}*{|sourcehan|} & 思源宋体 & 思源黑体 & --- \\ +% & Source Han Serif SC & Source Han Sans SC & --- \\ +% \multirow{2}*{|windows|} & (中易)宋体 & (中易)黑体 & (中易)仿宋 \\ +% & SimSun & SimHei & FangSong \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% 启用 \kvopt{font}{none} 或 \kvopt{cjk-font}{none} 之后,模板将关闭 +% 默认西文 / 中文字体设置。此时,需要自行使用 \cs{setmainfont}、 +% \cs{setCJKmainfont}、\cs{setmathfont} 等命令来配置字体。 +% +% \emph{关于字体配置,本模板完全采用\cls{fduthesis}模板代码}。 +% +% \begin{function}[added=2021-05-12]{style/font-size} +% \begin{nwafusyntax}[emph={[1]font-size}] +% font-size = (*<(-4)|5>*) +% \end{nwafusyntax} +% 设置论文的基础字号。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{style/fullwidth-stop} +% \begin{nwafusyntax}[emph={[1]fullwidth-stop}] +% fullwidth-stop = (**) +% \end{nwafusyntax} +% 选择是否把全角实心句点\FSFW 作为默认的句号形状。 +% 这种句号一般用于科技类文章,以避免与下标“$_o$”或“$_0$”混淆。 +% \end{function} +% +% 选择 \kvopt{fullwidth-stop}{catcode} 或 \opt{mapping} 后,都会实现 +% 上述效果。有所不同的是,在选择 \opt{catcode} 后,只有 +% \emph{显式的}\FSID 会被替换为\FSFW;但在选择 \opt{mapping} 后, +% \emph{所有的}\FSID 都会被替换。例如,如果用宏保存了一些含有 +% \FSID 的文字,那么在选择 \opt{catcode} 时,其中的\FSID 不会被 +% 替换为\FSFW。 +% +% 选项 \kvopt{fullwidth-stop}{mapping} 只在 \XeTeX{} 下有效。使用 +% \LuaTeX{} 编译时,该选项相当于 \kvopt{fullwidth-stop}{catcode}。 +% +% 如果在选择 \kvopt{fullwidth-stop}{mapping} 后仍需要临时显示 +% \FSID,可以按如下方法操作: +% \begin{latexexample}[moretexcs={\CJKfontspec},emph={[1]Mapping}] +% % 请使用 XeTeX 编译 +% % 外侧的花括号表示分组 +% 这是一个句号{\CJKfontspec{(*\meta{字体名}*)}[Mapping=full-stop]。} +% \end{latexexample} +% +% \emph{关于标点符号压缩,本模板完全采用\cls{fduthesis}模板代码}。 +% +% \begin{function}[added=2021-05-12]{style/footnote-style} +%^^A 这里奇怪的东西是用来控制对齐的。nwafusyntax 会吃掉开头的几个 +%^^A 空格,因此这里用 X 来占位。 +% \begin{nwafusyntax}[emph={[1]footnote-style}] +% footnote-style = (**) +% \end{nwafusyntax} +% 设置脚注编号样式。西文字体设置会影响其默认取值(见 +% 表~\ref{tab:footnote-font})。因此,要使得该选项生效,需将其 +% 放置在 \opt{font} 选项之后。带有 |sans| 的为相应的无衬线字体 +% 版本;带有 |*| 的为阴文样式(即黑底白字)。 +% \end{function} +% +% \begin{table}[ht] +% \caption{西文字体与脚注编号样式默认值的对应关系} +% \label{tab:footnote-font} +% \centering +% \begin{tabular}{ccccc} +% \toprule +% \textbf{西文字体设置} & +% |libertinus| & |lm| & |palatino| & |times| \\ +% \midrule +% \textbf{脚注编号样式默认值} & +% |libertinus| & |pifont| & |pifont| & |xits| \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \emph{关于脚注字体配置,本模板完全采用\cls{fduthesis}模板代码}。 +% +% \begin{function}[added=2021-05-12]{style/hyperlink} +% \begin{nwafusyntax}[emph={[1]hyperlink}] +% hyperlink = (**) +% \end{nwafusyntax} +% 设置超链接样式。\opt{border} 表示在超链接四周绘制方框; +% \opt{color} 表示用彩色显示超链接,可输出用于批阅的电子稿; +% \opt{none} 表示没有特殊装饰,可用于生成最终的打印版文稿。 +% \end{function} +% +% \begin{function}[added=2021-05-12,updated=2021-05-12]{style/hyperlink-color} +% \begin{nwafusyntax}[emph={[1]hyperlink-color}] +% hyperlink-color = (*<(default)|classic|elegant|fantasy|material|\\ +% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~~business|science|summer|autumn|graylevel|prl>*) +% \end{nwafusyntax} +% 设置超链接颜色。该选项在 \kvopt{hyperlink}{none} 时无效。 +% 各选项所代表的颜色见表~\ref{tab:hyperlink-color}。 +% \end{function} +% +% \begin{table}[ht] +% \centering +% \newcommand\linkcolorexam[3]{^^A +% {\small 图~\textcolor[HTML]{#1}{1-2}, +% (\textcolor[HTML]{#1}{3.4})~式} & +% {\small \textcolor[HTML]{#2}{\texttt{http://g.cn}}} & +% {\small 文献~[\textcolor[HTML]{#3}{1}], +% (\textcolor[HTML]{#3}{Knuth~1986})}} +% \begin{threeparttable} +% \caption{预定义的超链接颜色方案} +% \label{tab:hyperlink-color} +% \begin{tabular}{c*{3}{>{\hspace{0.2cm}}c<{\hspace{0.2cm}}}} +% \toprule +% \textsf{选项} & \textsf{链接} & \textsf{URL} & \textsf{引用} \\ +% \midrule +% \opt{default} & \linkcolorexam{990000}{0000B2}{007F00} \\ +% \opt{classic} & \linkcolorexam{FF0000}{0000FF}{00FF00} \\ +% \opt{elegant}\tnote{a} & \linkcolorexam{961212}{C31818}{9B764F} \\ +% \opt{fantasy}\tnote{b} & \linkcolorexam{FF4A19}{FF3F94}{934BA1} \\ +% \opt{material}\tnote{c} & \linkcolorexam{E91E63}{009688}{4CAF50} \\ +% \opt{business}\tnote{d} & \linkcolorexam{D14542}{295497}{1F6E43} \\ +% \opt{science}\tnote{e} & \linkcolorexam{CA0619}{389F9D}{FF8920} \\ +% \opt{summer}\tnote{f} & \linkcolorexam{00AFAF}{5F5FAF}{5F8700} \\ +% \opt{autumn}\tnote{f} & \linkcolorexam{D70000}{D75F00}{AF8700} \\ +% \opt{graylevel}\tnote{c} & \linkcolorexam{616161}{616161}{616161} \\ +% \opt{prl}\tnote{g} & \linkcolorexam{2D3092}{2D3092}{2D3092} \\ +% \bottomrule +% \end{tabular} +% \begin{tablenotes} +% \item[a] 来自 \href{https://tex.stackexchange.com/}^^A +% {\TeX{} - \LaTeX{} Stack Exchange 网站}。 +% \item[b] Adobe CC 产品配色。 +% \item[c] 取自 Material 色彩方案 +% (见 \url{https://material.io/guidelines/style/color.html})。 +% \item[d] Microsoft Office 2016 产品配色。 +% \item[e] 来自 \href{https://www.wolfram.com/}{Wolfram Research 网站}。 +% \item[f] 均取自 Solarized 色彩方案 +% (见 \url{http://ethanschoonover.com/solarized})。 +% \item[g] \textit{Physical Review Letter} 杂志配色。 +% \end{tablenotes} +% \end{threeparttable} +% \end{table} +% +% \emph{关于超链接配置,本模板完全采用\cls{fduthesis}模板的配置代码}。 +% +% \begin{function}[added=2021-05-12]{style/bib-resource} +% \begin{nwafusyntax}[emph={[1]bib-resource}] +% bib-resource = (*\marg{文件}*) +% \end{nwafusyntax} +% 参考文献数据源。可以是单个文件,也可以是用英文逗号隔开的一组文件。 +% 其中,各文献数据源文件必须明确给出 \file{.bib} +% 后缀名。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{style/logo} +% \begin{nwafusyntax}[emph={[1]logo}] +% logo = (*\marg{文件}*) +% \end{nwafusyntax} +% 封面中校名图片的文件名。默认值为 \file{logo/nwafu-bar.pdf}。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{style/logo-size} +% \begin{nwafusyntax}[emph={[1]logo-size}] +% logo-size = (*\marg{宽度}*) +% logo-size = {(*\meta{宽度}*), (*\meta{高度}*)} +% \end{nwafusyntax} +% 校名图片的大小。默认仅指定了宽度,为 |0.65\textwidth|\/。 +% 如果仅需指定高度,可在 \meta{宽度} 处填入一个空的分组 |{}|。 +% \end{function} +% +% \begin{function}[added=2021-05-12,updated=2021-5-22]{style/auto-make-cover} +% \begin{nwafusyntax}[emph={[1]auto-make-cover}] +% auto-make-cover = (*<\TTF>*) +% \end{nwafusyntax} +% 是否自动生成研究生论文的封面(封一)、英文封面(封二)、 +% 题名页(封三)、项目资助页(封四)、声明页(封五)和 +% 使用授权页(封六)。本科论文(设计)的封面(封一)和 +% 声明及使用授权页(封二)。 +% 封面中的各项信息,可通过 \cs{nwafuset} 录入, +% 具体请参阅 \ref{subsubsec:信息录入}~节。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{style/withchapter} +% \begin{nwafusyntax}[emph={[1]withchapter}] +% withchapter = (*<\TTF>*) +% \end{nwafusyntax} +% 选择论文章标题格式为章格式(如:第1章 绪论)还是报告格式(如:1 绪论)。 +% \end{function} +% +% \subsubsection{信息录入} \label{subsubsec:信息录入} +% +% \emph{这一部分代码基于\cls{fduthesis},并针对西北农林科技大学的要求, +% 进行了必要的删除和添加}。 +% +% \begin{function}[added=2021-05-12]{info} +% \begin{nwafusyntax}[emph={[1]info}] +% info = (*\marg{键值列表}*) +% info/(*\meta{key}*) = (*\meta{value}*) +% \end{nwafusyntax} +% 该选项包含许多子项目,用于录入论文信息。具体内容见下。以下带“|*|” +% 的项目表示对应的英文字段。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/degree} +% \begin{nwafusyntax}[emph={[1]degree}] +% degree = (*<(academic)|professional>*) +% \end{nwafusyntax} +% 学位类型,仅适用于硕士学位论文。\opt{academic} 和 \opt{professional} +% 分别表示学术学位和专业学位。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/btype} +% \begin{nwafusyntax}[emph={[1]btype}] +% btype = (*<(paper)|design>*) +% \end{nwafusyntax} +% 本科毕业类型,仅适用于本科。\opt{paper} 和 \opt{design} +% 分别表示论文和设计。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/title,info/title*} +% \begin{nwafusyntax}[emph={[1]title,title*}] +% title = (*\marg{中文标题}*) +% title* = (*\marg{英文标题}*) +% \end{nwafusyntax} +% 论文标题。默认会在约 20 个汉字字宽处强制断行,但为了语义的 +% 连贯以及排版的美观,如果的标题长于一行,建议使用“|\\|” +% 进行手动断行。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/author,info/author*} +% \begin{nwafusyntax}[emph={[1]author,author*}] +% author = (*\marg{姓名}*) +% author* = (*\marg{英文姓名或拼音}*) +% \end{nwafusyntax} +% 作者姓名。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/supervisor, info/supervisor*} +% \begin{nwafusyntax}[emph={[1]supervisor, supervisor*}] +% supervisor = (*\marg{姓名}*) +% supervisor* = (*\marg{英文姓名或拼音}*) +% \end{nwafusyntax} +% 导师姓名。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/cosupervisor, info/cosupervisor*} +% \begin{nwafusyntax}[emph={[1]cosupervisor, cosupervisor*}] +% cosupervisor = (*\marg{姓名}*) +% cosupervisor* = (*\marg{英文姓名或拼音}*) +% \end{nwafusyntax} +% 联合(协助)指导教师姓名。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/department, info/department*} +% \begin{nwafusyntax}[emph={[1]department, department*}] +% department = (*\marg{名称}*) +% department* = (*\marg{英文名称}*) +% \end{nwafusyntax} +% 学院名称。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/major,info/major*} +% \begin{nwafusyntax}[emph={[1]major, major*}] +% major = (*\marg{名称}*) +% major* = (*\marg{英文名称}*) +% \end{nwafusyntax} +% 专业名称。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/researchfield, info/researchfield*} +% \begin{nwafusyntax}[emph={[1]researchfield, researchfield*}] +% researchfield = (*\marg{名称}*) +% researchfield* = (*\marg{英文名称}*) +% \end{nwafusyntax} +% 研究方向名称(仅学硕需要)。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/professionaltype, info/professionaltype*} +% \begin{nwafusyntax}[emph={[1]professionaltype, professionaltype*}] +% professionaltype = (*\marg{名称}*) +% professionaltype* = (*\marg{英文名称}*) +% \end{nwafusyntax} +% 专业学位类型名称(仅专硕需要)。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/professionalfield, info/professionalfield*} +% \begin{nwafusyntax}[emph={[1]professionalfield, professionalfield*}] +% professionalfield = (*\marg{名称}*) +% professionalfield* = (*\marg{英文名称}*) +% \end{nwafusyntax} +% 专业学位领域名称(仅专硕需要)。 +% \end{function} +% +% \begin{function}[added=2021-05-23]{info/mastertype} +% \begin{nwafusyntax}[emph={[1]mastertype}] +% mastertype = (*\marg{研究生学位英文名称}*) +% \end{nwafusyntax} +% 研究生学位英文名称(用于硕士研究生英文封面)。 +% +% 对于学术硕士可以取:Philosophy(哲学);Economics(经济学); +% Science(理学);Engineering(工学);Agriculture(农学); +% Management(管理学)等(注意首字母需要大写)。 +% +% 对于专业硕士可以取:Engineering(工程硕士); +% Agricultural(农业硕士) 等(注意首字母需要大写)。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/student-id} +% \begin{nwafusyntax}[emph={[1]student-id}] +% student-id = (*\marg{数字}*) +% \end{nwafusyntax} +% 作者学号。 +% \end{function} +% +% 西北农林科技大学学号采用10位4段制编码:X1--X4/X5/X6/X7--X10。 +% 其中: +% +% X1--X4代表入学年份。 +% +% X5=0表示学生,此时,X6=1-2表示本科生, +% X6=3表示成人教育学生,X6=4表示预科生,X6=5-6表示研究生, +% X6=7表示国际学院学生,X6=8表示水土保持研究所学生。 +% X7-X10为流水号。 +% +% \begin{function}[added=2021-05-18]{info/class-id} +% \begin{nwafusyntax}[emph={[1]class-id}] +% class-id = (*\marg{数字}*) +% \end{nwafusyntax} +% 作者班级号,班号数字。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/grade} +% \begin{nwafusyntax}[emph={[1]grade}] +% grade = (*\marg{数字}*) +% \end{nwafusyntax} +% 毕业年份(届)。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/enroll} +% \begin{nwafusyntax}[emph={[1]enroll}] +% enroll = (*\marg{数字}*) +% \end{nwafusyntax} +% 入学年份(年级)。 +% \end{function} +% +% \begin{function}[added=2021-05-12,updated=2021-05-23]{info/school-id} +% \begin{nwafusyntax}[emph={[1]school-id}] +% school-id = (*\marg{数字}*) +% \end{nwafusyntax} +% 学校代码。默认值为 10712(西北农林科技大学学校代码)。 +% \end{function} +% +% \begin{function}[added=2021-05-12, updated=2021-05-24]{info/date, info/date*} +% \begin{nwafusyntax}[emph={[1]date, date*}] +% date = (*\marg{日期}*) +% date* = (*\marg{英文日期}*) +% \end{nwafusyntax} +% 论文完成日期。默认值为文档编译年月(\tn{datezh}和\tn{dateen})。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/defensedate} +% \begin{nwafusyntax}[emph={[1]defensedate}] +% defensedate = (*\marg{日期}*) +% \end{nwafusyntax} +% 论文答辩日期。默认值为文档编译日期(\tn{today})。 +% \end{function} +% +% \begin{function}[added=2021-05-12, updated=2021-05-18]{info/secret-level} +% \begin{nwafusyntax}[emph={[1]secret-level}] +% secret-level = (*<(none)|i|ii|iii|iv>*) +% \end{nwafusyntax} +% 密级。\opt{i}、\opt{ii}、\opt{iii}、\opt{iv} 分别表示限制、 +% 秘密、机密、绝密; +% \opt{none} 表示论文不涉密,密级为公开。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/instructors} +% \begin{nwafusyntax}[emph={[1]instructors}] +% instructors = (*\marg{成员 1, 成员 2, ...}*) +% \end{nwafusyntax} +% 指导小组成员。各成员之间需使用英文逗号隔开。为防止歧义, +% 可以用分组括号“|{...}|”把各成员字段括起来。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/defensecommittees} +% \begin{nwafusyntax}[emph={[1]defensecommittees}] +% defensecommittees = (*\marg{\{单位, 姓名, 职称\}, \{单位, 姓名, 职称\}, ...}*) +% \end{nwafusyntax} +% 答辩委员会构成(仅研究生需要),每个成员由单位、姓名和职称三部分构成, +% 用英文逗号分隔后置于大括号内,不同成员间用英文逗号隔开。为防止歧义, +% 可以用分组括号“|{...}|”把每个成员中的各个字段括起来。 +% \end{function} +% +% \begin{function}[added=2021-05-18]{info/foundation} +% \begin{nwafusyntax}[emph={[1]foundation}] +% foundation = (*\marg{\{来源, 名称, 编号\}, \{来源, 名称, 编号\}, ...}*) +% \end{nwafusyntax} +% 论文资助项目(仅研究生需要),每个项目由来源、名称和编号三部分构成, +% 用英文逗号分隔后置于大括号内,不同项目间用英文逗号隔开。为防止歧义, +% 可以用分组括号“|{...}|”把每个项目中的各个字段括起来。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/clc} +% \begin{nwafusyntax}[emph={[1]clc}] +% clc = (*\marg{分类号}*) +% \end{nwafusyntax} +% 中图分类号(CLC)。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{info/udc} +% \begin{nwafusyntax}[emph={[1]udc}] +% udc = (*\marg{UDC码}*) +% \end{nwafusyntax} +% UDC码(UDC)。 +% \end{function} +% +% \subsubsection{摘要数据录入} \label{subsubsec:摘要数据录入} +% +% \begin{function}[added=2021-05-31]{nwafu / abstract} +% \begin{nwafusyntax}[emph={[1]abstract}] +% abstract = (*\marg{键值列表}*) +% abstract/(*\meta{key}*) = (*\meta{value}*) +% \end{nwafusyntax} +% 该选项包含多个子项目,用于录入或指定论文摘要数据文件, +% 具体内容见下。以下带“|*|” 的项目表示对应的英文字段。 +% \end{function} +% +% \begin{function}[added=2021-05-31]{abstract/abstractfile,abstract/abstractfile*} +% \begin{nwafusyntax}[emph={[1]abstractfile,abstractfile*}] +% abstractfile = (*\marg{中文摘要文件名}*) +% abstractfile* = (*\marg{英文摘要文件名}*) +% \end{nwafusyntax} +% 摘要内容\file{.tex}源文件的文件名称。在文件名中可以使用路径信息, +% 文件名中需包括\file{.tex}扩展名。 +% \end{function} +% +% \begin{function}[added=2021-05-12,updated=2021-05-31]{abstract/keywords,abstract/keywords*} +% \begin{nwafusyntax}[emph={[1]keywords,keywords*}] +% keywords = (*\marg{中文关键字}*) +% keywords* = (*\marg{英文关键字}*) +% \end{nwafusyntax} +% 关键字列表。各关键字之间需\textbf{使用英文逗号隔开}。为防止歧义, +% 可以用分组括号“|{...}|”把各关键字括起来。 +% \end{function} +% +% \begin{function}[added=2021-05-31]{abstract/notationfile} +% \begin{nwafusyntax}[emph={[1]notationfile}] +% notationfile = (*\marg{主要符号对照表文件名}*) +% \end{nwafusyntax} +% 主要符号对照表内容\file{.tex}源文件的文件名称。在文件名中可以使用路径信息。 +% 文件名中需包括\file{.tex}扩展名。 +% \end{function} +% +% \subsection{正文编写} +% +% \begin{quotation} +% 喬孟符(吉)博學多能,以樂府稱。嘗云:「作樂府亦有法,曰^^A +% \CJKunderdot{鳳頭、豬肚、豹尾}六字是也。」大概起要美麗,中要浩蕩, +% 結要響亮。尤貴在首尾貫穿,意思清新。苟能若是,斯可以言樂府矣。 +% \end{quotation} +% \hfill ——陶宗儀《南村輟耕錄·作今樂府法》 +% +% \subsubsection{凤头} +% +% 对于研究生学位论文,该部分包含封面(研究生包括封面一$\sim$七, +% 本科生包括封面一和封面七)、中英文摘要、主要符号对照表和目录。 +% 在前置部分中,中英文摘要开始至主要符号对照表,页码采用大写罗马字母,并且与目录分开计数。 +% 目录应该放在奇数页起排,页码采用大写罗马字母,并与正文分开计数 +% +% 对于本科生毕业论文(设计),该部分包含中英文摘要和目录。其中, +% 中英文摘要无页码。目录应该放在奇数页起排,部分页码采用大写罗马字母,并与正文分开计数 +% +% 建议将中英文摘要内容分别写在不同\file{.tex}源文件中,然后用\cs{nwafuset}设置文件名后, +% 自动排版。在摘要的最后,会显示关键字列表,可通过 \cs{nwafuset} 录入关键字列表。 +% 关于摘要数据录入,具体请参阅 \ref{subsubsec:摘要数据录入}~节。 +% +% 建议将主要符号对照表写在\file{.tex}源文件中,然后用\cs{nwafuset}设置文件名后, +% 自动排版。关于主要符号对照表数据录入,具体请参阅 \ref{subsubsec:摘要数据录入}~节。 +% +% 为正确按要求实现排版顺序和页码,不建议手动排版封面、中英文摘要、主要符号对照表和目录, +% 在提供基本内容后,由模板自动实现前置部分(凤头)排版 +% +% \subsubsection{猪肚} +% +% \begin{function}[added=2021-05-29]{\mainmatter,\mainmatter*} +% \begin{nwafusyntax}[deletetexcs={\mainmatter,\mainmatter*}, +% morekeywords={\mainmatter,\mainmatter*}] +% \mainmatter(*\oarg{编号格式|(Roman)}*) +% \mainmatter*(*\oarg{编号格式|(Roman)}*) +% \end{nwafusyntax} +% \cs{mainmatter} 为主文区命令,章标题正常编号, +% 且页码为从1开始计数的阿拉伯数字, +% 带有星号的命令 \cs{mainmatter*} 不使用清双页命令 \tn{cleardoublepage}。 +% +% 注意,由于要求第一章从奇数页开始排版, +% 因此应该使用不带星号的\cs{mainmatter}开始正文主体区的排版。 +% \end{function} +% +% 主体部分是论文的核心,可以分章节撰写。如有需求,也可以采用 +% 多文件方式撰写,然后用\cs{include}命令将各个子文件包含入主文件。 +% 主体部分的页码采用阿拉伯数字连续编号。 +% +% \begin{function}[added=2021-05-12]{\footnote} +% \begin{nwafusyntax}[deletetexcs={\footnote},% +% morekeywords={\footnote}] +% \footnote(*\marg{脚注文字}*) +% \end{nwafusyntax} +% 插入脚注。脚注编号样式可利用 \opt{style/footnote-style} 选项控制, +% 具体见 \ref{subsubsec:论文格式}~小节。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{axiom,corollary,definition,example,lemma, +% proof,theorem} +% \begin{nwafusyntax}[emph={[2]proof}] +% \begin{proof}(*\oarg{小标题}*) +% (*\meta{证明过程}*) +% \end{proof} +% \end{nwafusyntax} +% 一系列预定义的数学环境。具体含义见表~\ref{tab:theorem}。 +% \end{function} +% +% \begin{table}[ht] +% \caption{预定义的数学环境} \label{tab:theorem} +% \centering +% \begin{tabular}{cccccccc} +% \toprule +% \textbf{名称} & +% \env{axiom} & \env{corollary} & \env{definition} & +% \env{example} & \env{lemma} & \env{proof} & +% \env{theorem} \\ +% \midrule +% \textbf{含义} & +% 公理 & 推论 & 定义 & 例 & 引理 & 证明 & 定理 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% 证明环境(\env{proof})的最后会添加证毕符号“$\QED$”。要确保 +% 该符号在正确的位置显示,需要按照 \ref{subsec:编译方式}~节 +% 中的有关说明至少编译\emph{两次},可不执行biber main参考文献编译操作。 +% +% \begin{function}[added=2021-05-12]{\newtheorem} +% \begin{nwafusyntax}[deletetexcs={\newtheorem}, +% morekeywords={\newtheorem,\newtheorem*}] +% \newtheorem(*\oarg{选项}\marg{环境名}\marg{标题}*) +% \newtheorem*(*\oarg{选项}\marg{环境名}\marg{标题}*) +% \begin(*\marg{环境名}\oarg{小标题}*) +% (*\meta{内容}*) +% \end(*\marg{环境名}*) +% \end{nwafusyntax} +% 声明新的定理类环境(数学环境)。带星号的版本表示不进行编号, +% 并且会默认添加证毕符号“$\QED$”。声明后,即可同预定义的数学环境 +% 一样使用。 +% \end{function} +% +% 事实上,表~\ref{tab:theorem} 中预定义的环境正是通过以下方式定义的: +% \begin{latexexample}[deletetexcs={\newtheorem}, +% morekeywords={\newtheorem,\newtheorem*}] +% \newtheorem*{proof}{证明} +% \newtheorem{axiom}{公理} +% \newtheorem{corollary}{定理} +% ... +% \end{latexexample} +% +% 与 \cs{nwafuset} 相同,\cs{newtheorem} 的可选参数 \meta{选项} +% 也为一组键值列表。可用的选项见下。注意无需输入“|theorem/|”。 +% +% \begin{function}[added=2021-05-12]{theorem/style} +% \begin{nwafusyntax}[emph={[1]style}] +% style = (*<(plain)|margin|change|\\ +% XXXXXX\mbox{}~~~~~~~~break|marginbreak|changebreak>*) +% \end{nwafusyntax} +% 定理类环境的总体样式。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{theorem/header-font} +% \begin{nwafusyntax}[emph={[1]header-font}] +% header-font = (*\marg{字体}*) +% \end{nwafusyntax} +% 定理头(即标题)的字体。中文模板默认为 \tn{sffamily},即无衬线体 +% (黑体);英文模板默认为 |\bfseries\upshape|,即加粗直立体。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{theorem/body-font} +% \begin{nwafusyntax}[emph={[1]body-font}] +% body-font = (*\marg{字体}*) +% \end{nwafusyntax} +% 定理内容的字体。中文模板默认为 \tn{nwafu@kai},即楷体;英文模板 +% 默认为 \tn{itshape},即斜体。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{theorem/qed} +% \begin{nwafusyntax}[emph={[1]qed}] +% qed = (*\marg{符号}*) +% \end{nwafusyntax} +% 定理结束标记(即证毕符号)。如果用 \cs{newtheorem} 声明定理, +% 则默认为空;用 \cs{newtheorem*} 声明,则默认为 +% |\ensuremath{\QED}|,即“$\QED$”。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{theorem/counter} +% \begin{nwafusyntax}[emph={[1]counter}] +% counter = (*\marg{计数器}*) +% \end{nwafusyntax} +% 定理计数器,表示定理编号在 \meta{计数器} 的下一级,并会随 +% \meta{计数器} 的变化而清零。\scite{刘海洋2013latex入门} +% 默认为 |chapter|,表示按章编号。使用 \cs{newtheorem*} 时, +% 该选项无效。 +% \end{function} +% +% \emph{关于定理部分命令定义和设置,完全采用\cls{fduthesis}的代码实现}。 +% +% \begin{function}[added=2021-05-12]{\caption} +% \begin{nwafusyntax}[deletetexcs={\caption},morekeywords={\caption}] +% \caption(*\marg{图表标题}*) +% \caption(*\oarg{短标题}\marg{长标题}*) +% \end{nwafusyntax} +% 插入图表标题。可选参数 \meta{短标题} 用于图表目录。在 +% \meta{长标题} 中,可以进行长达多段的叙述;但 \meta{短标题} +% 和单独的 \meta{图表标题} 中则不允许分段。 +% \scite{刘海洋2013latex入门} +% \end{function} +% +% \begin{function}[added=2021-05-22]{\bicaption} +% \begin{nwafusyntax}[deletetexcs={\bicaption},morekeywords={\bicaption}] +% \bicaption(*\marg{中文标题}\marg{英文标题}*) +% \end{nwafusyntax} +% 插入图表双语标题。双语标题基于\cls{bicaption}宏包实现。 +% \end{function} +% +% 按照排版惯例,建议将表格的标题放置在绘制表格的命令之前, +% 而将图片的标题放置在绘图或插图的命令之后。另需注意, +% \tn{caption} 命令必须放置在浮动体环境(如 \env{table} 或 +% \env{figure})中。 +% +% \subsubsection{豹尾} +% +% \begin{function}[added=2021-05-26]{\bibmatter} +% 参考文献开始开始。 +% \end{function} +% +% 用于为参考文献部分设置正确的页眉,后续页码接正文区连续编码。 +% +% \begin{function}[added=2021-05-12]{\printbibliography} +% \begin{nwafusyntax}[morekeywords={\printbibliography}] +% \printbibliography(*\oarg{选项}*) +% \end{nwafusyntax} +% 打印参考文献列表。 +% \meta{文献数据库} 可利用 \opt{style/bib-resource} 选项指定,具体见 +% \ref{subsubsec:论文格式}~小节。 +% \end{function} +% +% 注:本模板参考文献是胡振震根据西北农林科技大学的基本要求,通过 +% 添加部分样式控制代码实现的\scite{biblatex,biblatex-gb7714-2015}, +% 因此,\textbf{无法进行个性化定制}。 +% +% \begin{function}[added=2021-05-24]{\appdendix} +% 声明附录开始。 +% \end{function} +% +% 用于为附录部分设置正确的页眉及按要求实现附录中的图、表和公式编号。 +% 后续页码接参考文献区连续编码。 +% +% \begin{function}[added=2021-05-29]{\backmatter} +% \cs{backmatter} 为后置区命令,页码格式与编号保持不变, +% 章标题不编号。 +% \end{function} +% +% 用于为后置部分设置正确页眉,后置部分主要包括致谢和个人简历。 +% 后续页码接附录区连续编码。 +% +% \begin{function}[added=2021-06-01]{acknowledgement} +% \begin{nwafusyntax}[emph={[2]acknowledgement}] +% \begin{acknowledgement} +% (*\meta{致谢内容}*) +% \end{acknowledgement} +% \end{nwafusyntax} +% 致谢排版环境。使用该环境的主要作用是设置页眉及产生不编号章标题。 +% \end{function} +% +% \begin{function}[added=2021-06-01]{resume} +% \begin{nwafusyntax}[emph={[2]resume}] +% \begin{resume} +% (*\meta{简历内容}*) +% \end{resume} +% \end{nwafusyntax} +% 简历排版环境。使用该环境的主要作用是设置页眉及产生不编号章标题。 +% \end{function} +% +% \begin{function}[added=2021-06-01]{\researchitem} +% \begin{nwafusyntax}[deletetexcs={\researchitem},morekeywords={\researchitem}] +% \researchitem(*\oarg{个人简历分类名称}*) +% \end{nwafusyntax} +% 在简历排版中,指定成果类型,按标题的格式(非标题)居中排版。 +% \end{function} +% +% \begin{function}[added=2021-06-01]{publications} +% \begin{nwafusyntax}[emph={[2]publications}] +% \begin{publications} +% (*\meta{简历中发表的学术论文列表}*) +% \end{publications} +% \end{nwafusyntax} +% 简历中发表的学术论文排版列表环境。 +% \end{function} +% +% \begin{function}[added=2021-06-01]{achievements} +% \begin{nwafusyntax}[emph={[2]achievements}] +% \begin{achievements} +% (*\meta{简历中发表的学术论文列表}*) +% \end{achievements} +% \end{nwafusyntax} +% 简历中专利等研究成果排版列表环境。 +% \end{function} +% +% \section{其他命令接口} +% +% \begin{function}[added=2021-05-20]{\nwafuthesis} +% \cs{nwafuthesis} 命令用于输出\cls{nwafuthesis}模板 +% 的LOGO:~\nwafuthesis{}。 +% \end{function} +% +% \begin{function}[added=2021-05-20]{\datezh} +% \cs{datezh} 命令用于输出中文格式的当前年、月。 +% \end{function} +% +% \begin{function}[added=2021-05-20]{\dateen} +% \cs{dateen} 命令用于输出英文格式的当前月,年。 +% \end{function} +% +% \begin{function}[added=2021-05-12,updated=2021-5-28]{\makecoveri, +% \makecoverii,\makecoveriii, \makecoveriv, +% \makecoverv,\makecovervi,\makecovervii} +% 分别用于生成封面(一)$\sim$(七)。单独使用这几个命令可能 +% 会造成页面顺序错误,因此若非必要,应避免直接使用这些命令排版。 +% \end{function} +% +% \begin{function}[added=2021-06-04]{\makecovers} +% 生成所有封面。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{\tableofcontents,\listoffigures,\listoftables} +% 修改 \cs{tableofcontents}、\cs{listoffigures} 和 \cs{listoftables} 的定义, +% 使得页眉正确显示,并出现在目录及 PDF 书签中。来自于 \LaTeXe{} 标准文档类 +% \file{book.cls} +% \footnote{原代码中只有 \cs{tableofcontents} 的 \cs{@mkboth} 出现在 +% \cs{chapter*} 内部,这是出于兼容性的考虑而非 typo。}。 +% \end{function} +% +% \begin{function}[added=2021-05-28]{\makefront} +% 用于生成中英文摘要、目录和主要符号对照表。 +% +% 注意:不建议直接使用该命令排版, +% 应该由模板自动调用进行排版。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{abstract} +% \begin{nwafusyntax}[emph={[2]abstract}] +% \begin{abstract} +% (*\meta{中文摘要}*) +% \end{abstract} +% \end{nwafusyntax} +% \end{function} +% \begin{function}[added=2021-05-12]{abstract*} +% \begin{nwafusyntax}[emph={[2]abstract*}] +% \begin{abstract*} +% (*\meta{英文摘要}*) +% \end{abstract*} +% \end{nwafusyntax} +% 摘要排版环境。不带星号和带星号的版本分别用来排版中文摘要 +% 和英文摘要。 +% +% 注意:不建议直接排版摘要,应该提供摘要内容\file{.tex}源文件名后,由 +% \cs{makefront}命令自动排版。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{notation} +% \begin{nwafusyntax}[emph={[2]notation}] +% \begin{notation}(*\oarg{列格式说明}*) +% (*\meta{符号 1}*) & (*\meta{说明}*) \\ +% (*\meta{符号 2}*) & (*\meta{说明}*) \\ +% (*\phantom{\meta{符号 $n$}}*) (*$\vdots$*) +% (*\meta{符号\ \kern-0.1em$n$}*) & (*\meta{说明}*) +% \end{notation} +% \end{nwafusyntax} +% 主要符号对照表环境。可选参数 \meta{列格式说明}与 \LaTeX{} 中标准表格的列格 +% 式说明语法一致,默认值为“|lp{7.5cm}|”,即第一列宽度自动调整, +% 第二列限宽 \SI{7.5}{cm},两列均为左对齐。 +% +% 注意:不建议直接排版主要符号对照表, +% 应该提供主要符号对照表内容\file{.tex}源文件名后,由 +% \cs{makefront}命令自动排版。 +% \end{function} +% +% \begin{function}[added=2021-05-29]{\frontmatter,\frontmatter*} +% \begin{nwafusyntax}[deletetexcs={\frontmatter,\frontmatter*}, +% morekeywords={\frontmatter,\frontmatter*}] +% \frontmatter(*\oarg{编号格式|(Roman)}*) +% \frontmatter*(*\oarg{编号格式|(Roman)}*) +% \end{nwafusyntax} +% \cs{frontmatter} 为前置区命令,章标题不编号, +% 页码可设置为例如 \opt{roman}、\opt{Alph} 等格式, +% 带有星号的命令 \cs{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。 +% \end{function} +% +% \begin{function}[added=2021-05-12]{\cleardoublepage} +% \begin{nwafusyntax}[deletetexcs={\cleardoublepage},morekeywords={\cleardoublepage}] +% \cleardoublepage(*\oarg{页面风格|(empty)}*) +% \end{nwafusyntax} +% 在奇数页使用命令 \tn{cleardoublepage} 时可选参数为 +% 下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。 +% \end{function} +% +% \section{宏包依赖情况} +% +% 使用不同编译方式、指定不同选项,会导致宏包依赖情况有所不同。 +% 具体如下: +% \begin{itemize} +% \item 在任何情况下,本模板都会\emph{显式}调用以下宏包 +% (或文档类): +% \begin{itemize} +% \item \pkg{expl3}、\pkg{xparse}、\pkg{xtemplate} 和 +% \pkg{l3keys2e},用于构建 \LaTeX3 编程环境 +% \scite{source3}。它们分属 \pkg{l3kernel} 和 +% \pkg{l3packages} 宏集。 +% \item \cls{ctexbook},提供中文排版的通用框架。属于 \CTeX{} +% 宏集 \scite{CTeX}。 +% \item \pkg{amsmath},对 \LaTeX{} 的数学排版功能进行了 +% 全面扩展。属于 \AmSLaTeX{} 套件。 +% \item \pkg{unicode-math},负责处理 Unicode 编码的 +% OpenType 数学字体。 +% \item \pkg{geometry},用于调整页面尺寸。 +% \item \pkg{fancyhdr},处理页眉页脚。 +% \item \pkg{footmisc},处理脚注。 +% \item \pkg{ntheorem},提供增强版的定理类环境。 +% \item \pkg{graphicx},提供图形插入的接口。 +% \item \pkg{longtable},长表格(允许跨页)支持。 +% \item \pkg{booktabs},三线表支持。 +% \item \pkg{caption},用于设置标题。 +% \item \pkg{bicaption},用于设置标题。 +% \item \pkg{xcolor},提供彩色支持。 +% \item \pkg{enumitem},提供列表环境的个性化设置。 +% \item \pkg{biblatex},提供参考文献排版。 +% \item \pkg{hyperref},提供交叉引用、超链接、电子书签等功能。 +% \end{itemize} +% \item 开启 \kvopt{style/footnote-style}{pifont} 后,会调用 +% \pkg{pifont} 宏包。它属于 \pkg{psnfss} 套件。 +% \item \pkg{biblatex} 宏包需要依赖 \biber{} 程序。参考文献样式由 +% \pkg{biblatex-gb7714-2015} 宏包提供\scite{biblatex,biblatex-gb7714-2015}。 +% \end{itemize} +% +% 这里只列出了本模板直接调用的宏包。这些宏包自身的调用情况, +% 此处不再具体展开。如有需要,请参阅相关文档。 +% +% \begin{thebibliography}{99} +% +% \newcommand\urlprefix{\newline\hspace*{\fill}} +% \let\OldUrl=\url +% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}} +% \newcommand\CTANurl[2][]{{\small\textit{#1}~\href{http://mirror.ctan.org/#2}^^A +% {\ttfamily CTAN://#2}}} +% +% \subsection{图书} +% +% \bibitem{knuth1986texbook} +% \textsc{Knuth D E}. +% \newblock \textit{The \TeX book: Computers \& Typesetting, volume A} [M]. +% \newblock Boston: Addison--Wesley Publishing Company, 1986 +% \urlprefix \CTANurl[源代码^^A +% \footnote{此代码只可作为学习之用。未经 Knuth 本人同意,不应当编译此文档。}:]^^A +% {systems/knuth/dist/tex/texbook.tex} +% +% \bibitem{mittelbach2004latexcompanion} +% \textsc{Mittelbach F} and \textsc{Goossens M}. +% \newblock \textit{The \LaTeX{} Companion} [M]. +% \newblock 2nd ed. +% \newblock Boston: Addison--Wesley Publishing Company, 2004 +% +% \bibitem{胡伟2017latex2e} +% 胡伟. +% \newblock \textit{\LaTeXe{} 文类和宏包学习手册} [M]. +% \newblock 北京: 清华大学出版社, 2017 +% +% \bibitem{刘海洋2013latex入门} +% 刘海洋. +% \newblock \textit{\LaTeX{} 入门} [M]. +% \newblock 北京: 电子工业出版社, 2013 +% +% \subsection{标准、规范} +% +% \bibitem{gb-t-7713.1-2006} +% 国务院学位委员会办公室, 全国信息与文献标准化技术委员会. +% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S]. +% \newblock 北京: 中国标准出版社, 2007 +% +% \bibitem{gb-t-7714-2015} +% 全国信息与文献标准化技术委员会. +% \newblock \textit{信息与文献\quad 参考文献著录规则: GB/T 7714--2015} [S]. +% \newblock 北京: 中国标准出版社, 2015 +% +% \bibitem{gb-t-15834-2011} +% 教育部语言文字信息管理司. +% \newblock \textit{标点符号用法: GB/T 15834--2011} [S/OL]. +% \newblock 北京: 中国标准出版社, 2012 +% \urlprefix\url{http://www.moe.gov.cn/ewebeditor/uploadfile/2015/01/13/20150113091548267.pdf} +% +% \bibitem{clreq} +% W3C. +% \newblock \textit{中文排版需求(Requirements for Chinese Text Layout)} [EB/OL]. +% \newblock (2020-08-17) +% \urlprefix\url{https://w3c.github.io/clreq/} +% +% \bibitem{西北农林科技大学研究生论文写作指南} +% 西北农林科技大学研究生院. +% \newblock \textit{研究生学位论文写作指南(试用版)} [EB/OL]. +% \newblock 2021 年 3 月修订版. +% \newblock (2021-03-17) +% \urlprefix\url{https://yjshy.nwafu.edu.cn/docs//2021-03/0d686e7d3f204af9880822db5fd7045c.pdf} +% +% \bibitem{西北农林科技大学本科生论文撰写规范} +% 西北农林科技大学教务处. +% \newblock \textit{西北农林科技大学本科毕业论文(设计)写作规范(试用)} [EB/OL]. +% \newblock 2021 年 5 月修订版. +% \newblock (2021-05-07) +% \urlprefix\url{https://jiaowu.nwafu.edu.cn/docs//2021-05/8aa0ef88fcf94e5ebf0bdcc2a6f42785.pdf} +% +% \subsection{宏包、模版} +% +% \bibitem{source2e} +% \textsc{Braams J}, \textsc{Carlisle D}, \textsc{Jeffrey A}, et al. +% \newblock \textit{The \LaTeXe{} Sources} [CP/OL]. +% \newblock (2020-02-02) +% \urlprefix\url{https://ctan.org/pkg/latex} +% \urlprefix\CTANurl[源代码:]{macros/latex/base/source2e.pdf} +% +% \bibitem{CTeX} +% \textsc{CTEX.ORG}. +% \newblock \textit{\CTeX{} 宏集手册} [EB/OL]. +% \newblock version 2.5.4, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/ctex} +% \urlprefix\CTANurl[文档及源代码:]{language/chinese/ctex/ctex.pdf} +% +% \bibitem{xeCJK} +% \textsc{CTEX.ORG}. +% \newblock \textit{\pkg{xeCJK} 宏包} [EB/OL]. +% \newblock version 3.8.5, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/xecjk} +% \urlprefix\CTANurl[文档及源代码:]{macros/xetex/latex/xecjk/xeCJK.pdf} +% +% \bibitem{source3} +% \textsc{The \LaTeX3 Project}. +% \newblock \textit{The \LaTeX3 Sources} [CP/OL]. +% \newblock (2020-08-07) +% \urlprefix\url{https://ctan.org/pkg/l3kernel} +% \urlprefix\CTANurl[源代码:]{macros/latex/contrib/l3kernel/source3.pdf} +% +% \bibitem{biblatex} +% \textsc{Lehman P}, \textsc{Kime P}, \textsc{Boruvka A}, et al. +% \newblock \textit{The \pkg{biblatex} Package} [EB/OL]. +% \newblock version 3.15a, +% \newblock (2020-08-23) +% \urlprefix\url{https://ctan.org/pkg/biblatex} +% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf} +% +% \bibitem{lshort} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{The Not So Short Introduction to \LaTeXe{}: Or \LaTeXe{} in 139 minutes} [EB/OL]. +% \newblock version 6.2, +% \newblock (2018-02-28) +% \urlprefix\url{https://ctan.org/pkg/lshort-english} +% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf} +% +% \bibitem{lshort-zh-cn} +% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al. +% \newblock \textit{一份(不太)简短的 \LaTeXe{} 介绍: 或 112 分钟了解 \LaTeXe{}} [EB/OL]. +% \newblock \CTeX{} 开发小组, 译. +% \newblock 原版版本 version 6.2, 中文版本 version 6.02, +% \newblock (2020-08-03) +% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn} +% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf} +% +% \bibitem{biblatex-gb7714-2015} +% 胡振震. +% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. +% \newblock version 1.0v, +% \newblock (2020-07-21) +% \urlprefix\url{https://ctan.org/pkg/biblatex-gb7714-2015} +% \urlprefix\CTANurl[文档:]{biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf} +% +% \bibitem{fduthesis} +% 曾祥东(\textsc{Xiangdong Z}). +% \newblock \textit{\textsc{fduThesis}:复旦大学毕业论文 \LaTeX{} 模板} [EB/OL]. +% \newblock version 0.7e, +% \newblock (2020-08-30) +% \urlprefix\url{https://ctan.org/pkg/fduthesis} +% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/fduthesis/fduthesis.pdf} +% +% \subsection{其他} +% +% \bibitem{wright2009dtxfile} +% \textsc{Wright J}. +% \newblock \textit{A model dtx file} [EB/OL]. +% \newblock (2009-10-06) +% \urlprefix\url{https://www.texdev.net/2009/10/06/a-model-dtx-file/} +% +% \bibitem{孔雀计划} +% 刘庆(\textsc{Eric Q L}). +% \newblock \textit{孔雀计划:中文字体排印的思路} [EB/OL]. +% \urlprefix\url{https://thetype.com/kongque/} +% +% \end{thebibliography} +% +% \clearpage +% +% \end{documentation} +% +% \begin{implementation} +% +%^^A 代码部分的页边距 +% \newgeometry{ +% left = 2.25 in, +% right = 1.00 in, +% top = 1.25 in, +% bottom = 1.00 in, +% marginpar = 2.25 in +% } +% +% \section{实现细节} +% +% 本模板使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境, +% 并需调用 \pkg{l3packages} 中的相关宏包。 +% +% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符完全被忽略, +% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。 +% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”, +% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。 +% +% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*class>}} +% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。 +% “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含 +% “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定 +% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 +% +% 另有若干形如 \textcolor{MaterialPink}{\textsf{<@@=nwafu>}} 的 guard, +% 它们由 \pkg{l3docstrip} 定义,用来标识名字空间(模块)。 +% +% \subsection{准备} +% +% \begin{macrocode} +%<@@=nwafu> +%<*class> +% \end{macrocode} +% +% 检查 \LaTeX3 编程环境。 +% \begin{macrocode} +\RequirePackage { xparse, xtemplate, l3keys2e } +\clist_map_inline:nn { expl3, xparse, xtemplate, l3keys2e } + { + \@ifpackagelater {#1} { 2018/05/12 } + { } { \msg_error:nnn { nwafuthesis } { l3-too-old } {#1} } + } +\msg_new:nnn { nwafuthesis } { l3-too-old } + { + Package~ "#1"~ is~ too~ old. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ the~ bundles \\ + "l3kernel"~ and~ "l3packages"~ using~ your~ TeX~ package \\ + manager~ or~ from~ CTAN. + } +% \end{macrocode} +% +% 目前 \cls{nwafuthesis} 仅支持 \XeTeX{} 和 \LuaTeX{}。 +% \begin{macrocode} +\sys_if_engine_xetex:F + { + \sys_if_engine_luatex:F + { + \msg_fatal:nnx { nwafuthesis } { unsupported-engine } + { \c_sys_engine_str } + } + } +\msg_new:nnn { nwafuthesis } { unsupported-engine } + { + The~ nwafuthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\\\ + "#1"~ is~ not~ supported~ at~ present.~ You~ must~ change \\ + your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". + } +\hook_gset_rule:nnnn { begindocument/before } { nwafuthesis } { < } { xeCJK } +% \end{macrocode} +% +% \subsubsection{内部变量声明} +% +% \begin{variable}{\l_@@_tmpa_box, +% \l_@@_tmpa_clist, +% \l_@@_tmpb_clist, +% \l_@@_tmpc_clist, +% \l_@@_tmpt_clist, +% \l_@@_tmpa_dim, +% \l_@@_tmpb_dim, +% \l_@@_tmpc_dim, +% \l_@@_tmpd_dim, +% \l_@@_tmpt_dim, +% \l_@@_tmpa_skip, +% \l_@@_tmpa_tl, +% \l_@@_tmpb_tl, +% \l_@@_tmpt_tl +% } +% 临时变量。 +% \begin{macrocode} +\box_new:N \l_@@_tmpa_box +\clist_new:N \l_@@_tmpa_clist +\clist_new:N \l_@@_tmpb_clist +\clist_new:N \l_@@_tmpc_clist +\clist_new:N \l_@@_tmpd_clist +\clist_new:N \l_@@_tmpt_clist +\dim_new:N \l_@@_tmpa_dim +\dim_new:N \l_@@_tmpb_dim +\dim_new:N \l_@@_tmpc_dim +\dim_new:N \l_@@_tmpd_dim +\dim_new:N \l_@@_tmpt_dim +\skip_new:N \l_@@_tmpa_skip +\tl_new:N \l_@@_tmpa_tl +\tl_new:N \l_@@_tmpb_tl +\tl_new:N \l_@@_tmpc_tl +\tl_new:N \l_@@_tmpd_tl +\tl_new:N \l_@@_tmpt_tl +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_thesis_type_int} +% 论文类型。取值 1、2、3 分别对应博士、硕士、本科(学士)。 +% \begin{macrocode} +\int_new:N \g_@@_thesis_type_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_to_ctexbook_clist,\g_@@_to_hyperref_clist} +% 分别保存由 \cls{nwafuthesis} 传入 \cls{ctexbook} 文档类和 +% \pkg{hyperref} 宏包的选项列表。 +% \begin{macrocode} +\clist_new:N \g_@@_to_ctexbook_clist +\clist_new:N \g_@@_to_hyperref_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_withchap_bool} +% 是否按章编写论文(默认按章编写)。 +% 该选项是针对部分学院需要按报告形式(类似"1 绪论")撰写本科毕业论文(设计) +% 而设置的。 +% \begin{macrocode} +\bool_new:N \l_@@_withchap_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_twoside_bool} +% 是否开启双页模式(默认打开)。 +% 本模板中,目前使用双页与单页模式的排版结果是一样的, +% 保留该设置的目的是为了后续扩展。 +% \begin{macrocode} +\bool_new:N \g_@@_twoside_bool +\bool_set_true:N \g_@@_twoside_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_draft_bool} +% 是否开启草稿模式。 +% \begin{macrocode} +\bool_new:N \g_@@_draft_bool +% \end{macrocode} +% \end{variable} +% +% \subsubsection{内部函数} +% +% \begin{macro}{\cs_generate_variant:cn, +% \file_input:V, +% \int_to_arabic:v, +% \keys_define:nx, +% \tl_map_inline:xn} +% \begin{macro}[TF]{\tl_if_eq:Vn} +% \LaTeX3{} 函数的函数变体。 +% \begin{macrocode} +\cs_generate_variant:Nn \cs_generate_variant:Nn { cn } +\cs_generate_variant:Nn \file_input:n { V } +\cs_generate_variant:Nn \int_to_arabic:n { v } +\cs_generate_variant:Nn \keys_define:nn { nx } +\cs_generate_variant:Nn \tl_map_inline:nn { xn } +\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_quad:,\@@_qquad:} +% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。 +% \begin{macrocode} +\cs_new:Npn \@@_quad: { \skip_horizontal:n { 1 em } } +\cs_new:Npn \@@_qquad: { \skip_horizontal:n { 2 em } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_vspace:N,\@@_vspace:n,\@@_vspace:c} +% 类似 \LaTeXe{} 中的 \tn{vspace*}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_vspace:N #1 + { + \dim_set_eq:NN \l_@@_tmpa_dim \prevdepth + \hrule height \c_zero_dim + \nobreak + \skip_vertical:N #1 + \skip_vertical:N \c_zero_skip + \dim_set_eq:NN \prevdepth \l_@@_tmpa_dim + } +\cs_new_protected:Npn \@@_vspace:n #1 + { + \skip_set:Nn \l_@@_tmpa_skip {#1} + \@@_vspace:N \l_@@_tmpa_skip + } +\cs_generate_variant:Nn \@@_vspace:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_symbol:n} +% 等价于 \LaTeXe{} 中的 \tn{symbol}。 +% \begin{macrocode} +\cs_new:Npn \@@_symbol:n #1 { \tex_char:D #1 \scan_stop: } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_arabic:n} +% 等价于 \LaTeXe{} 中的 \tn{arabic}。 +% \begin{macrocode} +\cs_new:Npn \@@_arabic:n #1 + { \int_to_arabic:v { c@ #1 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_patch_cmd:Nnn,\@@_preto_cmd:Nn,\@@_appto_cmd:Nn} +% 补丁工具,来自 \pkg{ctexpatch} 宏包。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_patch_cmd:Nnn #1#2#3 + { + \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \@@_preto_cmd:Nn #1#2 + { + \ctex_preto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \@@_appto_cmd:Nn #1#2 + { + \ctex_appto_cmd:NnnTF #1 { } {#2} + { } { \ctex_patch_failure:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_at_begin_environment:nn} +% 在环境开始添加代码的补丁函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_at_begin_environment:nn #1#2 + { + \seq_set_from_clist:Nn \l_@@_env_hook_name_seq {#1} + \seq_map_inline:Nn \l_@@_env_hook_name_seq + { \AtBeginEnvironment{##1}{#2} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_at_end_preamble:n} +% 在导言区结束位置添加代码的补丁函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_at_end_preamble:n + { + \ctex_gadd_ltxhook:nn { env/document/before } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_define_fn_style:nn, +% \@@_define_punct:nn, +% \@@_define_name:nn, +% \@@_define_name:nnn} +% 用来定义脚注样式、标点、默认名称的辅助函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_define_fn_style:nn #1#2 + { \tl_const:cn { c_@@_fn_style_ #1 _tl } {#2} } +\cs_new_protected:Npn \@@_define_punct:nn #1#2 + { \tl_const:cn { c_@@_ #1 _tl } { \@@_symbol:n {#2} } } +\cs_new_protected:Npn \@@_define_name:nn #1#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} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_msg_new:nn, +% \@@_error:n,\@@_error:nn,\@@_error:nx,\@@_error:nnn, +% \@@_warning:n,\@@_warning:nn,\@@_warning:nxx, +% \@@_info:nx} +% 各种信息函数的缩略形式。 +% \begin{macrocode} +\cs_new:Npn \@@_msg_new:nn { \msg_new:nnn { nwafuthesis } } +\cs_new:Npn \@@_error:n { \msg_error:nn { nwafuthesis } } +\cs_new:Npn \@@_error:nn { \msg_error:nnn { nwafuthesis } } +\cs_new:Npn \@@_error:nx { \msg_error:nnx { nwafuthesis } } +\cs_new:Npn \@@_error:nnn { \msg_error:nnnn { nwafuthesis } } +\cs_new:Npn \@@_warning:n { \msg_warning:nn { nwafuthesis } } +\cs_new:Npn \@@_warning:nn { \msg_warning:nnn { nwafuthesis } } +\cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx { nwafuthesis } } +\cs_new:Npn \@@_info:nx { \msg_info:nnx { nwafuthesis } } +% \end{macrocode} +% \end{macro} +% +% \subsection{选项处理} +% +% 定义 |nwafu/option| 键值类。 +% \begin{macrocode} +\keys_define:nn { nwafu / option } + { +% \end{macrocode} +% +% \begin{macro}{type} +% 设置论文类型。设为模板选项主要是为了以后的兼容性。论文类型可能会 +% 影响很多设置,默认为本科毕业论文。 +% \begin{macrocode} + type .choice:, + type .value_required:n = true, + type .choices:nn = + { doctor, master, bachelor } + { \int_set_eq:NN \g_@@_thesis_type_int \l_keys_choice_int }, + type .initial:n = bachelor, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{oneside,twoside} +% 设置页面类型为单面或双面。 +% \begin{macrocode} + oneside .value_forbidden:n = true, + twoside .value_forbidden:n = true, + oneside .code:n = + { + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { oneside } + \bool_set_false:N \g_@@_twoside_bool + }, + twoside .code:n = + { +% \end{macrocode} +% 将双面设置为openany,从结果来讲与单面一样, +% 此处是为后续诸如页边距调整为左右不同保留的设置。 +% \begin{macrocode} + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { twoside, openany } + \bool_set_true:N \g_@@_twoside_bool + }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{draft} +% 是否开启草稿模式(默认关闭)。 +% \begin{macrocode} + draft .choice:, + draft / true .code:n = + { + \bool_set_true:N \g_@@_draft_bool + \clist_gput_right:Nn \g_@@_to_ctexbook_clist { draft } + }, + draft / false .code:n = + { \bool_set_false:N \g_@@_draft_bool }, + draft .default:n = true, + draft .initial:n = false, +% \end{macrocode} +% \end{macro} +% +% 处理未知选项。 +% \begin{macrocode} + unknown .code:n = { \@@_error:n { unknown-option } } + } +\@@_msg_new:nn { unknown-option } + { Class~ option~ "\l_keys_key_tl"~ is~ unknown. } +% \end{macrocode} +% +% 将文档类选项传给 |nwafu/option|。 +% \begin{macrocode} +\ProcessKeysOptions { nwafu / option } +% \end{macrocode} +% +% \subsection{模板参数配置} +% +% \subsubsection{定义模板LOGO和中英文年月命令} +% +% \begin{macro}{\nwafuthesis} +% nwafuthesis模板的LOGO。 +% \begin{macrocode} +\NewDocumentCommand \nwafuthesis { } + {% + \makebox{\rmfamily% + N\hspace{-0.2ex}\raisebox{-0.5ex}{W}\raisebox{0.5ex}{\hspace{-0.2ex}\textsc{AFU}}\hspace{0.3ex}% + \textsc{Thesis} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\datezh} +% 取得中文年月。 +% \begin{macrocode} +\NewDocumentCommand \datezh { } + { + \int_use:N \c_sys_year_int 年 + \int_use:N \c_sys_month_int 月 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\dateen} +% 取得英文月年,详见: +% 1 = Jan.(January), +% 2 = Feb.(February), +% 3 = Mar.(March), +% 4 = Apr.(April), +% 5 = May.(May), +% 6 = Jun.(June), +% 7 = Jul.(July), +% 8 = Aug.(August), +% 9 = Sept.(September), +% 10 = Oct.(October), +% 11 = Nov.(November), +% 12 = Dec.(December), +% \begin{macrocode} +\prop_new:N \l_@@_dateen_prop +\prop_set_from_keyval:Nn \l_@@_dateen_prop + { + 1 = Jan., + 2 = Feb., + 3 = Mar., + 4 = Apr., + 5 = May., + 6 = Jun., + 7 = Jul., + 8 = Aug., + 9 = Sept., + 10 = Oct., + 11 = Nov., + 12 = Dec., + } +\NewDocumentCommand \dateen { } + { + \prop_get:NVN \l_@@_dateen_prop \c_sys_month_int \l_@@_tmpa_tl + \l_@@_tmpa_tl ,~ \int_use:N \c_sys_year_int + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{通用常量} +% +% 这一部分内容在原\cls{fduthesis}中,是通过``*.def''文件实现的, +% 由于针对本校而言这些内容极少发生改变,为了减少文件依赖,将其 +% 全部写入了\cls{nwafuthesis.cls}文件。 +% +% \begin{variable}{\c_@@_name_simp_tl,\c_@@_name_trad_tl, +% \c_@@_name_en_tl} +% 学校名称。 +% \begin{macrocode} +\tl_const:Nn \c_@@_name_simp_tl { 西北农林科技大学 } +\tl_const:Nn \c_@@_name_trad_tl { 西北農林科技大學 } +\tl_const:Nn \c_@@_name_en_tl { Northwest~ A\&F~ University } +% \end{macrocode} +% \end{variable} +% +% 常用标点符号,见表~\ref{tab:punctuations}。 +% \begin{macrocode} +\clist_map_inline:nn + { + { ideo_comma } { "3001 }, + { ideo_full_stop } { "3002 }, + { fwid_comma } { "FF0C }, + { fwid_full_stop } { "FF0E }, + { fwid_colon } { "FF1A }, + { fwid_semicolon } { "FF1B }, + { fwid_left_paren } { "FF08 }, + { fwid_right_paren } { "FF09 } + } + { \@@_define_punct:nn #1 } +% \end{macrocode} +% +% \begin{table}[ht] +% \caption{常用标点符号} +% \label{tab:punctuations} +% \centering +% \begin{tabular}{cccc} +% \toprule +% \textbf{中文名称} & \textbf{英文名称} & \textbf{符号} & \textbf{Unicode} \\ +% \midrule +% 中文顿号 & Ideographic comma & \symbol{"3001} & U+3001 \\ +% 中文句号 & Ideographic full stop & \symbol{"3002} & U+3002 \\ +% 中文逗号 & Fullwidth comma & \symbol{"FF0C} & U+FF0C \\ +% 全角西文句点 & Fullwidth full stop & \symbol{"FF0E} & U+FF0E \\ +% 中文冒号 & Fullwidth colon & \symbol{"FF1A} & U+FF1A \\ +% 中文分号 & Fullwidth semicolon & \symbol{"FF1B} & U+FF1B \\ +% 中文左圆括号 & Fullwidth left parenthesis & \symbol{"FF08} & U+FF08 \\ +% 中文右圆括号 & Fullwidth right parenthesis & \symbol{"FF09} & U+FF09 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \begin{variable}{\c_@@_line_spread_fp} +% 行距倍数。行距倍数 $k$ 由下式确定: +% \begin{equation*} +% \num{1.2} \times k \times \SI{12}{bp} = \SI{20}{pt}. +% \end{equation*} +% 式中,\num{1.2} 是基本行距与文字大小之比,\SI{12}{bp} 是小四号字 +% 的大小,\SI{20}{pt} 是行距固定值。 +% \begin{macrocode} +\fp_const:Nn \c_@@_line_spread_fp + { \dim_ratio:nn { 20 pt } { 12 bp } / 1.2 } +% \end{macrocode} +% \end{variable} +% +% \subsubsection{声明页内容常量} +% +% \begin{variable}{\c_@@_orig_decl_text_tl} +% 论文独创性声明。 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生独创性声明,注意测试后,此处分段只能用\tn{par}实现。 +% \begin{macrocode} + \tl_const:Nn \c_@@_orig_decl_text_tl + { + 本人声明:所呈交的学位论文是我个人在导师指导下独立进行的研究工作及取 + 得的研究结果;论文中的研究数据及结果的获得完全符合学校《关于规范西北 + 农林科技大学研究生学术道德的暂行规定》,如果违反此规定,一切后果与法 + 律责任均由本人承担。\par + 尽我所知,除了文中特别加以标注和致谢的地方外,论文中不包含其他人已经 + 发表或撰写过的研究结果,也不包含其他人和自己本人已获得西北农林科技大 + 学或其它教育机构的学位或证书而使用过的材料。与我一同工作的同事对本 + 研究所做的任何贡献均已在论文的致谢中作了明确的说明并表示了谢意。 + } + } + { +% \end{macrocode} +% 本科生生独创性声明,注意测试后,此处分段只能用\tn{par}实现。 +% \begin{macrocode} + \tl_const:Nn \c_@@_orig_decl_text_tl + { + 本人声明:所呈交的毕业 + \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int } + 是我个人在导师指导下 + 独立进行的研究工作及取得的研究结果。尽我所知,除了文中特别加 + 以标注和致谢的地方外,论文中不包含其他人已经发表或撰写过的研究结果, + 也不包含其他人和自己本人已获得\c_@@_name_simp_tl{}或其它教育 + 机构的学位或证书而使用过的材料。与我一同工作的同事对本研究所做 + 的任何贡献均已在论文的致谢中作了明确的说明并表示了谢意。 + 如违反此声明,一切后果与法律责任均由本人承担。 + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_super_decl_text_tl} +% 研究生学位导师承诺。 +% \begin{macrocode} +\tl_const:Nn \c_@@_super_decl_text_tl + { + 本人承诺:我的研究生{\@@_text_uline:V \l_@@_info_author_tl}所呈交的 + 学位论文是在我指导下独立开展研究工作及取得的研究结果,属于我现 + 岗职务工作的结果,并严格按照学校《关于规范西北农林科技大学研究生学术 + 道德的暂行规定》而获得的研究结果。如果违反学校《关于规范西北农林科 + 技大学研究生学术道德的暂行规定》,我愿接受按学校有关规定的处罚处理并 + 承担相应导师连带责任。 + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_auth_decl_text_tl} +% 论文使用授权声明。 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生使用授权声明,注意测试后,此处分段只能用\tn{par}实现。 +% \begin{macrocode} + \tl_const:Nn \c_@@_auth_decl_text_tl + { + 本学位论文的知识产权归属西北农林科技大学。本人同意西北农林科技大学 + 保存或向国家有关部门或机构送交论文的纸质版和电子版,允许论文被查阅和 + 借阅;同意西北农林科技大学将本学位论文的全部或部分内容授权汇编录入 + 中国博士/硕士学位论文全文数据库》和《中国学位论文全文数据库》进行 + 出版,并享受相关权益。\par + + 本人保证,在毕业离开(或者工作调离)西北农林科技大学后,发表或者使用本 + 学位论文及其相关的工作成果时,将以西北农林科技大学为第一署名单位,否 + 则,愿意按《中华人民共和国著作权法》等有关规定接受处理并承担法律责任。\par + + 任何收存和保管本论文各种版本的其他单位和个人(包括研究生本人)未经本 + 论文作者的导师同意,不得有对本论文进行复制、修改、发行、出租、改编等 + 侵犯著作权的行为,否则,按违背《中华人民共和国著作权法》等有关规定处 + 理并追究法律责任。\par + + {\sffamily (保密的学位论文在保密期限内,不得以任何方式发表、借阅、复印、 + 缩印或扫描复制手段保存、汇编论文)} + } + } + { +% \end{macrocode} +% 本科生使用授权声明,注意测试后,此处分段只能用\tn{par}实现。 +% \begin{macrocode} + \tl_const:Nn \c_@@_auth_decl_text_tl + { + 本毕业 + \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int } + 的知识产权归属\c_@@_name_simp_tl{}。 + 本人同意\c_@@_name_simp_tl{}保存或向国家有关部门或机构 + 送交论文的纸质版和电子版,允许论文被查阅和借阅。\par + + 本人保证,在毕业离开\c_@@_name_simp_tl{}后,发表或者使用本毕业 + \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int } + 及其相关的工作成果时,将以\c_@@_name_simp_tl{} + 为第一署名单位,否则,愿意按《中华人民共和国著作权法》等 + 有关规定接受处理并承担法律责任。\par + + 任何收存和保管本论文各种版本的其他单位和个人(包括作者本人)未经 + 本论文作者的导师同意,不得有对本论文进行复制、修改、发行、出租、 + 改编等侵犯著作权的行为,否则,按违背《中华人民共和国著作权法》 + 等有关规定处理并追究法律责任。 + } + } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_orig_decl_sign_tl, +% \c_@@_super_decl_sign_tl} +% 声明页签名项目。 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生。 +% \begin{macrocode} + \tl_const:Nn \c_@@_orig_decl_sign_tl + { 研究生签名 } + \tl_const:Nn \c_@@_super_decl_sign_tl + { 导师签名 } + } + { +% \end{macrocode} +% 本科生。 +% \begin{macrocode} + \tl_const:Nn \c_@@_orig_decl_sign_tl + { 本科生签名 } + \tl_const:Nn \c_@@_super_decl_sign_tl + { 指导教师签名 } + } +\clist_const:Nn \c_@@_auth_decl_sign_clist + { 作者签名, 导师签名, 日期 } +% \end{macrocode} +% \end{variable} +% +% \subsubsection{杂项常量定义} +% +% \begin{variable}{\c_@@_thesis_type_clist, +% \c_@@_degree_type_clist, +% \c_@@_bachelor_type_clist} +% 论文类型与学位类型。 +% \begin{macrocode} +\clist_const:Nn \c_@@_thesis_type_clist + { 博士学位论文, 硕士学位论文, 本科毕业 } +\clist_const:Nn \c_@@_degree_type_clist + { 学术学位, 专业学位 } +\clist_const:Nn \c_@@_bachelor_type_clist + { 论文, 设计 } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_secret_clist} +% 四种密级,公开直接用,未列入。 +% \begin{macrocode} +\clist_const:Nn \c_@@_secret_clist { 限制, 秘密, 机密, 绝密 } +% \end{macrocode} +% \end{variable} +% +% 各字段默认名称,注意会忽略空格。 +% 研究生和本科名称存在不一样现象,例如研究生用“研究生学号”,本科生用“学号”。 +% +% 研究生和本科生名称相同中文字段。 +% \begin{macrocode} +% +\clist_map_inline:nn + { + { secret_level } { 密级 }, + { udc } { UDC }, + { school_id } { 学校代码 }, + { department } { 学院 }, + { enroll } { 年级 }, + { class_id } { 班级 }, + { instructors } { 指导小组 }, + { author_sign } { 作者签名 }, + { supervisor_sign } { 导师签名 }, + { sign_date } { 日期 }, + { toc } { 目 \quad 录 }, + { lof } { 插图目录 }, + { lot } { 表格目录 }, + { bib_en } { Bibliography }, + { ack } { 致 \quad 谢 }, + { resume } { 个人简历 }, + { pdf_creator } { LaTeX~ with~ nwafuthesis~ class }, + } + { \@@_define_name:nn #1 } +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% +% \end{macrocode} +% 研究生的字段。 +% \begin{macrocode} +% + \clist_map_inline:nn + { + { student_id } { 研究生学号 }, + { orig_decl } { 研究生学位论文的独创性声明 }, + { super_decl } { 导师指导研究生学位论文的承诺 }, + { auth_decl } { 关于研究生学位论文使用授权的说明 } + } + { \@@_define_name:nn #1 } + }{ +% +% \end{macrocode} +% 本科生的字段。 +% \begin{macrocode} +% + \clist_map_inline:nn + { + { major } { 专业 }, + { student_id } { 学号 }, + { author } { 学生姓名 }, + { cosupervisor } { 协助指导教师 }, + { date } { 完成日期 }, + { orig_decl } { 本科生毕业\clist_item:Nn + \c__@@_bachelor_type_clist { + \l__@@_info_bachelor_type_int + }的独创性声明 }, + { auth_decl } { 关于本科生毕业\clist_item:Nn + \c__@@_bachelor_type_clist { + \l__@@_info_bachelor_type_int + }知识产权的说明 } + } + { \@@_define_name:nn #1 } + } +% +% \end{macrocode} +% 研究生与本科生相同的中英文字段。 +% \begin{macrocode} +% +\clist_map_inline:nn + { + { supervisor } { 指导教师 } { Supervisor }, + } + { \@@_define_name:nnn #1 } +% +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% +% \end{macrocode} +% 研究生。 +% \begin{macrocode} +% + \clist_map_inline:nn + { + { major } { 学科专业 } { Major }, + { researchfield } { 研究方向 } { Research~ Field }, + { professionaltype } { 专业学位类型 } { Degree~ Type }, + { professionalfield } { 领域名称 } { Field }, + { author } { 论文作者 } { Candidate }, + { cosupervisor } { 联合指导教师 } { Co-Supervisor }, + { date } { 论文提交时间 } { Date~ of~ Submission }, + { abstract } { 摘 \quad 要 } { ABSTRACT }, + { keywords } { 关键字 } { KEYWORDS }, + { clc } { 分类号 } { CLC~ number: }, + { notation } { 主要符号对照表 } { List~ of~ Symbols } + } + { \@@_define_name:nnn #1 } + }{ +% +% \end{macrocode} +% 本科生。 +% \begin{macrocode} +% + \clist_map_inline:nn + { + { abstract } { 摘要 } { Abstract }, + { keywords } { 关键字 } { Keywords }, + { clc } { 分类号 } { CLC~ number }, + } + { \@@_define_name:nnn #1 } + } +% \end{macrocode} +% +% 定理标题中英文名称常量。 +% \begin{macrocode} +% +\clist_map_inline:nn + { + { proof } { 证明 } { Proof }, + { axiom } { 公理 } { Axiom }, + { corollary } { 推论 } { Corollary }, + { definition } { 定义 } { Definition }, + { example } { 例 } { Example }, + { lemma } { 引理 } { Lemma }, + { theorem } { 定理 } { Theorem } + } + { \@@_define_name:nnn #1 } +% \end{macrocode} +% +% \subsection{载入宏包、文档类} +% +% 将选项传入 \cls{ctexbook} 文档类。 +% \begin{macrocode} +\PassOptionsToClass + { + UTF8, + heading = true, + fontset = none, + zihao = -4, + linespread = \c_@@_line_spread_fp, + \g_@@_to_ctexbook_clist + } + { ctexbook } +% \end{macrocode} +% +% 传入各宏包选项。 +% \begin{macrocode} +\clist_map_inline:nn + { + { shortlabels } { enumitem }, + { no-math } { fontspec }, + { perpage } { footmisc }, + { amsmath, thmmarks } { ntheorem } + } + { \PassOptionsToPackage #1 } +% \end{macrocode} +% +% 本模板会在 \pkg{ctexhook} 提供的钩子 \cs{ctex_at_end_preamble:n} +% 中调用 \pkg{biblatex},而 \pkg{biblatex} 自身又会使用 \pkg{etoolbox} +% 的钩子 \tn{AtEndPreamble},因此需要在载入 \cls{ctexbook} 之前调用 +% \pkg{etoolbox}。钩子的顺序为: +% \[ \text{\tn{CTEX@document@left@hook}} +% \prec \text{\tn{@endpreamblehook}} +% \prec \text{\texttt{\textbackslash begin\{document\}}}. \] +% \begin{macrocode} +\RequirePackage { etoolbox } +% \end{macrocode} +% +% 载入 \cls{ctexbook} 文档类。 +% 在使用 \XeLaTeX{} 编译时,\cls{ctexbook} 的底层将调用 \pkg{xeCJK} +% 宏包;而在使用 \LuaLaTeX{} 编译时,则将调用 \pkg{LuaTeX-ja} 宏包。 +% 两种情况下 \cls{ctexbook} 均会调用 \pkg{fontspec} 宏包。 +% \begin{macrocode} +\LoadClass { ctexbook } +% \end{macrocode} +% +% +% 载入各宏包。其中,\pkg{amsmath} 必须在 \pkg{unicode-math} 之前引入。 +% \begin{macrocode} +\RequirePackage + { + amsmath, + unicode-math, + geometry, + fancyhdr, + titletoc, + footmisc, + ntheorem, + enumitem, + graphicx, + longtable, + booktabs, + caption, + xcolor, + } +% \end{macrocode} +% +% \begin{macro}{\@@_check_package:nnn} +% 检查过时宏包。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_check_package:nnn #1#2#3 + { + \@ifpackagelater {#1} {#2} + { } { \@@_error:nnn { package-too-old } {#1} {#3} } + } +\@@_msg_new:nn { package-too-old } + { + Package~ "#1"~ is~ too~ old. \\ + The~ nwafuthesis~ class~ only~ supports~ "#1"~ with~ a~ version \\ + higher~ than~ v#2. \\\\ + Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your \\ + TeX~ package~ manager~ or~ from~ CTAN. + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\@@_check_package:nnn { ctex } { 2017/08/07 } { 2.4.10 } +\@@_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e } +\@@_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i } +\sys_if_engine_xetex:T + { \@@_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } } +\sys_if_engine_luatex:T + { \@@_check_package:nnn { xunicode-addon } { 2018/04/30 } { 3.7.1 } } +% \end{macrocode} +% +% \subsection{页面布局} +% +% 利用 \pkg{geometry} 宏包设置纸张大小、页面边距以及页眉高度。这里, +% $\SI{2.54}{\centi\meter}=\SI{1}{in}$, +% $\SI{3.18}{\centi\meter}=\SI{1.25}{in}$。 +% +% 研究论文页面尺寸与本科生毕业论文(设计)的 +% 页面尺寸不一致,需要分开设置。 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生论文页边距 +% \begin{macrocode} + \geometry + { + paper=a4paper, + top=3.1cm, + bottom=3.3cm, + left=2.6cm, + right=2.6cm, + headheight=0.8cm, + headsep=0.7cm, + footskip=1.4cm, + %includehead, + %includefoot, + } + }{ +% \end{macrocode} +% 本科生论文页边距 +% \begin{macrocode} + \geometry + { + paper=a4paper, + top=3.14cm, + bottom=3.8cm, + left=2.45cm, + right=2.45cm, + headheight=0.8cm, + headsep=0.63cm, + footskip=2.3cm, + } + } +% \end{macrocode} +% +% 草稿模式下显示页面边框及页眉、页脚线 。 +% \begin{macrocode} +\bool_if:NT \g_@@_draft_bool { \geometry { showframe } } +% \end{macrocode} +% +% \subsection{字体} +% +% \subsubsection{预定义字体配置} +% +% \begin{variable}{\g_@@_fontset_tl, \g_@@_cjk_fontset_tl} +% 存放字体选项值。 +% \begin{macrocode} +\tl_new:N \g_@@_fontset_tl +\tl_new:N \g_@@_cjk_fontset_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{style/font} +% 预定义西文字体。 +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { + font .choices:nn = + { garamond, libertinus, lm, palatino, times, times*, none } + { \tl_set_eq:NN \g_@@_fontset_tl \l_keys_choice_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{style/cjk-font} +% 预定义中文字体。 +% \begin{macrocode} +%<*class> +\keys_define:nn { nwafu / style } + { + cjk-font .choices:nn = + { adobe, fandol, founder, mac, sinotype, sourcehan, windows, none } + { \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl } + } +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{withchapter} +% 设置本科论文章标题是否为章格式。 +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { + withchapter .bool_set:N = \l_@@_withchap_bool, + withchapter .default:n = true, + withchapter .initial:n = true, + } +% \end{macrocode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \@@_setmainfont:nn, +% \@@_setsansfont:nn, +% \@@_setmonofont:nn, +% \@@_setmathfont:nn} +% 用于设置西文字体的辅助函数,来源于 \pkg{fontspec} 和 \pkg{unicode-math}。 +% \begin{arguments} +% \item 字体名 +% \item 选项 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_setmainfont:nn #1#2 + { \__fontspec_main_setmainfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setsansfont:nn #1#2 + { \__fontspec_main_setsansfont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmonofont:nn #1#2 + { \__fontspec_main_setmonofont:nn {#2} {#1} } +\cs_new_protected:Npn \@@_setmathfont:nn #1#2 + { \__um_setmathfont:nn {#2} {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \@@_setCJKmainfont:nn, +% \@@_setCJKsansfont:nn, +% \@@_setCJKmonofont:nn} +% 用于设置中文字体的辅助函数,来源于 \pkg{xeCJK} 和 \pkg{ctex} 宏包。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_setCJKmainfont:nn #1#2 + { \@@_set_family:nnn { \CJKrmdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKsansfont:nn #1#2 + { \@@_set_family:nnn { \CJKsfdefault } {#2} {#1} } +\cs_new_protected:Npn \@@_setCJKmonofont:nn #1#2 + { \@@_set_family:nnn { \CJKttdefault } {#2} {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cjk_font_hei:nn,\nwafu@hei} +% 中文黑体需要单独设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_cjk_font_hei:nn #1#2 + { \@@_set_family:nnn { nwafu@hei } {#2} {#1} } +\cs_new_protected:Npn \nwafu@hei + { \@@_switch_family:n { nwafu@hei } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cjk_font_kai:nn,\nwafu@kai} +% 楷体需要单独设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_cjk_font_kai:nn #1#2 + { \@@_set_family:nnn { nwafu@kai } {#2} {#1} } +\cs_new_protected:Npn \nwafu@kai + { \@@_switch_family:n { nwafu@kai } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \@@_cjk_font_options:, +% \@@_cjk_font_hei_options:, +% \@@_setCJKmainfont:n, +% \@@_setCJKsansfont:n, +% \@@_setCJKmonofont:n, +% \@@_set_cjk_font_hei:n, +% \@@_set_cjk_font_kai:n} +% 将 bold、italic 和 bold italic 统一按照 roman 设置。 +% \begin{macrocode} +\tl_const:Nn \@@_cjk_font_options: + { UprightFont = *, ItalicFont = *, AutoFakeBold = true } +% \end{macrocode} +% 设置为黑体时不启用伪粗体 +% \begin{macrocode} +\tl_const:Nn \@@_cjk_font_hei_options: + { UprightFont = *, ItalicFont = *, AutoFakeBold = false } +% \end{macrocode} +% 设置正文常规字体 +% \begin{macrocode} +\cs_new_protected:Npx \@@_setCJKmainfont:n #1 + { \@@_setCJKmainfont:nn {#1} { \@@_cjk_font_options: } } +% \end{macrocode} +% 设置无衬线字体 +% \begin{macrocode} +\cs_new_protected:Npx \@@_setCJKsansfont:n #1 + { \@@_setCJKsansfont:nn {#1} { \@@_cjk_font_hei_options: } } +% \end{macrocode} +% 设置等宽字体 +% \begin{macrocode} +\cs_new_protected:Npx \@@_setCJKmonofont:n #1 + { \@@_setCJKmonofont:nn {#1} { \@@_cjk_font_options: } } +% \end{macrocode} +% 设置黑体字体 +% \begin{macrocode} +\cs_new_protected:Npx \@@_set_cjk_font_hei:n #1 + { \@@_set_cjk_font_hei:nn {#1} { \@@_cjk_font_hei_options: } } +% \end{macrocode} +% 设置楷体字体 +% \begin{macrocode} +\cs_new_protected:Npx \@@_set_cjk_font_kai:n #1 + { \@@_set_cjk_font_kai:nn {#1} { \@@_cjk_font_options: } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_family:nnn,\@@_switch_family:n} +% 封装 CJK 字体族的设定和切换命令。 +% \begin{macrocode} +\sys_if_engine_xetex:TF + { + \cs_new_eq:NN \@@_set_family:nnn \xeCJK_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \xeCJK_switch_family:n + } + { + \cs_new_eq:NN \@@_set_family:nnn \ctex_ltj_set_family:nnn + \cs_new_eq:NN \@@_switch_family:n \ctex_ltj_switch_family:n + } +% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \setmainfont, +% \setsansfont, +% \setmonofont, +% \setmathfont, +% \setCJKmainfont, +% \setCJKsansfont, +% \setCJKmonofont, +% \@@_set_font:n} +% 重新定义以上宏包提供的字体选择命令。把它放在导言区末尾,使得用户配置不被 +% 模板配置覆盖。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_font_helper:n #1 + { + \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } } + { + \ctex_at_end_preamble:n + { \use:c { @@_set #1 font:nn } {##2} { ##1, ##3 } } + } + } +\clist_map_inline:nn { main, sans, mono, math } { \@@_set_font_helper:n {#1} } +\clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \@@_set_font_helper:n {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{ +% \g_@@_font_family_libertinus_serif_tl, +% \g_@@_font_family_libertinus_sans_tl, +% \g_@@_font_style_libertinus_rm_tl, +% \g_@@_font_style_libertinus_bf_tl, +% \g_@@_font_style_libertinus_it_tl, +% \g_@@_font_style_libertinus_bfit_tl, +% \g_@@_font_style_libertinus_bfsl_tl, +% \g_@@_font_family_xits_tl, +% \g_@@_font_style_xits_rm_tl, +% \g_@@_font_style_xits_bf_tl, +% \g_@@_font_style_xits_it_tl, +% \g_@@_font_style_xits_bfit_tl, +% \g_@@_font_name_libertinus_serif_tl, +% \g_@@_font_name_libertinus_sans_tl, +% \g_@@_font_name_libertinus_math_tl, +% \g_@@_font_name_xits_tl, +% \g_@@_font_name_xits_math_rm_tl, +% \g_@@_font_name_xits_math_bf_tl} +% Libertinus 和 XITS 字体的文件名做过变动,需要特殊处理。 +% \begin{macrocode} +\tl_new:N \g_@@_font_family_libertinus_serif_tl +\tl_new:N \g_@@_font_family_libertinus_sans_tl +\tl_new:N \g_@@_font_style_libertinus_rm_tl +\tl_new:N \g_@@_font_style_libertinus_bf_tl +\tl_new:N \g_@@_font_style_libertinus_it_tl +\tl_new:N \g_@@_font_style_libertinus_bfit_tl +\tl_new:N \g_@@_font_style_libertinus_bfsl_tl +\tl_new:N \g_@@_font_family_xits_tl +\tl_new:N \g_@@_font_style_xits_rm_tl +\tl_new:N \g_@@_font_style_xits_bf_tl +\tl_new:N \g_@@_font_style_xits_it_tl +\tl_new:N \g_@@_font_style_xits_bfit_tl +\tl_new:N \g_@@_font_name_libertinus_serif_tl +\tl_new:N \g_@@_font_name_libertinus_sans_tl +\tl_new:N \g_@@_font_name_libertinus_math_tl +\tl_new:N \g_@@_font_name_xits_tl +\tl_new:N \g_@@_font_name_xits_math_rm_tl +\tl_new:N \g_@@_font_name_xits_math_bf_tl +\fontspec_font_if_exist:nTF { LibertinusSerif-Regular.otf } + { + \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { LibertinusSerif } + \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { LibertinusSans } + \tl_set:Nn \g_@@_font_family_libertinus_math_tl { LibertinusMath } + \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { Regular } + \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { Bold } + \tl_set:Nn \g_@@_font_style_libertinus_it_tl { Italic } + \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { BoldItalic } + \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { BoldOblique } + } + { + \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { libertinusserif } + \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { libertinussans } + \tl_set:Nn \g_@@_font_family_libertinus_math_tl { libertinusmath } + \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { regular } + \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { bold } + \tl_set:Nn \g_@@_font_style_libertinus_it_tl { italic } + \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { bolditalic } + \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { bolditalic } + } +\fontspec_font_if_exist:nTF { XITS-Regular.otf } + { + \tl_set:Nn \g_@@_font_family_xits_tl { XITS } + \tl_set:Nn \g_@@_font_style_xits_rm_tl { Regular } + \tl_set:Nn \g_@@_font_style_xits_bf_tl { Bold } + \tl_set:Nn \g_@@_font_style_xits_it_tl { Italic } + \tl_set:Nn \g_@@_font_style_xits_bfit_tl { BoldItalic } + \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { XITSMath-Regular } + \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { XITSMath-Bold } + } + { + \tl_set:Nn \g_@@_font_family_xits_tl { xits } + \tl_set:Nn \g_@@_font_style_xits_rm_tl { regular } + \tl_set:Nn \g_@@_font_style_xits_bf_tl { bold } + \tl_set:Nn \g_@@_font_style_xits_it_tl { italic } + \tl_set:Nn \g_@@_font_style_xits_bfit_tl { bolditalic } + \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { xits-math } + \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { xits-mathbold } + } +\tl_set:Nx \g_@@_font_name_libertinus_serif_tl + { \g_@@_font_family_libertinus_serif_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_libertinus_sans_tl + { \g_@@_font_family_libertinus_sans_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_libertinus_math_tl + { \g_@@_font_family_libertinus_math_tl - \g_@@_font_style_libertinus_rm_tl } +\tl_set:Nx \g_@@_font_name_xits_tl + { \g_@@_font_family_xits_tl - \g_@@_font_style_xits_rm_tl } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_garamond:} +% EB Garamond 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_garamond: + { + \@@_setmainfont:nn { EBGaramond } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Italic, + BoldItalicFont = *-BoldItalic + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { Garamond-Math.otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_libertinus:} +% Libertinus 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_libertinus: + { + \@@_setmainfont:nn { \g_@@_font_family_libertinus_serif_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfit_tl + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { \g_@@_font_name_libertinus_math_tl .otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_lm:} +% Latin Modern 系列。在 \XeLaTeX{} 和 \LuaLaTeX{} 中已作为默认字体,所以仅需 +% 额外处理数学部分。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_lm: + { \@@_setmathfont:nn { latinmodern-math.otf } { } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_palatino:} +% Palatino 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_palatino: + { + \@@_setmainfont:nn { texgyrepagella } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_libertinus_rm_tl, + BoldFont = *-\g_@@_font_style_libertinus_bf_tl, + ItalicFont = *-\g_@@_font_style_libertinus_it_tl, + BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl, + Scale = MatchUppercase + } + \@@_setmonofont:nn { lmmonolt10 } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-oblique, + BoldItalicFont = *-boldoblique + } + \@@_setmathfont:nn { texgyrepagella-math.otf } { } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_times:} +% Times 系列。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font_times: + { + \@@_setmainfont:nn { \g_@@_font_family_xits_tl } + { + Extension = .otf, + UprightFont = *-\g_@@_font_style_xits_rm_tl, + BoldFont = *-\g_@@_font_style_xits_bf_tl, + ItalicFont = *-\g_@@_font_style_xits_it_tl, + BoldItalicFont = *-\g_@@_font_style_xits_bfit_tl + } + \@@_setsansfont:nn { texgyreheros } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic + } + \@@_setmonofont:nn { texgyrecursor } + { + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + Ligatures = CommonOff + } + \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf } + { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_font_times*:} +% Times* 系列,除数学部分外采用系统字体。 +% \begin{macrocode} +\cs_new_protected:cpn { @@_load_font_ times* : } + { + \@@_setmainfont:nn { Times~ New~ Roman } { } + \@@_setsansfont:nn { Arial } { } + \@@_setmonofont:nn { Courier~ New } { } + \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf } + { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_adobe:} +% Adobe 字库。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_adobe: + { + \@@_setCJKmainfont:n { AdobeSongStd-Light } + \@@_setCJKsansfont:n { AdobeHeitiStd-Regular } + \@@_setCJKmonofont:n { AdobeFangsongStd-Regular } + \@@_set_cjk_font_hei:n { AdobeHeitiStd-Regular } + \@@_set_cjk_font_kai:n { AdobeKaitiStd-Regular } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_fandol:} +% Fandol 字库。注意它是安装在 TeX 发行版中的,所以使用文件名调用。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_fandol: + { + \@@_setCJKmainfont:nn { FandolSong } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { FandolHei } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKmonofont:nn { FandolFang } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + \@@_set_cjk_font_hei:nn { FandolHei } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_set_cjk_font_kai:nn { FandolKai } + { + Extension = .otf, + UprightFont = *-Regular, + BoldFont = *-Regular, + ItalicFont = *-Regular, + BoldItalicFont = *-Regular + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_founder:} +% 方正字库。虽然有粗体(方正小标宋)等,但并非免费,故这里不做处理。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_founder: + { + \@@_setCJKmainfont:nn { FZShuSong-Z01 } + { + UprightFont = *, + BoldFont = FZHei-B01, + ItalicFont = FZKai-Z03, + } + \@@_setCJKsansfont:n { FZHei-B01 } + \@@_setCJKmonofont:n { FZFangSong-Z02 } + \@@_set_cjk_font_hei:n { FZHei-B01 } + \@@_set_cjk_font_kai:n { FZKai-Z03 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_mac:} +% macOS 自带中文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_mac: + { + \@@_setCJKmainfont:nn { STSongti-SC } + { + UprightFont = *-Light, + BoldFont = *-Bold, + ItalicFont = *-Light, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { STHeitiSC } + { + UprightFont = *-Medium, + BoldFont = *-Medium, + ItalicFont = *-Medium, + BoldItalicFont = *-Medium + } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_hei:nn { STHeitiSC } + { + UprightFont = *-Medium, + BoldFont = *-Medium, + ItalicFont = *-Medium, + BoldItalicFont = *-Medium + } + \@@_set_cjk_font_kai:nn { STKaitiSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_sinotype:} +% 华文字库。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_sinotype: + { + \@@_setCJKmainfont:n { STSong } + \@@_setCJKsansfont:n { STHeiti } + \@@_setCJKmonofont:n { STFangsong } + \@@_set_cjk_font_hei:n { STHeiti } + \@@_set_cjk_font_kai:n { STKaiti } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_sourcehan:} +% 思源宋体、思源黑体。由于没有对应的楷体和仿宋,这里直接给出警告。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_sourcehan: + { + \@@_setCJKmainfont:nn { SourceHanSerifSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_setCJKsansfont:nn { SourceHanSansSC } + { + UprightFont = *-Regular, + BoldFont = *-Bold, + ItalicFont = *-Regular, + BoldItalicFont = *-Bold + } + \@@_warning:n { source-han } + } +\@@_msg_new:nn { source-han } + { Font~ set~ `sourcehan'~ does~ not~ contain~ kaiti~ and~ fangsong. } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_windows:} +% Windows 自带中文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_windows: + { + \@@_setCJKmainfont:n { SimSun } + \@@_setCJKsansfont:n { SimHei } + \@@_setCJKmonofont:n { FangSong } + \@@_set_cjk_font_hei:n { SimHei } + \@@_set_cjk_font_kai:n { KaiTi } + } +% \end{macrocode} +% \end{macro} +% +% 探测操作系统,以设置中英文字体。 +% \begin{macrocode} +\tl_new:N \l_@@_cjkfont_tl +\tl_new:N \l_@@_font_tl +\cs_new_protected:Npn \@@_detect_platform: + { + \sys_if_platform_windows:TF + { + \tl_set:Nn \l_@@_cjkfont_tl { windows } + \tl_set:Nn \l_@@_font_tl { times* } + } + { + \@@_if_platform_macos:TF + { + \tl_set:Nn \l_@@_cjkfont_tl { mac } + \tl_set:Nn \l_@@_font_tl { times* } + }{ + \tl_set:Nn \l_@@_cjkfont_tl { fandol } + \tl_set:Nn \l_@@_font_tl { times } + } + } + } +\cs_new_protected:Npn \@@_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +% \end{macrocode} +% +% \begin{macro}{\@@_load_font:} +% 字体加载命令。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font: + { + \tl_if_empty:NTF \g_@@_fontset_tl + { + \@@_detect_platform: + \tl_gset_eq:NN \g_@@_fontset_tl \l_@@_font_tl + }{ + } + \tl_if_empty:NTF \g_@@_cjk_fontset_tl + { + \@@_detect_platform: + \tl_gset_eq:NN \g_@@_cjk_fontset_tl \l_@@_cjkfont_tl + }{ + } + \use:c { @@_load_font_ \g_@@_fontset_tl : } + \use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : } + } +\ctex_at_end_preamble:n { \@@_load_font: } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{数学字体设置} +% +% 根据 GB 3102.11--93 以及 ISO 80000-2:2009 的规定,数学表达式中 +% 表示变量的拉丁字母和希腊字母均应当使用斜体。 +% 这里的 |\keys_set:nn{unicode-math}| 实际相当于 \cs{unimathsetup}。 +% \begin{macrocode} +\keys_set:nn { unicode-math } + { + math-style = ISO, + bold-style = ISO, +% mathrm = sym + } +% \end{macrocode} +% +% \subsubsection{字号} +% +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/font-size} +% |font-size| 不是文档类选项,不能传给 \cls{ctexbook} 文档类,因此 +% 只能手动重定义字号命令。 +% \begin{macrocode} + font-size .choice:, + font-size .value_required:n = true, + font-size / -4 .code:n = { }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tiny,\scriptsize,\footnotesize,\small, +% \normalsize,\large,\Large,\LARGE,\huge,\Huge} +% 默认使用小四号字,所以只有五号字需要重新设置。 +% \begin{macrocode} + font-size / 5 .code:n = + { + \RenewDocumentCommand \tiny { } { \zihao { 7 } } + \RenewDocumentCommand \scriptsize { } { \zihao { -6 } } + \RenewDocumentCommand \footnotesize { } { \zihao { 6 } } + \RenewDocumentCommand \small { } { \zihao { -5 } } + \RenewDocumentCommand \normalsize { } { \zihao { 5 } } + \RenewDocumentCommand \large { } { \zihao { -4 } } + \RenewDocumentCommand \Large { } { \zihao { -3 } } + \RenewDocumentCommand \LARGE { } { \zihao { -2 } } + \RenewDocumentCommand \huge { } { \zihao { 2 } } + \RenewDocumentCommand \Huge { } { \zihao { 1 } } +%<*class> + }, +% \end{macrocode} +% \end{macro} +% +% \subsubsection{句号} +% +% \begin{macro}{style/fullwidth-stop} +% 设置句号形状(圆圈或是圆点)。 +% \begin{macrocode} + fullwidth-stop .choice:, + fullwidth-stop .value_required:n = true, +% \end{macrocode} +% 利用类别码机制切换,只有显式的\FSID 会被替换。 +% \begin{macrocode} + fullwidth-stop / catcode .code:n = + { \@@_set_fullwidth_stop_catcode: }, +% \end{macrocode} +% 利用 TECKit 映射机制切换,相当于设置了 \tn{defaultCJKfontfeatures} +% |{|\kvopt{Map\-ping}{fullwidth-stop}|}|。这种手段会替换所有出现的\FSID, +% 并且将影响所有字体。只在 \XeTeX{} 下可用。 +% \begin{macrocode} + fullwidth-stop / mapping .code:n = + { + \sys_if_engine_xetex:TF + { + \clist_gset:Nn \g__xeCJK_default_features_clist + { Mapping = fullwidth-stop } + } + { +% \end{macrocode} +% \LuaTeX{} 下改用类别码机制代替,并给出警告。 +% \begin{macrocode} + \sys_if_engine_luatex:T + { + \@@_warning:n { mapping-not-available } + \@@_set_fullwidth_stop_catcode: + } + } + }, + fullwidth-stop / false .code:n = { } + } +% \end{macrocode} +% \end{macro} +% +% 提示信息。 +% \begin{macrocode} +\@@_msg_new:nn { mapping-not-available } + { + Option~ "fullwidth-stop = mapping"~ is~ not~ available~ in~ LuaTeX. \\ + "fullwidth-stop = catcode"~ will~ be~ set~ instead. + } +% \end{macrocode} +% +% \begin{macro}{\@@_set_fullwidth_stop_catcode:} +% 将\FSID 设置为活动符,并定义为句点\FSFW。 +% \begin{macrocode} +\cs_new:Npn \@@_set_fullwidth_stop_catcode: + { + \char_set_active_eq:nN { "3002 } \c_@@_fwid_full_stop_tl + \char_set_catcode_active:n { "3002 } + } +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{页眉页脚} +% +% 清除默认页眉页脚格式。 +% \begin{macrocode} +\fancyhf { } +% \end{macrocode} +% +% \begin{variable}{\l_@@_header_center_mark_tl} +% 保存中间页眉的文字。正文中设置为空,目录、摘要、符号表、 +% 参考文献、附录、致谢、个人简历等设置为相应标题。 +% \begin{macrocode} +\tl_new:N \l_@@_header_center_mark_tl +% \end{macrocode} +% \end{variable} +% +% 关闭横线显示(未启用)。 +% \begin{macrocode} +% \RenewDocumentCommand \headrulewidth { } { 0 pt } +% \end{macrocode} +% +% \begin{macro}{\cleardoublepage} +% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示页眉页脚,见 +% \url{https://tex.stackexchange.com/a/1683}。最后清空中间页眉,确保正文部分 +% 页眉显示正确。 +% \begin{macrocode} +\RenewDocumentCommand \cleardoublepage { } + { + \clearpage + \bool_if:NT \g_@@_twoside_bool + { + \int_if_odd:nF \c@page + { \hbox:n { } \thispagestyle { empty } \newpage } + } + \tl_gset:Nn \l_@@_header_center_mark_tl { } + } +% \end{macrocode} +% \end{macro} +% +% +% \pkg{ctex} 宏包使用 \opt{heading} 选项后,会把页面格式设置为 |headings|。 +% 因此必须在 \pkg{ctex} 调用之后重新设置 \cs{pagestyle} 为 |fancy|。 +% \begin{macrocode} +\pagestyle { fancy } +% \end{macrocode} +% +% \begin{macro}{\frontmatter,\mainmatter} +% 重定义 \tn{frontmatter}和\tn{frontmatter}, +% 以根据学校要求定制摘要、目录、主要符号对照表等前置部分的页眉页脚。 +% \begin{macrocode} +\cs_gset_eq:NN \nwafuhead\fancyhead +\cs_gset_eq:NN \nwafufoot\fancyfoot +% \end{macrocode} +% 重定义 \tn{frontmatter},带星号的命令不会启用\cs{cleardoublepage}。 +% \begin{macrocode} +\RenewDocumentCommand{\frontmatter}{sO{Roman}} + { +% \end{macrocode} +% 判断是否有*号参数 +% \begin{macrocode} + \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} + \@mainmatterfalse +% \end{macrocode} +% 页码格式 +% \begin{macrocode} + \pagenumbering{#2} +% \end{macrocode} +% 双面模式 +% \begin{macrocode} + \bool_if:NTF \g_@@_twoside_bool + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \nwafuhead[OC]{\small \nouppercase{ \leftmark } } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ \leftmark } } + } + }{ +% \end{macrocode} +% 单面模式,奇偶页设成一样 +% \begin{macrocode} + \nwafuhead [ C ] + { + \small \nouppercase { \l_@@_header_center_mark_tl } + } + } + \nwafufoot[C]{\small\thepage} + } +% \end{macrocode} +% 重定义 \tn{mainmatter},带星号的命令不会启用\cs{cleardoublepage}。 +% \begin{macrocode} +\RenewDocumentCommand{\mainmatter}{s} + { +% \end{macrocode} +% 判断是否有*号参数 +% \begin{macrocode} + \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} + \@mainmattertrue +% \end{macrocode} +% 页码格式 +% \begin{macrocode} + \pagenumbering{arabic} +% \end{macrocode} +% 双面模式 +% \begin{macrocode} + \bool_if:NTF \g_@@_twoside_bool + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \nwafuhead[OC]{\small \nouppercase{ \leftmark } } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ \l__@@_info_title_tl } } + } + }{ +% \end{macrocode} +% 单面模式,奇偶页设成一样 +% \begin{macrocode} + \nwafuhead [ C ] + { + \int_if_odd:nTF \c@page + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \small \nouppercase{ \leftmark } + }{ + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ \l__@@_info_title_tl } + } + } + } + } + \int_compare:nNnTF{ \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生页脚 +% \begin{macrocode} + \nwafufoot[C]{\small\thepage} + }{ +% \end{macrocode} +% 本科生页脚 +% \begin{macrocode} + \nwafufoot[C]{\small-\ \thepage\ -} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bibmatter} +% 新定义 \cs{bibmatter},以根据学校要求定制参考文献页眉页脚。 +% \begin{macrocode} +\NewDocumentCommand{\bibmatter}{s} + { +% \end{macrocode} +% 判断是否有*号参数 +% \begin{macrocode} + \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} + \@mainmattertrue +% \end{macrocode} +% 是否为双面排版 +% \begin{macrocode} + \bool_if:NTF \g_@@_twoside_bool + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \nwafuhead[OC]{\small \nouppercase{ \leftmark } } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ \leftmark } } + } + }{ +% \end{macrocode} +% 单面排版 +% \begin{macrocode} + \nwafuhead [ C ] + { + \int_if_odd:nTF \c@page + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \small \nouppercase{ \leftmark } + }{ + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ \leftmark } + } + } + } + } + } +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\appendix,\backmatter} +% 为 \cs{appendix}和\cs{backmatter}命令追加代码, +% 以根据学校要求定制附录及后置(致谢、个人简历等)页眉页脚。 +% \begin{macrocode} +\@@_appto_cmd:Nn \appendix + { + \clearpage + \bool_if:NTF \g_@@_twoside_bool +% \end{macrocode} +% 双面 +% \begin{macrocode} + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \nwafuhead[OC]{\small \nouppercase{ \@chapapp } } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ \@chapapp } } + } + }{ +% \end{macrocode} +% 单面 +% \begin{macrocode} + \nwafuhead [ C ] + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \int_if_odd:nTF \c@page + { + \small \nouppercase{ \@chapapp } + }{ + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ \@chapapp } + } + } + } + } + } + +\@@_appto_cmd:Nn \backmatter + { + \clearpage + \bool_if:NTF \g_@@_twoside_bool + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \nwafuhead[OC]{\small \nouppercase{ \leftmark } } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \nwafuhead[EC]{\small \nouppercase{ \leftmark } } + } + }{ +% \end{macrocode} +% 单面 +% \begin{macrocode} + \nwafuhead [ C ] + { + \int_if_odd:nTF \c@page + { +% \end{macrocode} +% 奇数页页眉 +% \begin{macrocode} + \small \nouppercase{ \leftmark } + }{ + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ + \c_@@_name_simp_tl \clist_item:Nn + \c_@@_thesis_type_clist { \g_@@_thesis_type_int } } + }{ +% \end{macrocode} +% 本科生偶数页页眉 +% \begin{macrocode} + \small \nouppercase{ \leftmark } + } + } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{章节标题设置} +% +% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。 +% +% 设置章(chapter)、节(section)与小节(sub-section)标题样式。 +% 此处使用 \kvopt{fixskip}{true} 选项来抑制前后的多余间距。 +% +% 设置标题级别 +% \begin{macrocode} +\int_compare:nNnTF{ \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生 +% \begin{macrocode} + \keys_set:nn { ctex } + { + secnumdepth = 3, + chapter = + { + pagestyle = fancy, + aftername = \hspace*{1.0\ccwd}, + format = \zihao{3} \normalfont \nwafu@hei \bfseries \centering, + beforeskip = 1.47\baselineskip, + afterskip = 1.24\baselineskip, + number = \@@_arabic:n { chapter }, + fixskip = true + }, + section = + { + format = \zihao{-3} \normalfont \nwafu@hei \bfseries \raggedright, + beforeskip = 1.09\baselineskip, + afterskip = 0.80\baselineskip, + fixskip = true + }, + subsection = + { + format = \zihao{4} \normalfont \nwafu@hei \bfseries \raggedright, + beforeskip = 0.80\baselineskip, + fixskip = true + }, + subsubsection = + { + format = \zihao{-4} \normalfont \nwafu@hei \bfseries \raggedright, + beforeskip = 0.40\baselineskip, + afterskip = 0.40\baselineskip, + fixskip = true + } + } + }{ +% \end{macrocode} +% 本科生 +% \begin{macrocode} + \keys_set:nn { ctex } + { + secnumdepth = 3, + chapter = + { + pagestyle = fancy, + name = { \bool_if:NT \l_@@_withchap_bool {第}, + \bool_if:NT \l_@@_withchap_bool {章} }, + number = \@@_arabic:n { chapter }, + aftername = \hspace*{\ccwd}, + format = \zihao{3} \normalfont \nwafu@hei \bfseries \centering, + beforeskip = 0.25\baselineskip, + afterskip = 0.65\baselineskip, + fixskip = true + }, + section = + { + aftername = \hspace*{0.5\ccwd}, + format = \zihao{4} \normalfont \nwafu@hei \bfseries \raggedright, + beforeskip = 0.60\baselineskip, + afterskip = 0.65\baselineskip, + fixskip = true, + afterindent = true, + }, + subsection = + { + aftername = \hspace*{0.5\ccwd}, + format = \zihao{-4} \normalfont \nwafu@hei \bfseries, + beforeskip = 0.60\baselineskip, + afterskip = 0.65\baselineskip, + fixskip = true, + afterindent = true, + % indent = 2\ccwd, + }, + subsubsection = + { + name = {(,)}, + aftername = \hspace*{0.5\ccwd}, + number = \@@_arabic:n { subsubsection }, + format = \zihao{-4} \normalfont, + beforeskip = 0.60\baselineskip, + afterskip = 0.65\baselineskip, + fixskip = true, + % afterindent = true, + indent = 2\ccwd, + } + } + } +% \end{macrocode} +% +% +% \begin{macro}{\@@_chapter:n,\@@_chapter:V} +% 手动生成章的标题,用于摘要、参考文献等。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter:n #1 + { + \group_begin: + \ctexset { chapter / numbering = false } + \chapter {#1} + \@@_chapter_header:n {#1} + \group_end: + } +\cs_generate_variant:Nn \@@_chapter:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_no_toc:n,\@@_chapter_no_toc:V} +% 目录自身不出现在目录中,需特别处理。参考 +% \url{https://tex.stackexchange.com/a/1821}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_no_toc:n #1 + { + \chapter * {#1} + \@@_chapter_header:n {#1} + \pdfbookmark [0] {#1} { toc } + } +\cs_generate_variant:Nn \@@_chapter_no_toc:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter_header:n} +% 单页模式下,目录、摘要、符号表等的页眉中间为相应标题,左右为空。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_chapter_header:n #1 + { + \bool_if:NTF \g_@@_twoside_bool + { \markboth {#1} {#1} } + { + \markboth { } { } + \tl_gset:Nn \l_@@_header_center_mark_tl {#1} + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{脚注} +% +% \emph{脚注部分的代码完全使用\cls{fduthesis}模板的代码}。 +% +% \subsubsection{编号样式} +% +% 各种脚注编号样式的名称。 +% \begin{macrocode} +\clist_map_inline:nn + { + { plain } { plain }, + { libertinus } { libertinus }, + { libertinus_neg } { libertinus* }, + { libertinus_sans } { libertinus-sans }, + { pifont } { pifont }, + { pifont_neg } { pifont* }, + { pifont_sans } { pifont-sans }, + { pifont_sans_neg } { pifont-sans* }, + { xits } { xits }, + { xits_sans } { xits-sans }, + { xits_sans_neg } { xits-sans* } + } + { \@@_define_fn_style:nn #1 } +% \end{macrocode} +% +% \begin{variable}{\l_@@_fn_style_tl} +% 保存当前使用的脚注编号样式。 +% \begin{macrocode} +\tl_new:N \l_@@_fn_style_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/footnote-style} +% 脚注类型共分四大类: +% \begin{itemize} +% \item \opt{plain}:使用当前字体; +% \item \opt{libertinus}:取自 Libertinus Serif 和 Libertinus Sans +% 字体; +% \item \opt{pifont}:使用 \pkg{pifont} 宏包; +% \item \opt{xits}:取自 XITS 字体。 +% \end{itemize} +% 不带任何修饰的为衬线阳文符号,带“|sans|”的为无衬线符号,带“|*|”的 +% 为阴文版本。 +% \begin{macrocode} + footnote-style .choices:nn = + { + plain, + libertinus, libertinus*, libertinus-sans, + pifont, pifont*, pifont-sans, pifont-sans*, + xits, xits-sans, xits-sans* + } +% \end{macrocode} +% 若使用 \opt{pifont} 类型,则需引入 \pkg{pifont} 宏包。 +% \begin{macrocode} + { + \tl_gset_eq:NN \l_@@_fn_style_tl \l_keys_choice_tl + \int_compare:nT { 5 <= \l_keys_choice_int <= 8 } + { \RequirePackage { pifont } } + }, + footnote-style .value_required:n = true + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus:n} +% \opt{libertinus} 普通版。\numrange{1}{20} 为数字,\numrange{21}{46} +% 为小写英文字母,\numrange{47}{72} 为大写英文字母。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_libertinus:n #1 + { + \int_compare:nTF { #1 >= 21 } + { + \int_compare:nTF { #1 >= 47 } + { \@@_symbol:n { \int_eval:n { "24B6 - 47 + #1 } } } + { \@@_symbol:n { \int_eval:n { "24D0 - 21 + #1 } } } + } + { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus_neg:n} +% \opt{libertinus} 阴文衬线版。只含 \numrange{1}{20}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_libertinus_neg:n #1 + { + \int_compare:nTF { #1 >= 11 } + { \@@_symbol:n { \int_eval:n { "24EB - 11 + #1 } } } + { \@@_symbol:n { \int_eval:n { "2776 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_libertinus_sans:n} +% \opt{libertinus} 阳文无衬线版。符号排列与普通版相同。 +% \begin{macrocode} +\cs_new_eq:NN \@@_fn_symbol_libertinus_sans:n \@@_fn_symbol_libertinus:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont:n} +% \opt{pifont} 普通版。以下四种都只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont:n #1 + { \ding { \int_eval:n { 171 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_neg:n} +% \opt{pifont} 阴文衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_neg:n #1 + { \ding { \int_eval:n { 181 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_sans:n} +% \opt{pifont} 阳文无衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_sans:n #1 + { \ding { \int_eval:n { 191 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_pifont_sans_neg:n} +% \opt{pifont} 阴文无衬线版。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_pifont_sans_neg:n #1 + { \ding { \int_eval:n { 201 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits:n} +% \opt{xits} 普通版。\numrange{1}{9} 为数字,\numrange{10}{35} +% 为小写英文字母,\numrange{36}{61} 为大写英文字母。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits:n #1 + { + \int_compare:nTF { #1 >= 10 } + { + \int_compare:nTF { #1 >= 36 } + { \@@_symbol:n { \int_eval:n { "24B6 - 36 + #1 } } } + { \@@_symbol:n { \int_eval:n { "24D0 - 10 + #1 } } } + } + { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits_sans:n} +% \opt{xits} 阳文无衬线版。只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits_sans:n #1 + { \@@_symbol:n { \int_eval:n { "2780 - 1 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fn_symbol_xits_sans_neg:n} +% \opt{xits} 阴文无衬线版。也只包含 \numrange{1}{10}。 +% \begin{macrocode} +\cs_new:Npn \@@_fn_symbol_xits_sans_neg:n #1 + { \@@_symbol:n { \int_eval:n { "278A - 1 + #1 } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thefootnote} +% 重定义脚注编号。 +% \begin{macrocode} +\cs_set:Npn \thefootnote { \nwafu_footnote_number:N \c@footnote } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nwafu_footnote_number:N} +% 脚注编号样式。 +% \begin{macrocode} +\cs_new:Npn \nwafu_footnote_number:N #1 + { + \tl_case:NnF \l_@@_fn_style_tl + { +% \end{macrocode} +% \opt{plain} 类型直接使用计数器 |footnote| 的值。 +% \begin{macrocode} + \c_@@_fn_style_plain_tl + { \int_use:N #1 } +% \end{macrocode} +% \opt{libertinus} 类型需要使用 Libertinus Serif 或 +% Libertinus Sans 字体。 +% \begin{macrocode} + \c_@@_fn_style_libertinus_tl + { + \fontspec { \g_@@_font_name_libertinus_serif_tl .otf } + \@@_fn_symbol_libertinus:n {#1} + } + \c_@@_fn_style_libertinus_neg_tl + { + \fontspec { \g_@@_font_name_libertinus_serif_tl .otf } + \@@_fn_symbol_libertinus_neg:n {#1} + } + \c_@@_fn_style_libertinus_sans_tl + { + \fontspec { \g_@@_font_name_libertinus_sans_tl .otf } + \@@_fn_symbol_libertinus_sans:n {#1} + } +% \end{macrocode} +% \opt{pifont} 类型无需进行额外的操作。 +% \begin{macrocode} + \c_@@_fn_style_pifont_tl + { \@@_fn_symbol_pifont:n {#1} } + \c_@@_fn_style_pifont_neg_tl + { \@@_fn_symbol_pifont_neg:n {#1} } + \c_@@_fn_style_pifont_sans_tl + { \@@_fn_symbol_pifont_sans:n {#1} } + \c_@@_fn_style_pifont_sans_neg_tl + { \@@_fn_symbol_pifont_sans_neg:n {#1} } +% \end{macrocode} +% \opt{xits} 类型需要临时切换数学字体。 +% \begin{macrocode} + \c_@@_fn_style_xits_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits:n {#1} + } + \c_@@_fn_style_xits_sans_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits_sans:n {#1} + } + \c_@@_fn_style_xits_sans_neg_tl + { + \fontspec { \g_@@_font_name_xits_tl .otf } + \@@_fn_symbol_xits_sans_neg:n {#1} + } + } +% \end{macrocode} +% 变量 \cs{l_@@_fn_style_tl} 保存的类型未知时,默认使用 \opt{plain} +% 类型。 +% \begin{macrocode} + { \int_use:N #1 } + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{整体样式} +% +% \begin{macro}[int]{\@makefntext} +% 重定义内部脚注文字命令,使脚注编号不使用上标,宽度为 \SI{1.5}{em}。 +% 见 \url{http://tex.stackexchange.com/q/19844} 和 +% \url{https://www.zhihu.com/question/53030087}。 +% \begin{macrocode} +\cs_set:Npn \@makefntext #1 + { + \mode_leave_vertical: + \hbox_to_wd:nn { 1.5 em } { \@thefnmark \hfil } + #1 + } +% \end{macrocode} +% \end{macro} +% +% \subsection{定理环境} +% +% \emph{定理环境部分的代码完全使用\cls{fduthesis}模板的代码}。 +% +% \begin{variable}{\c_@@_thm_style_plain_clist, +% \c_@@_thm_style_break_clist} +% 保存 \opt{plain}、\opt{break} 两种类型的定理样式名称。 +% \begin{macrocode} +\clist_const:Nn \c_@@_thm_style_plain_clist + { plain, margin, change } +\clist_const:Nn \c_@@_thm_style_break_clist + { break, marginbreak, changebreak } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_thm_style_tl, +% \l_@@_thm_header_font_tl, +% \l_@@_thm_body_font_tl, +% \l_@@_thm_qed_tl, +% \l_@@_thm_counter_tl} +% 定理所需的一些字段。 +% \begin{macrocode} +\tl_new:N \l_@@_thm_style_tl +\tl_new:N \l_@@_thm_header_font_tl +\tl_new:N \l_@@_thm_body_font_tl +\tl_new:N \l_@@_thm_qed_tl +\tl_new:N \l_@@_thm_counter_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{theorem/style, +% theorem/header-font, +% theorem/body-font, +% theorem/qed, +% theorem/counter} +% 定义 |nwafu/theorem| 键值类。 +% \begin{macrocode} +\keys_define:nn { nwafu / theorem } + { + style .tl_set:N = \l_@@_thm_style_tl, + header-font .tl_set:N = \l_@@_thm_header_font_tl, + body-font .tl_set:N = \l_@@_thm_body_font_tl, + qed .tl_set:N = \l_@@_thm_qed_tl, + counter .tl_set:N = \l_@@_thm_counter_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_thm_ntheorem_style:n,\@@_thm_ntheorem_new:w} +% 拷贝 \pkg{ntheorem} 命令。 +% \begin{macrocode} +\cs_new_eq:NN \@@_thm_ntheorem_style:n \theoremstyle +\cs_new_eq:NN \@@_thm_ntheorem_new:w \newtheorem +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\newtheorem} +% 定义新的定理环境。 +% \begin{macrocode} +\RenewDocumentCommand \newtheorem { s o m m } + { +% \end{macrocode} +% 默认情况下,由 \cs{newtheorem*} 创建的定理其证毕符号为 \cs{QED}, +% 而由 \cs{new\-the\-orem} 创建的则不带证毕符号。符号 \cs{QED} 由 +% \pkg{unicode-math} 宏包提供。 +% \begin{macrocode} + \IfBooleanTF {#1} + { \tl_set:Nn \l_@@_thm_qed_tl { \ensuremath { \QED } } } + { \tl_set:Nn \l_@@_thm_qed_tl { } } +% \end{macrocode} +% 设置默认样式为 \opt{plain}。 +% \begin{macrocode} +% TODO: (2017-12-07) Move to interface + \tl_set:Nn \l_@@_thm_style_tl { plain } +% \end{macrocode} +% 处理可选参数。利用 |nwafu/theorem| 键值对设置,并按此修改证毕符号、 +% 定理头字体和定理正文字体。 +% \begin{macrocode} + \IfValueT {#2} { \keys_set:nn { nwafu / theorem } {#2} } + \nwafu_thm_set_header_font:V \l_@@_thm_header_font_tl + \nwafu_thm_set_body_font:V \l_@@_thm_body_font_tl + \nwafu_thm_set_qed:V \l_@@_thm_qed_tl +% \end{macrocode} +% \cs{newtheorem} 负责创建编号定理,而 \cs{newtheorem*} +% 则负责创建无编号定理。以下分这两种情况处理。 +% \begin{macrocode} + \IfBooleanTF {#1} + { +% \end{macrocode} +% 带 |*| 的版本原则上只接受 \opt{plain} 和 \opt{break} 两种样式, +% 其余样式将被转换成这两者其中之一。 +% \begin{macrocode} + \clist_if_in:nVF { plain, break } \l_@@_thm_style_tl + { + \clist_if_in:NVTF + \c_@@_thm_style_plain_clist \l_@@_thm_style_tl + { \@@_thm_redefine_style:n { plain } } + { + \clist_if_in:NVTF + \c_@@_thm_style_break_clist \l_@@_thm_style_tl + { \@@_thm_redefine_style:n { break } } + { + \@@_error:nx { unknown-theorem-style } + { \l_@@_thm_style_tl } + } + } + } +% \end{macrocode} +% \pkg{ntheorem} 宏包提供的无编号定理带有 |nonumber| 前缀, +% 这里将其加上。 +% \begin{macrocode} + \tl_put_left:Nn \l_@@_thm_style_tl { nonumber } + \nwafu_thm_new_no_number:Vxx \l_@@_thm_style_tl {#3} {#4} + } + { +% \end{macrocode} +% 不带 |*| 的版本支持不含“|nonumber|”的所有定理样式。 +% \begin{macrocode} + \clist_clear:N \l_@@_tmpa_clist + \clist_concat:NNN \l_@@_tmpa_clist + \c_@@_thm_style_plain_clist \c_@@_thm_style_break_clist + \clist_if_in:NVF \l_@@_tmpa_clist \l_@@_thm_style_tl + { + \@@_error:nx { unknown-theorem-style } + { \l_@@_thm_style_tl } + } + \nwafu_thm_new:VVxx \l_@@_thm_style_tl \l_@@_thm_counter_tl + {#3} {#4} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_thm_redefine_style:n} +% 重定义定理样式,并给出警告。 +% \begin{macrocode} +\cs_new:Npn \@@_thm_redefine_style:n #1 + { + \@@_warning:nxx { redefine-theorem-style } + {#1} { \l_@@_thm_style_tl } + \tl_set:Nn \l_@@_thm_style_tl {#1} + } +% \end{macrocode} +% \end{macro} +% +% 提示信息。 +% \begin{macrocode} +\@@_msg_new:nn { redefine-theorem-style } + { Theorem~ style~ "#2"~ will~ be~ redefined~ as~ "#1". } +\@@_msg_new:nn { unknown-theorem-style } + { Theorem~ style~ "#1"~ is~ unknown. } +% \end{macrocode} +% +% \begin{macro}{\nwafu_thm_new:nnnn,\nwafu_thm_new:VVxx} +% 带编号的定理环境。 +% \begin{arguments} +% \item 样式 +% \item 计数器 +% \item 定理环境名称 +% \item 定理头文字 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \nwafu_thm_new:nnnn #1#2#3#4 + { + \@@_thm_ntheorem_style:n {#1} + \@@_thm_ntheorem_new:w {#3} {#4} [#2] + } +\cs_generate_variant:Nn \nwafu_thm_new:nnnn { VVxx } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nwafu_thm_new_no_number:nnn, +% \nwafu_thm_new_no_number:Vxx} +% 不带编号的定理环境。 +% \begin{arguments} +% \item 样式 +% \item 定理环境名称 +% \item 定理头文字 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \nwafu_thm_new_no_number:nnn #1#2#3 + { + \@@_thm_ntheorem_style:n {#1} + \@@_thm_ntheorem_new:w {#2} {#3} + } +\cs_generate_variant:Nn \nwafu_thm_new_no_number:nnn { Vxx } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nwafu_thm_set_qed:n, +% \nwafu_thm_set_header_font:n, +% \nwafu_thm_set_body_font:n, +% \nwafu_thm_set_qed:V, +% \nwafu_thm_set_header_font:V, +% \nwafu_thm_set_body_font:V} +% 封装 \pkg{ntheorem} 宏包提供的若干命令,分别用以设置证毕符号、 +% 定理头字体和定理正文字体。 +% \begin{macrocode} +\cs_new:Npn \nwafu_thm_set_qed:n #1 { \theoremsymbol {#1} } +\cs_new:Npn \nwafu_thm_set_header_font:n #1 { \theoremheaderfont {#1} } +\cs_new:Npn \nwafu_thm_set_body_font:n #1 { \theorembodyfont {#1} } +\cs_generate_variant:Nn \nwafu_thm_set_qed:n { V } +\cs_generate_variant:Nn \nwafu_thm_set_header_font:n { V } +\cs_generate_variant:Nn \nwafu_thm_set_body_font:n { V } +% \end{macrocode} +% \end{macro} +% +% \subsection{图表绘制;浮动体} +% +% +% 分别设置浮动体 \env{figure} 和 \env{table} 的标题样式。 +% \begin{macrocode} +\DeclareCaptionLabelSeparator{ccwd}{\hspace{0.5\ccwd}} +\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)} +\DeclareCaptionFont{nwafu@table@font}{\sffamily\small} +\DeclareCaptionFont{nwafu@figure@font}{\sffamily\small} +\DeclareCaptionFont{nwafu@subtable@font}{\small} +\DeclareCaptionFont{nwafu@subfigure@font}{\small} +% \end{macrocode} +% 图表题注设置。 +% \begin{macrocode} +\captionsetup + { + format = hang, + font = {stretch = 1}, + labelsep = ccwd, + singlelinecheck = true, + skip=4bp, + } +% \end{macrocode} +% 图表题注字体设置。 +% \begin{macrocode} +\captionsetup[table]{font += nwafu@table@font} +\captionsetup[longtable]{font += nwafu@table@font} +\captionsetup[figure]{font += nwafu@figure@font} +% \end{macrocode} +% 子图题注设置。 +% \begin{macrocode} +\captionsetup[subfigure] + { + labelformat = parens, + font = nwafu@subfigure@font, + belowskip = 2pt, + aboveskip = 6pt + } +% \end{macrocode} +% 设置双语标题前缀 +% 直接采用类似\cs{captionsetup}[figure][bi-first]{name=图} +% 设置会与longtable宏包的caption冲突 +% 需要改成如下设置,[]中的可选参数可以根据需要选择 +% \begin{macrocode} +\DeclareCaptionOption{bi-first}[format=hang,hangindent=-0.5em]{ + \def\tablename{表} + \def\figurename{图} + } +\DeclareCaptionOption{bi-second}[format=hang,hangindent=-2em]{ + \def\tablename{Tab.} + \def\figurename{Fig.} + } +\captionsetup[bi-first]{bi-first} +\captionsetup[bi-second]{bi-second} +% +\AddToHook + { env/figure/end } + { + \centering + } +\AddToHook + { env/table/end } + { + \centering + } +% +% \end{macrocode} +% 在tabular、tabularx、longtable环境开始处添加代码, +% 设置表格行距和字号。 +% \begin{macrocode} +\@@_at_begin_environment:nn { tabular,tabularx,longtable,tblr } + { + \exp_args:Nx \linespread { 1.05 } + \small\selectfont\ignorespaces + } +% \end{macrocode} +% +% \begin{macro}{\thefigure,\thetable} +% 重定义图表编号。 +% \begin{macrocode} +\cs_set:Npn \thefigure + { \thechapter - \@@_arabic:n { figure } } +\cs_set:Npn \thetable + { \thechapter - \@@_arabic:n { table } } +% \end{macrocode} +% \end{macro} +% +% \subsection{封面} +% +% \subsubsection{信息录入} +% +% \begin{variable}{\l_@@_info_title_tl, +% \l_@@_info_date_tl, +% \l_@@_info_grade_tl, +% \l_@@_info_enroll_tl, +% \l_@@_info_author_tl, +% \l_@@_info_supervisor_tl, +% \l_@@_info_cosupervisor_tl, +% \l_@@_info_department_tl, +% \l_@@_info_major_tl, +% \l_@@_info_researchfield_tl, +% \l_@@_info_professionaltype_tl, +% \l_@@_info_professionalfield_tl, +% \l_@@_info_class_id_tl, +% \l_@@_info_student_id_tl, +% \l_@@_info_school_id_tl, +% \l_@@_info_clc_tl, +% \l_@@_info_defensedate_tl, +% \l_@@_info_instructors_clist, +% \l_@@_info_defensecommittees_clist, +% \l_@@_info_foundation_clist} +% 封面所需的一些字段。 +% \begin{macrocode} +\clist_map_inline:nn + { + title, date, grade, enroll, author, supervisor, cosupervisor + department, major, researchfield, professionaltype, professionalfield, + class_id, student_id, school_id, clc, defensedate, udc + } + { \tl_new:c { l_@@_info_ #1 _tl } } +\clist_new:N \l_@@_info_instructors_clist +\clist_new:N \l_@@_info_defensecommittees_clist +\clist_new:N \l_@@_info_foundation_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_title_en_tl, +% \l_@@_info_author_en_tl, +% \l_@@_info_supervisor_en_tl, +% \l_@@_info_cosupervisor_en_tl, +% \l_@@_info_department_en_tl, +% \l_@@_info_major_en_tl, +% \l_@@_info_mastertype_en_tl, +% \l_@@_info_researchfield_en_tl, +% \l_@@_info_professionaltype_en_tl, +% \l_@@_info_professionalfield_en_tl, +% \l_@@_info_date_en_tl} +% 对应的英文字段。 +% \begin{macrocode} +\clist_map_inline:nn + { title, author, supervisor, cosupervisor, department, + major, mastertype, researchfield, professionaltype, professionalfield,date } + { \tl_new:c { l_@@_info_ #1 _en_tl } } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_degree_type_int} +% 学位类型。1 为学术学位,2 为专业学位。仅对研究生有效。 +% \begin{macrocode} +\int_new:N \l_@@_info_degree_type_int +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_bachelor_type_int} +% 本科毕业类型。1 为论文,2 为设计。仅对本科生有效。 +% \begin{macrocode} +\int_new:N \l_@@_info_bachelor_type_int +% \end{macrocode} +% \end{variable} +% +% 定义 |nwafu/info| 键值类。 +% \begin{macrocode} +\keys_define:nn { nwafu / info } + { +% \end{macrocode} +% +% \begin{macro}{info/degree} +% 学位类型。只对硕士论文有效。 +% \begin{macrocode} + degree .choices:nn = + { academic, professional } + { \int_set_eq:NN \l_@@_info_degree_type_int \l_keys_choice_int }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/btype} +% 本科毕业类型。仅对本科生有效。 +% \begin{macrocode} + btype .choice:, + btype .value_required:n = true, + btype .choices:nn = + { paper, design } + { \int_set_eq:NN \l_@@_info_bachelor_type_int \l_keys_choice_int }, + btype .initial:n = paper, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/title,info/title*} +% 论文题目。以下带星号的项目均表示相应的英文字段。 +% \begin{macrocode} + title .tl_set:N = \l_@@_info_title_tl, + title* .tl_set:N = \l_@@_info_title_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/date, info/date*} +% 论文完成日期。 +% \begin{macrocode} + date .tl_set:N = \l_@@_info_date_tl, + date* .tl_set:N = \l_@@_info_date_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/grade} +% 毕业年份(届)。 +% \begin{macrocode} + grade .tl_set:N = \l_@@_info_grade_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/enroll} +% 入学年份(级)。 +% \begin{macrocode} + enroll .tl_set:N = \l_@@_info_enroll_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/author,info/author*} +% 作者姓名。 +% \begin{macrocode} + author .tl_set:N = \l_@@_info_author_tl, + author* .tl_set:N = \l_@@_info_author_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/supervisor,info/supervisor*} +% 导师姓名。 +% \begin{macrocode} + supervisor .tl_set:N = \l_@@_info_supervisor_tl, + supervisor* .tl_set:N = \l_@@_info_supervisor_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/cosupervisor, info/cosupervisor} +% 协助指导教师。 +% \begin{macrocode} + cosupervisor .tl_set:N = \l_@@_info_cosupervisor_tl, + cosupervisor* .tl_set:N = \l_@@_info_cosupervisor_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/instructors} +% 指导小组成员。 +% \begin{macrocode} + instructors .clist_set:N = \l_@@_info_instructors_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/defensecommittees} +% 答辩委员会成员,每个成员包含单位、姓名、职称。仅研究生需要。 +% \begin{macrocode} + defensecommittees .clist_set:N = \l_@@_info_defensecommittees_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/defensedate} +% 论文答辩日期。 +% \begin{macrocode} + defensedate .tl_set:N = \l_@@_info_defensedate_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/foundation} +% 资助项目,每个项目包含项目类型、项目名称、项目编号。仅研究生需要。 +% \begin{macrocode} + foundation .clist_set:N = \l_@@_info_foundation_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/department,info/department*} +% 院系。 +% \begin{macrocode} + department .tl_set:N = \l_@@_info_department_tl, + department* .tl_set:N = \l_@@_info_department_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/major,info/major*} +% 专业。 +% \begin{macrocode} + major .tl_set:N = \l_@@_info_major_tl, + major* .tl_set:N = \l_@@_info_major_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/mastertype} +% 硕士学位类型英文名称,仅硕士需要。 +% \begin{macrocode} + mastertype .tl_set:N = \l_@@_info_mastertype_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/researchfield,info/researchfield*} +% 研究方向,仅博士、学历硕士需要。 +% \begin{macrocode} + researchfield .tl_set:N = \l_@@_info_researchfield_tl, + researchfield* .tl_set:N = \l_@@_info_researchfield_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/professionaltype,info/professionaltype*} +% 专业学位类型,仅专业学位硕士需要。 +% \begin{macrocode} + professionaltype .tl_set:N = \l_@@_info_professionaltype_tl, + professionaltype* .tl_set:N = \l_@@_info_professionaltype_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/professionalfield,info/professionalfield*} +% 领域名称,仅专业学位硕士需要。 +% \begin{macrocode} + professionalfield .tl_set:N = \l_@@_info_professionalfield_tl, + professionalfield* .tl_set:N = \l_@@_info_professionalfield_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/class-id} +% 班级号。仅本科生需要 +% \begin{macrocode} + class-id .tl_set:N = \l_@@_info_class_id_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/student-id} +% 学号。 +% \begin{macrocode} + student-id .tl_set:N = \l_@@_info_student_id_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/school-id} +% 学校代码。 +% \begin{macrocode} + school-id .tl_set:N = \l_@@_info_school_id_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/clc} +% 中图分类号。 +% \begin{macrocode} + clc .tl_set:N = \l_@@_info_clc_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/udc} +% UDC码。 +% \begin{macrocode} + udc .tl_set:N = \l_@@_info_udc_tl, + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_cover_logo_tl,\l_@@_cover_logo_size_clist} +% \begin{macrocode} +\tl_new:N \l_@@_cover_logo_tl +\clist_new:N \l_@@_cover_logo_size_clist +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{style/logo,style/logo-size} +% 校名图片的文件名和尺寸。 +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { + logo .tl_set:N = \l_@@_cover_logo_tl, + logo-size .clist_set:N = \l_@@_cover_logo_size_clist + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{密级} +% +% \begin{variable}{\l_@@_secret_bool} +% 是否显示密级。 +% \begin{macrocode} +\bool_new:N \l_@@_secret_bool +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\l_@@_info_secret_level_tl} +% 保存当前的密级。 +% \begin{macrocode} +\tl_new:N \l_@@_info_secret_level_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { nwafu / info } + { +% \end{macrocode} +% +% \begin{macro}{info/secret-level} + % 密级。\opt{none} 表示公开,\opt{i}、\opt{ii}、\opt{iii}、\opt{iv} 分别为 +% 限制、秘密、机密、绝密。 +% \begin{macrocode} + secret-level .choices:nn = + { none, i, ii, iii, iv } + { + \int_compare:nNnTF { \l_keys_choice_int } > { 1 } + { + \bool_set_true:N \l_@@_secret_bool + \tl_set:Nn \l_@@_info_secret_level_tl + { + \clist_item:Nn \c_@@_secret_clist + { \l_keys_choice_int - 1 } + } + } + { + \bool_set_false:N \l_@@_secret_bool + \tl_set:Nn \l_@@_info_secret_level_tl { 公开 } + } + }, + secret-level .value_required:n = true, + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{定义内部函数} +% +% \begin{macro}{\@@_spread_box:nn,\@@_spread_box:Vn,\@@_spread_box:nV} +% 分散对齐的水平盒子。 +% \begin{arguments} +% \item 宽度 +% \item 内容 +% \end{arguments} +% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip} +% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。 +% |#2| 需要完全展开以避免 underfull 警告。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_spread_box:nn #1#2 + { + \mode_leave_vertical: + \hbox_to_wd:nn {#1} + { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip } + } +\cs_generate_variant:Nn \@@_spread_box:nn { Vn } +\cs_generate_variant:Nn \@@_spread_box:nn { nV } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_center_box:nn,\@@_center_box:Vn} +% 居中对齐的下划线水平盒子。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_center_box:nn #1#2 + { + \mode_leave_vertical: + \dim_set:Nn \l_@@_tmpt_dim {#1} + \dim_add:Nn \l_@@_tmpt_dim {0.6em} + \makebox[0cm][l]{\rule[-0.5ex]{\l_@@_tmpt_dim}{0.4 pt}} + {\hbox_to_wd:nn {\l_@@_tmpt_dim} { \hfil #2 \hfil }} + % \fbox[b]{\parbox {#1} { \centering #2 }} + } +\cs_generate_variant:Nn \@@_center_box:nn { Vn } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fixed_width_box:nn,\@@_fixed_width_box:Vn} +% 限宽盒子(允许换行)。 +% \begin{macrocode} +\cs_new:Npn \@@_fixed_width_box:nn #1#2 + { \parbox {#1} {#2} } +\cs_generate_variant:Nn \@@_fixed_width_box:nn { Vn } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fixed_width_center_box:nn} +% 居中对齐的限宽盒子(允许换行)。 +% \begin{macrocode} +\cs_new:Npn \@@_fixed_width_center_box:nn #1#2 + { \parbox {#1} { \centering #2 } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_text_width:Nn,\@@_get_text_width:NV} +% 获取文本宽度,并存入 |dim| 型变量。 +% \begin{arguments} +% \item |dim| 型变量 +% \item 内容 +% \end{arguments} +% \begin{macrocode} +\cs_new:Npn \@@_get_text_width:Nn #1#2 + { + \hbox_set:Nn \l_@@_tmpa_box {#2} + \dim_set:Nn #1 { \box_wd:N \l_@@_tmpa_box } + } +\cs_generate_variant:Nn \@@_get_text_width:Nn { NV } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_get_max_text_width:NN} +% 获取多个文本中的最大宽度,并存入 |dim| 型变量。 +% \begin{arguments} +% \item |dim| 型变量 +% \item 文本 |clist| +% \end{arguments} +% 当 \cs{l_@@_tmpa_clist} 非空时,弹出最后一个元素 +% 赋给 \cs{l_@@_tmpa_tl},获取其长度后与 |#1| 进行比较, +% 二者中较大的那一个将成为 |#1| 的新值。 +% 不断循环,直至 \cs{l_@@_tmpa_clist} 为空。 +% \begin{macrocode} +\cs_new:Npn \@@_get_max_text_width:NN #1#2 + { +% \end{macrocode} +% 这里用 |group| 确保局部变量不会被污染。 +% \begin{macrocode} + \group_begin: + \dim_set:Nn #1 {-999pt} + \clist_set_eq:NN \l_@@_tmpt_clist #2 + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpt_clist } + { + \clist_pop:NN \l_@@_tmpt_clist \l_@@_tmpt_tl + \@@_get_text_width:NV \l_@@_tmpt_dim \l_@@_tmpt_tl + \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpt_dim } } + } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_blank_underline:n} +% 下划线占位符。|#1|: 长度。 +% \begin{macrocode} +\cs_new:Npn \@@_blank_underline:n #1 + { \rule [ -0.5 ex ] {#1} { 0.4 pt } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_text_uline:n,\@@_text_uline:V} +% 下划线文字。|#1|: 文字。 +% \begin{macrocode} +\cs_new:Npn \@@_text_uline:n #1 + { + \@@_get_text_width:Nn \l_@@_tmpt_dim {#1} + \dim_add:Nn \l_@@_tmpt_dim {0.6em} + \makebox[0cm][l]{\rule[-0.5ex]{\l_@@_tmpt_dim}{0.4 pt}} + \rule{.3em}{0cm}#1\rule{.3em}{0cm} + } +\cs_generate_variant:Nn \@@_text_uline:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_line_spread:N,\@@_line_spread:n} +% 设置行距。|#1|: 行距倍数 |fp| 变量。 +% \begin{macrocode} +\cs_new:Npn \@@_line_spread:N #1 + { \linespread { \fp_use:N #1 } \selectfont } +\cs_new:Npn \@@_line_spread:n #1 + { \linespread {#1} \selectfont } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{封面各部件} +% +% \begin{macro}{\@@_cover_id:,\@@_cover_id_aux:n} +% 封面中的中图分类号、udc码、密级、学校代码和学号。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_id: + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生 +% \begin{macrocode} + \group_begin: +% \end{macrocode} +% 将中图分类号、udc码和密级标记名称存入逗号分隔列表,并计算最宽宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_clear:N \l_@@_tmpa_clist + \clist_set:Nx \l_@@_tmpa_clist + { + { \c_@@_name_clc_tl }, + { \c_@@_name_udc_tl }, + { \c_@@_name_secret_level_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 将中图分类号、udc码和密级信息值存入逗号分隔列表,并计算最宽宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_clc_tl }, + { \l_@@_info_udc_tl }, + { \l_@@_info_secret_level_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist +% \end{macrocode} +% 将学校代码、研究生学号标记名称存入逗号分隔列表,并计算最宽宽度赋给 +% \cs{l_@@_tmpc_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpc_clist + { + { \c_@@_name_school_id_tl }, + { }, + { \c_@@_name_student_id_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpc_dim \l_@@_tmpc_clist +% \end{macrocode} +% 将学校代码、研究生学号信息值存入逗号分隔列表,并计算最宽宽度赋给 +% \cs{l_@@_tmpd_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpd_clist + { + { \l_@@_info_school_id_tl }, + { }, + { \l_@@_info_student_id_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpd_dim \l_@@_tmpd_clist +% \end{macrocode} +% 用minipage环境通过循环输出结果。 +% \begin{macrocode} + \begin{minipage} [ c ] { \textwidth } + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl + \clist_pop:NN \l_@@_tmpd_clist \l_@@_tmpd_tl +% \end{macrocode} +% udc码标记需要左对齐。 +% \begin{macrocode} + \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_name_udc_tl + { + \@@_fixed_width_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl } + }{ + \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl } + } + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \hfill +% \end{macrocode} +% 用空值占有一行。 +% \begin{macrocode} + \tl_if_empty:NTF \l_@@_tmpc_tl + { + }{ + \@@_spread_box:Vn \l_@@_tmpc_dim { \l_@@_tmpc_tl } + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpd_dim { \l_@@_tmpd_tl } + } + \par + } + \end{minipage} + \group_end: + } + { +% \end{macrocode} +% 本科生。 +% \begin{macrocode} + \@@_fixed_width_box:nn { 120 pt } + { + \@@_cover_id_aux:n { student_id } + } + } + } +\cs_new:Npn \@@_cover_id_aux:n #1 + { + \tl_use:c { c_@@_name_ #1 _tl } + \c_@@_fwid_colon_tl + \@@_text_uline:n {\tl_use:c { l_@@_info_ #1 _tl }} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_logo:} +% 插入校名图片。根据参数 \opt{width} 和 \opt{height} 是否为空依次 +% 判断。\cs{l_@@_cover_logo_size_clist} 中超过两个的参数将被忽略。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_logo: + { + \clist_pop:NN \l_@@_cover_logo_size_clist \l_@@_tmpa_tl + \clist_pop:NNTF \l_@@_cover_logo_size_clist \l_@@_tmpb_tl + { + \tl_if_empty:NTF \l_@@_tmpa_tl + { \includegraphics [ height = \l_@@_tmpb_tl ] } + { + \includegraphics + [ width = \l_@@_tmpa_tl, height = \l_@@_tmpb_tl ] + } + } + { \includegraphics [ width = \l_@@_tmpa_tl ] } + { \l_@@_cover_logo_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_type:} +% 论文类型。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_type: + { + \tl_set:Nx \l_@@_tmpa_tl + { +% \end{macrocode} +% 取出论文类型。 +% \begin{macrocode} + \clist_item:Nn \c_@@_thesis_type_clist { \g_@@_thesis_type_int } + } + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生论文。 +% \begin{macrocode} + \@@_spread_box:nn { 0.75 \textwidth } { \l_@@_tmpa_tl } + }{ +% \end{macrocode} +% 本科毕业年份(届)。 +% \begin{macrocode} + \@@_get_text_width:NV \l__@@_tmpa_dim \l__@@_info_grade_tl + \@@_center_box:Vn \l__@@_tmpa_dim { \l__@@_info_grade_tl } + \@@_spread_box:nn { 0.50 \textwidth }{ + 届 + \l_@@_tmpa_tl +% \end{macrocode} +% 本科的论文或设计。 +% \begin{macrocode} + \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_info:} +% 作者信息栏。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_info: + { + \begin{minipage} [ c ] { \textwidth } + \centering +% \end{macrocode} +% 根据论文类型(博士、硕士、本科)分支输出不同信息 +% \begin{macrocode} + \int_case:nn {\g_@@_thesis_type_int} + { +% \end{macrocode} +% 博士论文 +% \begin{macrocode} + {1}{ +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_major_tl, + \c_@@_name_researchfield_tl, + \c_@@_name_author_tl, + \c_@@_name_supervisor_tl, + \c_@@_name_cosupervisor_tl, + \c_@@_name_date_tl, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_major_tl }, + { \l_@@_info_researchfield_tl }, + { \l_@@_info_author_tl }, + { \l_@@_info_supervisor_tl }, + { \l_@@_info_cosupervisor_tl }, + { \l_@@_info_date_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + } +% \end{macrocode} +% 硕士论文 +% \begin{macrocode} + {2}{ + \int_case:nn {\l_@@_info_degree_type_int} + { +% \end{macrocode} +% 学术硕士 +% \begin{macrocode} + {1}{ +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_major_tl, + \c_@@_name_researchfield_tl, + \c_@@_name_author_tl, + \c_@@_name_supervisor_tl, + \c_@@_name_cosupervisor_tl, + \c_@@_name_date_tl, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_major_tl }, + { \l_@@_info_researchfield_tl }, + { \l_@@_info_author_tl }, + { \l_@@_info_supervisor_tl }, + { \l_@@_info_cosupervisor_tl }, + { \l_@@_info_date_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + } +% \end{macrocode} +% 专业学位硕士 +% \begin{macrocode} + {2}{ +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_professionaltype_tl, + \c_@@_name_professionalfield_tl, + \c_@@_name_author_tl, + \c_@@_name_supervisor_tl, + \c_@@_name_cosupervisor_tl, + \c_@@_name_date_tl, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_professionaltype_tl }, + { \l_@@_info_professionalfield_tl }, + { \l_@@_info_author_tl }, + { \l_@@_info_supervisor_tl }, + { \l_@@_info_cosupervisor_tl }, + { \l_@@_info_date_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + } + } + } +% \end{macrocode} +% 本科论文 +% \begin{macrocode} + {3}{ +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_department_tl, + \c_@@_name_major_tl, + \c_@@_name_enroll_tl\c_@@_name_class_id_tl, + \c_@@_name_author_tl, + \c_@@_name_supervisor_tl, + \c_@@_name_cosupervisor_tl, + \c_@@_name_date_tl, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_department_tl }, + { \l_@@_info_major_tl }, + { \l_@@_info_enroll_tl 级 \l_@@_info_class_id_tl 班 }, + { \l_@@_info_author_tl }, + { \l_@@_info_supervisor_tl }, + { \l_@@_info_cosupervisor_tl }, + { \l_@@_info_date_tl } + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + } + } +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl } + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \skip_vertical:n { 1 ex } + } + \end{minipage} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_info_en:} +% 英文作者信息栏,仅对研究生有效。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_info_en: + { + \int_case:nn {\g_@@_thesis_type_int} + { + {1}{ +% \end{macrocode} +% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + {\c_@@_name_major_en_tl{\l_@@_info_major_en_tl}}, + {\c_@@_name_researchfield_en_tl{\l_@@_info_researchfield_en_tl}}, + {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}}, + {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}}, + {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}}, + {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}}, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 将宽度值适当放宽。 +% \begin{macrocode} + \dim_add:Nn \l_@@_tmpa_dim {2.5em} + \begin{minipage} [ c ] { \l_@@_tmpa_dim } + \flushleft +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_major_en_tl, + \c_@@_name_researchfield_en_tl, + \c_@@_name_author_en_tl, + \c_@@_name_supervisor_en_tl, + \c_@@_name_cosupervisor_en_tl, + \c_@@_name_date_en_tl, + } +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_major_en_tl }, + { \l_@@_info_researchfield_en_tl }, + { \l_@@_info_author_en_tl }, + { \l_@@_info_supervisor_en_tl }, + { \l_@@_info_cosupervisor_en_tl }, + { \l_@@_info_date_en_tl } + } +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \l_@@_tmpb_tl + \skip_vertical:n { 1 ex } + } + \end{minipage} + } + {2}{ + \int_case:nn {\l_@@_info_degree_type_int} + { +% \end{macrocode} +% 学术硕士 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + {1}{ +% \end{macrocode} +% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + {\c_@@_name_major_en_tl{\l_@@_info_major_en_tl}}, + {\c_@@_name_researchfield_en_tl{\l_@@_info_researchfield_en_tl}}, + {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}}, + {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}}, + {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}}, + {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}}, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 将宽度值适当放宽。 +% \begin{macrocode} + \dim_add:Nn \l_@@_tmpa_dim {2.5em} + \begin{minipage} [ c ] { \l_@@_tmpa_dim } + \flushleft +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_major_en_tl, + \c_@@_name_researchfield_en_tl, + \c_@@_name_author_en_tl, + \c_@@_name_supervisor_en_tl, + \c_@@_name_cosupervisor_en_tl, + \c_@@_name_date_en_tl, + } +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { \l_@@_info_major_en_tl }, + { \l_@@_info_researchfield_en_tl }, + { \l_@@_info_author_en_tl }, + { \l_@@_info_supervisor_en_tl }, + { \l_@@_info_cosupervisor_en_tl }, + { \l_@@_info_date_en_tl } + } +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \l_@@_tmpb_tl + \skip_vertical:n { 1 ex } + } + \end{minipage} + } +% \end{macrocode} +% 专业学位硕士。 +% \begin{macrocode} + {2}{ +% \end{macrocode} +% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + {\c_@@_name_professionaltype_en_tl{Master~of~\l_@@_info_professionaltype_en_tl}}, + {\c_@@_name_professionalfield_en_tl{\l_@@_info_professionalfield_en_tl}}, + {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}}, + {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}}, + {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}}, + {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}}, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 将宽度值适当放宽。 +% \begin{macrocode} + \dim_add:Nn \l_@@_tmpa_dim {2.5em} + \begin{minipage} [ c ] { \l_@@_tmpa_dim } + \flushleft +% \end{macrocode} +% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpa_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + \c_@@_name_professionaltype_en_tl, + \c_@@_name_professionalfield_en_tl, + \c_@@_name_author_en_tl, + \c_@@_name_supervisor_en_tl, + \c_@@_name_cosupervisor_en_tl, + \c_@@_name_date_en_tl, + } +% \end{macrocode} +% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给 +% \cs{l_@@_tmpb_dim}。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + { Master ~ of ~ \l_@@_info_professionaltype_en_tl }, + { \l_@@_info_professionalfield_en_tl }, + { \l_@@_info_author_en_tl }, + { \l_@@_info_supervisor_en_tl }, + { \l_@@_info_cosupervisor_en_tl }, + { \l_@@_info_date_en_tl } + } +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \l_@@_tmpb_tl + \skip_vertical:n { 1 ex } + } + \end{minipage} + } + } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_instructors:} +% 标题内页作者、指导教师、指导小组签名,仅对研究生有效。 +% 此处应该是签名,在此直接设计为打印出姓名。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_instructors: + { + \int_case:nn {\g_@@_thesis_type_int} + { +% \end{macrocode} +% 博士生,需要指导小组。 +% \begin{macrocode} + {1}{ +% \end{macrocode} +% 作者、导师、指导小组标识,并取得最宽宽度。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + {\c_@@_name_author_tl }, + {\c_@@_name_supervisor_tl }, + {\c_@@_name_instructors_tl }, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 取得指导小组名单。 +% \begin{macrocode} + \tl_set:Nn \l_@@_tmpa_tl {\clist_use:Nn \l_@@_info_instructors_clist {\@@_quad: }} +% \end{macrocode} +% 作者、导师、指导小组信息,并取得最宽宽度。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + {\l_@@_info_author_tl }, + {\l_@@_info_supervisor_tl }, + {\l_@@_tmpa_tl }, + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist +% \end{macrocode} +% 计算小页环境宽度。 +% \begin{macrocode} + \dim_set_eq:NN \l_@@_tmpt_dim \l_@@_tmpa_dim + \dim_add:Nn \l_@@_tmpt_dim { \l_@@_tmpb_dim } + \dim_add:Nn \l_@@_tmpt_dim {2.5em} + \begin{minipage} [ c ] { \l_@@_tmpt_dim } + \centering +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \skip_vertical:n { 1 ex } + } +% \end{macrocode} +% 不输出姓名,输出下划线,留作签名空间(暂未启用)。 +% \begin{macrocode} + % \c_@@_name_author_tl + % \c_@@_fwid_colon_tl + % \@@_blank_underline:n{ 12em } + % \skip_vertical:n { 1 ex } + % \c_@@_name_supervisor_tl + % \c_@@_fwid_colon_tl + % \@@_blank_underline:n{ 12em } + % \skip_vertical:n { 1 ex } + % \c_@@_name_instructors_tl + % \c_@@_fwid_colon_tl + % \@@_blank_underline:n{ 12em } + % \skip_vertical:n { 1 ex } + \end{minipage} + } +% \end{macrocode} +% 硕士生,仅需作者和导师。 +% \begin{macrocode} + {2}{ +% \end{macrocode} +% 作者、导师标识,并取得最宽宽度。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpa_clist + { + {\c_@@_name_author_tl }, + {\c_@@_name_supervisor_tl }, + } + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist +% \end{macrocode} +% 作者、导师信息,并取得最宽宽度。 +% \begin{macrocode} + \clist_set:Nx \l_@@_tmpb_clist + { + {\l_@@_info_author_tl }, + {\l_@@_info_supervisor_tl }, + } + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + \dim_add:Nn \l_@@_tmpb_dim { \l_@@_tmpb_dim } +% \end{macrocode} +% 计算小页环境宽度。 +% \begin{macrocode} + \dim_set_eq:NN \l_@@_tmpt_dim \l_@@_tmpa_dim + \dim_add:Nn \l_@@_tmpt_dim { \l_@@_tmpb_dim } + \dim_add:Nn \l_@@_tmpt_dim {2.5em} + \begin{minipage} [ c ] { \l_@@_tmpt_dim } + \centering +% \end{macrocode} +% 用循环输出各字段。 +% \begin{macrocode} + \bool_until_do:nn + { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \skip_vertical:n { 1 ex } + } +% \end{macrocode} +% 不输出姓名,输出下划线,留作签名空间(暂未启用)。 +% \begin{macrocode} + % \begin{minipage} [ c ] { 17em } + % \flushleft + % \c_@@_name_author_tl + % \c_@@_fwid_colon_tl + % \@@_blank_underline:n{ 12em } + % \skip_vertical:n { 1 ex } + % \c_@@_name_supervisor_tl + % \c_@@_fwid_colon_tl + % \@@_blank_underline:n{ 12em } + % \skip_vertical:n { 1 ex } + \end{minipage} + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_defensecommittees:} +% 答辩委员会名单,仅对研究生有效。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_defensecommittees: + { +% \end{macrocode} +% 清空临时变量。 +% \begin{macrocode} + \clist_set:Nn \l_@@_tmpa_clist {} + \clist_set:Nn \l_@@_tmpb_clist {} + \clist_set:Nn \l_@@_tmpc_clist {} + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_info_defensecommittees_clist } + { + \clist_set:Nn \l_@@_tmpt_clist {} +% \end{macrocode} +% 取出一个答辩委员的信息。 +% \begin{macrocode} + \clist_pop:NN \l_@@_info_defensecommittees_clist \l_@@_tmpa_tl + \clist_set:NV \l_@@_tmpt_clist \l_@@_tmpa_tl +% \end{macrocode} +% 构造单位列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpa_clist { + \clist_item:Nn \l_@@_tmpt_clist {1} + } +% \end{macrocode} +% 构造姓名列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpb_clist { + \clist_item:Nn \l_@@_tmpt_clist {2} + } +% \end{macrocode} +% 构造职称列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpc_clist { + \clist_item:Nn \l_@@_tmpt_clist {3} + } + } +% \end{macrocode} +% 分别计算单位列表、姓名列表、职称列表的最宽宽度。 +% \begin{macrocode} + \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist + \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist + \@@_get_max_text_width:NN \l_@@_tmpc_dim \l_@@_tmpc_clist +% \end{macrocode} +% 输出答辩委员会信息。 +% \begin{macrocode} + \begin{minipage} [ c ] { \textwidth } + \centering + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl + \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl } + \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl } + \@@_spread_box:Vn \l_@@_tmpc_dim { \l_@@_tmpc_tl } + \skip_vertical:n { 0.5 ex } + } + \end{minipage} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_foundation:} +% 项目资助列表,仅对研究生有效。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_foundation: + { +% \end{macrocode} +% 清空临时变量。 +% \begin{macrocode} + \clist_set:Nn \l_@@_tmpa_clist {} + \clist_set:Nn \l_@@_tmpb_clist {} + \clist_set:Nn \l_@@_tmpc_clist {} + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_info_foundation_clist } + { + \clist_set:Nn \l_@@_tmpt_clist {} +% \end{macrocode} +% 取出一个资助项目的信息。 +% \begin{macrocode} + \clist_pop:NN \l_@@_info_foundation_clist \l_@@_tmpa_tl + \clist_set:NV \l_@@_tmpt_clist \l_@@_tmpa_tl +% \end{macrocode} +% 构造项目来源列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpa_clist { + \clist_item:Nn \l_@@_tmpt_clist {1} + } +% \end{macrocode} +% 构造项目名称列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpb_clist { + \clist_item:Nn \l_@@_tmpt_clist {2} + } +% \end{macrocode} +% 构造项目编号列表。 +% \begin{macrocode} + \clist_put_right:Nx \l_@@_tmpc_clist { + \clist_item:Nn \l_@@_tmpt_clist {3} + } + } +% \end{macrocode} +% 输出资助项目信息。 +% \begin{macrocode} + \begin{minipage} [ c ] { \textwidth } + \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist } + { + \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl + \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl + \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl + \indent + \@@_qquad: + 本研究得到 + \l_@@_tmpa_tl + \c_@@_fwid_colon_tl + \l_@@_tmpb_tl + (编号\c_@@_fwid_colon_tl + \l_@@_tmpc_tl + )资助 + \par + } + \end{minipage} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_cover_signature:N} +% 签名行。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_signature:N #1 + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生。 +% \begin{macrocode} + \@@_qquad: + \@@_spread_box:nV { 5 em } #1 + \c_@@_fwid_colon_tl + \hspace*{\fill} + }{ +% \end{macrocode} +% 本科生。 +% \begin{macrocode} + \@@_spread_box:nV { 6 em } #1 + \c_@@_fwid_colon_tl + % \@@_blank_underline:n { 6 em } + \hspace*{\fill} + } +% \end{macrocode} +% 签名时间。 +% \begin{macrocode} + 时间\c_@@_fwid_colon_tl + \@@_qquad:\@@_qquad: 年 + \@@_qquad: 月 + \@@_qquad: 日 + \hspace*{\fill} + % \@@_qquad: + } +% \end{macrocode} +% \end{macro} +% +% \subsubsection{封面模板} +% +% 声明封面对象。不需要带参数(\emph{完全复制fduthesis.dtx未做任何修改})。 +% \begin{macrocode} +%<@@=nwafu_cover> +\DeclareObjectType { nwafu / cover } { \c_zero_int } +% \end{macrocode} +% +% \begin{macro}{\DeclareCoverTemplate,\nwafu_cover_declare_template:nn} +% 声明封面模板。 +% \begin{arguments} +% \item 模板名称 +% \item 封面部件列表,以逗号分隔 +% \end{arguments} +% \begin{macrocode} +\NewDocumentCommand \DeclareCoverTemplate { m m } + { \nwafu_cover_declare_template:nn {#1} {#2} } +\cs_new_protected:Npn \nwafu_cover_declare_template:nn #1#2 + { + \tl_set:Nn \l_@@_template_tl {#1} +% \end{macrocode} +% 构建模板接口。 +% \begin{macrocode} + \@@_declare_template_interface:nx {#1} + { + format : tokenlist, + top-skip : skip, + bottom-skip : skip, + \clist_map_function:nN {#2} \@@_key_type:n + } +% \end{macrocode} +% 声明所用变量。 +% \begin{macrocode} + \tl_new:c { l_@@ / #1 / format_tl } + \skip_new:c { l_@@ / #1 / top_skip } + \skip_new:c { l_@@ / #1 / bottom_skip } + \clist_map_inline:nn {#2} + { + \tl_new:c { l_@@ / #1 / ##1 / content_tl } + \tl_new:c { l_@@ / #1 / ##1 / format_tl } + \skip_new:c { l_@@ / #1 / ##1 / bottom_skip } + } +% \end{macrocode} +% 声明模板代码。^^A 以下名字空间为 `nwafu_cover' 而非 `nwafu' +% \begin{macrocode} + \@@_declare_template_code:nxn {#1} + { + format = \exp_not:c { l_@@ / #1 / format_tl }, + top-skip = \use:c { l_@@ / #1 / top_skip }, + bottom-skip = \use:c { l_@@ / #1 / bottom_skip }, + \clist_map_function:nN {#2} \@@_key_binding:n + } + { + \AssignTemplateKeys + \tl_use:c { l_@@ / #1 / format_tl } + \__nwafu_vspace:c { l_@@ / #1 / top_skip } + \clist_map_inline:nn {#2} + { + \use:c { @@ / #1 / ####1 / align:n } + { + \tl_use:c { l_@@ / #1 / ####1 / format_tl } + \tl_use:c { l_@@ / #1 / ####1 / content_tl } + \par + } + \__nwafu_vspace:c { l_@@ / #1 / ####1 / bottom_skip } + } + \__nwafu_vspace:c { l_@@ / #1 / bottom_skip } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_@@_template_tl} +% 保存模板名称。 +% \begin{macrocode} +\tl_new:N \l_@@_template_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_declare_template_interface:nn, +% \@@_declare_template_code:nnn, +% \@@_declare_template_interface:nx, +% \@@_declare_template_code:nxn} +% 为了展开的方便,这里需要封装 \pkg{xtemplate} 的一些函数。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_template_interface:nn #1#2 + { \DeclareTemplateInterface { nwafu / cover } {#1} { \c_zero_int } {#2} } +\cs_new_protected:Npn \@@_declare_template_code:nnn #1#2#3 + { \DeclareTemplateCode { nwafu / cover } {#1} { \c_zero_int } {#2} {#3} } +\cs_generate_variant:Nn \@@_declare_template_interface:nn { nx } +\cs_generate_variant:Nn \@@_declare_template_code:nnn { nxn } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_key_type:n} +% \begin{macrocode} +\cs_new:Npn \@@_key_type:n #1 + { + #1 / content : tokenlist, + #1 / format : tokenlist, + #1 / bottom-skip : skip, + #1 / align : choice { left, right, center, normal } = normal, + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_key_binding:n} +% \begin{macrocode} +\cs_new:Npn \@@_key_binding:n #1 + { + #1 / content = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / content_tl }, + #1 / format = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / format_tl }, + #1 / bottom-skip = + \exp_not:c + { l_@@ / \l_@@_template_tl / #1 / bottom_skip }, + #1 / align = + { + left = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \flushleft ##1 \endflushleft + \group_end: + } + }, + right = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \flushright ##1 \endflushright + \group_end: + } + }, + center = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { + \exp_not:n + { + \group_begin: + \center ##1 \endcenter + \group_end: + } + }, + normal = + \exp_not:N \cs_set_protected:cpn + { @@ / \l_@@_template_tl / #1 / align:n } + \exp_not:n {##1} + { \exp_not:n { \group_begin: ##1 \group_end: } } + }, + } +%<@@=nwafu> +% \end{macrocode} +% \end{macro} +% +% \subsubsection{绘制封面} +% +% \begin{macro}{\makecoveri,\makecoverii,\makecoveriii, +% \makecoveriv,\makecoverv,\makecovervi,\makecovervii} +% 封面一~七,其中一~六为研究生使用,一和七为本科生使用。 +% \begin{macrocode} +% 封面一,研究生、本科生中文封面 +\NewDocumentCommand \makecoveri { } + { + \thispagestyle { empty } + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \UseInstance { nwafu / cover } { cover-i-default } + \restoregeometry + } +% \end{macrocode} +% 封面二,研究生英文封面 +% \begin{macrocode} +\NewDocumentCommand \makecoverii { } + { + \thispagestyle { empty } + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \UseInstance { nwafu / cover } { cover-ii-default } + \restoregeometry + } +% \end{macrocode} +% 封面三,研究生封面内页(ID、答辩委员会等) +% \begin{macrocode} +\NewDocumentCommand \makecoveriii { } + { + % \cleardoublepage + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \thispagestyle { empty } + \UseInstance { nwafu / cover } { cover-iii-default } + \restoregeometry + } +% \end{macrocode} +% 封面四,研究生项目资助页 +% \begin{macrocode} +\NewDocumentCommand \makecoveriv { } + { + % \cleardoublepage + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \thispagestyle { empty } + \UseInstance { nwafu / cover } { cover-iv-default } + \restoregeometry + } +% \end{macrocode} +% 封面五,研究生独创性声明与导师承诺 +% \begin{macrocode} +\NewDocumentCommand \makecoverv { } + { + % \cleardoublepage + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \thispagestyle { empty } + \UseInstance { nwafu / cover } { cover-v-default } + \restoregeometry + } +% \end{macrocode} +% 封面六,研究生论文使用授权说明 +% \begin{macrocode} +\NewDocumentCommand \makecovervi { } + { + % \cleardoublepage + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \thispagestyle { empty } + \UseInstance { nwafu / cover } { cover-vi-default } + \restoregeometry + } +% \end{macrocode} +% 封面七,本科生独创性声明及论文使用授权说明 +% \begin{macrocode} +\NewDocumentCommand \makecovervii { } + { + % \cleardoublepage + \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in} + \thispagestyle { empty } + \UseInstance { nwafu / cover } { cover-vii-default } + \restoregeometry + } +% \end{macrocode} +% \end{macro} +% +% 声明各封面模板组成部分。 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生封面一 +% \begin{macrocode} + \DeclareCoverTemplate { cover-i } + { logo, type, title, info } + }{ +% \end{macrocode} +% 本科生封面一 +% \begin{macrocode} + \DeclareCoverTemplate { cover-i } + { id, logo, type, title, info } + } +% \end{macrocode} +% 研究生封面二 +% \begin{macrocode} +\DeclareCoverTemplate { cover-ii } { + type, title, info, department, nwafu + } +% \end{macrocode} +% 研究生封面三 +% \begin{macrocode} +\DeclareCoverTemplate { cover-iii } { id, name, title, instructors, + ctitle, committees, dtitle, date + } +% \end{macrocode} +% 研究生封面四 +% \begin{macrocode} +\DeclareCoverTemplate { cover-iv } { name-list } +% \end{macrocode} +% 研究生封面五 +% \begin{macrocode} +\DeclareCoverTemplate { cover-v } + { + originality-decl-name, + originality-decl-text, + originality-decl-sig, + supervisor-decl-name, + supervisor-decl-text, + supervisor-decl-sig + } +% \end{macrocode} +% 研究生封面六 +% \begin{macrocode} +\DeclareCoverTemplate { cover-vi } + { + authorization-decl-name, + authorization-decl-text, + authorization-decl-sig, + supervisor-decl-sig + } +% \end{macrocode} +% 封面七,仅用于本科生独创性声明和授权说明 +% \begin{macrocode} +\DeclareCoverTemplate { cover-vii } + { + originality-decl-name, + originality-decl-text, + originality-decl-sig, + authorization-decl-name, + authorization-decl-text, + authorization-decl-sig, + supervisor-decl-sig + } +% \end{macrocode} +% +% 定义封面的具体配置参数。 +% 封面一 +% \begin{macrocode} +\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生 +% \begin{macrocode} + \DeclareInstance { nwafu / cover } { cover-i-default } { cover-i } + { + bottom-skip = 0 pt plus 1.5 fill, + logo / content = \@@_cover_logo:, + logo / bottom-skip = -45 pt plus 0.3 fill, + logo / align = center, + type / content = \@@_cover_type:, + type / format = \sffamily \zihao { 0 },% \bfseries, + type / bottom-skip = -20 pt plus 0.3 fill, + type / align = center, + title / content = + \@@_fixed_width_center_box:nn + { 0.9 \textwidth } { \l_@@_info_title_tl }, + title / format = \nwafu@hei \bfseries \zihao { 2 }, + title / bottom-skip = 80 pt plus 0.3 fill, + title / align = center, + info / content = \@@_cover_info:, + info / format = \@@_line_spread:n {1.05}\nwafu@hei \zihao { -3 }, + info / align = center, + } + }{ +% \end{macrocode} +% 本科生 +% \begin{macrocode} + \DeclareInstance { nwafu / cover } { cover-i-default } { cover-i } + { + bottom-skip = 0 pt plus 0.5 fill, + id / content = \@@_cover_id:, + id / format = \bfseries\zihao { 4 }, + id / bottom-skip = 0 pt plus 0.3 fill, + id / align = right, + logo / content = \@@_cover_logo:, + logo / bottom-skip = -30 pt,% plus 0.3 fill, + logo / align = center, + type / content = \@@_cover_type:, + type / format = \bfseries\nwafu@kai\zihao { 1 }, + type / bottom-skip = -20 pt plus 0.3 fill, + type / align = center, + title / content = + \@@_fixed_width_center_box:nn + { 0.9 \textwidth } { \l_@@_info_title_tl }, + title / format = \nwafu@hei \bfseries\zihao { 2 }, + title / bottom-skip = 80 pt plus 0.3 fill, + title / align = center, + info / content = \@@_cover_info:, + info / format = \rmfamily\zihao { 3 }, + info / align = center, + } + } +% \end{macrocode} +% 封面二 +% \begin{macrocode} +\int_case:nn {\g_@@_thesis_type_int} + { + {1}{ +% \end{macrocode} +% 博士研究生 +% \begin{macrocode} + \DeclareInstance { nwafu / cover } { cover-ii-default } { cover-ii } + { + bottom-skip = 0 pt plus 0.5 fill, + type / content = + \@@_fixed_width_center_box:nn { 0.7\textwidth } { + Thesis~Submitted~to~\c_@@_name_en_tl\\ + in~Partial~Fulfillment~of~the~Requirements\\ + for~Degree~of\\ + Doctor~of~Philosophy + }, + type / format = \@@_line_spread:n {1.22} \zihao { -3 }, + type / bottom-skip = 42 pt,% plus 0.3 fill, + type / align = center, + title / content = \l_@@_info_title_en_tl, + title / format = \@@_line_spread:n {0.90} + \zihao { 1 } \bfseries, + title / bottom-skip = 35 pt,% plus 0.3 fill, + title / align = center, + info / content = \@@_cover_info_en:, + info / format = \@@_line_spread:n {1.12} \zihao { -3 }, + info / bottom-skip = 72 pt,% plus 0.3 fill, + info / align = center, + department / content = \l_@@_info_department_en_tl, + department / format = \zihao { -3 }, + department / bottom-skip = -32 pt,% plus 0.3 fill, + department / align = center, + nwafu / content = \c_@@_name_en_tl, + nwafu / format = \zihao { -3 }, + nwafu / align = center, + } + } + {2}{ +% \end{macrocode} +% 硕士研究生 +% \begin{macrocode} + \DeclareInstance { nwafu / cover } { cover-ii-default } { cover-ii } + { + bottom-skip = 0 pt plus 0.5 fill, + type / content = + \@@_fixed_width_center_box:nn { 0.7\textwidth } { + Thesis~Submitted~to~\c_@@_name_en_tl\\ + in~Partial~Fulfillment~of~the~Requirements\\ + for~Degree~of\\ + Master~of + \int_case:nn {\l_@@_info_degree_type_int} + { + {1}{ + \@@_text_uline:V \l_@@_info_mastertype_en_tl + } + {2}{ + \@@_text_uline:V \l_@@_info_professionaltype_en_tl + } + } + }, + type / format = \@@_line_spread:n {1.22} \zihao { -3 }, + type / bottom-skip = 42 pt,% plus 0.3 fill, + type / align = center, + title / content = \l_@@_info_title_en_tl, + title / format = \@@_line_spread:n {0.90} \zihao { 1 } \bfseries, + title / bottom-skip = 35 pt,% plus 0.3 fill, + title / align = center, + info / content = \@@_cover_info_en:, + info / format = \@@_line_spread:n {1.12} \zihao { -3 }, + info / bottom-skip = 72 pt,% plus 0.3 fill, + info / align = center, + department / content = \l_@@_info_department_en_tl, + department / format = \zihao { -3 }, + department / bottom-skip = -32 pt,% plus 0.3 fill, + department / align = center, + nwafu / content = \c_@@_name_en_tl, + nwafu / format = \zihao { -3 }, + nwafu / align = center, + } + } + } +% \end{macrocode} +% 封面三 +% \begin{macrocode} +\DeclareInstance { nwafu / cover } { cover-iii-default } { cover-iii } + { + top-skip = -55 pt plus 0.1 fill, + bottom-skip = 0 pt plus 0.5 fill, + id / content = \@@_cover_id:, + id / format = \@@_line_spread:n {1.12}\zihao { -4 }, + id / bottom-skip = 35 pt plus 0.3 fill, + id / align = center, + name / content = \c_@@_name_simp_tl + \clist_item:Nn \c_@@_thesis_type_clist { \g_@@_thesis_type_int }, + name / format = \zihao { -2 }\bfseries, + name / bottom-skip = 0 pt plus 0.3 fill, + name / align = center, + title / content = \l_@@_info_title_tl, + title / format = \zihao { 2 } \sffamily, + title / bottom-skip = 65 pt plus 0.3 fill, + title / align = center, + instructors / content = \@@_cover_instructors:, + instructors / format = \@@_line_spread:n {0.88}\zihao { 3 }\bfseries, + instructors / bottom-skip = 75 pt plus 0.3 fill, + instructors / align = center, + ctitle / content = 答辩委员会\c_@@_fwid_colon_tl, + ctitle / format = \zihao { -3 }\bfseries, + ctitle / bottom-skip = -20 pt plus 0.3 fill, + ctitle / align = left, + committees / content = \@@_cover_defensecommittees:, + committees / format = \@@_line_spread:n {1.12}\zihao { -3 }, + committees / bottom-skip = 60 pt plus 0.3 fill, + committees / align = center, + date / content = {\bfseries{}答辩日期}\c_@@_fwid_colon_tl\l_@@_info_defensedate_tl, + date / format = \zihao { -3 }, + date / bottom-skip = 0 pt plus 0.3 fill, + date / align = left, + } +% \end{macrocode} +% 封面四 +% \begin{macrocode} +\DeclareInstance { nwafu / cover } { cover-iv-default } { cover-iv } + { + name-list / content = \@@_cover_foundation:, + name-list / format = \sffamily\zihao{3}, + name-list / align = center, + } +% \end{macrocode} +% 封面五 +% \begin{macrocode} +\DeclareInstance { nwafu / cover } { cover-v-default } { cover-v } + { + format = + \@@_line_spread:n { 1.25 }, + top-skip = 0 pt plus 0.2 fill, + bottom-skip = 0 pt plus 2.5 fill, + originality-decl-name / content = \c_@@_name_orig_decl_tl, + originality-decl-text / content = \c_@@_orig_decl_text_tl, + originality-decl-sig / content = + \@@_cover_signature:N \c_@@_orig_decl_sign_tl, + supervisor-decl-name / content = \c_@@_name_super_decl_tl, + supervisor-decl-text / content = \c_@@_super_decl_text_tl, + supervisor-decl-sig / content = + \@@_cover_signature:N \c_@@_super_decl_sign_tl, + originality-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily, + supervisor-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily, + originality-decl-text / format = \zihao { -4 }, + supervisor-decl-text / format = \zihao { -4 }, + originality-decl-name / bottom-skip = 0.25 cm, + originality-decl-text / bottom-skip = 0.4 cm, + originality-decl-sig / bottom-skip = 0.4 cm, + supervisor-decl-name / bottom-skip = 0.25 cm, + supervisor-decl-text / bottom-skip = 0.4 cm, + originality-decl-name / align = center, + originality-decl-sig / align = left, + supervisor-decl-name / align = center, + supervisor-decl-sig / align = left, + } +% \end{macrocode} +% 封面六 +% \begin{macrocode} +\DeclareInstance { nwafu / cover } { cover-vi-default } { cover-vi } + { + format = + \@@_line_spread:n { 1.25 }, + top-skip = 0 pt plus 0.2 fill, + bottom-skip = 0 pt plus 2.5 fill, + authorization-decl-name / content = \c_@@_name_auth_decl_tl, + authorization-decl-text / content = \c_@@_auth_decl_text_tl, + authorization-decl-sig / content = + \@@_cover_signature:N \c_@@_orig_decl_sign_tl, + supervisor-decl-sig / content = + \@@_cover_signature:N \c_@@_super_decl_sign_tl, + authorization-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily, + authorization-decl-text / format = \zihao { -4 }, + authorization-decl-name / bottom-skip = 0.25 cm, + authorization-decl-text / bottom-skip = 0.8 cm, + authorization-decl-sig / bottom-skip = -0.50 cm, + authorization-decl-name / align = center, + authorization-decl-sig / align = left, + supervisor-decl-sig / align = left, + } +% \end{macrocode} +% 封面七 +% \begin{macrocode} +\DeclareInstance { nwafu / cover } { cover-vii-default } { cover-vii } + { + format = + \@@_line_spread:n { 1.25 }, + top-skip = 0 pt plus 0.2 fill, + bottom-skip = 0 pt plus 2.5 fill, + originality-decl-name / content = \c_@@_name_orig_decl_tl, + originality-decl-text / content = \c_@@_orig_decl_text_tl, + originality-decl-sig / content = + \@@_cover_signature:N \c_@@_orig_decl_sign_tl, + authorization-decl-name / content = \c_@@_name_auth_decl_tl, + authorization-decl-text / content = \c_@@_auth_decl_text_tl, + authorization-decl-sig / content = + \@@_cover_signature:N \c_@@_orig_decl_sign_tl, + supervisor-decl-sig / content = + \@@_cover_signature:N \c_@@_super_decl_sign_tl, + originality-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily, + authorization-decl-name / format = + \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily, + originality-decl-text / format = \zihao { -4 } \nwafu@kai, + authorization-decl-text / format = \zihao { -4 } \nwafu@kai, + originality-decl-sig / format = \zihao { -4 } \nwafu@kai, + authorization-decl-sig / format = \zihao { -4 } \nwafu@kai, + supervisor-decl-sig / format = \zihao { -4 } \nwafu@kai, + originality-decl-name / bottom-skip = 0.25 cm, + originality-decl-text / bottom-skip = 0.4 cm, + originality-decl-sig / bottom-skip = 0.4 cm, + authorization-decl-name / bottom-skip = 0.25 cm, + authorization-decl-text / bottom-skip = 0.4 cm, + authorization-decl-sig / bottom-skip = -0.5 cm, + originality-decl-name / align = center, + originality-decl-sig / align = left, + authorization-decl-name / align = center, + authorization-decl-sig / align = left, + supervisor-decl-sig / align = left, + } +% \end{macrocode} +% +% \begin{macro}{style/auto-make-cover} +% \begin{variable}{\l_@@_auto_make_cover_bool} +% 是否自动生成封面。 +% \begin{macrocode} +\bool_new:N \l_@@_auto_make_cover_bool +\keys_define:nn { nwafu / style } + { + auto-make-cover .bool_set:N = \l_@@_auto_make_cover_bool, + auto-make-cover .default:n = true + } +% \end{macrocode} +% \end{variable} +% \end{macro} +% +% \begin{macro}{\makecovers} +% 在排版所有封面。 +% \begin{macrocode} +\NewDocumentCommand \makecovers { } + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生 +% \begin{macrocode} + \begin{titlepage} + \makecoveri + \newpage + \makecoverii + \newpage + \makecoveriii + \newpage + \makecoveriv + \newpage + \makecoverv + \newpage + \makecovervi + \end{titlepage} + }{ +% \end{macrocode} +% 本科生 +% \begin{macrocode} + \begin{titlepage} + \makecoveri + \cleardoublepage + \makecovervii + \end{titlepage} + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{摘要及符号表} +% +% \begin{variable}{\l_@@_abstract_file_tl, +% \l_@@_abstract_file_en_tl, +% \l_@@_abstract_keywords_clist, +% \l_@@_abstract_keywords_en_clist, +% \l_@@_notation_file_tl} +% 摘要数据所需字段。 +% \begin{macrocode} +\tl_new:c { l_@@_abstract_file_tl } +\tl_new:c { l_@@_abstract_file_en_tl } +\clist_new:N \l_@@_abstract_keywords_clist +\clist_new:N \l_@@_abstract_keywords_en_clist +\tl_new:c { l_@@_notation_file_tl } +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { nwafu / abstract } + { +% \end{macrocode} +% +% \begin{macro}{abstract/abstractfile, abstract/abstractfile*} +% 摘要文件的文件名 +% \begin{macrocode} + abstractfile .tl_set:N = \l_@@_abstract_file_tl, + abstractfile* .tl_set:N = \l_@@_abstract_file_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{abstract/keywords, abstract/keywords*} +% 论文关键字列表。 +% \begin{macrocode} + keywords .clist_set:N = \l_@@_abstract_keywords_clist, + keywords* .clist_set:N = \l_@@_abstract_keywords_en_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{abstract/notation} +% 论文符号表文件的文件名。 +% \begin{macrocode} + notationfile .tl_set:N = \l_@@_notation_file_tl, + notationfile .default:n = {}, + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\makefront} +% 排版摘要、目录等前料。 +% \begin{macrocode} +\NewDocumentCommand \makefront { } + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { +% \end{macrocode} +% 研究生,\cs{frontmatter}命令用于设置页眉页脚,页码格式 +% 并于奇数页起排。 +% \begin{macrocode} + \frontmatter + \tl_if_empty:NF \l_@@_abstract_file_tl + { +% \end{macrocode} +% 根据提供的文件,排版中文摘要,否则什么都不做。 +% \begin{macrocode} + \begin{abstract} + \file_input:V \l_@@_abstract_file_tl + \end{abstract} + } + \tl_if_empty:NF \l_@@_abstract_file_en_tl + { +% \end{macrocode} +% 根据提供的文件,排版英文摘要,否则什么都不做。 +% \begin{macrocode} + \begin{abstract*} + \file_input:V \l_@@_abstract_file_en_tl + \end{abstract*} + } +% \end{macrocode} +% 排版目录,需要在奇数页起排。 +% \begin{macrocode} + \cleardoublepage + \pagenumbering{Roman} + \tableofcontents +% \end{macrocode} +% 排版主要符号对照表,需要在奇数页起排。 +% \begin{macrocode} + % \frontmatter + \tl_if_empty:NF \l_@@_notation_file_tl + { +% \end{macrocode} +% 根据提供的文件,排版主要符号对照表,否则什么都不做。 +% \begin{macrocode} + \cleardoublepage + \pagenumbering{Roman} + \file_input:V \l_@@_notation_file_tl + } + }{ +% \end{macrocode} +% 本科生,无页眉页脚 +% \begin{macrocode} + \cleardoublepage + \thispagestyle { empty } + \tl_if_empty:NF \l_@@_abstract_file_tl + { +% \end{macrocode} +% 根据提供的文件,排版中文摘要,否则什么都不做。 +% \begin{macrocode} + \begin{abstract} + \@@_get_text_width:Nn \l_@@_tmpa_dim {\c_@@_name_keywords_tl} + \group_begin: + \par \indent + {\sffamily\zihao{-4} + \@@_spread_box:Vn \l_@@_tmpa_dim {\c_@@_name_abstract_tl} + \c_@@_fwid_colon_tl} + \normalfont + \file_input:V \l_@@_abstract_file_tl + \group_end: + \end{abstract} + } + \clearpage + \thispagestyle { empty } + \tl_if_empty:NF \l_@@_abstract_file_en_tl + { +% \end{macrocode} +% 根据提供的文件,排版英文摘要,否则什么都不做。 +% \begin{macrocode} + \begin{abstract*} + \group_begin: + \par \indent + {\bfseries\zihao{-4} + \c_@@_name_abstract_en_tl : ~} + \normalfont + \file_input:V \l_@@_abstract_file_en_tl + \group_end: + \end{abstract*} + } + \frontmatter + \tableofcontents + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\AfterEndPreamble + { + \bool_if:NT \l_@@_auto_make_cover_bool + { + \makecovers + \makefront + } + } +% \end{macrocode} +% +% \subsection{目录} +% +% 设置目录标题。 +% \begin{macrocode} +\keys_set:nn { ctex } + { + contentsname = \c_@@_name_toc_tl, + listfigurename = \c_@@_name_lof_tl, + listtablename = \c_@@_name_lot_tl, + } +% \end{macrocode} +% +% \begin{variable}{\@@_toc_chapter_format_tl, +% \@@_toc_chapter_indent_tl, +% \@@_toc_chapter_rule_tl, +% \@@_toc_chapter_numsep_tl, +% \@@_toc_chapter_offset_dim, +% \@@_toc_section_format_tl, +% \@@_toc_section_indent_tl, +% \@@_toc_section_rule_tl, +% \@@_toc_section_numsep_tl, +% \@@_toc_section_offset_dim, +% \@@_toc_subsection_format_tl, +% \@@_toc_subsection_indent_tl, +% \@@_toc_subsection_rule_tl, +% \@@_toc_subsection_numsep_tl, +% \@@_toc_subsection_offset_dim, +% \@@_toc_list_format_tl, +% \@@_toc_list_indent_tl, +% \@@_toc_list_rule_tl, +% \@@_toc_list_numsep_tl, +% \@@_toc_list_offset_dim, +% \@@_toc_line_align_bool, +% \@@_titletoc_hang_fix_bool} +% 目录设置中需要的字段。 +% \begin{macrocode} +\clist_map_inline:nn + { + chapter, section, subsection, figure, table + } + { + \clist_map_inline:nn + { + format, indent, rule, numsep + } + { + \tl_new:c {@@_toc_ #1 _ ##1 _ tl} + } + } +\clist_map_inline:nn + { + chapter, section, subsection, figure, table + } + { \dim_new:c { @@_toc_ #1 _offset_dim } } +\bool_new:N \@@_toc_line_align_bool +\bool_new:N \@@_titletoc_hang_fix_bool +% \end{macrocode} +% \end{variable} +% +% 目录格式设置,研究生与本科生需设置不同参数 +% \begin{macrocode} +\tl_set:Nn \@@_toc_chapter_format_tl { \addvspace{1pt}\nwafu@hei \bfseries } +\tl_set:Nn \@@_toc_chapter_indent_tl {0pc} +\tl_set:Nn \@@_toc_chapter_rule_tl {\tocrule{$\cdot$}} +\tl_set:Nn \@@_toc_chapter_numsep_tl {0.5\ccwd} +\dim_set:Nn \@@_toc_chapter_offset_dim + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + 0pc + }{ + 1pt + } + } +\tl_set:Nn \@@_toc_section_format_tl + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \addvspace{0pt} + }{ + \addvspace{1pt}\small + } + } +\tl_set:Nn \@@_toc_section_indent_tl { \ccwd } +\tl_set:Nn \@@_toc_section_rule_tl {\tocrule{$\cdot$}} +\tl_set:Nn \@@_toc_section_numsep_tl {0.5\ccwd} +\dim_set:Nn \@@_toc_section_offset_dim + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + 0pc + }{ + 1pt + } + } +\tl_set:Nn \@@_toc_subsection_format_tl + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \addvspace{0pt} + }{ + \addvspace{1pt}\small + } + } +\tl_set:Nn \@@_toc_subsection_indent_tl {2.0\ccwd} +\tl_set:Nn \@@_toc_subsection_rule_tl {\tocrule{$\cdot$}} +\tl_set:Nn \@@_toc_subsection_numsep_tl {0.5\ccwd} +\dim_set:Nn \@@_toc_subsection_offset_dim + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + 0pc + }{ + 1pt + } + } +\tl_set:Nn \@@_toc_figure_format_tl + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \addvspace{0pt} + }{ + \addvspace{1pt} + } + } +\tl_set:Nn \@@_toc_figure_indent_tl {0pc} +\tl_set:Nn \@@_toc_figure_rule_tl {\tocrule{$\cdot$}} +\tl_set:Nn \@@_toc_figure_numsep_tl {0.5\ccwd} +\dim_set:Nn \@@_toc_figure_offset_dim + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + 0pc + }{ + 1pt + } + } +\tl_set:Nn \@@_toc_table_format_tl + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \addvspace{0pt} + }{ + \addvspace{1pt} + } + } +\tl_set:Nn \@@_toc_table_indent_tl {0pc} +\tl_set:Nn \@@_toc_table_rule_tl {\tocrule{$\cdot$}} +\tl_set:Nn \@@_toc_table_numsep_tl {0.5\ccwd} +\dim_set:Nn \@@_toc_table_offset_dim + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + 0pc + }{ + 1pt + } + } +\bool_set_false:N \@@_toc_line_align_bool +\bool_set_false:N \@@_titletoc_hang_fix_bool +% +% \end{macrocode} +% 循环设置各级别目录格式。 +% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。 +% \begin{macrocode} +% +\clist_map_inline:nn + { + chapter, section, subsection, figure, table + } + { + \titlecontents{#1} +% \end{macrocode} +% 左侧缩进距离。 +% \begin{macrocode} + [ \use:c { @@_toc_#1_indent_tl } ] +% \end{macrocode} +% 标题格式,可以设置字体、加入垂直间距等, +% 垂直间距最好使用无间距重合的\textbackslash addvspace命令。 +% \begin{macrocode} + { \use:c { @@_toc_#1_format_tl } } +% \end{macrocode} +% 标题标志格式,如序号格式、序号宽度、序号与标题内容之间的间距等。 +% 该参数若为空,则无标题标志。 +% \begin{macrocode} + { + \bool_if:NT \@@_titletoc_hang_fix_bool + { + \contentspush + { + \thecontentslabel +% \end{macrocode} +% 有编号的标题在目录中编号与标题的间距。 +% \begin{macrocode} + \hspace{\use:c { @@_toc_#1_numsep_tl }} + } + } + } +% \end{macrocode} +% 无序号标题格式。 +% \begin{macrocode} + {} +% \end{macrocode} +% 标题与页码之间的导引线。 +% \begin{macrocode} + {\use:c { @@_toc_#1_rule_tl }} +% \end{macrocode} +% 下间距,可选参数, 用于设置标题排版后还需要执行的命令, +% 例如与下个标题的垂直间距等。 +% \begin{macrocode} + [\addvspace{\use:c{ @@_toc_ #1 _offset_dim }}] + } + +% \end{macrocode} +% 自定义导引线命令。 +% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。 +% \begin{macrocode} +\cs_new:Npn \NWAFUNumberLine #1 + { + \CTEXifname + { + \use:c { CTEXthe#1 } + \hspace{\use:c { @@_toc_#1_numsep_tl }} + }{} + } + +% \end{macrocode} +% 导引线。 +% \begin{macrocode} +\bool_if:NTF \@@_titletoc_hang_fix_bool + { +% \end{macrocode} +% CTeX格式导引线。 +% \begin{macrocode} + \keys_set:nn { ctex } + { + chapter/tocline = \CTEXnumberline{#1}#2, + section/tocline = \CTEXnumberline{#1}#2, + subsection/tocline = \CTEXnumberline{#1}#2 + } + }{ +% \end{macrocode} +% 自定义导引线。 +% \begin{macrocode} + \keys_set:nn { ctex } + { + chapter/tocline = \NWAFUNumberLine{#1}#2, + section/tocline = \NWAFUNumberLine{#1}#2, + subsection/tocline = \NWAFUNumberLine{#1}#2 + } + } +% +% \end{macrocode} +% 定义tocrule目录导引线命令。 +% *星号命令能够使右侧与页码连接与不是对齐。 +% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。 +% \begin{macrocode} +% +\NewDocumentCommand{\tocrule}{sO{0.3pc}D(){1.2}mO{}} + { + \small\normalfont + \titlerule*[#2]{\scalebox{#3}{#4}}#5 + \IfBooleanTF{#1} + {\thecontentspage} + { + \bool_if:NTF \@@_toc_line_align_bool + {\contentspage}{\thecontentspage} + } + } +% \end{macrocode} +% +% \begin{macro}{\tableofcontents,\listoffigures,\listoftables} +% 修改 \cs{tableofcontents}、\cs{listoffigures} 和 \cs{listoftables} 的定义, +% 使得页眉正确显示,并出现在目录及 PDF 书签中。来自于 \LaTeXe{} 标准文档类 +% \file{book.cls} +% \footnote{原代码中只有 \cs{tableofcontents} 的 \cs{@mkboth} 出现在 +% \cs{chapter*} 内部,这是出于兼容性的考虑而非 typo。}。 +% \begin{macrocode} +\@@_patch_cmd:Nnn \tableofcontents + { + \chapter*{\contentsname + \@mkboth{\MakeUppercase\contentsname} + {\MakeUppercase\contentsname}} + } + { \@@_chapter_no_toc:V \contentsname } +\@@_patch_cmd:Nnn \listoffigures + { + \chapter*{\listfigurename} + \@mkboth{\MakeUppercase\listfigurename} + {\MakeUppercase\listfigurename} + } + { \@@_chapter:V \listfigurename } +\@@_patch_cmd:Nnn \listoftables + { + \chapter*{\listtablename} + \@mkboth{\MakeUppercase\listtablename} + {\MakeUppercase\listtablename} + } + { \@@_chapter:V \listtablename } +% \end{macrocode} +% \end{macro} +% +% \subsection{摘要} +% +% \begin{environment}{abstract} +% \begin{environment}{abstract*} +% 摘要环境,定义中英文双语摘要。 +% \begin{macrocode} +\NewDocumentEnvironment { abstract } { } + { \@@_abstract_begin: } { \@@_abstract_end: } +%<*class> +\NewDocumentEnvironment { abstract* } { } + { \@@_abstract_en_begin: } { \@@_abstract_en_end: } +% +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\@@_abstract_begin:,\@@_abstract_en_begin:} +% 摘要页标题。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_abstract_begin: + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \@@_chapter:V \c_@@_name_abstract_tl + }{ + \par \mode_leave_vertical: \par + \begin{center}\nwafu@hei\bfseries\zihao{3}\l_@@_info_title_tl\end{center} + } + } +% +\cs_new_protected:Npn \@@_abstract_en_begin: + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \@@_chapter:n \c_@@_name_abstract_en_tl + }{ + \par \mode_leave_vertical: \par + \begin{center}\bfseries\zihao{3}\l_@@_info_title_en_tl\end{center} + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_abstract_end:,\@@_abstract_en_end:} +% 摘要正文完成后,输出关键字列表。 +% \begin{macrocode} +%<*class> +\cs_new_protected:Npn \@@_abstract_end: + { + \@@_keywords:nNn + { \sffamily \zihao{-4} \c_@@_name_keywords_tl \c_@@_fwid_colon_tl } + \l_@@_abstract_keywords_clist { ; ~} + } +% +\cs_new_protected:Npn \@@_abstract_en_end: + { + \@@_keywords:nNn + { \bfseries \c_@@_name_keywords_en_tl : ~ } + \l_@@_abstract_keywords_en_clist { ; ~ } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_keywords:nNn,\@@_keywords_prevdepth:} +% 关键字列表前要空一行,使用悬挂缩进。|\parbox| 之后的间距 +% 需要调整,见 \url{https://tex.stackexchange.com/a/34982}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_keywords:nNn #1#2#3 + { + \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 } + { + \par \mode_leave_vertical: \par \noindent + \@@_get_text_width:Nn \l_@@_tmpa_dim {#1} + \group_begin: \MakeUppercase{#1} \group_end: + \parbox [t] { \dim_eval:n { \textwidth - \l_@@_tmpa_dim } } + { + \clist_use:Nn #2 {#3} \par + \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D } + } + }{ + \par \mode_leave_vertical: \par + \@@_get_text_width:Nn \l_@@_tmpa_dim {#1} + \group_begin: #1 \group_end: + \clist_use:Nn #2 {#3} \par + \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D } + } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{符号表} +% +% \begin{environment}{notation} +% 符号表环境,利用 \env{longtable} 封装。可选参数为表格列格式说明符。 +% \begin{macrocode} +\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } } + { + \@@_notation_begin: + \group_begin: + \@@_notation_long_table_setup: + \longtable {#1} + } + { + \endlongtable + \group_end: + } +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\@@_notation_begin:} +% 符号表页标题。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_notation_begin: + { + \@@_chapter_no_toc:V \c_@@_name_notation_tl + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_notation_long_table_setup:} +% 调整 \cs{LTpre} 和 \cs{LTpost},以删去 \env{longtable} 前后的空白。 +% 英文模板中还需要调整表格的行距。注意 \tn{arraystretch} 只是一个简单 +% 宏,不能使用 \cs{fp_set:Nn}。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_notation_long_table_setup: + { + \dim_set_eq:NN \LTpre \c_zero_dim + \dim_set_eq:NN \LTpost \c_zero_dim + } +% \end{macrocode} +% \end{macro} +% +% \subsection{致谢} +% +% \begin{environment}{acknowledgement} +% 致谢环境,只是简单地设置章节不编号标题。 +% \begin{macrocode} +\NewDocumentEnvironment { acknowledgement } { } + { + \group_begin: + \@@_chapter:V \c_@@_name_ack_tl + } + { + \group_end: + } +% \end{macrocode} +% \end{environment} +% +% \subsection{个人简历} +% +% \begin{environment}{resume} +% 致谢环境,只是简单地设置章节不编号标题。 +% \begin{macrocode} +\NewDocumentEnvironment { resume } { } + { + \group_begin: + \@@_chapter:V \c_@@_name_resume_tl + } + { + \group_end: + } +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\resumeitem,\researchitem} +% 摘要页标题。 +% \begin{macrocode} +\NewDocumentCommand{ \resumitem }{ O{ 学习经历 } } + {% + \vspace{24bp}{\zihao{-4}\nwafu@hei\bfseries\centerline{#1}}\par\vspace{6bp} + } +\NewDocumentCommand{ \researchitem }{ O{ 发表的学术论文 } } + {% + \vspace{32bp}{\zihao{-4}\nwafu@hei\bfseries\centerline{#1}}\par\vspace{14bp} + } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{publications} +% \begin{environment}{achievements} +% 个人简历中发论文和研究成果列表环境。 +% \begin{macrocode} +\newlist{publications}{enumerate}{1} +\setlist[publications]{label=[\arabic*],align=left,nosep,itemsep=6bp, + leftmargin=10mm,before=\zihao{-4},resume} +\newlist{achievements}{enumerate}{1} +\setlist[achievements]{label=[\arabic*],align=left,nosep,itemsep=6bp, + leftmargin=10mm,before=\zihao{-4}} +\def\publicationskip{\bigskip\bigskip} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \subsection{参考文献著录与引用} +% +% \begin{variable}{\l_@@_bib_resource_clist} +% 保存参考文献数据库列表。 +% \begin{macrocode} +\clist_new:N \l_@@_bib_resource_clist +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\keys_define:nn { nwafu / style } + { +% \end{macrocode} +% \begin{macro}{style/bib-resource} +% 参考文献数据源。 +% \begin{macrocode} + bib-resource .clist_set:N = \l_@@_bib_resource_clist + } +% \end{macrocode} +% \end{macro} +% +% 为了保证导言区中的设置能起作用,\pkg{biblatex} 宏包均需要在 +% 导言区末尾载入(仍在 \pkg{hyperref} 之前),并做相关设置。 +% \begin{macrocode} +% \AddToHook +% { env/document/begin } +\@@_at_end_preamble:n + { + \@@_biblatex_pre_setup: + \RequirePackage { biblatex } + \@@_biblatex_post_setup: + } +% \end{macrocode} +% +% \begin{macro}{ +% \@@_biblatex_pre_setup:, +% \@@_biblatex_post_setup:, +% \@@_pass_options_to_biblatex:n} +% \pkg{biblatex} 相关设置。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_biblatex_pre_setup: + { +% \end{macrocode} +% 参考文献引用与著录样式。 +% \begin{macrocode} + \@@_pass_options_to_biblatex:n { style = gb7714-2015ay } +% \end{macrocode} +% 其它参数。 +% \begin{macrocode} + \@@_pass_options_to_biblatex:n { backend = biber, sortlocale=zh__pinyin, + gbtype=false, maxbibnames=99, maxcitenames=2, mincitenames=1, + gbpub=false, uniquename=false, uniquelist=false, gbnamefmt=lowercase, + doi=false, isbn=false, gbfieldtype=true, gbpunctin=false, + } + } +\cs_new_protected:Npn \@@_biblatex_post_setup: + { +% \end{macrocode} +% 载入参考文献数据源文件。 +% \begin{macrocode} + \@@_biblatex_misc: + \clist_map_function:NN \l_@@_bib_resource_clist \addbibresource + \@@_biblatex_allow_url_break: +% \end{macrocode} +% 修改参考文献标题。 +% \begin{macrocode} + \defbibheading { bibliography } [ \bibname ] { \@@_chapter:n {##1} } + } +\cs_new_protected:Npn \@@_pass_options_to_biblatex:n #1 + { \PassOptionsToPackage {#1} { biblatex } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_biblatex_misc:} +% \pkg{biblatex} 中需要针对西北农林科技大学参考文献规范的特殊设置。 +% 由符合 GB/T 7714-2015 标准的 biblatex 参考文献样式 +% (\url{https://github.com/hushidong/biblatex-gb7714-2015}) +% 作者胡振震协助实现。 +% \begin{macrocode} +\cs_new:Npn \@@_biblatex_misc: + { +% \end{macrocode} +% 表示范围的波浪线符号 +% \begin{macrocode} + \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{$\sim$}} +% \end{macrocode} +% 设置全局字体字号(5号字,行间距为1.3) +% \begin{macrocode} + \newcommand\nwafu@font@bib{\@@_line_spread:n {1.3}\zihao{5}} + \renewcommand{\bibfont}{\nwafu@font@bib} +% \end{macrocode} +% 英文期刊名称用斜休(Italic体) +% \begin{macrocode} + \DeclareFieldFormat[article]{journaltitle}{\iffieldequalstr{userd}{chinese}{##1}{\textit{##1}}\isdot} +% \end{macrocode} +% \tn{parencite}命令引用标注后导分割符 +% \begin{macrocode} + \renewcommand{\postnotedelim}{\addcolon\space} +% \end{macrocode} +% 删除\tn{parencite}命令引用标注中有页码选项时的p. pp.字符 +% \begin{macrocode} + \DeclareFieldFormat{postnote}{##1} +% \end{macrocode} +% 引用标注作者年制中作者和年份之间的标点(人名与年之间用空格分隔) +% \begin{macrocode} + \DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\space} + \DeclareDelimFormat[textcite]{nameyeardelim}{\space} +% \end{macrocode} +% 文献著录列表中作者与年之间的分割符(最后一个作者后用点) +% \begin{macrocode} + \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addperiod\space} +% \end{macrocode} +% 删除文献著录列表中最后的点 +% \begin{macrocode} + \renewcommand*{\finentrypunct}{} +% \end{macrocode} +% 修改部分中文化字符串 +% \begin{macrocode} + \DefineBibliographyStrings{english}{ + andincitecn = {和}, + andincite = {and}, + mathesiscn={[硕士学位论文]}, + phdthesiscn={[博士学位论文]}, + in={In:\addspace}, + incn={见:\addspace}, + } +% \end{macrocode} +% 修改最后一个作者前的字符串,比如“and”、“和”。 +% +% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 +% 非默认情况,根据选项信息,选择选择强制中文或英文 +% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 +% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 +% \begin{macrocode} + \DeclareDelimFormat{finalnamedelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\addspace\bibstring{andincite}\addspace}{}% + \iffieldequalstr{\userfieldabcde}{french}{\addspace\bibstring{and}\addspace}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\addspace\bibstring{and}\addspace}{}% + \or% + \bibstring{andincitecn}% + \or% + \addspace\bibstring{andincite}\addspace% + \fi + } +% \end{macrocode} +% 20190215, 胡振震邮件指导代码 +% 去掉超过3个著者时汉字“等”前的空格(GB/T 7714-2015规定需要有空格) +% \begin{macrocode} + \DeclareDelimFormat{strandothersdelim}{% + \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% + %\addspace% + \edef\userfieldabcde{userd}% + \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% + \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% + \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% + \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% + \ifcase\value{gbcitelocalcase}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andothersincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothersincite}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% + \or% + \bibstring{andothersincitecn}% + \or% + \bibstring{andothersincite}% + \fi + } +% \end{macrocode} +% 设置andothersdelim +% \begin{macrocode} + \AtEveryCitekey{% + \iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace + {\renewcommand*{\andothersdelim}{\addspace}}% + } +% \end{macrocode} +% 标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果 +% \begin{macrocode} + \renewbibmacro*{cite:extradate}{% + \iffieldundef{extradate} {} + {\printtext[bibhyperref]{\printlabeldateextra}}%\printfield{extradate} + } +% \end{macrocode} +% 文献表中的日期格式 +% \begin{macrocode} + \renewbibmacro*{date+extradate}{% + \iffieldundef{labelyear}{}% + {\ifboolexpr{% + test {\ifentrytype{patent}} + or + (test {\ifentrytype{newspaper}} )% + }% + {\printtext{\blx@isodate{}{}}}% + {\printtext{% + \iflabeldateisdate + {\printdateextra} + {\printlabeldateextra} + } + }% + }% + } + \newbibmacro*{origdate+extradate}{% + \printtext{\printorigdate}% + } +% \end{macrocode} +% 修改译者位置格式 +% \begin{macrocode} + \renewbibmacro*{bytranslator+others}{% + \ifnameundef{translator} + {} + {\printnames[bytranslator]{translator}% + \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 + \newunit + }% + \usebibmacro{withothers}% + \ifboolexpr{% + test {\iffieldundef{origyear}} or test {\ifnameundef{translator}}%% + }{}{\printtext{\printdate}}% + } +% \end{macrocode} +% url和url日期格式 +% \begin{macrocode} + \renewbibmacro*{url+urldate}{% + \usebibmacro{url}% + \iffieldundef{urlyear}% + {} + {\usebibmacro{urldate} + } + } + \DeclareFieldFormat{addnumflag}{% + \ifentrytype{newspaper} + {\setunit{\addcomma\addspace}\printtext{##1}} + {\nobreak\printtext{(}\nobreak ##1\nobreak\printtext{)}} + } +% \end{macrocode} +% 重设专利title的输出,输出文献类型标识符 +% \begin{macrocode} + \renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件 + \ifboolexpr{% + test{\iffieldundef{title}}% + and% + test{\iffieldundef{subtitle}}% + }% + {}% + { + \printtext[title]{\bibtitlefont% + \printfield[titlecase]{title}% + \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 + {} + { + \setunit{\subtitlepunct}% + \printfield[titlecase]{subtitle}}% + \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 + {\setunit{\subtitlepunct}\printfield{titleaddon}}% + \setunit{\adddot\addspace}\printfield{number}%写专利号 + \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% + }% + }% + } +% \end{macrocode} +% 修改作者数量超过限定值,省略时的处理格式 +% 20190103,hzz,修改利用新定义的一个分隔符strandothersdelim +% +% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 +% \begin{macrocode} + \renewbibmacro*{name:andothers}{% + \ifboolexpr{ + test {\ifnumequal{\value{listcount}}{\value{liststop}}} + and + test \ifmorenames + }{\ifnumgreater{\value{liststop}}{1}% + {\finalandcomma}% + {}% + \printdelim{andothersdelim}\printdelim{strandothersdelim}% + }{%当是译者的时候需要特殊处理 + \ifcurrentname{translator}{\addcomma}{}% + } + } +% \end{macrocode} +% 修改对edition版本信息格式 +% \begin{macrocode} + \DeclareFieldFormat{edition}{% + \testCJKfirst{userd}% + \iftoggle{ifCJKforgbt}% + {\ifinteger{##1}% + {\printtext{\bibstring{serialcn}\zhnumber{##1}\str@edition}}% + {##1\isdot} + }% + {\ifinteger{##1}% + {\mkbibordedition{##1}~\bibstring{edition}}% + {##1\isdot} + } + } +% \end{macrocode} +% 注意这里当没有作者只有标题时在年份之前的标点是否需要 +% 标准并未涉及,所以未做处理。 +% \begin{macrocode} + \renewbibmacro*{author}{% + \ifboolexpr{ + test \ifuseauthor + and + not test {\ifnameundef{author}} + }{\usebibmacro{bbx:dashcheck} + {\printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上 + }{\usebibmacro{bbx:savehash}% + \printnames{author}% + \iffieldundef{authortype} + {\setunit{\printdelim{nameyeardelim}}} + {\setunit{\printdelim{authortypedelim}}} + }% + \iffieldundef{authortype} + {} + {\usebibmacro{authorstrg}% + \setunit{\printdelim{nameyeardelim}} + } + }% + {\global\undef\bbx@lasthash + \usebibmacro{labeltitle}% + \setunit*{\printdelim{nonameyeardelim}} + }% + \ifboolexpr{% + test {\iffieldundef{origyear}} or test {\ifnameundef{translator}}% + }{\usebibmacro{date+extradate}}% + {\usebibmacro{origdate+extradate}}% + } +% \end{macrocode} +% book条目类的驱动 +% \begin{macrocode} + \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% + \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{maintitle+title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock% + \usebibmacro{byauthor}% + \newunit\newblock% + }% + \newunit% + \printfield{edition}% + \newunit% + \usebibmacro{byeditor+others}% + \newunit\newblock% + \iftoggle{bbx:gbstrict}{}{% + \iffieldundef{maintitle}% + {% + \printfield{volume}% + \printfield{part}% + }% + {}% + \newunit% + \printfield{volumes}% + \newunit\newblock% + \usebibmacro{series+number}% + }% + \newunit\newblock% + \usebibmacro{publisher+location+date}% + \usebibmacro{chapter+pages}% + \iffieldundef{url}{}{%当没有网址时也不输出 + \usebibmacro{modifydate}%带括号的修改或更新日期, + }% + \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 + \newunit\newblock% + \printfield{pagetotal}% + \newunit\newblock% + \iftoggle{bbx:isbn}% + {\printfield{isbn}} + {}% + \newunit\newblock% + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock% + \iftoggle{bbx:related}% + {\usebibmacro{related:init}% + \usebibmacro{related}% + }{}% + \usebibmacro{finentry} + } +% \end{macrocode} +% 在线文献驱动 +% \begin{macrocode} + \DeclareBibliographyDriver{online}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author/editor+others/translator+others}% + \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{title}% + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor}% + \newunit\newblock + \usebibmacro{byeditor+others}% + \newunit\newblock + \printfield{note} + }% + \newunit + \printfield{version}% + \newunit\newblock + \printlist{institution}% + \newunit\newblock + \ifboolexpr{% + test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% + }{\usebibmacro{date}}% + \usebibmacro{url+urldate}%从下面移上来 + \newunit\newblock + \iftoggle{bbx:eprint} + {\usebibmacro{eprint}} + {}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related}} + {}% + \usebibmacro{finentry} + } +% \end{macrocode} +% 专利文献驱动 +% \begin{macrocode} + \DeclareBibliographyDriver{patent}{%源来自standard.BBX + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% + \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 + \usebibmacro{patenttitle}%给出专利专用的标题输出 + \iftoggle{bbx:gbstrict}{}{% + \newunit% + \printlist{language}% + \newunit\newblock + \usebibmacro{byauthor} + }% + \newunit\newblock + \printfield{type}% + \setunit*{\addspace}% + \iflistundef{location} + {} + {\setunit*{\addspace}% + \printtext{%[parens] + \printlist[][-\value{listtotal}]{location}} + }% + \newunit\newblock + \usebibmacro{byholder}% + \newunit\newblock + \printfield{note}% + \newunit\newblock + \usebibmacro{doi+eprint+url}% + \newunit\newblock + \usebibmacro{addendum+pubstate}% + \setunit{\bibpagerefpunct}\newblock + \usebibmacro{pageref}% + \newunit\newblock + \iftoggle{bbx:related} + {\usebibmacro{related:init}% + \usebibmacro{related} + } + {}% + \usebibmacro{finentry} + } +% \end{macrocode} +% 间距的控制 +% \begin{macrocode} + \setlength{\bibitemsep}{2pt} + \setlength{\bibnamesep}{0ex} + \setlength{\bibinitsep}{0ex} +% \end{macrocode} +% 文献著录条目缩进控制(悬挂缩进4英文字符) +% \begin{macrocode} + \setlength{\bibitemindent}{-2\ccwd}% bibitemindent表示一条文献中第一行相对后面各行的缩进 + \setlength{\bibhang}{2\ccwd} % 表示的各行起始位置到页边的距离 + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_biblatex_allow_url_break:} +% \pkg{biblatex} 下允许 URL 在字母、数字和一些特殊符号处断行。 +% \begin{macrocode} +\cs_new:Npn \@@_biblatex_allow_url_break: + { + \int_set_eq:NN \c@biburlucpenalty \c_one_int + \int_set_eq:NN \c@biburlnumpenalty \c_one_int + \int_set_eq:NN \c@biburllcpenalty \c_one_int + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_cite_style_author_year:} +% 著者—出版年制下的引用样式。 +% \begin{macrocode} +\cs_new:Npn \@@_set_cite_style_author_year: + { + \NAT@numbersfalse +%<*class> + \cs_set_eq:NN \NAT@open \c_@@_fwid_left_paren_tl + \cs_set_eq:NN \NAT@close \c_@@_fwid_right_paren_tl + \cs_set_eq:NN \NAT@sep \c_@@_fwid_semicolon_tl + \cs_set_eq:NN \NAT@aysep \c_@@_fwid_comma_tl + \cs_set_eq:NN \NAT@yrsep \c_@@_ideo_comma_tl +% + } +% \end{macrocode} +% \end{macro} +% +% \subsection{间距设置} +% +% 段落间距 +% \begin{macrocode} +\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } +% \end{macrocode} +% 浮动体顶商与底端所留距离 +% \begin{macrocode} +\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } +% \end{macrocode} +% 最后一个浮动对象顶端或第一个浮动对象底端与正文之间的距离 +% \begin{macrocode} +\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } +\allowdisplaybreaks[4] +\ctex_after_end_preamble:n + { +% \end{macrocode} +% 公式前的距离 +% \begin{macrocode} + \skip_set:Nn \abovedisplayskip { 5pt plus 1pt minus 1pt } +% \end{macrocode} +% 公式后的距离 +% \begin{macrocode} + \skip_set:Nn \belowdisplayskip { 5pt plus 1pt minus 1pt } +% \end{macrocode} +% 公式前与文本的距离 +% \begin{macrocode} + \skip_set:Nn \abovedisplayshortskip { 0pt } +% \end{macrocode} +% 公式后与文本的距离 +% \begin{macrocode} + \skip_set:Nn \belowdisplayshortskip { 5pt plus 1pt minus 1pt } + } +% \end{macrocode} +% +% \subsection{\env{enumerate}列表环境设置} +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_enumitem_label_set:nn #1#2 + { \SetEnumitemValue{label}{#1}{#2} } +\clist_map_inline:nn + { + { bullet } { \textbullet }, + { endash } { \normalfont\bfseries\textendash }, + { asterisk } { \textasteriskcentered }, + { arabic } { \bool_if:NTF \l_@@_withchap_bool + { \arabic*. }{ (\arabic*) } }, + { alph } { \bool_if:NTF \l_@@_withchap_bool + { \alph*. }{ (\alph*) } }, + { roman } { \bool_if:NTF \l_@@_withchap_bool + { \roman*. }{ (\roman*) } }, + { alph } { (\alph*) }, + { roman } { \roman*. }, + { outline } { \upshape\ding{111} } + } + { \@@_enumitem_label_set:nn #1 } +\SetEnumitemValue{font}{sf}{\normalfont\sffamily} +\SetEnumitemValue{ref}{enumii}{\arabic{enumi}.\alph*} +\SetEnumitemValue{ref}{enumiii}{\arabic{enumi}.\alph{enumii}.\roman*} +\setlist + { + nosep, + leftmargin = *, + labelindent = \dimexpr\parindent+0pt\relax, + wide=\parindent, + } +\setlist[itemize,1]{label = bullet} +\setlist[itemize,2]{label = endash} +\setlist[itemize,3]{label = asterisk} +\setlist[enumerate,1]{label = arabic,ref = \arabic*} +\setlist[enumerate,2]{label = alph,ref = enumii} +\setlist[enumerate,3]{label = roman,ref = enumiii,labelwidth = *} +\setlist[description]{font = sf,labelwidth = *,leftmargin = 2\ccwd} +% \end{macrocode} +% +% \subsection{\pkg{hyperref} 相关配置} +% +% \emph{\pkg{hyperref}相关配置完成使用\cls{fduthesis}模板的代码}。 +% +% \begin{macro}{\hypersetup,\nwafu_hyperref_setup:n} +% \pkg{hyperref} 宏包是在导言区之后才引入的。若要在导言区中使用 +% \tn{hypersetup} 命令,必须另行定义。 +% \begin{macrocode} +\NewDocumentCommand \hypersetup { m } + { \nwafu_hyperref_setup:n {#1} } +\cs_new_protected:Npn \nwafu_hyperref_setup:n #1 + { \clist_gput_right:Nn \g_@@_to_hyperref_clist {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_hyperlink_color_key:n} +% 设置超链接颜色选项。最后的逗号用于确保 \pkg{l3keys} 可以正确解析,不能省去。 +% \begin{macrocode} +\cs_new:Npn \@@_set_hyperlink_color_key:n #1 + { + hyperlink-color / \clist_item:nn {#1} {1} .code:n = + { + \@@_define_hyperlink_color:nnn + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } + \nwafu_hyperref_setup:n + { + linkcolor = nwafu@link, linkbordercolor = nwafu@link, + urlcolor = nwafu@url, urlbordercolor = nwafu@url, + citecolor = nwafu@cite, citebordercolor = nwafu@cite + } + }, + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_define_hyperlink_color:nnn} +% 定义超链接颜色。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_define_hyperlink_color:nnn #1#2#3 + { + \definecolorset { HTML } { nwafu@ } { } + { link, #1; url, #2; cite, #3 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\keys_define:nx { nwafu / style } + { +% \end{macrocode} +% +% \begin{macro}{style/hyperlink} +% 超链接样式。 +% \begin{macrocode} + hyperlink .choice:, + hyperlink .value_required:n = true, + hyperlink / border .code:n = { }, + hyperlink / color .code:n = + { \nwafu_hyperref_setup:n { colorlinks = true } }, + hyperlink / none .code:n = + { \nwafu_hyperref_setup:n { hidelinks = true } }, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{style/hyperlink-color} +% 超链接颜色。 +% \begin{macrocode} + hyperlink-color .choice:, + hyperlink-color .value_required:n = true, + \clist_map_function:nN + { + { autumn, D70000, D75F00, AF8700 }, + { business, D14542, 295497, 1F6E43 }, + { classic, FF0000, 0000FF, 00FF00 }, + { default, 990000, 0000B2, 007F00 }, + { elegant, 961212, C31818, 9B764F }, + { fantasy, FF4A19, FF3F94, 934BA1 }, + { material, E91E63, 009688, 4CAF50 }, + { science, CA0619, 389F9D, FF8920 }, + { summer, 00AFAF, 5F5FAF, 5F8700 }, + { graylevel, 616161, 616161, 616161 }, + { prl, 2D3092, 2D3092, 2D3092 } + } + \@@_set_hyperlink_color_key:n + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\nwafu_allow_url_break:,\@@_add_url_break_points:} +% 允许 URL 在字母、数字和一些特殊符号处断行。见 +% \url{https://bit.ly/2hhIjLW}。 +% \begin{macrocode} +\cs_new:Npn \nwafu_allow_url_break: + { + \cs_new:Npn \@@_add_url_break_points: + { \tl_map_function:NN \c_@@_url_break_points_tl \do } + \@@_appto_cmd:Nn \UrlBreaks + { \UrlOrds \@@_add_url_break_points: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\c_@@_url_break_points_tl} +% 额外的断行位置是 26 个英文字母(大小写)以及 10 个阿拉伯数字。 +% \pkg{url} 提供的宏 \tn{UrlBreaks} 还包含了特殊符号 |*|、|-|、 +% |~|、|'|、|"|、|-|,也被设置为允许断行。 +% \begin{macrocode} +\tl_const:Nn \c_@@_url_break_points_tl + { + abcdefghijklmnopqrstuvwxyz + ABCDEFGHIJKLMNOPQRSTUVWXYZ + 0123456789 + } +% \end{macrocode} +% \end{variable} +% +% 在导言区末尾引入 \pkg{hyperref} 宏包。 +% \begin{macrocode} +\ctex_at_end_preamble:n + { + \RequirePackage { hyperref } +% \end{macrocode} +% 此后 \tn{hypersetup} 命令由 \pkg{hyperref} 宏包接管。 +% \begin{macrocode} + \hypersetup + { + bookmarksnumbered = true, + psdextra = true, + unicode = true, +% \end{macrocode} +% 填写 PDF 元信息。 +% \begin{macrocode} +%<*class> + pdftitle = \l_@@_info_title_tl, + pdfauthor = \l_@@_info_author_tl, + pdfkeywords = \l_@@_abstract_keywords_clist, +% +% pdfsubject = , + pdfcreator = \c_@@_name_pdf_creator_tl + } +% \end{macrocode} +% 将导言区中通过 \cs{nwafu_hyperref_setup:n} 进行的设置传入 +% \tn{hypersetup}。 +% \begin{macrocode} + \exp_args:NV \hypersetup \g_@@_to_hyperref_clist +% \end{macrocode} +% URL 断行处理。 +% \begin{macrocode} + \nwafu_allow_url_break: +% \end{macrocode} +% 手动开启 \pkg{biblatex} 的 \pkg{hyperref} 支持。 +% \begin{macrocode} + \BiblatexManualHyperrefOn + } +% \end{macrocode} +% +% 在 PDF 字符串中设置 \tn{nwafu@kai} 命令为空,以抑制 \pkg{hyperref} +% 的警告信息。 +% \begin{macrocode} +\ctex_at_end_package:nn { hyperref } + { + \pdfstringdefDisableCommands + { + \cs_set_eq:NN \nwafu@kai \prg_do_nothing: + \cs_set_eq:NN \quad \c_space_tl + \cs_set_eq:NN \qquad \c_space_tl + } + } +% \end{macrocode} +% +% 引用标题配置。 +% \begin{macrocode} +\labelformat{part}{\CTEXthepart} +\labelformat{chapter}{\CTEXthechapter} +\labelformat{figure}{\figurename~#1} +\labelformat{table}{\tablename~#1} +\def\figureautorefname{图} +\def\tableautorefname{表} +\keys_set_known:nn { ctex } + { + figurename = 图, + tablename = 表, + } +\labelformat{equation}{式(#1)} +\labelformat{section}{节 #1} +\labelformat{subsection}{小节 #1} +% \end{macrocode} +% +% \subsection{用户接口} +% +% \begin{macro}{abstract,info,style} +% 定义元(meta)键值对。 +% \begin{macrocode} +\keys_define:nn { nwafu } + { + abstract .meta:nn = { nwafu / abstract } {#1}, + info .meta:nn = { nwafu / info } {#1}, + style .meta:nn = { nwafu / style } {#1} + } +% \end{macrocode} +% \end{macro} +% +% 文档类初始设置。 +% \begin{macrocode} +\keys_set:nn { nwafu } + { + style / font-size = -4, + style / fullwidth-stop = false, + style / auto-make-cover = true, + style / logo = { logo/nwafu-bar.pdf }, + style / logo-size = { 0.65 \textwidth }, + style / hyperlink = none, + style / hyperlink-color = default, + info / degree = academic, + info / secret-level = none, + info / school-id = { 10712 }, + info / date = { \zhtoday }, + theorem / header-font = { \sffamily }, + theorem / body-font = { \nwafu@kai }, + theorem / counter = { chapter } + } +% \end{macrocode} +% +% \begin{macro}{\nwafuset} +% 用户设置接口。 +% \begin{macrocode} +\NewDocumentCommand \nwafuset { m } + { \keys_set:nn { nwafu } {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{proof} +% \begin{environment}{axiom} +% \begin{environment}{corollary} +% \begin{environment}{definition} +% \begin{environment}{example} +% \begin{environment}{lemma} +% \begin{environment}{theorem} +% 模板预定义的常用数学环境。 +% 其中的“证明”比较特殊,它不编号,但会添加证毕符号。 +% \begin{macrocode} +%<*class> +\newtheorem* { proof } { \c_@@_name_proof_tl } +\newtheorem { axiom } { \c_@@_name_axiom_tl } +\newtheorem { corollary } { \c_@@_name_corollary_tl } +\newtheorem { definition } { \c_@@_name_definition_tl } +\newtheorem { example } { \c_@@_name_example_tl } +\newtheorem { lemma } { \c_@@_name_lemma_tl } +\newtheorem { theorem } { \c_@@_name_theorem_tl } +% +% +% \end{macrocode} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% \end{environment} +% +% \begin{macrocode} +%<@@=> +% \end{macrocode} +% +% \clearpage +% +% \end{implementation} +% diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf new file mode 100644 index 0000000000..625302daac Binary files /dev/null and b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf differ -- cgit v1.2.3