From 36c40243665f27f57f0167810c4e29d88347ee0a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Feb 2022 21:21:30 +0000 Subject: njuthesis (20feb22) git-svn-id: svn://tug.org/texlive/trunk@62107 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/njuthesis/README.md | 18 + .../texmf-dist/doc/latex/njuthesis/njuthesis.pdf | Bin 1060301 -> 1103774 bytes .../source/latex/njuthesis/njuthesis.dtx | 1757 ++++++++++++++------ .../texmf-dist/tex/latex/njuthesis/njuthesis.cls | 792 ++++++--- 4 files changed, 1752 insertions(+), 815 deletions(-) diff --git a/Master/texmf-dist/doc/latex/njuthesis/README.md b/Master/texmf-dist/doc/latex/njuthesis/README.md index b9ea0d1884b..b9411c04fbb 100644 --- a/Master/texmf-dist/doc/latex/njuthesis/README.md +++ b/Master/texmf-dist/doc/latex/njuthesis/README.md @@ -6,6 +6,24 @@ dissertations with LaTeX, providing support for bachelor, master, and doctoral thesis. Compilation of this class requires either `xelatex` or `lualatex` engine. +Usage +----- + +A minimal example of this document class should look like + +``` +\documentclass{njuthesis} +\njusetup{} +\begin{document} +\maketitle +\tableofcontents +\mainmatter +\chapter{Welcome} +Hello \LaTeX{}! +\printbibliography +\end{document} +``` + Contributing ------------ diff --git a/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf b/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf index 5aa0cc75c00..6d15a76a773 100644 Binary files a/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf and b/Master/texmf-dist/doc/latex/njuthesis/njuthesis.pdf differ diff --git a/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx b/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx index 10471b82e8c..d08fbc07f1d 100644 --- a/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx +++ b/Master/texmf-dist/source/latex/njuthesis/njuthesis.dtx @@ -8,7 +8,7 @@ % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this -% license or (at your option) any later version. The latest version +% license or (at your option) any later version. The latest version % of this license is in the file % % https://www.latex-project.org/lppl.txt @@ -105,10 +105,10 @@ To produce the documentation run the original source files ending with % %\NeedsTeXFormat{LaTeX2e} %\RequirePackage{expl3} -%\GetIdInfo $Id: njuthesis.dtx 0.14.0 2022-01-16 00:00:00 +0800 NJU LUG $ -% { Thesis template for Nanjing University } +%\GetIdInfo $Id: njuthesis.dtx 0.15.0 2022-02-20 10:30:00 +0800 NJU LUG $ +% {Thesis template for Nanjing University} %\ProvidesExplClass{njuthesis} -%{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % %<*driver> \ProvidesFile{njuthesis.dtx} @@ -119,6 +119,7 @@ To produce the documentation run the original source files ending with \colorlet{at@guard}{njuviolet} \definecolor{olgreen}{HTML}{138a07} \newcommand\olbutton[1]{\textcolor{olgreen}{\bfseries #1}} +\newcommand\grd[1]{\textcolor{at@guard}{\sffamily #1}} \hypersetup{% pdftitle = {The njuthesis class - LaTeX thesis template for Nanjing University}, citecolor = njublue, @@ -182,7 +183,7 @@ To produce the documentation run the original source files ending with % 南京大学 Linux 用户组 % \thanks{E-mail: \href{mailto:git+nju-lug-email-3104-issue-@yaoge123.cn}{git+nju-lug-email-3104-issue-@yaoge123.cn}}} % -% \date{v0.14.0 \quad 2022-01-16} +% \date{v0.15.0 \quad 2022-02-20} % % \changes{v0.1}{2021/09/04}{开始开发。} % \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。} @@ -265,7 +266,7 @@ To produce the documentation run the original source files ending with % \hspace{2em}\begin{minipage}[c]{10cm} % \begin{enumerate} % \item 访问 \url{https://tex.nju.edu.cn} -% \item 点击右上角~\olbutton{注册}~按钮,用南大邮箱注册账号 +% \item 点击右上角~\olbutton{注册}~按钮,用\href{https://itsc.nju.edu.cn/1b/ce/c21586a334798/page.htm}{南大邮箱}注册账号 % \item 登录您的账号 % \item 点击左上角~\olbutton{创建新项目}~按钮,选择~\olbutton{论文模板} % \item 随意取名,点击~\olbutton{创建}~按钮 @@ -382,11 +383,27 @@ To produce the documentation run the original source files ending with % % \cls{njuthesis} 目前处于积极的维护中,主要可通过以下三种途径获取模板文件: % -% \subparagraph{CTAN} \href{https://ctan.org/}{CTAN}\footnote{The Comprehensive \hologo{TeX} Archive Network} 是所有 \hologo{TeX} 相关材料的中枢。\href{https://ctan.org/pkg/njuthesis}{本模板的 CTAN 页面}\footnote{\cls{njuthesis} 已经于2021年9月12日发布在 CTAN,用于绘制南大图标的 \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发布,两者已被 \hologo{TeX}\,Live 和 \hologo{MiKTeX} 收录,将进入 \hologo{TeX}\,Live 2022 发行版。}上提供基本的介绍信息,可以下载说明文档(本文档)和宏包源代码。当然,使用这一来源时并不需要接触后者,请参考 \ref{subsubsec:standard-installation} 的标准安装方法。 -% -% \subparagraph{GitHub 仓库} 最新开发进度会提交在本项目的 \href{https://github.com/nju-lug/NJUThesis}{Github仓库}。仓库内仅包含源代码、空白模板及测试文件,不可直接用于写作。这些文件对应的使用方法请参考 \ref{subsubsec:on-the-fly-installation}。如果由于网络原因不便访问主仓库,也可以从\href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis}{NJU Git 同步镜像} 获取项目工程文件。 -% -% \subparagraph{GitHub Releases} 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,赋以更改后的版本号,发布在 \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github Releases 页面}。如果由于网络原因不便访问主仓库,也可以从\href{https://mirror.nju.edu.cn/github-release/nju-lug/NJUThesis/LatestRelease/}{南京大学镜像站下载页面}获取。可供下载的文件包括下列三种: +% \subparagraph{CTAN} +% \href{https://ctan.org/}{CTAN}\footnote{The Comprehensive \hologo{TeX} +% Archive Network} 是所有 \hologo{TeX} 相关材料的中枢。 +% 本模板的 CTAN 页面 +% \footnote{\href{https://ctan.org/pkg/njuthesis}{\cls{njuthesis}} 已经于2021年9 +% 月12日发布在 CTAN,用于绘制南大图标的 +% \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发 +% 布,两者已被 \hologo{TeX}\,Live 和 \hologo{MiKTeX} 收录,将进入 \hologo{TeX}\, +% Live 2022 发行版。}上提供基本的介绍信息,可以下载说明文档(本文档)和宏包源代 +% 码。当然,使用这一来源时并不需要接触后者,请参考 +% \ref{subsubsec:standard-installation} 的标准安装方法。 +% +% \subparagraph{GitHub 仓库} +% 最新开发进度会提交在本项目的 +% \href{https://github.com/nju-lug/NJUThesis}{Github仓库}。仓库内仅包含源代码、 +% 空白模板及测试文件,不可直接用于写作。这些文件对应的使用方法请参考 +% \ref{subsubsec:on-the-fly-installation}。如果由于网络原因不便访问主仓库,也可 +% 以从\href{https://git.nju.edu.cn/nju-lug/nju-latex-templates/njuthesis}{NJU Git 同步镜像} 获取项目工程文件。 +% +% \subparagraph{GitHub Releases} +% 本模板不定期将已有的新功能和问题修复打包为新的正式发行版,赋以更改后的版本号,发布在 \href{https://github.com/nju-lug/NJUThesis/releases/latest}{Github Releases 页面}。如果由于网络原因不便访问主仓库,也可以从\href{https://mirror.nju.edu.cn/github-release/nju-lug/NJUThesis/LatestRelease/}{南京大学镜像站下载页面}获取。可供下载的文件包括下列三种: % \begin{description} % \item[\file{njuthesis-v*.pdf}] 模板说明文档(本文档)。 % \item[\file{njuthesis-user-v*.zip}] 交付给用户的完整模板包,包括格式文件和范本文档,可在解压后用于本地编译,也可直接上传至在线编译网站。 @@ -506,9 +523,9 @@ To produce the documentation run the original source files ending with % % % \subsubsection{配置编辑器} -% \changes{v0.11}{2021/11/23}{提供TeXstudio配置文件。} +% \changes{v0.11}{2021/11/23}{提供 TeXstudio 配置文件。} % -% 配置完编译器后,还需要一个\emph{文本编辑器}来完成\file{.tex}文件内容的写作。 +% 配置完编译器后,还需要一个\emph{文本编辑器}来完成 \file{.tex} 文件内容的写作。 % % 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是最好的 % 文本编辑器。但对于本项目而言,在此诚心诚意地推荐您使用\emph{更现代更美观更多功 @@ -516,7 +533,7 @@ To produce the documentation run the original source files ending with % % \cls{njuthesis} 为一些常见编辑器提供了配置文件,如 % \begin{description} -% \item[Visual Studio Code] 本模板在\file{.vscode/}中提供一份\hologo{LaTeX} Workshop 插件的简易配置,在打开文件夹后将自动导入,可以省略初始配置步骤直接使用。 +% \item[Visual Studio Code] 本模板在 \file{.vscode/} 中提供一份 \hologo{LaTeX} Workshop 插件的简易配置,在打开文件夹后将自动导入,可以省略初始配置步骤直接使用。 % \item[TeXstudio] 本模板提供 \file{conf.txsprofile},可以使用快捷键 |alt+O+P| 导入配置文件。为了简化流程\footnote{当然,也可以设置为使用 \hologo{XeLaTeX} 编译,然后按照 \ref{subsubsec:compileseq} 内容使用快捷键 |F8| 手动编译参考文献。},该配置文件使用 \pkg{latexmk},第一次编译前请参考下一节内容安装 Perl。 % \end{description} % @@ -570,7 +587,7 @@ To produce the documentation run the original source files ending with % \pkg{latexmk}\cite{latexmk} 是一个基于 Perl 脚本的自动编译工具,宗旨是通过单一命令简化上述的多次编译流程。在使用该命令前,请确保安装了以下软件: % \begin{description} % \item[Perl] 一般预装于 macOS 和 Linux,而 Windows 用户需要单独安装 \href{https://strawberryperl.com/}{Strawberry Perl}。 -% \item[\pkg{latexmk}] \hologo{MiKTeX}已预装;如果终端找不到|latexmk|命令,\hologo{TeX}\,Live 用户需使用 \pkg{tlmgr} 单独安装。 +% \item[\pkg{latexmk}] \hologo{MiKTeX} 已预装;如果终端找不到 |latexmk| 命令,\hologo{TeX}\,Live 用户需使用 \pkg{tlmgr} 单独安装。 % \end{description} % % 该命令的使用方法为 @@ -591,7 +608,7 @@ To produce the documentation run the original source files ending with % \subsection{在线编译} % \label{subsec:onlinecompile} % -% 相信您在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长\footnote{因此对于 Windows 推荐 \hologo{MiKTeX}。},占用空间过大\footnote{事实上,可以通过 |scheme-infraonly| 模式安装 \hologo{TeX}\,Live,随后利用 \pkg{tlmgr} 安装依赖宏包,这份宏包列表可以在 Git 仓库的 \file{.github/workflows/build.yml} 找到。},而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{出于文件 IO 速度的差异,同一个模板在 Linux 编译可以相对 Windows 节省约一半耗时。}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。 +% 相信您在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如 \hologo{TeX} 编译器安装过程较为漫长\footnote{因此对于 Windows 推荐 \hologo{MiKTeX}。},占用空间过大\footnote{事实上,可以通过 |scheme-infraonly| 模式安装 \hologo{TeX}\,Live,随后利用 \pkg{tlmgr} 安装依赖宏包,这份宏包列表可以在 Git 仓库的 \file{.github/workflows/build.yml} 找到。},而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{出于文件 IO 速度的差异,同一个模板在 Linux 编译可以相对 Windows 节省约一半耗时。}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。 % % \subsubsection{南大\hologo{TeX}平台简介} % \changes{v0.2}{2021/09/07}{添加对南大 \hologo{TeX} 的支持。} @@ -624,7 +641,7 @@ To produce the documentation run the original source files ending with % % \subsection{版本升级} % -% 考虑到本模板仍在开发中,将不断发布新版本,您可能需要不定期进行更新以得到对于已知问题的修复补丁。考虑到安装和编译方式的差异,不妨直接将论文内容迁移至新版的 \file{njuthesis-sample.tex}\footnote{请赞美 \hologo{TeX} 系统“样式与内容分离”的原则!},然后按照当前工作文件夹内是否有 \file{.cls} 文件分别进行更新操作。 +% 考虑到本模板仍在开发中,将不断发布新版本,您可能需要不定期进行更新以得到对于已知问题的修复补丁。每个版本的更新内容记录于 Git 仓库中的 \file{CHANGELOG.md}。考虑到安装和编译方式的差异,不妨直接将论文内容迁移至新版的 \file{njuthesis-sample.tex}\footnote{请赞美 \hologo{TeX} 系统“样式与内容分离”的原则!},然后按照当前工作文件夹内是否有 \file{.cls} 文件分别进行更新操作。 % % \subparagraph{有} % 迁移至 \file{njuthesis-user-v*.zip} 提供的新内容。 @@ -689,7 +706,7 @@ To produce the documentation run the original source files ending with % 是否使用国家图书馆封面,默认关闭。 % \end{function} % -% 通过此项可用国家图书馆封面替换普通封面。 +% 通过此项可用国家图书馆封面\emph{替换}普通封面。 % 由于本科生院文件中并未提及相关规定,故本选项仅对于研究生有效。 % % \begin{function}[updated=2022-01-06]{decl-page} @@ -733,7 +750,7 @@ To produce the documentation run the original source files ending with % \end{itemize} % 草稿模式有助于提升编译速度以及检查格式问题,建议在定稿前始终开启。 % -% 启用这一选项也会改变特定宏包的行为,譬如在草稿模式下 \pkg{listings} 宏包的代码环境不会显示内容,具体效果需要参照各个宏包的说明文档。如需抵消草稿模式的影响,请使用 \opt{final} 选项载入相关红包。 +% 启用这一选项也会改变特定宏包的行为,譬如在草稿模式下 \pkg{listings} 宏包的代码环境不会显示内容,具体效果需要参照各个宏包的说明文档。如需抵消草稿模式的影响,请使用 \opt{final} 选项载入相关宏包。 % % % \subsubsection{指定字体} @@ -1308,9 +1325,10 @@ To produce the documentation run the original source files ending with % % \begin{function}[added=2021-12-19]{bib/style} % \begin{syntax} -% style = <(numeric)|author-year> +% style = <(numeric)|author-year|\meta{自定义样式}> % \end{syntax} -% 参考文献样式。分为顺序编码制 \opt{numeric} 和著者-出版年制 \opt{author-year},默认为顺序编码制。 +% 参考文献样式。可选顺序编码制 \opt{numeric} 和著者-出版年制 \opt{author-year}, +% 或自行填入任意其他 \pkg{biblatex} 样式。默认为顺序编码制。 % \end{function} % % 参考文献样式是一个整体的设置,会对正文中引用的文献的标注方法和参考文献表的输出格式产生影响。根据国家规定\cite{gb-t-7714-2015},可以按照参考文献表的组织方式分为以下两种样式: @@ -1321,6 +1339,16 @@ To produce the documentation run the original source files ending with % % 对于本科生而言,学校规定文件表明参考文献表应当“用数字加方括号表示”\cite{nju2021},符合顺序编码制的格式,保持默认设置即可。 % +% \begin{function}[added=2022-02-15]{bib/option} +% \begin{syntax} +% option = \meta{选项列表} +% \end{syntax} +% 待传入 \pkg{biblatex} 宏包的额外选项列表。 +% \end{function} +% +% 本模板中 \pkg{biblatex} 并不是显式载入的。 +% 如需在其基础上进行一些定制,可使用本设置项载入宏包选项\cite{biblatex}。 +% % \begin{function}[added=2021-12-19]{bib/resource} % \begin{syntax} % resource = \Arg{文件} @@ -1335,24 +1363,40 @@ To produce the documentation run the original source files ending with % 添加参考文献源文件。为了与 \pkg{biblatex} 进行兼容,也可使用本命令添加数据源。本命令不支持逗号分隔多个文件的形式,如果希望额外添加参考文献列表,需要在导言区中多次调用。 % \end{function} % -% 示例参考文献存储于 \file{njuthesis-sample.bib},直接向其中粘贴新的参考文献即可。 -% % 可以参考如下范例进行参考文献设置。 +% 其中 \opt{bib/option} 的内容旨在关闭部分不需显示的文献信息,可根据需要使用。 % \begin{latexexample}[moretexcs={\njusetup},emph={[2]bib}] % \njusetup { % bib = { -% style = author-year, -% resource = {njuthesis-sample.bib} +% style = author-year, +% resource = {njuthesis-sample.bib}, +% option = { +% doi = false, +% isbn = false, +% url = false, +% eprint = false +% } % } % } % \end{latexexample} % +% +% \subsubsection{参考文献表} +% % \begin{function}{\printbibliography} -% 生成参考文献表页面。 +% 生成参考文献表。 % \end{function} % % 显然只有被引用过的条目才会被输出至参考文献表。 % +% 假如需要在每章末尾附上单独的参考文献表,导言区添加以下设置, +% 并在每章后使用 \cs{printbibliography} 即可。 +% \begin{latexexample}[moretexcs={\njusetup},emph={[2]bib}] +% \njusetup { +% bib = { option = { refsection = chapter } } +% } +% \end{latexexample} +% % 如果开启了草稿模式,您可能会注意到部分条目存在超宽的问题,这时就要果断假装没有看到。 % 该问题的产生是由于 \hologo{LaTeX} 中只有固定的字母组合中间可以断行。使条目右侧平齐的方法有如下两种 % \footnote{详见 \url{https://github.com/nju-lug/NJUThesis/issues/57}。很不幸,\pkg{microtype} 与 \pkg{babel} 没能在我们的模板中解决问题。}: @@ -1442,9 +1486,9 @@ To produce the documentation run the original source files ending with % \end{function} % % 本科生模板仅会生成中文封面;研究生模板会生成中英文封面。 -% 如果选择了 \opt{nlcover},仅会生成研究生的国家图书馆封面。 -% 如果选择了 \opt{decl-page},会在封面后生成本科生的诚信承诺书或研究生的原创性声明。 -% 在启用草稿模式后封面绘制将被禁用。 +% 如果选择了 \opt{nlcover},\emph{仅仅}会生成研究生的国家图书馆封面。 +% 如果选择了 \opt{decl-page},会在封面后生成本科生的诚信承诺书或研究生的 +% 原创性声明。在启用草稿模式后封面绘制将被禁用。 % % \paragraph{封面图片} % @@ -1462,7 +1506,9 @@ To produce the documentation run the original source files ending with % 校名图片文件。 % \end{function} % -% 通过以上两个选项可以使用外置的校徽和校名图片。本模板封面中校徽及校名的绘制默认依赖 \pkg{njuvisual} 宏包提供的 \pkg{tikz} 矢量曲线,耗时较长,在替换为外置图片后可节省约1秒的编译时长。 +% 通过以上两个选项可以使用外置的校徽和校名图片。本模板封面中校徽及校名的绘制 +% 默认依赖 \pkg{njuvisual} 宏包提供的 \pkg{tikz} 矢量曲线,耗时较长, +% 在替换为外置图片后可节省约1秒的编译时长。 % % % \subsubsection{摘要页} @@ -1482,6 +1528,14 @@ To produce the documentation run the original source files ending with % \end{abstract*} % \end{latexexample} % +% \begin{function}[added=2022-02-04]{style/abstract-in-toc} +% \begin{syntax} +% abstract-in-toc = <\TTF> +% \end{syntax} +% 是否将摘要条目插入目录,默认开启。 +% 关闭此选项后摘要页将不会出现在目录中,仅保留其 PDF 书签。 +% \end{function} +% % % \subsubsection{前言页} % @@ -1515,7 +1569,29 @@ To produce the documentation run the original source files ending with % listtablename = { 表格清单 } % } % \end{latexexample} -% 实际上,根据《学位论文编写规则》国家标准\cite{gb-t-7713.1-2006},尽管“目录”这一说法已流传甚广,但学位论文中理应使用“目次”这一名称来指代篇目的列表。 +% 实际上,根据《学位论文编写规则》国家标准\cite{gb-t-7713.1-2006}, +% 尽管“目录”这一说法已流传甚广,但学位论文中理应使用“目次”这一名称 +% 来指代篇目的列表。 +% +% \begin{function}[added=2022-02-04]{style/toc-in-toc} +% \begin{syntax} +% toc-in-toc = <\TTF> +% \end{syntax} +% 是否在目录中显示目录自身的条目,默认开启。关闭此选项后目录、 +% 插图目录和表格目录将不会出现在目录中,仅保留其 PDF 书签。 +% \end{function} +% +% +% \subsubsection{符号表} +% +% \begin{function}{notation,notation*} +% \begin{syntax} +% \tn{begin}\{notation\}\oarg{说明宽度}\oarg{符号宽度} +% \quad\tn{item}\oarg{符号} \meta{说明} +% \tn{end}\{notation\} +% \end{syntax} +% 符号表。带有星号的符号表环境不会插入目录。 +% \end{function} % % % \subsubsection{致谢页} @@ -1573,10 +1649,10 @@ To produce the documentation run the original source files ending with % % 视觉识别系统 \pkg{njuvisual} 现已被分离为独立宏包\cite{njuvisual},基本使用方法举例如下: % \begin{latexexample}[moretexcs={\njuemblem,\njuname,\njuname*}] -% \njuemblem{!}{3cm} % 生成指定大小的紫色南大校徽 -% \njuname{4cm}{!} % 生成指定大小的紫色南大中文校名 -% \njuname*{4cm}{!} % 生成指定大小的紫色南大英文校名 -% \njuemblem[black]{!}{3cm} % 黑色的南大校徽 +% \njuemblem{!}{3cm} % 生成高 3cm 的紫色校徽 +% \njuname{4cm}{!} % 生成宽 4cm 的紫色中文校名 +% \njuname*{4cm}{!} % 生成宽 4cm 的紫色英文校名 +% \njuemblem[black]{!}{3cm} % 黑色的校徽 % \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标 % \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标 % \end{latexexample} @@ -1651,6 +1727,14 @@ To produce the documentation run the original source files ending with % % \subsection*{宏包} % +% \bibitem{biblatex} +% \textsc{Lehman P}, \textsc{Wright J}, \textsc{Boruvka A}, \textsc{Kime P}. +% \newblock \textit{Sophisticated Bibliographies in \hologo{LaTeX}} [EB/OL]. +% \newblock version 3.17, +% \newblock (2022-02-02) +% \urlprefix\url{https://ctan.org/pkg/biblatex} +% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf} +% % \bibitem{biblatex-gb7714-2015} % 胡振震. % \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL]. @@ -1794,9 +1878,9 @@ To produce the documentation run the original source files ending with % “|*|”和“|/|”的 guard 出现在行号右侧,它们用来确定 % 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。 % -% 另有若干包含 \textsf{\color{at@guard}@@} 的 guard,用以表示名空间(模块)。 +% 另有若干包含 \grd{@@} 的 guard,用以表示名空间(模块)。 % 在删除注释生成格式文件时,源代码变量名称中的 |@@| 会被等号后的字段替换, -% 譬如在本模板中 \textsf{\color{at@guard}〈@@=nju〉}。 +% 譬如在本模板中 \grd{〈@@=nju〉}。 % % % \subsection{准备} @@ -1834,7 +1918,7 @@ To produce the documentation run the original source files ending with The~ njuthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\ "#1"~ is~ not~ supported~ at~ present.~ - You~ must~ change your~ typesetting~ engine~ + You~ must~ change~ your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". } \sys_if_engine_xetex:F @@ -1989,6 +2073,19 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_vskip:N} +% 类似于 \hologo{LaTeX2e} 中的 \tn{vspace*},从上一个页面元素底部开始生成 |skip|。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_vskip:N #1 + { + \hrule height \c_zero_dim + \nobreak + \skip_vertical:n { - \baselineskip - \lineskip } + \skip_vertical:N #1 + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_define_name:nn,\@@_define_name:nnn} % 用来定义默认名称的辅助函数。 % \begin{macrocode} @@ -2151,7 +2248,7 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_uline_entry:nnnn} +% \begin{macro}{\@@_uline_entry:Nnnn} % 生成占整页宽度的下划线条目。 % \begin{arguments} % \item 宽度,|dim| 型变量 @@ -2160,7 +2257,7 @@ To produce the documentation run the original source files ending with % \item 分隔符 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_uline_entry:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_uline_entry:Nnnn #1#2#3#4 { \@@_full_uline:NV #1 { \@@_name:n { #2 } #4 } \@@_ulined_center_box:nn { #1 } { \@@_info:n { #3 } } @@ -2168,7 +2265,7 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_uline_bientry:nnnn} +% \begin{macro}{\@@_uline_bientry:Nnnn} % 生成占半页宽度的下划线条目。 % \begin{arguments} % \item 宽度,|dim| 型变量 @@ -2177,7 +2274,7 @@ To produce the documentation run the original source files ending with % \item 分隔符 % \end{arguments} % \begin{macrocode} -\cs_new_protected:Npn \@@_uline_bientry:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_uline_bientry:Nnnn #1#2#3#4 { \@@_full_uline:NV #1 { \@@_name:n { #2 } #4 } \dim_sub:Nn #1 { \textwidth / 2 } @@ -2338,6 +2435,7 @@ To produce the documentation run the original source files ending with { { acknowledgement } { 致\hspace{2em}谢 }, { id } { 学号 }, + { notation } { 符号表 }, { orig_date } { 日期 }, { paperlist } { 发表文章目录 }, { pdf_creator } { LaTeX~ with~ njuthesis~ class }, @@ -2420,8 +2518,8 @@ To produce the documentation run the original source files ending with { confer } { 学位授予单位和日期 }, { df_date } { 论文答辩日期 }, { degree } { 申请学位级别 }, - { degree_l } { (申请 }, - { degree_r } { 学位) }, + { apply } + { (申请 \l_@@_info_degree_tl 学位) }, { field } { 研究方向 }, { g } { 研究生 }, { grade } { 级 }, @@ -2503,133 +2601,6 @@ To produce the documentation run the original source files ending with % \end{macrocode} % % -% \subsection{个人信息} -% \changes{v0.11}{2021/10/01}{将个人信息变量名改为小写字母加连字符的形式。} -% -% \begin{macrocode} -\keys_define:nn { nju / info } - { -% \end{macrocode} -% -% \begin{macro}{info/title,info/title*} -% \changes{v0.13}{2021/12/12}{简化多行标题的输入方式。} -% \changes{v0.14}{2022/01/14}{将标题断行控制符修改为 |\\|。} -% 题目。中文题目可使用 |\\| 手动断行。以下标注星号(|*|)的皆为对应的英文字段。 -% \begin{macrocode} - title .tl_set:N = \l_@@_info_title_tl, - title .initial:n = { 空 }, - title* .tl_set:N = \l_@@_info_title_en_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/keywords,info/keywords*} -% \changes{v0.11}{2021/10/01}{修改了添加关键词的方式。} -% 关键词列表。 -% \begin{macrocode} - keywords .clist_set:N = \l_@@_info_keywords_clist, - keywords* .clist_set:N = \l_@@_info_keywords_en_clist, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/grade,info/student-id,info/author,info/author*} -% 年级、学号、姓名。 -% \begin{macrocode} - grade .tl_set:N = \l_@@_info_grade_tl, - student-id .tl_set:N = \l_@@_info_id_tl, - author .tl_set:N = \l_@@_info_author_tl, - author* .tl_set:N = \l_@@_info_author_en_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/department,info/department*,info/major,info/major*,info/field,info/field*} -% 院系、专业、方向。 -% \begin{macrocode} - department .tl_set:N = \l_@@_info_dept_tl, - department* .tl_set:N = \l_@@_info_dept_en_tl, - major .tl_set:N = \l_@@_info_major_tl, - major* .tl_set:N = \l_@@_info_major_en_tl, - field .tl_set:N = \l_@@_info_field_tl, - field* .tl_set:N = \l_@@_info_field_en_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/supervisor,info/supervisor*} -% \changes{v0.13}{2021/12/11}{修改了导师选项的变量名称。} -% \changes{v0.14}{2022/01/12}{精简导师信息选项。} -% 导师信息。中文导师全称使用 |clist| 存储,便于在本科生封面中进行分割。 -% \begin{macrocode} - supervisor .clist_set:N = \l_@@_info_supv_clist, - supervisor* .tl_set:N = \l_@@_info_supv_en_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/supervisor-ii,info/supervisor-ii*} -% 第二导师信息。 -% \begin{macrocode} - supervisor-ii .clist_set:N = \l_@@_info_supv_ii_clist, - supervisor-ii* .tl_set:N = \l_@@_info_supv_ii_en_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/submit-date} -% \changes{v0.14}{2022/01/14}{精简提交日期选项。} -% 提交日期,初始值为编译当天日期。 -% \begin{macrocode} - submit-date .tl_set:N = \l_@@_info_sm_date_raw_tl, - submit-date .initial:V = \c_@@_today_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/defend-date} -% \changes{v0.14}{2022/01/14}{精简答辩日期选项。} -% 答辩日期。 -% \begin{macrocode} - defend-date .tl_set:N = \l_@@_info_df_date_raw_tl, - defend-date .initial:V = \c_@@_today_tl, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/defend-date,info/chairman,info/reviewer} -% 答辩委员会信息。 -% \begin{macrocode} - chairman .tl_set:N = \l_@@_info_chairman_tl, - reviewer .clist_set:N = \l_@@_info_reviewer_clist, -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{info/clc,info/secret-level,info/udc,info/supervisor-contact} -% 国家图书馆封面相关信息。 -% \begin{macrocode} - clc .tl_set:N = \l_@@_info_clc_tl, - secret-level .tl_set:N = \l_@@_info_seclv_tl, - udc .tl_set:N = \l_@@_info_udc_tl, - supervisor-contact .tl_set:N = \l_@@_info_supv_cont_tl, - } -% \end{macrocode} -% \end{macro} -% -% 拼合双导师的姓名和职称。 -% \begin{macrocode} -\bool_set:Nn \l_@@_second_supv_bool - { ! \clist_if_empty_p:N \l_@@_info_supv_ii_clist } -\tl_set:Nn \l_@@_info_supv_full_tl - { - \clist_use:Nn \l_@@_info_supv_clist { \@@_hskip: } - \bool_if:NT \l_@@_second_supv_bool - { - \@@_quad: - \clist_use:Nn \l_@@_info_supv_ii_clist { \@@_hskip: } - } - } -\tl_set:Nn \l_@@_info_supv_full_en_tl - { - \l_@@_info_supv_en_tl - \bool_if:NT \l_@@_second_supv_bool - { \@@_quad: \l_@@_info_supv_ii_en_tl } - } -% \end{macrocode} -% -% % \subsection{载入宏包} % % \changes{v0.12}{2021/12/07}{重新组织宏包载入顺序。} @@ -2687,6 +2658,7 @@ To produce the documentation run the original source files ending with % \end{macrocode} % % \changes{v0.14}{2021/12/21}{移除内置的 \pkg{hologo}。} +% \changes{v0.15}{2022/01/17}{移除内置的 \pkg{url}。} % 载入各种宏包。 % \begin{macrocode} \RequirePackage @@ -2720,10 +2692,6 @@ To produce the documentation run the original source files ending with % \begin{macrocode} enumitem, % \end{macrocode} -% \pkg{url} 用于生成链接文本。 -% \begin{macrocode} - url, -% \end{macrocode} % 按以下顺序加载两个关于引用的包。 % \pkg{hyperref} 覆写了大量命令,因此需要在其他包最后载入。 % 仅有 \pkg{cleveref} 需要在 \pkg{hyperref} 后载入,否则会报错。 @@ -2784,102 +2752,269 @@ To produce the documentation run the original source files ending with % \end{macrocode} % % -% \subsection{字体设置} -% -% \pkg{fontspec} 已在 C\hologo{TeX} 套件中包含,无需另行载入。 -% -% \subsubsection{操作系统检测} +% \subsection{个人信息} +% \changes{v0.11}{2021/10/01}{将个人信息变量名改为小写字母加连字符的形式。} +% \changes{v0.15}{2022/01/22}{将个人信息设置移到载入宏包后。} % -% 判断用户是否自定义了中英文字体。如果其中任意一种未被定义, -% 则使用系统预装字体覆盖字体选项。 % \begin{macrocode} -\tl_if_empty:NTF \g_@@_latin_font_tl - { \bool_gset_true:N \g_@@_load_sys_font_bool } +\keys_define:nn { nju / info } { - \tl_if_empty:NT \g_@@_cjk_font_tl - { \bool_gset_true:N \g_@@_load_sys_font_bool } - } % \end{macrocode} % -% 进行系统检测。 -% 检测 Windows 的命令由\pkg{l3kernal}提供, -% 检测 macOS 的命令由\pkg{ctex}提供, -% 这两种情况外的系统被判断为 Linux,一律使用自由字体。 +% \begin{macro}{info/title,info/title*} +% \changes{v0.13}{2021/12/12}{简化多行标题的输入方式。} +% \changes{v0.14}{2022/01/14}{将标题断行控制符修改为 |\\|。} +% 题目。中文题目可使用 |\\| 手动断行。以下标注星号(|*|)的皆为对应的英文字段。 % \begin{macrocode} -\bool_if:NT \g_@@_load_sys_font_bool - { - \sys_if_platform_windows:TF - { \tl_set:Nn \g_@@_latin_font_tl { win } - \tl_set:Nn \g_@@_cjk_font_tl { win } } - { \ctex_if_platform_macos:TF - { \tl_set:Nn \g_@@_latin_font_tl { mac } - \tl_set:Nn \g_@@_cjk_font_tl { mac } } - { \tl_set:Nn \g_@@_latin_font_tl { gyre } - \tl_set:Nn \g_@@_cjk_font_tl { fandol } } } - } + title .tl_set:N = \l_@@_info_title_tl, + title .initial:n = { 空 }, + title* .tl_set:N = \l_@@_info_title_en_tl, % \end{macrocode} +% \end{macro} % -% -% \subsubsection{定义英文字库} -% -% 接下来逐个定义所需要使用的字库。 -% -% \begin{macro}{\@@_load_latin_font_win:} -% Windows 西文字体 +% \begin{macro}{info/keywords,info/keywords*} +% \changes{v0.11}{2021/10/01}{修改了添加关键词的方式。} +% 关键词列表。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_latin_font_win: - { - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Courier~New}[Scale=MatchLowercase] - } + keywords .clist_set:N = \l_@@_info_keywords_clist, + keywords* .clist_set:N = \l_@@_info_keywords_en_clist, % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_load_latin_font_mac:} -% macOS 西文字体。 +% \begin{macro}{info/grade,info/student-id,info/author,info/author*} +% 年级、学号、姓名。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_latin_font_mac: - { - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Menlo}[Scale=MatchLowercase] - } + grade .tl_set:N = \l_@@_info_grade_tl, + student-id .tl_set:N = \l_@@_info_id_tl, + author .tl_set:N = \l_@@_info_author_tl, + author* .tl_set:N = \l_@@_info_author_en_tl, % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_load_latin_font_gyre:} -% 开源的 gyre 西文字体。 +% \begin{macro}{info/department,info/department*,info/major,info/major*,info/field,info/field*} +% 院系、专业、方向。 % \begin{macrocode} -\cs_new_protected:Npn \@@_load_latin_font_gyre: - { - \setmainfont{texgyretermes}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setsansfont{texgyreheros}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setmonofont{texgyrecursor}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic, - Scale=MatchLowercase, - Ligatures=CommonOff] - } + department .tl_set:N = \l_@@_info_dept_tl, + department* .tl_set:N = \l_@@_info_dept_en_tl, + major .tl_set:N = \l_@@_info_major_tl, + major* .tl_set:N = \l_@@_info_major_en_tl, + field .tl_set:N = \l_@@_info_field_tl, + field* .tl_set:N = \l_@@_info_field_en_tl, % \end{macrocode} % \end{macro} % +% \begin{macro}{info/supervisor,info/supervisor*} +% \changes{v0.13}{2021/12/11}{修改了导师选项的变量名称。} +% \changes{v0.14}{2022/01/12}{精简导师信息选项。} +% 导师信息。中文导师全称使用 |clist| 存储,便于在本科生封面中进行分割。 +% \begin{macrocode} + supervisor .clist_set:N = \l_@@_info_supv_clist, + supervisor* .tl_set:N = \l_@@_info_supv_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/supervisor-ii,info/supervisor-ii*} +% 第二导师信息。 +% \begin{macrocode} + supervisor-ii .clist_set:N = \l_@@_info_supv_ii_clist, + supervisor-ii* .tl_set:N = \l_@@_info_supv_ii_en_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/submit-date} +% \changes{v0.14}{2022/01/14}{精简提交日期选项。} +% 提交日期,初始值为编译当天日期。 +% \begin{macrocode} + submit-date .tl_set:N = \l_@@_info_sm_date_raw_tl, + submit-date .initial:V = \c_@@_today_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/defend-date} +% \changes{v0.14}{2022/01/14}{精简答辩日期选项。} +% 答辩日期。 +% \begin{macrocode} + defend-date .tl_set:N = \l_@@_info_df_date_raw_tl, + defend-date .initial:V = \c_@@_today_tl, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/defend-date,info/chairman,info/reviewer} +% 答辩委员会信息。 +% \begin{macrocode} + chairman .tl_set:N = \l_@@_info_chairman_tl, + reviewer .clist_set:N = \l_@@_info_reviewer_clist, +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{info/clc,info/secret-level,info/udc,info/supervisor-contact} +% 国家图书馆封面相关信息。 +% \begin{macrocode} + clc .tl_set:N = \l_@@_info_clc_tl, + secret-level .tl_set:N = \l_@@_info_seclv_tl, + udc .tl_set:N = \l_@@_info_udc_tl, + supervisor-contact .tl_set:N = \l_@@_info_supv_cont_tl, + } +% \end{macrocode} +% \end{macro} +% +% \changes{v0.15}{2022/01/22}{正确处理双导师信息。} +% 在导言区录入用户信息后进行变量设置。此处使用到了 \pkg{ctex} 提供的命令,应当位于载入文档类之后。 +% \begin{macrocode} +\ctex_at_end_preamble:n + { +% \end{macrocode} +% 拼合双导师的姓名和职称。 +% \begin{macrocode} + \bool_set:Nn \l_@@_second_supv_bool + { ! \clist_if_empty_p:N \l_@@_info_supv_ii_clist } + \tl_set:Nx \l_@@_info_supv_full_tl + { + \clist_use:Nn \l_@@_info_supv_clist { \@@_hskip: } + \bool_if:NT \l_@@_second_supv_bool + { + \@@_quad: + \clist_use:Nn \l_@@_info_supv_ii_clist { \@@_hskip: } + } + } + \tl_set:Nx \l_@@_info_supv_full_en_tl + { + \l_@@_info_supv_en_tl + \bool_if:NT \l_@@_second_supv_bool + { \@@_quad: \l_@@_info_supv_ii_en_tl } + } +% \end{macrocode} +% 将 ISO 格式的原始日期字符串格式化为中文日期表示,该字符串需要进行展开。 +% \begin{macrocode} + \tl_set:Nn \l_@@_info_sm_date_tl + { + \exp_last_unbraced:NV + \@@_date:www \l_@@_info_sm_date_raw_tl \q_stop + } +% \end{macrocode} +% 英文提交日期以及答辩日期仅用于研究生封面。 +% \begin{macrocode} + \int_compare:nF { \l_@@_info_degree_int == 1 } + { + \tl_set:Nn \l_@@_info_sm_date_en_tl + { + \exp_last_unbraced:NV + \@@_date_en:www \l_@@_info_sm_date_raw_tl \q_stop + } + \tl_set:Nn \l_@@_info_df_date_tl + { + \exp_last_unbraced:NV + \@@_date:www \l_@@_info_df_date_raw_tl \q_stop + } + } + } +% \end{macrocode} +% +% +% \subsection{字体设置} +% +% \pkg{fontspec} 包含于 \pkg{ctex} 宏集,无需另行载入。 +% +% \subsubsection{操作系统检测} +% +% 判断用户是否自定义了中英文字体。如果其中任意一种未被定义, +% 则使用系统预装字体覆盖字体选项。 +% \begin{macrocode} +\tl_if_empty:NTF \g_@@_latin_font_tl + { \bool_gset_true:N \g_@@_load_sys_font_bool } + { + \tl_if_empty:NT \g_@@_cjk_font_tl + { \bool_gset_true:N \g_@@_load_sys_font_bool } + } +% \end{macrocode} +% +% 进行系统检测。 +% 检测 Windows 的命令由 \pkg{l3kernel} 提供, +% 检测 macOS 的命令由 \pkg{ctex} 提供, +% 这两种情况外的系统被判断为 Linux,一律使用自由字体。 +% \begin{macrocode} +\bool_if:NT \g_@@_load_sys_font_bool + { + \sys_if_platform_windows:TF + { \tl_set:Nn \g_@@_latin_font_tl { win } + \tl_set:Nn \g_@@_cjk_font_tl { win } } + { \ctex_if_platform_macos:TF + { \tl_set:Nn \g_@@_latin_font_tl { mac } + \tl_set:Nn \g_@@_cjk_font_tl { mac } } + { \tl_set:Nn \g_@@_latin_font_tl { gyre } + \tl_set:Nn \g_@@_cjk_font_tl { fandol } } } + } +% \end{macrocode} +% +% +% \subsubsection{定义英文字库} +% +% 接下来逐个定义所需要使用的字库。 +% +% \begin{macro}{\@@_load_latin_font_win:} +% Windows 西文字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_win: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Courier~New}[Scale=MatchLowercase] + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_latin_font_mac:} +% macOS 西文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_mac: + { + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Menlo}[Scale=MatchLowercase] + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_latin_font_gyre:} +% 开源的 gyre 西文字体。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_gyre: + { + \setmainfont{texgyretermes}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setsansfont{texgyreheros}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] + \setmonofont{texgyrecursor}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic, + Scale=MatchLowercase, + Ligatures=CommonOff] + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{定义中文字库} +% +% \begin{macro}{\@@_diable_no_script_msg:} +% 移除 |does not contain script "CJK"| 警告。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_diable_no_script_msg: + { \msg_redirect_name:nnn { fontspec } { no-script } { info } } +% \end{macrocode} +% \end{macro} % -% \subsubsection{定义中文字库} -% % \begin{macro}{\@@_load_cjk_font_win:} % Windows 中文字体。 % \begin{macrocode} @@ -2904,10 +3039,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_mac: { -% \end{macrocode} -% 移除 does not contain script "CJK" 警告。 -% \begin{macrocode} - \msg_redirect_name:nnn { fontspec } { no-script } { info } + \@@_diable_no_script_msg: \setCJKmainfont{Songti~SC~Light}[ BoldFont=Songti~SC~Bold, ItalicFont=Kaiti~SC, @@ -2928,8 +3060,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_fandol: { - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} + \@@_diable_no_script_msg: \setCJKmainfont{FandolSong-Regular}[ Extension=.otf, BoldFont=FandolSong-Bold, @@ -2958,14 +3089,13 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_load_cjk_font_founder: { - \sys_if_engine_luatex:T - { % \end{macrocode} -% 在 LuaTeX 中调整方正字体括号位置 -% XeTeX 暂无好的解决方法 +% 调整方正字体括号位置。\footnote{\hologo{XeTeX} 的调整方法来自 \url{https://www.zhihu.com/question/46241367/answer/101660183}。} % \begin{macrocode} - \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} - } + \sys_if_engine_xetex:T + { \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } } + \sys_if_engine_luatex:T + { \defaultCJKfontfeatures { JFM = { zh_CN/{quanjiao,fzpr} } } } \setCJKmainfont { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] @@ -3124,40 +3254,61 @@ To produce the documentation run the original source files ending with % % \subsubsection{页眉页脚} % -% 本科生页眉页脚。要求无页眉,页脚居中,页码使用五号新罗马体数字。 +% \begin{macro}{\@@_fancy_head:nn} +% 页眉样式,设置为小号字体、楷书。这里对 \pkg{fancyhdr} 的命令进行了包装。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_fancy_head:nn #1#2 + { \fancyhead [#1] { \small \kaishu \nouppercase {#2} } } +% \end{macrocode} +% \end{macro} +% +% 重定义 \pkg{fancyhdr} 的 \opt{plain} 样式,即本科生正文和部分特殊页面使用的的 +% 页眉页脚样式。页眉无内容;页脚为居中的页码,使用五号新罗马体数字。注意标记页眉 +% 页脚横线宽度的变量并不是 |dim| 类型的,但是采取了该类型的格式。 % \begin{macrocode} \fancypagestyle { plain } { \fancyhf { } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } + \fancyfoot [ C ] { \zihao { 5 } \rmfamily \thepage } + \tl_set:Nn \headrulewidth { \c_zero_dim } + \tl_set:Nn \footrulewidth { \c_zero_dim } } % \end{macrocode} % -% 研究生页眉页脚。页眉为横线,奇数页显示章名,偶数页显示节名;页脚为页码。 +% \begin{macro}{\@@_set_heading_g:} +% \changes{v0.15}{2022/01/17}{修复单页模式的页眉问题。} +% 以 \opt{plain} 样式为基础,单独设置研究生模板的页眉内容。在 \cs{fancyhead} 的 +% 可选参数中,\opt{E} 和 \opt{O} 分别表示在偶数页(even)和奇数页(odd), 而 +% \opt{L}、\opt{R} 和 \opt{C} 则分别表示左(left)、右(right)和中间(center) +% 。按照通常的排版规则,在双面模式下,偶数页的中间页眉文字在左,奇数页则在右。 +% 单面模式下,左右页眉都要显示。 % \begin{macrocode} -\fancypagestyle{headings} +\cs_new_protected:Npn \@@_set_heading_g: { - \fancyhf { } - \fancyhead [ CO ] { \leftmark } - \fancyhead [ CE ] { \rightmark } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0.4 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } - \setlength { \headheight } { 20 pt } + \bool_if:NTF \g_@@_twoside_bool + { + \@@_fancy_head:nn { EL } { \leftmark } + \@@_fancy_head:nn { OR } { \rightmark } + } + { + \@@_fancy_head:nn { L } { \leftmark } + \@@_fancy_head:nn { R } { \rightmark } + } + \tl_set:Nn \headrulewidth { 0.4 pt } + \dim_set:Nn \headheight { 20 pt } } % \end{macrocode} +% \end{macro} % % \begin{macro}{\frontmatter} % 重定义 \cs{frontmatter},清空页眉页脚以及页码设置。 -% 此命令仅为解决原 \cls{book} 类中使用小写罗马字母序号的冲突,并不建议使用。 +% 此命令仅为解决原 \cls{book} 类中默认使用小写罗马字母序号的冲突,并不建议使用。 % \begin{macrocode} \RenewDocumentCommand \frontmatter { } { \cleardoublepage - \pagestyle{empty} - \pagenumbering{Roman} + \pagestyle { empty } + \pagenumbering { Roman } } % \end{macrocode} % \end{macro} @@ -3165,13 +3316,15 @@ To produce the documentation run the original source files ending with % \begin{macro}{\mainmatter} % \changes{v0.12}{2021/12/03}{修复了摘要页字体格式泄漏到正文的问题。} % \changes{v0.12}{2021/12/03}{修复了页眉上长标题重叠的问题。} -% 重定义 \cs{mainmatter},在论文主体部分载入页眉页脚设置,使用阿拉伯数字重新进行页码编号。 +% 重定义 \cs{mainmatter},在论文主体部分载入页眉页脚设置,使用阿拉伯数字重新进行 +% 页码编号。 % \begin{macrocode} \RenewDocumentCommand \mainmatter { } { \cleardoublepage - \int_compare:nTF { \l_@@_info_degree_int == 1 } - { \pagestyle { plain } } { \pagestyle { headings } } + \pagestyle { plain } + \int_compare:nF { \l_@@_info_degree_int == 1 } + { \@@_set_heading_g: } \pagenumbering { arabic } \normalfont \normalsize } @@ -3188,38 +3341,64 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\njuchapter} +% \begin{macro}{\@@_add_tocline:n,\@@_add_tocline:V} +% 添加目录条目。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_tocline:n #1 + { \addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1 } } +\cs_generate_variant:Nn \@@_add_tocline:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_chapter:n,\@@_chapter:V} % 含有目录和 PDF 标签的无编号章。 % \begin{macrocode} -\NewDocumentCommand \njuchapter { m } +\cs_new_protected:Npn \@@_chapter:n #1 { - \chapter* { #1 } - \addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1 } - \@mkboth { #1 } { #1 } + \chapter * { #1 } + \@@_add_tocline:n { #1 } + \@@_chapter_header:n { #1 } } +\cs_generate_variant:Nn \@@_chapter:n { V } % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_chapter_header:n} +% 单页模式下,目录、摘要、符号表等特殊页面的页眉中间为相应标题,左右为空。这里通 +% 过居中的 \tn{leftmark} 实现。 % \begin{macrocode} -\ctexset +\cs_new_protected:Npn \@@_chapter_header:n #1 { - chapter/beforeskip = 10 pt, - chapter/afterskip = 60 pt, - chapter/format = \centering \c_@@_sec_format_tl, - section/format = \c_@@_sec_format_tl, - subsection/format = \c_@@_sec_format_tl, - subsubsection/format = \c_@@_sec_format_tl + \bool_if:NTF \g_@@_twoside_bool + { \markboth { #1 } { #1 } } + { \markboth { \hfill #1 \hfill } { } } } % \end{macrocode} +% \end{macro} % +% \begin{macro}{\njuchapter} +% 封装无编号章环境,供用户在正文中使用。 +% \begin{macrocode} +\NewDocumentCommand \njuchapter { m } { \@@_chapter:V { #1 } } +% \end{macrocode} +% \end{macro} % -% \subsection{目录格式} -% \changes{v0.13}{2021/12/09}{删除 \pkg{tocloft},改用 \pkg{ctex} 内置的目录设置。} -% +% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。 % \begin{macrocode} -\ctexset +\keys_set:nn { ctex } { + chapter / beforeskip = 10 pt, + chapter / afterskip = 60 pt, + chapter / format = \c_@@_sec_format_tl \centering, + section / format = \c_@@_sec_format_tl, + subsection / format = \c_@@_sec_format_tl, + subsubsection / format = \c_@@_sec_format_tl, % \end{macrocode} +% +% +% \subsection{目录格式} +% \changes{v0.13}{2021/12/09}{移除 \pkg{tocloft},用 \pkg{ctex} 修改目录样式。} +% % 设置目录标题默认名称。 % \begin{macrocode} contentsname = { 目\hspace{2em}录 }, @@ -3228,21 +3407,45 @@ To produce the documentation run the original source files ending with % \end{macrocode} % 设置目录中章标题的样式。 % \begin{macrocode} - chapter / tocline = \c_@@_sec_format_tl \CTEXnumberline {#1} #2 + chapter / tocline = \c_@@_sec_format_tl \CTEXnumberline { #1 } #2 } % \end{macrocode} % -% \begin{macro}{\@@_modify_toc_title:nn} +% \begin{macrocode} +\keys_define:nn { nju / style } + { +% \end{macrocode} +% \begin{macro}{style/toc-in-toc} +% \changes{v0.15}{2022/02/04}{可选择目录自身是否出现在目录中。} +% 是否在目录中显示目录自身。 +% \begin{macrocode} + toc-in-toc .bool_gset:N = \g_@@_toc_in_toc_bool, + toc-in-toc .initial:n = true + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_make_toc:nn,\@@_make_toc:Vn} % 通过 group 内修改标题设置,将目录页标题格式单独设置为三号粗宋体。 +% 目录自身不出现在目录中时需特别处理。参考 +% \url{https://tex.stackexchange.com/a/1821}。 % \begin{macrocode} -\cs_new_protected:Npn \@@_modify_toc_title:nn #1#2 -{ - \group_begin: - \ctexset { chapter/format = \centering \zihao{3} \bf } - \njuchapter { #1 } - \group_end: - \@starttoc { #2 } -} +\cs_new_protected:Npn \@@_make_toc:nn #1#2 + { + \group_begin: + \keys_set:nn { ctex } + { chapter/format = \centering \zihao { 3 } \bfseries } + \bool_if:NTF \g_@@_toc_in_toc_bool + { \@@_chapter:n { #1 } } + { + \chapter * { #1 } + \pdfbookmark [0] { #1 } { #2 } + \@@_chapter_header:n { #1 } + } + \group_end: + \@starttoc { #2 } + } +\cs_generate_variant:Nn \@@_make_toc:nn { Vn } % \end{macrocode} % \end{macro} % @@ -3250,59 +3453,124 @@ To produce the documentation run the original source files ending with % 重定义目录命令,修改标题格式并插入书签。 % \begin{macrocode} \RenewDocumentCommand \tableofcontents { } - { \@@_modify_toc_title:nn { \contentsname } { toc } } + { \@@_make_toc:Vn \contentsname { toc } } \RenewDocumentCommand \listoffigures { } - { \@@_modify_toc_title:nn { \listfigurename } { lof } } + { \@@_make_toc:Vn \listfigurename { lof } } \RenewDocumentCommand \listoftables { } - { \@@_modify_toc_title:nn { \listtablename } { lot } } + { \@@_make_toc:Vn \listtablename { lot } } % \end{macrocode} % \end{macro} % % % \subsection{参考文献} % +% \begin{variable}{\g_@@_biblatex_option_clist} +% 存储传入 \pkg{biblatex} 的选项列表。 +% \begin{macrocode} +\clist_new:N \g_@@_biblatex_option_clist +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\g_@@_bib_resource_clist} +% 存储参考文献数据源列表。 +% \begin{macrocode} +\clist_new:N \g_@@_bib_resource_clist +% \end{macrocode} +% \end{variable} +% +% \begin{macrocode} +\msg_new:nnn { njuthesis } { extra-bib-style } + { + Wrongly-placed~ bib~ style.\\ + Please~ use~ the~ `bib/style`~ field. + } +% \end{macrocode} +% % \begin{macrocode} \keys_define:nn { nju / bib } { % \end{macrocode} +% % \begin{macro}{bib/style} % \changes{v0.14}{2021/12/19}{提供选择参考文献样式的接口。} -% 参考文献样式。分为顺序编码制 \opt{numeric}(\opt{gb7714-2015} 样式)和著者-出版年制 \opt{author-year}(\opt{gb7714-2015ay} 样式)。用户选取的样式会被加入选项列表中,以待传进 \pkg{biblatex} 宏包。 +% \changes{v0.15}{2022/02/11}{可使用国标以外的文献样式。} +% 参考文献样式。国家标准为顺序编码制 \opt{numeric} 和著者-出版年制 +% \opt{author-year},分别对应 \pkg{biblatex} 的 \opt{gb7714-2015} +% 和 \opt{gb7714-2015ay} 样式。其余样式一律视作 \opt{unknown}。用户 +% 选取的样式会被加入选项列表中,以待传进 \pkg{biblatex} 宏包。 % \begin{macrocode} style .choice:, style / numeric .code:n = - { \clist_set:Nn \l_@@_tmp_clist { style = gb7714-2015 } }, + { + \clist_gput_right:Nn \g_@@_biblatex_option_clist + { style = gb7714-2015 } + }, style / author-year .code:n = - { \clist_set:Nn \l_@@_tmp_clist { style = gb7714-2015ay } }, + { + \clist_gput_right:Nn \g_@@_biblatex_option_clist + { style = gb7714-2015ay } + }, + style / unknown .code:n = + { + \clist_gput_right:Nx \g_@@_biblatex_option_clist + { style = \l_keys_value_tl } + }, style .initial:n = numeric, % \end{macrocode} % \end{macro} +% +% \begin{macro}{bib/option} +% \changes{v0.15}{2022/02/15}{提供传入 \pkg{biblatex} 宏包选项的接口。} +% 待传入 \pkg{biblatex} 的额外宏包选项,以列表形式储存。 +% 更为常见的参考文献样式设置已由 \opt{bib/style} 提供, +% 此处对重复的样式设置进行了检查。本设置项等效于在导言区使用 +% |\PassoptionToPackage{|\meta{key}|=|\meta{value}|}{biblatex}| 命令。 +% \begin{macrocode} + option .code:n = + { + \tl_if_in:VnTF \l_keys_value_tl { style = } + { \msg_error:nn { njuthesis } { extra-bib-style } } + { + \clist_gput_right:NV \g_@@_biblatex_option_clist + \l_keys_value_tl + } + }, +% \end{macrocode} +% \end{macro} +% % \begin{macro}{bib/resource} % \changes{v0.14}{2021/12/19}{提供批量导入参考文献数据源的接口。} -% 参考文献数据源。 +% 参考文献数据源,以列表形式储存。 % \begin{macrocode} - resource .clist_set:N = \l_@@_bib_resource_clist + resource .code:n = + { + \clist_gput_right:NV \g_@@_bib_resource_clist + \l_keys_value_tl + }, } % \end{macrocode} % \end{macro} % % \begin{macro}{\addbibresource} -% 为了吸收用户在导言区设置的选项,\pkg{biblatex} 宏包被设置在导言区末尾才会载入。此处单独定义了可以在导言区使用的 \cs{addbibresource} 命令,用于兼容传统的添加参考文献数据源的方法。 +% 为了吸收用户在导言区设置的选项,\pkg{biblatex} 宏包被设置在导言区末尾才会载 +% 入。此处单独定义了可以在导言区使用的 \cs{addbibresource} 命令,用于兼容传统的 +% 添加参考文献数据源的方法。 % \begin{macrocode} \NewDocumentCommand \addbibresource { m } - { \clist_gput_right:Nn \l_@@_bib_resource_clist { #1 } } + { \clist_gput_right:Nn \g_@@_bib_resource_clist { #1 } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_biblatex_pre_setup:} -% 载入 \pkg{biblatex} 宏包前,必须禁用自行定义的 \cs{addbibresource} 命令,并传入用户设置的选项。 +% 载入 \pkg{biblatex} 宏包前,必须禁用自行定义的 \cs{addbibresource} +% 命令,并传入用户设置的选项。 % \begin{macrocode} \cs_new_protected:Npn \@@_biblatex_pre_setup: { \cs_undefine:N \addbibresource - \clist_put_right:Nn \l_@@_tmp_clist { backend = biber } - \exp_args:NV \PassOptionsToPackage \l_@@_tmp_clist { biblatex } - \clist_clear:N \l_@@_tmp_clist + \clist_gput_right:Nn \g_@@_biblatex_option_clist { backend = biber } + \exp_args:NV \PassOptionsToPackage + \g_@@_biblatex_option_clist { biblatex } } % \end{macrocode} % \end{macro} @@ -3314,37 +3582,27 @@ To produce the documentation run the original source files ending with { % \end{macrocode} % \changes{v0.12}{2021/12/06}{设置输出参考文献的默认选项。} -% 修改参考文献的头部样式,自动添加目录条目。 +% \changes{v0.15}{2022/02/17}{可在每章后附上参考文献表。} +% 修改参考文献的头部样式,自动添加目录条目。默认为 |chapter| 级别。 +% 如果需要在每章后附上一个参考文献表,即对 \pkg{biblatex} 传入了 +% |refsection = chapter| 选项,则默认为 |section| 级别。 % \begin{macrocode} - \defbibheading { njubib } [ \bibname ] { \njuchapter { ##1 } } - \DeclarePrintbibliographyDefaults { heading = njubib } + \defbibheading { njubibintoc } [ \bibname ] { \@@_chapter:V { ##1 } } + \tl_if_eq:NnTF \blx@refsecreset@level { 2 } + { \DeclarePrintbibliographyDefaults { heading = subbibintoc } } + { \DeclarePrintbibliographyDefaults { heading = njubibintoc } } % \end{macrocode} % 传入参考文献源文件,此时可正常使用 \cs{addbibresource} 命令。 % \begin{macrocode} - \clist_map_inline:Nn \l_@@_bib_resource_clist + \clist_map_inline:Nn \g_@@_bib_resource_clist { \addbibresource { ##1 } } -% \end{macrocode} -% 忽略不需要的文献信息。 -% \begin{macrocode} - \AtEveryBibitem - { - \clist_map_inline:nn - { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } - { \clearfield { ##1 } } - % \ifentrytype{online} { } - % { - % \ifentrytype{misc} { } - % \clearfield{urldate} { \clearfield{url} } - % } - } } % \end{macrocode} % \end{macro} % -% 使用 \pkg{etoolbox} 提供的 \tn{BeforeBeginEnvironment},在 \env{document} 环境开始的钩子前载入 \pkg{biblatex} 并进行相关设置。 +% 使用 \pkg{etoolbox} 提供的 \tn{BeforeBeginEnvironment},在 \env{document} 环境 +% 开始的钩子前载入 \pkg{biblatex} 并进行相关设置。 % \begin{macrocode} -%\hook_gset_rule:nnnn { begindocument/before } { . } { < } { xeCJK } -%\hook_gput_code:nnn { env/document/begin } { . } \BeforeBeginEnvironment { document } { \@@_biblatex_pre_setup: @@ -3357,7 +3615,7 @@ To produce the documentation run the original source files ending with % \subsection{引用} % % 在导言区末尾进行 \pkg{hyperref} 设置。 -% \changes{v0.11}{2021/10/01}{写入PDF元数据。} +% \changes{v0.11}{2021/10/01}{写入 PDF 元数据。} % \begin{macrocode} \ctex_at_end_preamble:n { @@ -3438,6 +3696,8 @@ To produce the documentation run the original source files ending with % % \subsection{列表环境} % \changes{v0.12}{2021/12/07}{删除了 \pkg{enumitem} 的部分列表环境设置。} +% +% 缩减列表环境的条目间距。 % \begin{macrocode} \setlist { noitemsep } % \end{macrocode} @@ -3461,7 +3721,8 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% 定义证明环境。证毕符号使用 \tn{mdlgwhtsquare} 绘制,对应于 |U+25A1| 字符\footnote{\url{https://tex.stackexchange.com/questions/567135/how-get-box-like-symbol-with-xelatex}}。 +% 定义证明环境。证毕符号使用 \tn{mdlgwhtsquare} 绘制,对应于 |U+25A1| 字符 +% \footnote{\url{https://tex.stackexchange.com/questions/567135/how-get-box-like-symbol-with-xelatex}}。 % \begin{macrocode} \theoremsymbol { \ensuremath { \mdwhtsquare } } \newtheorem* { proof } { \c_@@_name_proof_tl } @@ -3587,6 +3848,140 @@ To produce the documentation run the original source files ending with % \end{macro} % % +% \subsubsection{定义对象} +% \changes{v0.15}{2022/01/24}{使用 \pkg{xtemplate} 重构封面。} +% +% 本模板使用 \pkg{xtemplate} 提供的面向对象方法简化封面和摘要的绘制过程。 +% +% 以下分别从页面元素(element)和页面整体(page)的层次进行了抽象。当我们把页面部件考虑为一个对象时,它天然地只具备有限数量的属性:内容、格式、边距、对齐方式等。而具体的页面是这些对象的实例的集合,附加边距、行距等属性,创建页面只需传入一个列表调用各个 Instance 即可。通过 \pkg{xtemplate} 提供的功能,我们可以根据这些属性创建模板(template),进而能大量构建具有\emph{相似行为}的实例(instance)。这种做法能充分分离内容和样式,极大优化代码的可读性。 +% +% 声明对象类型。此类对象不需要参数。 +% \begin{macrocode} +\DeclareObjectType { nju } { \c_zero_int } +% \end{macrocode} +% +% 定义元素模板。 +% \begin{macrocode} +%<@@=njuelem> +% \end{macrocode} +% +% 声明页面元素模板接口。 +% 元素是一个页面的基本组成单位,包括文段、图片等等。一个抽象的元素应当具备以下属性: +% \begin{description} +% \item[\opt{content}] 内容,即剥离样式的元素本身 +% \item[\opt{format}] 格式,例如字号、字体 +% \item[\opt{bottom-skip}] 下间距,即与下一个元素的距离 +% \item[\opt{align}] 对齐方式,包括左对齐、右对齐、居中、正常段落 +% \end{description} +% \begin{macrocode} +\DeclareTemplateInterface { nju } { element } { \c_zero_int } + { + content : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + bottom-skip : skip = \c_zero_skip, + align : choice { l, r, c, n } = c + } +% \end{macrocode} +% +% 声明页面元素模板代码。涉及的变量将被自动创建。 +% \begin{macrocode} +\DeclareTemplateCode { nju } { element } { \c_zero_int } + { + content = \l_@@_content_tl, + format = \l_@@_format_tl, + bottom-skip = \l_@@_bottom_skip, + align = + { + l = + { \tl_set_eq:NN \l_@@_begin_align_tl \flushleft + \tl_set_eq:NN \l_@@_end_align_tl \endflushleft }, + r = + { \tl_set_eq:NN \l_@@_begin_align_tl \flushright + \tl_set_eq:NN \l_@@_end_align_tl \endflushright }, + c = + { \tl_set_eq:NN \l_@@_begin_align_tl \center + \tl_set_eq:NN \l_@@_end_align_tl \endcenter }, + n = + { \tl_clear:N \l_@@_begin_align_tl + \tl_clear:N \l_@@_end_align_tl } + } + } + { + \AssignTemplateKeys + \group_begin: + \l_@@_begin_align_tl + \l_@@_format_tl + \l_@@_content_tl \par + \l_@@_end_align_tl + \group_end: + \__nju_vskip:N \l_@@_bottom_skip + } +% \end{macrocode} +% +% 定义页面模板。 +% \begin{macrocode} +%<@@=njupage> +% \end{macrocode} +% +% 声明页面模板接口。 +% 页面是元素的集合。一个抽象的页面应当具备以下属性: +% \begin{description} +% \item[\opt{element}] 包含的元素,这里使用的是名称列表 +% \item[\opt{prefix}] 元素名称前缀 +% \item[\opt{format}] 格式,例如行距 +% \item[\opt{top-skip}] 上间距,即与页面顶部的距离 +% \item[\opt{bottom-skip}] 下间距,即与页面底部的距离 +% \end{description} +% \begin{macrocode} +\DeclareTemplateInterface { nju } { page } { \c_zero_int } + { + element : commalist = \c_empty_clist, + prefix : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + top-skip : skip = \c_zero_skip, + bottom-skip : skip = \c_zero_skip + } +% \end{macrocode} +% +% 声明页面模板代码。 +% \begin{macrocode} +\DeclareTemplateCode { nju } { page } { \c_zero_int } + { + element = \l_@@_element_clist, + prefix = \l_@@_prefix_tl, + format = \l_@@_format_tl, + top-skip = \l_@@_top_skip, + bottom-skip = \l_@@_bottom_skip + } + { + \AssignTemplateKeys + \newpage + \__nju_vskip:N \l_@@_top_skip + \group_begin: + \l_@@_format_tl + \clist_map_inline:Nn \l_@@_element_clist + { \UseInstance { nju } { \l_@@_prefix_tl ##1 } } + \group_end: + \__nju_vskip:N \l_@@_bottom_skip + } +%<@@=nju> +% \end{macrocode} +% +% \begin{macro}{\@@_declare_element:nn,\@@_declare_page:nn} +% 封装 \pkg{xtemplate} 提供的函数,简化创建实例的过程。 +% \begin{arguments} +% \item 实例名称 +% \item 参数列表 +% \end{arguments} +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_element:nn #1#2 + { \DeclareInstance { nju } {#1} { element } {#2} } +\cs_new_protected:Npn \@@_declare_page:nn #1#2 + { \DeclareInstance { nju } {#1} { page } {#2} } +% \end{macrocode} +% \end{macro} +% +% % \subsubsection{绘制部件} % % \begin{macrocode} @@ -3629,39 +4024,57 @@ To produce the documentation run the original source files ending with { \includegraphics [ width = #2, height = #3 ] { \l_@@_name_img_tl } } } + } % \end{macrocode} % \end{macro} -% 将 ISO 格式的原始日期字符串格式化为中文日期表示,该字符串需要进行展开。 +% +% \paragraph{本科生} +% +% \begin{macro}{cover/ug/emblem-img} +% 本科生封面校徽图片实例。 % \begin{macrocode} - \tl_set:Nn \l_@@_info_sm_date_tl - { - \exp_last_unbraced:NV - \@@_date:www \l_@@_info_sm_date_raw_tl \q_stop - } +\@@_declare_element:nn { cover / ug / emblem-img } + { + content = \njuemblem [ black ] { ! } { 3.35 cm }, + bottom-skip = 1 cm, + align = l + } % \end{macrocode} -% 英文提交日期以及答辩日期仅用于研究生封面。 -% \begin{macrocode} - \int_compare:nF { \l_@@_info_degree_int == 1 } - { - \tl_set:Nn \l_@@_info_sm_date_en_tl - { - \exp_last_unbraced:NV - \@@_date_en:www \l_@@_info_sm_date_raw_tl \q_stop - } - \tl_set:Nn \l_@@_info_df_date_tl - { - \exp_last_unbraced:NV - \@@_date:www \l_@@_info_df_date_raw_tl \q_stop - } - } +% \end{macro} +% +% \begin{macro}{cover/ug/name-img} +% 本科生封面校名图片实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / ug / name-img } + { + content = \njuname [ black ] { ! } { 3 cm }, + bottom-skip = 1 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/ug/title} +% 本科生封面标题实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / ug / title } + { + content = + \@@_spread_box:nnn { 9 em } { \bf } { \l_@@_info_type_tl }, + format = \zihao { -1 }, + bottom-skip = 0 pt plus 1.5 fill } % \end{macrocode} +% \end{macro} % -% \begin{macro}{\@@_cover_title_ug:} -% 本科生封面标题。 +% \begin{macro}{cover/ug/info} +% 本科生封面信息栏实例。 % \begin{macrocode} -\cs_new_protected:Npn \@@_cover_title_ug: - { \@@_spread_box:nnn { 9 em } { \bf } { \l_@@_info_type_tl } } +\@@_declare_element:nn { cover / ug / info } + { + content = + \@@_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em }, + format = \zihao { 3 } + } % \end{macrocode} % \end{macro} % @@ -3675,7 +4088,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_cover_info_ug:nnn #1#2#3 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \@@_cover_entry:nnn { dept } { #1 } { #2 } \@@_cover_entry:nnn { major } { #1 } { #2 } @@ -3691,17 +4104,76 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_cover_title_g:} -% 研究生封面标题。 +% \paragraph{研究生} +% +% \subparagraph{正面} 包括校名、校徽、标题、信息栏。 +% +% \begin{macro}{cover/g/emblem-img} +% 研究生封面校徽图片实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / emblem-img } + { + content = \njuemblem [ black ] { ! } { 1.9 cm }, + bottom-skip = 1 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/g/name-img} +% 研究生封面校名图片实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / name-img } + { + content = \njuname [ black ] { 4.4 cm } { ! }, + bottom-skip = 2 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/g/type} +% 研究生封面标题实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / type } + { + content = + \@@_spread_box:nnn { 9 em } { } { \l_@@_info_type_tl }, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/g/degree} +% 研究生封面标题实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / degree } + { + content = \c_@@_name_apply_tl, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm plus 1.5 fil + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/g/info} +% 研究封面信息栏实例。 % \begin{macrocode} -\cs_new_protected:Npn \@@_cover_title_g: +\@@_declare_element:nn { cover / g / info } { - \@@_spread_box:nnn { 9em } { } { \l_@@_info_type_tl } \@@_vskip: - \c_@@_name_degree_l_tl \l_@@_info_degree_tl \c_@@_name_degree_r_tl + content = \@@_cover_info_g:nn { 6.2 em } { 18 em }, + bottom-skip = 0 pt plus 1.5 fil } % \end{macrocode} % \end{macro} % +% \begin{macro}{cover/g/date} +% 研究封面日期实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / date } + { content = \l_@@_info_sm_date_tl } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_cover_info_g:nn} % 研究生封面信息栏。 % \begin{arguments} @@ -3711,7 +4183,7 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_cover_info_g:nn #1#2 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \@@_multiline_title:nnn { } { #1 } { #2 } \clist_map_inline:nn { author, major, field, supv_full } @@ -3721,6 +4193,19 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \subparagraph{背面} +% +% \begin{macro}{cover/g/back} +% 研究生封面背面信息实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / g / back } + { + content = \@@_cover_back_g:, + align = l + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_cover_back_g:} % 研究生封面背面信息。格式存在变化,没有使用循环来简化。 % \begin{macrocode} @@ -3738,53 +4223,152 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_cover_en_g:} -% 研究生英文封面。 +% \subparagraph{英文封面} 包括标题、顶部、中部、校徽、底部。 +% +% \begin{macro}{cover/g/en/title} +% 研究生英文封面标题实例。 % \begin{macrocode} -\cs_new_protected:Npn \@@_cover_en_g: +\@@_declare_element:nn { cover / g / en / title } { + content = \l_@@_info_title_en_tl, + format = \bf \sffamily \zihao { 2 }, + bottom-skip = 2 cm + } % \end{macrocode} -% 标题。 -% \begin{macrocode} - \parbox { \textwidth } - { \centering \bf \sffamily \zihao { 2 } \l_@@_info_title_en_tl } - \skip_vertical:n { 1 cm } -% \end{macrocode} -% 作者。 -% \begin{macrocode} - \group_begin: \zihao { 4 } { by } \group_end: \@@_vskip: - \group_begin: - \bf \sffamily \zihao { 4 } \l_@@_info_author_en_tl - \group_end: \skip_vertical:n { 1 cm } -% \end{macrocode} -% 导师。 +% \end{macro} +% +% \begin{macro}{cover/g/en/top} +% 研究生英文封面顶部信息实例。 % \begin{macrocode} - \group_begin: \zihao { 4 } { Supervised~ by } \group_end: \@@_vskip: - \group_begin: - \sffamily \zihao { 4 } \l_@@_info_supv_full_en_tl - \group_end: \vfill +\@@_declare_element:nn { cover / g / en / top } + { + content = + { by } + \skip_vertical:N \c_zero_skip + \textbf { \sffamily \l_@@_info_author_en_tl } + \skip_vertical:n { .5 cm } + { Supervised~ by } + \skip_vertical:N \c_zero_skip + \textsf { \l_@@_info_supv_full_en_tl }, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } % \end{macrocode} -% 学位信息。 +% \end{macro} +% +% \begin{macro}{cover/g/en/middle} +% 研究生英文封面中部信息实例。 % \begin{macrocode} +\@@_declare_element:nn { cover / g / en / middle } + { + content = \c_@@_cover_en_text_tl \@@_vskip: \textsc { \clist_item:Nn \c_@@_name_degree_en_clist { \l_@@_info_degree_int } } \@@_vskip: { in } \@@_vskip: - \l_@@_info_major_en_tl \skip_vertical:n { 1 cm } + \l_@@_info_major_en_tl, + bottom-skip = 2 cm + } % \end{macrocode} -% 校徽。 +% \end{macro} +% +% \begin{macro}{cover/g/en/emblem-img} +% 研究生英文封面校徽图片实例。 % \begin{macrocode} - \njuemblem [ black ] { ! } { 2.5 cm } \@@_vskip: - \l_@@_info_dept_en_tl \\ \c_@@_name_nju_en_tl - \skip_vertical:n { 1 cm } +\@@_declare_element:nn { cover / g / en / emblem-img } + { + content = \njuemblem [ black ] { ! } { 2.5 cm }, + bottom-skip = 1.5 cm + } % \end{macrocode} -% 提交日期。 +% \end{macro} +% +% \begin{macro}{cover/g/en/bottom} +% 研究生英文封面底部信息实例。 % \begin{macrocode} +\@@_declare_element:nn { cover / g / en / bottom } + { + content = + \l_@@_info_dept_en_tl \skip_vertical:N \c_zero_skip + \c_@@_name_nju_en_tl \skip_vertical:n { 1 cm } \l_@@_info_sm_date_en_tl } % \end{macrocode} % \end{macro} % +% \subparagraph{国家图书馆封面} 包括顶部、题名、标题、中部、底部、日期。 +% +% \begin{macro}{cover/nl/top} +% 国家图书馆封面顶部信息实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / top } + { + content = \@@_cover_top_nl:, + bottom-skip = 2 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/nl/name} +% 国家图书馆封面标题名称实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / name } + { + content = + \@@_spread_box:nnn { 6 em } { } { \c_@@_name_title_tl }, + format = \zihao { -0 }, + bottom-skip = 0 pt plus 1.2 fil + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/nl/title} +% 国家图书馆封面标题实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / title } + { + content = \@@_cover_title_nl:, + format = \zihao { 1 }, + bottom-skip = 1 cm + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/nl/middle} +% 国家图书馆封面中部信息实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / middle } + { + content = \@@_cover_info_nl:, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/nl/bottom} +% 国家图书馆封面底部信息实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / bottom } + { + content = \@@_cover_bottom_nl:, + bottom-skip = 1 cm, + align = r + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{cover/nl/date} +% 国家图书馆封面底部日期实例。 +% \begin{macrocode} +\@@_declare_element:nn { cover / nl / date } + { + content = \@@_qquad: 年 \@@_quad: 月 \@@_quad: 日, + format = \kaishu \zihao { 3 } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_cover_top_nl:} % 国家图书馆封面顶部信息。 % \begin{macrocode} @@ -3805,15 +4389,14 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_cover_title_nl: { - \noindent \kaishu \zihao { -0 } \skip_vertical:n { -1 cm } - \@@_spread_box:nnn { 6 em } { } { \c_@@_name_title_tl } - \@@_vskip: \zihao { 1 } \@@_split_title:n { \l_@@_info_title_tl } \@@_multiline_box:nnnn { \l_@@_tmp_int } \l_@@_tmp_clist { 3 } { 15 em } - \@@_vskip: \zihao{4} \c_@@_name_title_nl_tl - \@@_vskip: \zihao{1} + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } \c_@@_name_title_nl_tl } + \skip_vertical:N \c_zero_skip \@@_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl } - \@@_vskip: \zihao{4} { ( } \c_@@_name_author_tl { ) } + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } { ( } \c_@@_name_author_tl { ) } } } % \end{macrocode} % \end{macro} @@ -3827,13 +4410,13 @@ To produce the documentation run the original source files ending with { \clist_item:Nn \l_@@_info_supv_clist { 1 } } \tl_set:Nn \l_@@_info_supv_ttl_tl { \clist_item:Nn \l_@@_info_supv_clist { 2 } } - \@@_uline_entry:nnnn \l_@@_tmp_dim { supv_info } { supv } { } \\ + \@@_uline_entry:Nnnn \l_@@_tmp_dim { supv_info } { supv } { } \\ \@@_ulined_center_box:nn { \textwidth } { \@@_info:n { supv_ttl } \@@_quad: \@@_info:n { supv_cont } } \\ - \@@_uline_bientry:nnnn \l_@@_tmp_dim { degree } { degree } { } - \@@_uline_bientry:nnnn \l_@@_tmp_dim { major_nl } { major } { } \\ - \@@_uline_bientry:nnnn \l_@@_tmp_dim { sm_date } { sm_date } { } - \@@_uline_bientry:nnnn \l_@@_tmp_dim { df_date } { df_date } { } \\ + \@@_uline_bientry:Nnnn \l_@@_tmp_dim { degree } { degree } { } + \@@_uline_bientry:Nnnn \l_@@_tmp_dim { major_nl } { major } { } \\ + \@@_uline_bientry:Nnnn \l_@@_tmp_dim { sm_date } { sm_date } { } + \@@_uline_bientry:Nnnn \l_@@_tmp_dim { df_date } { df_date } { } \\ \@@_full_uline:Nn \l_@@_tmp_dim { \c_@@_name_confer_tl } \@@_uline:n { \l_@@_tmp_dim } } @@ -3856,124 +4439,99 @@ To produce the documentation run the original source files ending with % % % \subsubsection{绘制封面} -% -% \begin{macro}{\@@_make_cover_ug:} % \changes{v0.13}{2021/12/10}{使用 \hologo{LaTeX3} 语法重构本科生封面。} -% 生成本科生封面。 +% \changes{v0.13}{2021/12/11}{使用 \hologo{LaTeX3} 语法重构研究生封面。} +% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构国家图书馆封面。} +% \changes{v0.15}{2022/01/25}{将封面页面封装为对象。} +% +% 定义封面页面的具体配置参数。 +% +% \begin{macro}{cover-ug-default} +% 默认本科生封面实例。 % \begin{macrocode} -\cs_new_protected:Npn \@@_make_cover_ug: +\@@_declare_page:nn { cover-ug-default } { - \newpage -% \end{macrocode} -% 校徽、校名。 -% \begin{macrocode} - \null \skip_horizontal:n { -1 cm } - \njuemblem [ black ] { ! } { 3.35 cm } - \begin{center} - \njuname [ black ] { ! } { 3 cm } \@@_vskip: -% \end{macrocode} -% 学位信息。 -% \begin{macrocode} - \group_begin: \zihao { -1 } \@@_cover_title_ug: \group_end: - \skip_vertical:n { 1.5 cm } \vfil -% \end{macrocode} -% 信息栏。 -% \begin{macrocode} - \zihao{3} \@@_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em } \vfil - \end{center} + element = { emblem-img, name-img, title, info }, + prefix = cover / ug /, + bottom-skip = 0.5 cm plus 1.5 fill } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_make_cover_g:} -% \changes{v0.13}{2021/12/11}{使用 \hologo{LaTeX3} 语法重构研究生封面。} -% 生成研究生封面。 +% \begin{macro}{cover-g-front-default} +% 默认研究生普通封面正面实例。 % \begin{macrocode} -\cs_new_protected:Npn \@@_make_cover_g: +\@@_declare_page:nn { cover-g-front-default } { - \newpage - \begin{center} + element = { emblem-img, name-img, type, degree, info, date }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 1.5 cm + } % \end{macrocode} -% 校徽、校名。 +% \end{macro} +% +% \begin{macro}{cover-g-back-default} +% 默认研究生普通封面背面实例。 % \begin{macrocode} - \null \skip_vertical:n { 1 cm } - \njuemblem [ black ] { ! } { 1.9 cm } \skip_vertical:n { 0.5 cm } - \njuname [ black ] { 4.4 cm } { ! } \@@_vskip: +\@@_declare_page:nn { cover-g-back-default } + { + element = { back }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 20 cm + } % \end{macrocode} -% 学位信息。 +% \end{macro} +% +% \begin{macro}{cover-g-en-default} +% 默认研究生英文封面实例。 % \begin{macrocode} - \group_begin: - \zihao { -1 } \bf \kaishu \@@_cover_title_g: - \group_end: - \skip_vertical:n { 3 cm } \vfil +\@@_declare_page:nn { cover-g-en-default } + { + element = { title, top, middle, emblem-img, bottom }, + prefix = cover / g / en /, + top-skip = 0 pt plus 1.2 fil + } % \end{macrocode} -% 信息栏。 +% \end{macro} +% +% \begin{macro}{cover-nl-default} +% 默认国家图书馆封面实例。 % \begin{macrocode} - \group_begin: - \zihao { 3 } \kaishu - \@@_cover_info_g:nn { 6.2 em } { 18 em } \vfil - \skip_vertical:n { 2 cm } \l_@@_info_sm_date_tl - \group_end: - \end{center} +\@@_declare_page:nn { cover-nl-default } + { + element = { top, name, title, middle, bottom, date }, + prefix = cover / nl /, + format = \kaishu + } % \end{macrocode} -% 背面。 +% \end{macro} +% +% \begin{macro}{\@@_make_cover_ug:} +% 生成本科生封面。 % \begin{macrocode} - \newpage - \noindent \null \skip_vertical:n { 18 cm } - \group_begin: - \zihao { 3 } \kaishu \@@_cover_back_g: - \group_end: +\cs_new_protected:Npn \@@_make_cover_ug: + { \UseInstance { nju } { cover-ug-default } } % \end{macrocode} -% 英文封面。 +% \end{macro} +% +% \begin{macro}{\@@_make_cover_g:} +% 生成研究生的普通封面。 % \begin{macrocode} - \newpage - \noindent \null \skip_vertical:n { 2 cm } - \begin{center} - \@@_cover_en_g: - \end{center} +\cs_new_protected:Npn \@@_make_cover_g: + { + \clist_map_inline:nn { front, back, en } + { \UseInstance { nju } { cover-g- ##1 -default } } } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_make_cover_nl:} -% \changes{v0.13}{2021/12/12}{使用 \hologo{LaTeX3} 语法重构国家图书馆封面。} % 生成研究生的国家图书馆封面。 % \begin{macrocode} \cs_new_protected:Npn \@@_make_cover_nl: - { - \pdfbookmark [ 0 ] { 国家图书馆封面 } { nlcover } - \noindent \null -% \end{macrocode} -% 顶部,包括密级、分类号、UDC。 -% \begin{macrocode} - \begin{center} - \zihao{ -4 } \skip_vertical:n { -2 cm } - \@@_cover_top_nl: - \end{center} -% \end{macrocode} -% 标题。 -% \begin{macrocode} - \begin{center} - \skip_vertical:n { -2 cm } - \@@_cover_title_nl: - \end{center} -% \end{macrocode} -% 中部信息栏。 -% \begin{macrocode} - \group_begin: - \kaishu \zihao { 4 } \noindent \@@_cover_info_nl: - \group_end: -% \end{macrocode} -% 底部答辩信息。 -% \begin{macrocode} - \begin{flushright} - \@@_cover_bottom_nl: - \end{flushright} - \begin{center} - \kaishu \zihao{3} \@@_qquad: 年 \@@_quad: 月 \@@_quad: 日 - \end{center} - \skip_vertical:n { -1 cm } - } + { \UseInstance { nju } { cover-nl-default } } % \end{macrocode} % \end{macro} % @@ -4013,9 +4571,11 @@ To produce the documentation run the original source files ending with { \bool_if:NF \g_@@_draft_bool { - \pagestyle { empty } + \pagestyle { empty } + \pagenumbering { gobble } % \end{macrocode} -% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面和原创性声明,反之生成普通封面。 +% 如果在研究生模板中选择了 \opt{nlcover},就生成用于申请学位的国家图书馆封面, +% 反之生成普通封面。 % \begin{macrocode} \bool_if:NTF \g_@@_nlcover_bool { \@@_make_cover_nl: } @@ -4045,6 +4605,35 @@ To produce the documentation run the original source files ending with % % \subsubsection{内部命令} % +% \begin{macrocode} +\keys_define:nn { nju / style } + { +% \end{macrocode} +% \begin{macro}{style/abstract-in-toc} +% \changes{v0.15}{2022/02/04}{可选择摘要是否出现在目录中。} +% 是否将摘要添加到目录。 +% \begin{macrocode} + abstract-in-toc .bool_gset:N = \g_@@_abs_in_toc_bool, + abstract-in-toc .initial:n = true + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_abs_bookmark:nn} +% \changes{v0.14}{2021/12/21}{将摘要插入目录。} +% 生成摘要的目录条目。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_abs_bookmark:nn #1#2 + { + \phantomsection + \bool_if:NTF \g_@@_abs_in_toc_bool + { \@@_add_tocline:n { #1 } } + { \pdfbookmark [0] { #1 } { #2 } } + } +\cs_generate_variant:Nn \@@_abs_bookmark:nn { Vn } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_abs_title_uuline:n} % 摘要标题双层下划线格式。 % \begin{arguments} @@ -4069,39 +4658,21 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_abs_bookmark:,\@@_abs_bookmark_en:} -% \changes{v0.14}{2021/12/21}{将摘要插入目录。} -% 生成摘要的目录条目。 -% \begin{macrocode} -\cs_new_protected:Npn \@@_abs_bookmark: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c_@@_sec_format_tl \c_@@_name_lang_tl \c_@@_name_abstract_tl } - } -\cs_new_protected:Npn \@@_abs_bookmark_en: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c_@@_sec_format_tl \c_@@_name_abstract_en_tl } - } -% \end{macrocode} -% \end{macro} -% % % \subsubsection{绘制部件} % +% \paragraph{本科生} +% % \begin{macro}{\@@_abs_title_ug:n} % 绘制本科生摘要标题。 % \begin{arguments} % \item 语言,空置为中文,|_en| 为英文 % \end{arguments} % \begin{macrocode} -\cs_generate_variant:Nn \clist_map_inline:nn { Vn } \cs_new_protected:Npn \@@_abs_title_ug:n #1 { - \@@_name:n { nju } \@@_name:n { type } - \@@_name:n { lang #1 } \@@_name:n { abstract } + \clist_map_inline:nn { nju, type, lang #1, abstract } + { \@@_name:n { ##1 } } } % \end{macrocode} % \end{macro} @@ -4137,6 +4708,8 @@ To produce the documentation run the original source files ending with % \end{macrocode} % \end{macro} % +% \paragraph{研究生} +% % \begin{macro}{\@@_abs_title_g:n} % 绘制研究生摘要标题。 % \begin{arguments} @@ -4213,14 +4786,17 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \clist_map_inline:nn { major, author, supv_full } { \\ - \@@_uline_entry:nnnn \l_@@_tmp_dim { ##1 _en } { ##1 _en } { #2 } + \@@_uline_entry:Nnnn \l_@@_tmp_dim { ##1 _en } { ##1 _en } { #2 } } } } % \end{macrocode} % \end{macro} % +% \paragraph{关键词列表} +% % \begin{macro}{\@@_print_keywords:nn} +% \changes{v0.15}{2022/01/26}{为关键词列表添加悬挂缩进。} % 生成中英文关键词列表。 % \begin{arguments} % \item 语言,空置为中文,|_en| 为英文 @@ -4229,15 +4805,27 @@ To produce the documentation run the original source files ending with % \begin{macrocode} \cs_new_protected:Npn \@@_print_keywords:nn #1#2 { - \skip_vertical:n { 2 ex } - \group_begin: + \exp_args:NNc + \tl_set_eq:NN \l_@@_tmp_tl { c_@@_name_keywords #1 _tl } + \@@_get_text_width:Nn \l_@@_tmp_dim { \l_@@_tmp_tl } % \end{macrocode} -% “关键词”字样使用加粗黑体。 +% 关键词列表的悬挂缩进样式由 \tn{list} 环境产生。 % \begin{macrocode} - \noindent \bf \heiti - \use:c { c_@@_name_keywords #1 _tl } - \group_end: - \clist_use:cn { l_@@_info_keywords #1 _clist } { #2 } + \list { } + { + \labelwidth \l_@@_tmp_dim + \labelsep \c_zero_dim + \leftmargin \c_zero_dim + \rightmargin \c_zero_dim + \advance \leftmargin \l_@@_tmp_dim +% \end{macrocode} +% 使用粗体作为标签样式。 +% \begin{macrocode} + \cs_set_eq:NN \makelabel \textbf + } + \item [ \l_@@_tmp_tl ] + \clist_use:cn { l_@@_info_keywords #1 _clist } { #2 } + \endlist } % \end{macrocode} % \end{macro} @@ -4296,10 +4884,12 @@ To produce the documentation run the original source files ending with % \changes{v0.13}{2021/12/12}{重新绘制摘要。} % 中文摘要环境。 % \begin{macrocode} -\NewDocumentEnvironment{abstract} { +b } +\NewDocumentEnvironment { abstract } { +b } { \cleardoublepage - \@@_abs_bookmark: + \thispagestyle { plain } + \@@_abs_bookmark:Vn + { \c_@@_name_lang_tl \c_@@_name_abstract_tl } { abstract } \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { } { : } \group_begin: \kaishu \zihao { -4 } #1 } @@ -4310,12 +4900,13 @@ To produce the documentation run the original source files ending with % \begin{environment}{abstract*} % 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。 % \begin{macrocode} -\NewDocumentEnvironment{abstract*} { +b } +\NewDocumentEnvironment { abstract* } { +b } { \cleardoublepage - \@@_abs_bookmark_en: + \thispagestyle { plain } + \@@_abs_bookmark:Vn { \c_@@_name_abstract_en_tl } { abstract-en } \use:c { @@_make_abs_ \l_@@_info_diploma_tl :nn } { _en } { :~ } - \group_begin: \kaishu \zihao{ -4 } #1 + \group_begin: \zihao{ -4 } #1 } { \@@_print_keywords:nn { _en } { ;~ } \group_end: } % \end{macrocode} @@ -4329,13 +4920,16 @@ To produce the documentation run the original source files ending with % 单独制作的前言致谢页。 % \begin{macrocode} \NewDocumentEnvironment { preface } { +b } - { \njuchapter { \c_@@_name_preface_tl } #1 } { } + { \@@_chapter:V { \c_@@_name_preface_tl } #1 } { } \NewDocumentEnvironment { acknowledgement } { +b } - { \njuchapter { \c_@@_name_acknowledgement_tl } #1 } { } + { \@@_chapter:V { \c_@@_name_acknowledgement_tl } #1 } { } % \end{macrocode} % \end{environment} % \end{environment} % +% +% \subsection{成果列表} +% % \begin{macro}{\njupaperlist} % \changes{v0.10}{2021/09/29}{新增了成果列表页面。} % \changes{v0.14}{2021/12/20}{成果列表中可突出指定作者姓名及年份。} @@ -4365,9 +4959,80 @@ To produce the documentation run the original source files ending with \end{refsection} \group_end: } -% % \end{macrocode} % \end{macro} % +% +% \subsection{符号表} +% +% \begin{macro}{\@@_notation_label:n} +% 左对齐的标签格式,用于符号表。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_notation_label:n #1 { #1 \hfil } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_make_notation:nn} +% 生成符号表。由于符号表只有符号和说明两列,相比于 \env{longtable} 环境, +% \env{description} 环境的语法更为简洁直观,且说明文字可以换行,因而此处使用 +% \hologo{LaTeX2e} 的列表环境进行封装,定义和语法参见 \file{source2e.pdf} 中的 +% File I \quad ltlists.dtx 一章。 +% \begin{macrocode} +\cs_new_protected:Npn \@@_make_notation:nn #1#2 + { + \dim_set:Nn \l_@@_tmp_dim { \textwidth - #1 - #2 } + \list { } + { +% \end{macrocode} +% \tn{list} 环境使用宽度固定的盒子制作标签,通过指定这个盒子的宽度 +% \tn{labelwidth} 即可确定左侧标签区域的宽度。 +% \begin{macrocode} + \labelwidth #2 + \labelsep \c_zero_dim + \itemsep \c_zero_dim + \parsep \c_zero_dim +% \end{macrocode} +% 右侧说明文字区域的宽度无法直接指定,而是靠计算左右边距 \tn{leftmargin} 和 +% \tn{rightmargin} 得到的。 +% \begin{macrocode} + \leftmargin .5\l_@@_tmp_dim + \rightmargin \leftmargin + \advance \leftmargin #2 + \cs_set_eq:NN \makelabel \@@_notation_label:n + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{notation} +% \changes{v0.15}{2022/01/17}{提供符号表环境。} +% 符号表环境。 +% \begin{arguments} +% \item 说明区域宽度,初始值为 10 em。说明宽度的调整更为常见,所以放在前面。 +% \item 符号区域宽度,初始值为 5 em +% \end{arguments} +% \begin{macrocode} +\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } } + { + \@@_chapter:V { \c_@@_name_notation_tl } + \@@_make_notation:nn { #1 } { #2 } + } + { \endlist } +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{notation*} +% 带有星号的符号表不会插入目录。 +% \begin{macrocode} +\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } } + { + \chapter * { \c_@@_name_notation_tl } + \@@_make_notation:nn { #1 } { #2 } + } + { \endlist } +% +% \end{macrocode} +% \end{environment} +% % \end{implementation} % diff --git a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls index 8f3b2043967..19383bdf427 100644 --- a/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls +++ b/Master/texmf-dist/tex/latex/njuthesis/njuthesis.cls @@ -25,10 +25,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo $Id: njuthesis.dtx 0.14.0 2022-01-16 00:00:00 +0800 NJU LUG $ - { Thesis template for Nanjing University } +\GetIdInfo $Id: njuthesis.dtx 0.15.0 2022-02-20 10:30:00 +0800 NJU LUG $ + {Thesis template for Nanjing University} \ProvidesExplClass{njuthesis} -{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} + {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \RequirePackage { xtemplate, l3keys2e } \msg_new:nnn { njuthesis } { l3-too-old } { @@ -49,7 +49,7 @@ The~ njuthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\ "#1"~ is~ not~ supported~ at~ present.~ - You~ must~ change your~ typesetting~ engine~ + You~ must~ change~ your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex". } \sys_if_engine_xetex:F @@ -106,6 +106,13 @@ \cs_new:Nn \__nju_qquad: { \skip_horizontal:n { 2 em } } \cs_new:Nn \__nju_vskip: { \skip_vertical:n { 1 ex } } \cs_new:Nn \__nju_hskip: { \skip_horizontal:n { 0.3 em } } +\cs_new_protected:Npn \__nju_vskip:N #1 + { + \hrule height \c_zero_dim + \nobreak + \skip_vertical:n { - \baselineskip - \lineskip } + \skip_vertical:N #1 + } \cs_new_protected:Npn \__nju_define_name:nn #1#2 { \tl_const:cn { c__nju_name_ #1 _tl } { #2 } } \cs_new_protected:Npn \__nju_define_name:nnn #1#2#3 @@ -172,12 +179,12 @@ \dim_set:Nn #1 { \textwidth - #1 } #2 } \cs_generate_variant:Nn \__nju_full_uline:Nn { NV } -\cs_new_protected:Npn \__nju_uline_entry:nnnn #1#2#3#4 +\cs_new_protected:Npn \__nju_uline_entry:Nnnn #1#2#3#4 { \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } \__nju_ulined_center_box:nn { #1 } { \__nju_info:n { #3 } } } -\cs_new_protected:Npn \__nju_uline_bientry:nnnn #1#2#3#4 +\cs_new_protected:Npn \__nju_uline_bientry:Nnnn #1#2#3#4 { \__nju_full_uline:NV #1 { \__nju_name:n { #2 } #4 } \dim_sub:Nn #1 { \textwidth / 2 } @@ -239,6 +246,7 @@ { { acknowledgement } { 致\hspace{2em}谢 }, { id } { 学号 }, + { notation } { 符号表 }, { orig_date } { 日期 }, { paperlist } { 发表文章目录 }, { pdf_creator } { LaTeX~ with~ njuthesis~ class }, @@ -300,8 +308,8 @@ { confer } { 学位授予单位和日期 }, { df_date } { 论文答辩日期 }, { degree } { 申请学位级别 }, - { degree_l } { (申请 }, - { degree_r } { 学位) }, + { apply } + { (申请 \l__nju_info_degree_tl 学位) }, { field } { 研究方向 }, { g } { 研究生 }, { grade } { 级 }, @@ -358,55 +366,6 @@ { theorem } { 定理 } { Theorem } } { \__nju_define_name:nnn #1 } -\keys_define:nn { nju / info } - { - title .tl_set:N = \l__nju_info_title_tl, - title .initial:n = { 空 }, - title* .tl_set:N = \l__nju_info_title_en_tl, - keywords .clist_set:N = \l__nju_info_keywords_clist, - keywords* .clist_set:N = \l__nju_info_keywords_en_clist, - grade .tl_set:N = \l__nju_info_grade_tl, - student-id .tl_set:N = \l__nju_info_id_tl, - author .tl_set:N = \l__nju_info_author_tl, - author* .tl_set:N = \l__nju_info_author_en_tl, - department .tl_set:N = \l__nju_info_dept_tl, - department* .tl_set:N = \l__nju_info_dept_en_tl, - major .tl_set:N = \l__nju_info_major_tl, - major* .tl_set:N = \l__nju_info_major_en_tl, - field .tl_set:N = \l__nju_info_field_tl, - field* .tl_set:N = \l__nju_info_field_en_tl, - supervisor .clist_set:N = \l__nju_info_supv_clist, - supervisor* .tl_set:N = \l__nju_info_supv_en_tl, - supervisor-ii .clist_set:N = \l__nju_info_supv_ii_clist, - supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, - submit-date .tl_set:N = \l__nju_info_sm_date_raw_tl, - submit-date .initial:V = \c__nju_today_tl, - defend-date .tl_set:N = \l__nju_info_df_date_raw_tl, - defend-date .initial:V = \c__nju_today_tl, - chairman .tl_set:N = \l__nju_info_chairman_tl, - reviewer .clist_set:N = \l__nju_info_reviewer_clist, - clc .tl_set:N = \l__nju_info_clc_tl, - secret-level .tl_set:N = \l__nju_info_seclv_tl, - udc .tl_set:N = \l__nju_info_udc_tl, - supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, - } -\bool_set:Nn \l__nju_second_supv_bool - { ! \clist_if_empty_p:N \l__nju_info_supv_ii_clist } -\tl_set:Nn \l__nju_info_supv_full_tl - { - \clist_use:Nn \l__nju_info_supv_clist { \__nju_hskip: } - \bool_if:NT \l__nju_second_supv_bool - { - \__nju_quad: - \clist_use:Nn \l__nju_info_supv_ii_clist { \__nju_hskip: } - } - } -\tl_set:Nn \l__nju_info_supv_full_en_tl - { - \l__nju_info_supv_en_tl - \bool_if:NT \l__nju_second_supv_bool - { \__nju_quad: \l__nju_info_supv_ii_en_tl } - } \PassOptionsToClass { a4paper, @@ -446,7 +405,6 @@ caption, graphicx, enumitem, - url, hyperref, cleveref } @@ -476,6 +434,76 @@ } \sys_if_engine_luatex:T { \__nju_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } } +\keys_define:nn { nju / info } + { + title .tl_set:N = \l__nju_info_title_tl, + title .initial:n = { 空 }, + title* .tl_set:N = \l__nju_info_title_en_tl, + keywords .clist_set:N = \l__nju_info_keywords_clist, + keywords* .clist_set:N = \l__nju_info_keywords_en_clist, + grade .tl_set:N = \l__nju_info_grade_tl, + student-id .tl_set:N = \l__nju_info_id_tl, + author .tl_set:N = \l__nju_info_author_tl, + author* .tl_set:N = \l__nju_info_author_en_tl, + department .tl_set:N = \l__nju_info_dept_tl, + department* .tl_set:N = \l__nju_info_dept_en_tl, + major .tl_set:N = \l__nju_info_major_tl, + major* .tl_set:N = \l__nju_info_major_en_tl, + field .tl_set:N = \l__nju_info_field_tl, + field* .tl_set:N = \l__nju_info_field_en_tl, + supervisor .clist_set:N = \l__nju_info_supv_clist, + supervisor* .tl_set:N = \l__nju_info_supv_en_tl, + supervisor-ii .clist_set:N = \l__nju_info_supv_ii_clist, + supervisor-ii* .tl_set:N = \l__nju_info_supv_ii_en_tl, + submit-date .tl_set:N = \l__nju_info_sm_date_raw_tl, + submit-date .initial:V = \c__nju_today_tl, + defend-date .tl_set:N = \l__nju_info_df_date_raw_tl, + defend-date .initial:V = \c__nju_today_tl, + chairman .tl_set:N = \l__nju_info_chairman_tl, + reviewer .clist_set:N = \l__nju_info_reviewer_clist, + clc .tl_set:N = \l__nju_info_clc_tl, + secret-level .tl_set:N = \l__nju_info_seclv_tl, + udc .tl_set:N = \l__nju_info_udc_tl, + supervisor-contact .tl_set:N = \l__nju_info_supv_cont_tl, + } +\ctex_at_end_preamble:n + { + \bool_set:Nn \l__nju_second_supv_bool + { ! \clist_if_empty_p:N \l__nju_info_supv_ii_clist } + \tl_set:Nx \l__nju_info_supv_full_tl + { + \clist_use:Nn \l__nju_info_supv_clist { \__nju_hskip: } + \bool_if:NT \l__nju_second_supv_bool + { + \__nju_quad: + \clist_use:Nn \l__nju_info_supv_ii_clist { \__nju_hskip: } + } + } + \tl_set:Nx \l__nju_info_supv_full_en_tl + { + \l__nju_info_supv_en_tl + \bool_if:NT \l__nju_second_supv_bool + { \__nju_quad: \l__nju_info_supv_ii_en_tl } + } + \tl_set:Nn \l__nju_info_sm_date_tl + { + \exp_last_unbraced:NV + \__nju_date:www \l__nju_info_sm_date_raw_tl \q_stop + } + \int_compare:nF { \l__nju_info_degree_int == 1 } + { + \tl_set:Nn \l__nju_info_sm_date_en_tl + { + \exp_last_unbraced:NV + \__nju_date_en:www \l__nju_info_sm_date_raw_tl \q_stop + } + \tl_set:Nn \l__nju_info_df_date_tl + { + \exp_last_unbraced:NV + \__nju_date:www \l__nju_info_df_date_raw_tl \q_stop + } + } + } \tl_if_empty:NTF \g__nju_latin_font_tl { \bool_gset_true:N \g__nju_load_sys_font_bool } { @@ -528,6 +556,8 @@ Scale=MatchLowercase, Ligatures=CommonOff] } +\cs_new_protected:Npn \__nju_diable_no_script_msg: + { \msg_redirect_name:nnn { fontspec } { no-script } { info } } \cs_new_protected:Npn \__nju_load_cjk_font_win: { \setCJKmainfont { SimSun } @@ -541,7 +571,7 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_mac: { - \msg_redirect_name:nnn { fontspec } { no-script } { info } + \__nju_diable_no_script_msg: \setCJKmainfont{Songti~SC~Light}[ BoldFont=Songti~SC~Bold, ItalicFont=Kaiti~SC, @@ -556,8 +586,7 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_fandol: { - % 移除 does not contain script "CJK" 警告 - \msg_redirect_name:nnn {fontspec} {no-script} {info} + \__nju_diable_no_script_msg: \setCJKmainfont{FandolSong-Regular}[ Extension=.otf, BoldFont=FandolSong-Bold, @@ -579,10 +608,10 @@ } \cs_new_protected:Npn \__nju_load_cjk_font_founder: { + \sys_if_engine_xetex:T + { \xeCJKEditPunctStyle {quanjiao} { optimize-kerning = true } } \sys_if_engine_luatex:T - { - \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}} - } + { \defaultCJKfontfeatures { JFM = { zh_CN/{quanjiao,fzpr} } } } \setCJKmainfont { FZShuSong-Z01 } [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] @@ -678,110 +707,160 @@ headheight = 15 pt } \bool_if:NT \g__nju_draft_bool { \geometry { showframe } } +\cs_new_protected:Npn \__nju_fancy_head:nn #1#2 + { \fancyhead [#1] { \small \kaishu \nouppercase {#2} } } \fancypagestyle { plain } { \fancyhf { } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } + \fancyfoot [ C ] { \zihao { 5 } \rmfamily \thepage } + \tl_set:Nn \headrulewidth { \c_zero_dim } + \tl_set:Nn \footrulewidth { \c_zero_dim } } -\fancypagestyle{headings} +\cs_new_protected:Npn \__nju_set_heading_g: { - \fancyhf { } - \fancyhead [ CO ] { \leftmark } - \fancyhead [ CE ] { \rightmark } - \fancyfoot [ C ] { \zihao{5} \thepage } - \RenewDocumentCommand \headrulewidth { } { 0.4 pt } - \RenewDocumentCommand \footrulewidth { } { 0 pt } - \setlength { \headheight } { 20 pt } + \bool_if:NTF \g__nju_twoside_bool + { + \__nju_fancy_head:nn { EL } { \leftmark } + \__nju_fancy_head:nn { OR } { \rightmark } + } + { + \__nju_fancy_head:nn { L } { \leftmark } + \__nju_fancy_head:nn { R } { \rightmark } + } + \tl_set:Nn \headrulewidth { 0.4 pt } + \dim_set:Nn \headheight { 20 pt } } \RenewDocumentCommand \frontmatter { } { \cleardoublepage - \pagestyle{empty} - \pagenumbering{Roman} + \pagestyle { empty } + \pagenumbering { Roman } } \RenewDocumentCommand \mainmatter { } { \cleardoublepage - \int_compare:nTF { \l__nju_info_degree_int == 1 } - { \pagestyle { plain } } { \pagestyle { headings } } + \pagestyle { plain } + \int_compare:nF { \l__nju_info_degree_int == 1 } + { \__nju_set_heading_g: } \pagenumbering { arabic } \normalfont \normalsize } \tl_const:Nn \c__nju_sec_format_tl { \large \normalfont \sffamily } -\NewDocumentCommand \njuchapter { m } - { - \chapter* { #1 } - \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } - \@mkboth { #1 } { #1 } +\cs_new_protected:Npn \__nju_add_tocline:n #1 + { \addcontentsline { toc } { chapter } { \c__nju_sec_format_tl #1 } } +\cs_generate_variant:Nn \__nju_add_tocline:n { V } +\cs_new_protected:Npn \__nju_chapter:n #1 + { + \chapter * { #1 } + \__nju_add_tocline:n { #1 } + \__nju_chapter_header:n { #1 } + } +\cs_generate_variant:Nn \__nju_chapter:n { V } +\cs_new_protected:Npn \__nju_chapter_header:n #1 + { + \bool_if:NTF \g__nju_twoside_bool + { \markboth { #1 } { #1 } } + { \markboth { \hfill #1 \hfill } { } } + } +\NewDocumentCommand \njuchapter { m } { \__nju_chapter:V { #1 } } +\keys_set:nn { ctex } + { + chapter / beforeskip = 10 pt, + chapter / afterskip = 60 pt, + chapter / format = \c__nju_sec_format_tl \centering, + section / format = \c__nju_sec_format_tl, + subsection / format = \c__nju_sec_format_tl, + subsubsection / format = \c__nju_sec_format_tl, + contentsname = { 目\hspace{2em}录 }, + listfigurename = { 插图目录 }, + listtablename = { 表格目录 }, + chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline { #1 } #2 } -\ctexset +\keys_define:nn { nju / style } { - chapter/beforeskip = 10 pt, - chapter/afterskip = 60 pt, - chapter/format = \centering \c__nju_sec_format_tl, - section/format = \c__nju_sec_format_tl, - subsection/format = \c__nju_sec_format_tl, - subsubsection/format = \c__nju_sec_format_tl + toc-in-toc .bool_gset:N = \g__nju_toc_in_toc_bool, + toc-in-toc .initial:n = true } -\ctexset +\cs_new_protected:Npn \__nju_make_toc:nn #1#2 { - contentsname = { 目\hspace{2em}录 }, - listfigurename = { 插图目录 }, - listtablename = { 表格目录 }, - chapter / tocline = \c__nju_sec_format_tl \CTEXnumberline {#1} #2 - } -\cs_new_protected:Npn \__nju_modify_toc_title:nn #1#2 -{ - \group_begin: - \ctexset { chapter/format = \centering \zihao{3} \bf } - \njuchapter { #1 } - \group_end: - \@starttoc { #2 } -} + \group_begin: + \keys_set:nn { ctex } + { chapter/format = \centering \zihao { 3 } \bfseries } + \bool_if:NTF \g__nju_toc_in_toc_bool + { \__nju_chapter:n { #1 } } + { + \chapter * { #1 } + \pdfbookmark [0] { #1 } { #2 } + \__nju_chapter_header:n { #1 } + } + \group_end: + \@starttoc { #2 } + } +\cs_generate_variant:Nn \__nju_make_toc:nn { Vn } \RenewDocumentCommand \tableofcontents { } - { \__nju_modify_toc_title:nn { \contentsname } { toc } } + { \__nju_make_toc:Vn \contentsname { toc } } \RenewDocumentCommand \listoffigures { } - { \__nju_modify_toc_title:nn { \listfigurename } { lof } } + { \__nju_make_toc:Vn \listfigurename { lof } } \RenewDocumentCommand \listoftables { } - { \__nju_modify_toc_title:nn { \listtablename } { lot } } + { \__nju_make_toc:Vn \listtablename { lot } } +\clist_new:N \g__nju_biblatex_option_clist +\clist_new:N \g__nju_bib_resource_clist +\msg_new:nnn { njuthesis } { extra-bib-style } + { + Wrongly-placed~ bib~ style.\\ + Please~ use~ the~ `bib/style`~ field. + } \keys_define:nn { nju / bib } { style .choice:, style / numeric .code:n = - { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015 } }, + { + \clist_gput_right:Nn \g__nju_biblatex_option_clist + { style = gb7714-2015 } + }, style / author-year .code:n = - { \clist_set:Nn \l__nju_tmp_clist { style = gb7714-2015ay } }, + { + \clist_gput_right:Nn \g__nju_biblatex_option_clist + { style = gb7714-2015ay } + }, + style / unknown .code:n = + { + \clist_gput_right:Nx \g__nju_biblatex_option_clist + { style = \l_keys_value_tl } + }, style .initial:n = numeric, - resource .clist_set:N = \l__nju_bib_resource_clist + option .code:n = + { + \tl_if_in:VnTF \l_keys_value_tl { style = } + { \msg_error:nn { njuthesis } { extra-bib-style } } + { + \clist_gput_right:NV \g__nju_biblatex_option_clist + \l_keys_value_tl + } + }, + resource .code:n = + { + \clist_gput_right:NV \g__nju_bib_resource_clist + \l_keys_value_tl + }, } \NewDocumentCommand \addbibresource { m } - { \clist_gput_right:Nn \l__nju_bib_resource_clist { #1 } } + { \clist_gput_right:Nn \g__nju_bib_resource_clist { #1 } } \cs_new_protected:Npn \__nju_biblatex_pre_setup: { \cs_undefine:N \addbibresource - \clist_put_right:Nn \l__nju_tmp_clist { backend = biber } - \exp_args:NV \PassOptionsToPackage \l__nju_tmp_clist { biblatex } - \clist_clear:N \l__nju_tmp_clist + \clist_gput_right:Nn \g__nju_biblatex_option_clist { backend = biber } + \exp_args:NV \PassOptionsToPackage + \g__nju_biblatex_option_clist { biblatex } } \cs_new_protected:Npn \__nju_biblatex_post_setup: { - \defbibheading { njubib } [ \bibname ] { \njuchapter { ##1 } } - \DeclarePrintbibliographyDefaults { heading = njubib } - \clist_map_inline:Nn \l__nju_bib_resource_clist + \defbibheading { njubibintoc } [ \bibname ] { \__nju_chapter:V { ##1 } } + \tl_if_eq:NnTF \blx@refsecreset@level { 2 } + { \DeclarePrintbibliographyDefaults { heading = subbibintoc } } + { \DeclarePrintbibliographyDefaults { heading = njubibintoc } } + \clist_map_inline:Nn \g__nju_bib_resource_clist { \addbibresource { ##1 } } - \AtEveryBibitem - { - \clist_map_inline:nn - { abstract, issn, isbn, archivePrefix, arxivId, pmid, eprint } - { \clearfield { ##1 } } - % \ifentrytype{online} { } - % { - % \ifentrytype{misc} { } - % \clearfield{urldate} { \clearfield{url} } - % } - } } \BeforeBeginEnvironment { document } { @@ -893,6 +972,76 @@ { \clist_item:cn { l__nju_info_ #1 _clist } { 2 } } \__nju_vskip: } +\DeclareObjectType { nju } { \c_zero_int } +\DeclareTemplateInterface { nju } { element } { \c_zero_int } + { + content : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + bottom-skip : skip = \c_zero_skip, + align : choice { l, r, c, n } = c + } +\DeclareTemplateCode { nju } { element } { \c_zero_int } + { + content = \l__njuelem_content_tl, + format = \l__njuelem_format_tl, + bottom-skip = \l__njuelem_bottom_skip, + align = + { + l = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \flushleft + \tl_set_eq:NN \l__njuelem_end_align_tl \endflushleft }, + r = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \flushright + \tl_set_eq:NN \l__njuelem_end_align_tl \endflushright }, + c = + { \tl_set_eq:NN \l__njuelem_begin_align_tl \center + \tl_set_eq:NN \l__njuelem_end_align_tl \endcenter }, + n = + { \tl_clear:N \l__njuelem_begin_align_tl + \tl_clear:N \l__njuelem_end_align_tl } + } + } + { + \AssignTemplateKeys + \group_begin: + \l__njuelem_begin_align_tl + \l__njuelem_format_tl + \l__njuelem_content_tl \par + \l__njuelem_end_align_tl + \group_end: + \__nju_vskip:N \l__njuelem_bottom_skip + } +\DeclareTemplateInterface { nju } { page } { \c_zero_int } + { + element : commalist = \c_empty_clist, + prefix : tokenlist = \c_empty_tl, + format : tokenlist = \c_empty_tl, + top-skip : skip = \c_zero_skip, + bottom-skip : skip = \c_zero_skip + } +\DeclareTemplateCode { nju } { page } { \c_zero_int } + { + element = \l__njupage_element_clist, + prefix = \l__njupage_prefix_tl, + format = \l__njupage_format_tl, + top-skip = \l__njupage_top_skip, + bottom-skip = \l__njupage_bottom_skip + } + { + \AssignTemplateKeys + \newpage + \__nju_vskip:N \l__njupage_top_skip + \group_begin: + \l__njupage_format_tl + \clist_map_inline:Nn \l__njupage_element_clist + { \UseInstance { nju } { \l__njupage_prefix_tl ##1 } } + \group_end: + \__nju_vskip:N \l__njupage_bottom_skip + } +\cs_new_protected:Npn \__nju_declare_element:nn #1#2 + { \DeclareInstance { nju } {#1} { element } {#2} } +\cs_new_protected:Npn \__nju_declare_page:nn #1#2 + { \DeclareInstance { nju } {#1} { page } {#2} } \keys_define:nn { nju / style } { emblem-img .tl_set:N = \l__nju_emblem_img_tl, @@ -912,30 +1061,34 @@ { \includegraphics [ width = #2, height = #3 ] { \l__nju_name_img_tl } } } - \tl_set:Nn \l__nju_info_sm_date_tl - { - \exp_last_unbraced:NV - \__nju_date:www \l__nju_info_sm_date_raw_tl \q_stop - } - \int_compare:nF { \l__nju_info_degree_int == 1 } - { - \tl_set:Nn \l__nju_info_sm_date_en_tl - { - \exp_last_unbraced:NV - \__nju_date_en:www \l__nju_info_sm_date_raw_tl \q_stop - } - \tl_set:Nn \l__nju_info_df_date_tl - { - \exp_last_unbraced:NV - \__nju_date:www \l__nju_info_df_date_raw_tl \q_stop - } - } } -\cs_new_protected:Npn \__nju_cover_title_ug: - { \__nju_spread_box:nnn { 9 em } { \bf } { \l__nju_info_type_tl } } +\__nju_declare_element:nn { cover / ug / emblem-img } + { + content = \njuemblem [ black ] { ! } { 3.35 cm }, + bottom-skip = 1 cm, + align = l + } +\__nju_declare_element:nn { cover / ug / name-img } + { + content = \njuname [ black ] { ! } { 3 cm }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / ug / title } + { + content = + \__nju_spread_box:nnn { 9 em } { \bf } { \l__nju_info_type_tl }, + format = \zihao { -1 }, + bottom-skip = 0 pt plus 1.5 fill + } +\__nju_declare_element:nn { cover / ug / info } + { + content = + \__nju_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em }, + format = \zihao { 3 } + } \cs_new_protected:Npn \__nju_cover_info_ug:nnn #1#2#3 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \__nju_cover_entry:nnn { dept } { #1 } { #2 } \__nju_cover_entry:nnn { major } { #1 } { #2 } @@ -948,20 +1101,50 @@ \__nju_cover_entry:nnn { sm_date } { #1 } { #2 } \end{minipage} } -\cs_new_protected:Npn \__nju_cover_title_g: +\__nju_declare_element:nn { cover / g / emblem-img } + { + content = \njuemblem [ black ] { ! } { 1.9 cm }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / g / name-img } + { + content = \njuname [ black ] { 4.4 cm } { ! }, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / type } + { + content = + \__nju_spread_box:nnn { 9 em } { } { \l__nju_info_type_tl }, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / g / degree } { - \__nju_spread_box:nnn { 9em } { } { \l__nju_info_type_tl } \__nju_vskip: - \c__nju_name_degree_l_tl \l__nju_info_degree_tl \c__nju_name_degree_r_tl + content = \c__nju_name_apply_tl, + format = \zihao { -1 } \bfseries, + bottom-skip = 1 cm plus 1.5 fil } +\__nju_declare_element:nn { cover / g / info } + { + content = \__nju_cover_info_g:nn { 6.2 em } { 18 em }, + bottom-skip = 0 pt plus 1.5 fil + } +\__nju_declare_element:nn { cover / g / date } + { content = \l__nju_info_sm_date_tl } \cs_new_protected:Npn \__nju_cover_info_g:nn #1#2 { - \begin{minipage} [ c ] { #1 + #2 + 0.3 em } + \begin{minipage} { #1 + #2 + 0.3 em } \raggedleft \__nju_multiline_title:nnn { } { #1 } { #2 } \clist_map_inline:nn { author, major, field, supv_full } { \__nju_cover_entry:nnn { ##1 } { #1 } { #2 } } \end{minipage} } +\__nju_declare_element:nn { cover / g / back } + { + content = \__nju_cover_back_g:, + align = l + } \cs_new_protected:Npn \__nju_cover_back_g: { \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_id_tl } @@ -973,29 +1156,82 @@ \__nju_spread_box:nnn { 6.2 em } { \kaishu } { \c__nju_name_supv_full_tl } { : \__nju_quad: } \skip_horizontal:n { 8 em } \c__nju_name_sign_tl } -\cs_new_protected:Npn \__nju_cover_en_g: - { - \parbox { \textwidth } - { \centering \bf \sffamily \zihao { 2 } \l__nju_info_title_en_tl } - \skip_vertical:n { 1 cm } - \group_begin: \zihao { 4 } { by } \group_end: \__nju_vskip: - \group_begin: - \bf \sffamily \zihao { 4 } \l__nju_info_author_en_tl - \group_end: \skip_vertical:n { 1 cm } - \group_begin: \zihao { 4 } { Supervised~ by } \group_end: \__nju_vskip: - \group_begin: - \sffamily \zihao { 4 } \l__nju_info_supv_full_en_tl - \group_end: \vfill +\__nju_declare_element:nn { cover / g / en / title } + { + content = \l__nju_info_title_en_tl, + format = \bf \sffamily \zihao { 2 }, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / en / top } + { + content = + { by } + \skip_vertical:N \c_zero_skip + \textbf { \sffamily \l__nju_info_author_en_tl } + \skip_vertical:n { .5 cm } + { Supervised~ by } + \skip_vertical:N \c_zero_skip + \textsf { \l__nju_info_supv_full_en_tl }, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / g / en / middle } + { + content = \c__nju_cover_en_text_tl \__nju_vskip: \textsc { \clist_item:Nn \c__nju_name_degree_en_clist { \l__nju_info_degree_int } } \__nju_vskip: { in } \__nju_vskip: - \l__nju_info_major_en_tl \skip_vertical:n { 1 cm } - \njuemblem [ black ] { ! } { 2.5 cm } \__nju_vskip: - \l__nju_info_dept_en_tl \\ \c__nju_name_nju_en_tl - \skip_vertical:n { 1 cm } + \l__nju_info_major_en_tl, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / g / en / emblem-img } + { + content = \njuemblem [ black ] { ! } { 2.5 cm }, + bottom-skip = 1.5 cm + } +\__nju_declare_element:nn { cover / g / en / bottom } + { + content = + \l__nju_info_dept_en_tl \skip_vertical:N \c_zero_skip + \c__nju_name_nju_en_tl \skip_vertical:n { 1 cm } \l__nju_info_sm_date_en_tl } +\__nju_declare_element:nn { cover / nl / top } + { + content = \__nju_cover_top_nl:, + bottom-skip = 2 cm + } +\__nju_declare_element:nn { cover / nl / name } + { + content = + \__nju_spread_box:nnn { 6 em } { } { \c__nju_name_title_tl }, + format = \zihao { -0 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / nl / title } + { + content = \__nju_cover_title_nl:, + format = \zihao { 1 }, + bottom-skip = 1 cm + } +\__nju_declare_element:nn { cover / nl / middle } + { + content = \__nju_cover_info_nl:, + format = \zihao { 4 }, + bottom-skip = 0 pt plus 1.2 fil + } +\__nju_declare_element:nn { cover / nl / bottom } + { + content = \__nju_cover_bottom_nl:, + bottom-skip = 1 cm, + align = r + } +\__nju_declare_element:nn { cover / nl / date } + { + content = \__nju_qquad: 年 \__nju_quad: 月 \__nju_quad: 日, + format = \kaishu \zihao { 3 } + } \cs_new_protected:Npn \__nju_cover_top_nl: { \__nju_spread_box:nnn { 3.2 em } { } { \c__nju_name_clc_tl } \__nju_hskip: @@ -1007,15 +1243,14 @@ } \cs_new_protected:Npn \__nju_cover_title_nl: { - \noindent \kaishu \zihao { -0 } \skip_vertical:n { -1 cm } - \__nju_spread_box:nnn { 6 em } { } { \c__nju_name_title_tl } - \__nju_vskip: \zihao { 1 } \__nju_split_title:n { \l__nju_info_title_tl } \__nju_multiline_box:nnnn { \l__nju_tmp_int } \l__nju_tmp_clist { 3 } { 15 em } - \__nju_vskip: \zihao{4} \c__nju_name_title_nl_tl - \__nju_vskip: \zihao{1} + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } \c__nju_name_title_nl_tl } + \skip_vertical:N \c_zero_skip \__nju_ulined_center_box:nn { 4.5 em } { \l__nju_info_author_tl } - \__nju_vskip: \zihao{4} { ( } \c__nju_name_author_tl { ) } + \skip_vertical:n { - 0.5 cm } + { \zihao { 4 } { ( } \c__nju_name_author_tl { ) } } } \cs_new_protected:Npn \__nju_cover_info_nl: { @@ -1023,13 +1258,13 @@ { \clist_item:Nn \l__nju_info_supv_clist { 1 } } \tl_set:Nn \l__nju_info_supv_ttl_tl { \clist_item:Nn \l__nju_info_supv_clist { 2 } } - \__nju_uline_entry:nnnn \l__nju_tmp_dim { supv_info } { supv } { } \\ + \__nju_uline_entry:Nnnn \l__nju_tmp_dim { supv_info } { supv } { } \\ \__nju_ulined_center_box:nn { \textwidth } { \__nju_info:n { supv_ttl } \__nju_quad: \__nju_info:n { supv_cont } } \\ - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { degree } { degree } { } - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { major_nl } { major } { } \\ - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { sm_date } { sm_date } { } - \__nju_uline_bientry:nnnn \l__nju_tmp_dim { df_date } { df_date } { } \\ + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { degree } { degree } { } + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { major_nl } { major } { } \\ + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { sm_date } { sm_date } { } + \__nju_uline_bientry:Nnnn \l__nju_tmp_dim { df_date } { df_date } { } \\ \__nju_full_uline:Nn \l__nju_tmp_dim { \c__nju_name_confer_tl } \__nju_uline:n { \l__nju_tmp_dim } } @@ -1041,69 +1276,47 @@ \__nju_multiline_box:nnnn { \l__nju_tmp_int } { \l__nju_info_reviewer_clist } { 4 } { 9 em } } -\cs_new_protected:Npn \__nju_make_cover_ug: +\__nju_declare_page:nn { cover-ug-default } { - \newpage - \null \skip_horizontal:n { -1 cm } - \njuemblem [ black ] { ! } { 3.35 cm } - \begin{center} - \njuname [ black ] { ! } { 3 cm } \__nju_vskip: - \group_begin: \zihao { -1 } \__nju_cover_title_ug: \group_end: - \skip_vertical:n { 1.5 cm } \vfil - \zihao{3} \__nju_cover_info_ug:nnn { 4.2 em } { 16 em } { 5.5 em } \vfil - \end{center} + element = { emblem-img, name-img, title, info }, + prefix = cover / ug /, + bottom-skip = 0.5 cm plus 1.5 fill } -\cs_new_protected:Npn \__nju_make_cover_g: +\__nju_declare_page:nn { cover-g-front-default } { - \newpage - \begin{center} - \null \skip_vertical:n { 1 cm } - \njuemblem [ black ] { ! } { 1.9 cm } \skip_vertical:n { 0.5 cm } - \njuname [ black ] { 4.4 cm } { ! } \__nju_vskip: - \group_begin: - \zihao { -1 } \bf \kaishu \__nju_cover_title_g: - \group_end: - \skip_vertical:n { 3 cm } \vfil - \group_begin: - \zihao { 3 } \kaishu - \__nju_cover_info_g:nn { 6.2 em } { 18 em } \vfil - \skip_vertical:n { 2 cm } \l__nju_info_sm_date_tl - \group_end: - \end{center} - \newpage - \noindent \null \skip_vertical:n { 18 cm } - \group_begin: - \zihao { 3 } \kaishu \__nju_cover_back_g: - \group_end: - \newpage - \noindent \null \skip_vertical:n { 2 cm } - \begin{center} - \__nju_cover_en_g: - \end{center} + element = { emblem-img, name-img, type, degree, info, date }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 1.5 cm } -\cs_new_protected:Npn \__nju_make_cover_nl: +\__nju_declare_page:nn { cover-g-back-default } { - \pdfbookmark [ 0 ] { 国家图书馆封面 } { nlcover } - \noindent \null - \begin{center} - \zihao{ -4 } \skip_vertical:n { -2 cm } - \__nju_cover_top_nl: - \end{center} - \begin{center} - \skip_vertical:n { -2 cm } - \__nju_cover_title_nl: - \end{center} - \group_begin: - \kaishu \zihao { 4 } \noindent \__nju_cover_info_nl: - \group_end: - \begin{flushright} - \__nju_cover_bottom_nl: - \end{flushright} - \begin{center} - \kaishu \zihao{3} \__nju_qquad: 年 \__nju_quad: 月 \__nju_quad: 日 - \end{center} - \skip_vertical:n { -1 cm } + element = { back }, + prefix = cover / g /, + format = \zihao { 3 } \kaishu, + top-skip = 20 cm } +\__nju_declare_page:nn { cover-g-en-default } + { + element = { title, top, middle, emblem-img, bottom }, + prefix = cover / g / en /, + top-skip = 0 pt plus 1.2 fil + } +\__nju_declare_page:nn { cover-nl-default } + { + element = { top, name, title, middle, bottom, date }, + prefix = cover / nl /, + format = \kaishu + } +\cs_new_protected:Npn \__nju_make_cover_ug: + { \UseInstance { nju } { cover-ug-default } } +\cs_new_protected:Npn \__nju_make_cover_g: + { + \clist_map_inline:nn { front, back, en } + { \UseInstance { nju } { cover-g- ##1 -default } } + } +\cs_new_protected:Npn \__nju_make_cover_nl: + { \UseInstance { nju } { cover-nl-default } } \cs_new_protected:Npn \__nju_make_orig_decl: { \chapter* { \c__nju_name_nju_tl \c__nju_name_orig_decl_tl } @@ -1123,7 +1336,8 @@ { \bool_if:NF \g__nju_draft_bool { - \pagestyle { empty } + \pagestyle { empty } + \pagenumbering { gobble } \bool_if:NTF \g__nju_nlcover_bool { \__nju_make_cover_nl: } { \use:c { __nju_make_cover_ \l__nju_info_diploma_tl : } } @@ -1135,29 +1349,29 @@ \pagenumbering { Roman } \normalfont \normalsize } +\keys_define:nn { nju / style } + { + abstract-in-toc .bool_gset:N = \g__nju_abs_in_toc_bool, + abstract-in-toc .initial:n = true + } +\cs_new_protected:Npn \__nju_abs_bookmark:nn #1#2 + { + \phantomsection + \bool_if:NTF \g__nju_abs_in_toc_bool + { \__nju_add_tocline:n { #1 } } + { \pdfbookmark [0] { #1 } { #2 } } + } +\cs_generate_variant:Nn \__nju_abs_bookmark:nn { Vn } \cs_new_protected:Npn \__nju_abs_title_uuline:n #1 { \bf \kaishu \zihao { -2 } \__nju_uuline:n { #1 } } \cs_new_protected:Npn \__nju_abs_info_style:n #1 { \noindent \zihao{ #1 } \kaishu } \cs_new_protected:Npn \__nju_abs_info_style_en: #1 { \zihao{ #1 } } -\cs_new_protected:Npn \__nju_abs_bookmark: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c__nju_sec_format_tl \c__nju_name_lang_tl \c__nju_name_abstract_tl } - } -\cs_new_protected:Npn \__nju_abs_bookmark_en: - { - \phantomsection - \addcontentsline { toc } { chapter } - { \c__nju_sec_format_tl \c__nju_name_abstract_en_tl } - } -\cs_generate_variant:Nn \clist_map_inline:nn { Vn } \cs_new_protected:Npn \__nju_abs_title_ug:n #1 { - \__nju_name:n { nju } \__nju_name:n { type } - \__nju_name:n { lang #1 } \__nju_name:n { abstract } + \clist_map_inline:nn { nju, type, lang #1, abstract } + { \__nju_name:n { ##1 } } } \cs_new_protected:Npn \__nju_abs_info_ug:nn #1#2 { @@ -1214,18 +1428,27 @@ \tl_range:Nnn \l__nju_info_title_en_tl { 41 } { -1 } \clist_map_inline:nn { major, author, supv_full } { \\ - \__nju_uline_entry:nnnn \l__nju_tmp_dim { ##1 _en } { ##1 _en } { #2 } + \__nju_uline_entry:Nnnn \l__nju_tmp_dim { ##1 _en } { ##1 _en } { #2 } } } } \cs_new_protected:Npn \__nju_print_keywords:nn #1#2 { - \skip_vertical:n { 2 ex } - \group_begin: - \noindent \bf \heiti - \use:c { c__nju_name_keywords #1 _tl } - \group_end: - \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } + \exp_args:NNc + \tl_set_eq:NN \l__nju_tmp_tl { c__nju_name_keywords #1 _tl } + \__nju_get_text_width:Nn \l__nju_tmp_dim { \l__nju_tmp_tl } + \list { } + { + \labelwidth \l__nju_tmp_dim + \labelsep \c_zero_dim + \leftmargin \c_zero_dim + \rightmargin \c_zero_dim + \advance \leftmargin \l__nju_tmp_dim + \cs_set_eq:NN \makelabel \textbf + } + \item [ \l__nju_tmp_tl ] + \clist_use:cn { l__nju_info_keywords #1 _clist } { #2 } + \endlist } \cs_new_protected:Npn \__nju_make_abs_ug:nn #1#2 { @@ -1249,26 +1472,29 @@ \__nju_abs_info_g:nn { #1 } { #2 } \group_end: \__nju_vskip: } -\NewDocumentEnvironment{abstract} { +b } +\NewDocumentEnvironment { abstract } { +b } { \cleardoublepage - \__nju_abs_bookmark: + \thispagestyle { plain } + \__nju_abs_bookmark:Vn + { \c__nju_name_lang_tl \c__nju_name_abstract_tl } { abstract } \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { } { : } \group_begin: \kaishu \zihao { -4 } #1 } { \__nju_print_keywords:nn { } { ; } \group_end: } -\NewDocumentEnvironment{abstract*} { +b } +\NewDocumentEnvironment { abstract* } { +b } { \cleardoublepage - \__nju_abs_bookmark_en: + \thispagestyle { plain } + \__nju_abs_bookmark:Vn { \c__nju_name_abstract_en_tl } { abstract-en } \use:c { __nju_make_abs_ \l__nju_info_diploma_tl :nn } { _en } { :~ } - \group_begin: \kaishu \zihao{ -4 } #1 + \group_begin: \zihao{ -4 } #1 } { \__nju_print_keywords:nn { _en } { ;~ } \group_end: } \NewDocumentEnvironment { preface } { +b } - { \njuchapter { \c__nju_name_preface_tl } #1 } { } + { \__nju_chapter:V { \c__nju_name_preface_tl } #1 } { } \NewDocumentEnvironment { acknowledgement } { +b } - { \njuchapter { \c__nju_name_acknowledgement_tl } #1 } { } + { \__nju_chapter:V { \c__nju_name_acknowledgement_tl } #1 } { } \NewDocumentCommand \njupaperlist { O { \c__nju_name_paperlist_tl } m } { @@ -1287,6 +1513,34 @@ \end{refsection} \group_end: } +\cs_new_protected:Npn \__nju_notation_label:n #1 { #1 \hfil } +\cs_new_protected:Npn \__nju_make_notation:nn #1#2 + { + \dim_set:Nn \l__nju_tmp_dim { \textwidth - #1 - #2 } + \list { } + { + \labelwidth #2 + \labelsep \c_zero_dim + \itemsep \c_zero_dim + \parsep \c_zero_dim + \leftmargin .5\l__nju_tmp_dim + \rightmargin \leftmargin + \advance \leftmargin #2 + \cs_set_eq:NN \makelabel \__nju_notation_label:n + } + } +\NewDocumentEnvironment { notation } { O { 10 em } O { 5 em } } + { + \__nju_chapter:V { \c__nju_name_notation_tl } + \__nju_make_notation:nn { #1 } { #2 } + } + { \endlist } +\NewDocumentEnvironment { notation* } { O { 10 em } O { 5 em } } + { + \chapter * { \c__nju_name_notation_tl } + \__nju_make_notation:nn { #1 } { #2 } + } + { \endlist } \endinput %% %% End of file `njuthesis.cls'. -- cgit v1.2.3