summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/njuthesis/njuthesis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/unicodetex/latex/njuthesis/njuthesis.dtx')
-rw-r--r--macros/unicodetex/latex/njuthesis/njuthesis.dtx524
1 files changed, 297 insertions, 227 deletions
diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.dtx b/macros/unicodetex/latex/njuthesis/njuthesis.dtx
index 42cf9a9e77..926b68a51c 100644
--- a/macros/unicodetex/latex/njuthesis/njuthesis.dtx
+++ b/macros/unicodetex/latex/njuthesis/njuthesis.dtx
@@ -12,6 +12,16 @@
%
% https://www.latex-project.org/lppl.txt
%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Yu Xiong.
+%
+% This work consists of the files njuthesis.dtx,
+% and the derived files njuthesis.ins,
+% njuthesis.cls,
+% njuthesis.pdf,
+% and README.md.
+%
% -----------------------------------------------------------------------
%
% The development version of the template can be found at
@@ -33,7 +43,7 @@
%</internal>
%
%<*install>
-\input l3docstrip.tex
+\input docstrip.tex
\keepsilent
\askforoverwritefalse
@@ -43,7 +53,7 @@ Copyright (C) 2021
by Nanjing University Linux User Group <nju.lug@yaoge123.cn>
This file may be distributed and/or modified under the conditions of
-the LaTeX Project Public License, either version 1.3 of this license
+the LaTeX Project Public License, either version 1.3c of this license
or (at your option) any later version. The latest version of this
license is in:
@@ -60,9 +70,6 @@ through XeTeX.
\generate{
\usedir{tex/latex/njuthesis}
\file{\jobname.cls} {\from{\jobname.dtx}{class}}
- \file{njuvisual.sty}
- {\from{\jobname.dtx}{visual}
- \from{njuvisual.dtx}{visual}}
%</install>
%<*internal>
\usedir{source/latex/njuthesis}
@@ -81,7 +88,6 @@ through XeTeX.
\Msg{* *}
\Msg{* njuthesis.cls *}
\Msg{* njuthesis.ins *}
-\Msg{* njuvisual.sty *}
\Msg{* *}
\Msg{* To produce the documentation, run the file njuthesis.dtx *}
\Msg{* through XeLaTeX. *}
@@ -97,44 +103,39 @@ through XeTeX.
\fi
%</internal>
%
-%<class|visual>\NeedsTeXFormat{LaTeX2e}
-%<class|visual>\RequirePackage{expl3}
-%<class|visual>\GetIdInfo $Id: njuthesis.dtx 0.11.0 2021-10-01 19:00:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $
+%<class>\NeedsTeXFormat{LaTeX2e}
+%<class>\RequirePackage{expl3}
+%<class>\GetIdInfo $Id: njuthesis.dtx 0.12.0 2021-11-30 11:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $
%<class> { Thesis template for Nanjing University }
%<class>\ProvidesExplClass{njuthesis}
-%<visual> { LaTeX3 Package for NJU Visual Identity }
-%<visual>\ProvidesExplPackage{njuvisual}
-%<class|visual>{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+%<class>{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
%
%<*driver>
\ProvidesFile{njuthesis.dtx}
\documentclass{ctxdoc}
-\usepackage{listings,xcolor,tabularray}
+\usepackage{floatrow,tabularray,njuvisual}
+\usepackage[firstpage=true]{background}
+\backgroundsetup{contents={\njuemblem[white!85!gray]{22cm}{!}},scale=1,angle=0,hshift=-4cm}
\setlist[1]{labelindent=0.5em}
\UseTblrLibrary{booktabs,siunitx,diagbox}
\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable}
\SetTblrStyle{caption-tag}{font=\bfseries}
\DefTblrTemplate{caption-sep}{default}{\quad}
-\definecolor{njuviolet}{cmyk}{0.5,1,0,0.4}
-\definecolor{njumagenta}{cmyk}{0.05,1,0.55,0}
-\definecolor{njublue}{cmyk}{0.8,0.5,0,0}
-\definecolor{njuyellow}{cmyk}{0,0.3,1,0}
\begin{document}
- \DocInput{njuthesis.dtx}
- \DocInput{njuvisual.dtx}
+ \DocInput{njuthesis.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
-% \title{\color{njuviolet}{The \textsc{NJuThesis} class\\ 南京大学学位论文模板}}
+% \title{\color{njuviolet}{The \cls{njuthesis} class\\ 南京大学学位论文模板}}
%
% \author{^^A
% Nanjing University Linux User Group
% \thanks{E-mail: \href{mailto:nju.lug@yaoge123.cn}{nju.lug@yaoge123.cn}}}
%
-% \date{v0.11.0 \\ Released 2021-10-01}
+% \date{v0.12.0 \\ Released 2021-11-30}
%
% \changes{v0.1}{2021/09/04}{开始开发。}
% \changes{v0.2}{2021/09/07}{初步搭建了可用的模板。}
@@ -150,44 +151,51 @@ through XeTeX.
% \changes{v0.9}{2021/09/15}{大幅度修改宏名称以符合\hologo{LaTeX3}规范。}
% \changes{v0.9}{2021/09/15}{进一步完善文档。}
% \changes{v0.10}{2021/09/24}{删除了生成自述文件的代码。}
+% \changes{v0.12}{2021/11/28}{删除内置的 \pkg{njuvisual} 代码。}
+% \changes{v0.12}{2021/11/29}{更新了说明文档封面设计。}
%
% \maketitle
%
% \begin{abstract}
-% 南京大学学位论文\hologo{LaTeX}模板基于本科生院的论文撰写规范制作,
-% 同时参考研究生院提供的硕士、博士学位材料包,
-% 用于生成符合南京大学学位论文排版要求和相应的国家规范、行业标准的学位论文,
-% 旨在为同学提供毕业论文书写的方便。
+% 南京大学学位论文 \hologo{LaTeX} 模板 \cls{njuthesis} 基于本科生院的论文撰写
+% 规范制作,同时参考研究生院提供的硕士、博士学位材料包,用于生成符合南京大学学
+% 位论文排版要求和相应的国家规范、行业标准的学位论文,旨在为同学提供毕业论文书
+% 写的方便。
% \end{abstract}
%
% \def\abstractname{Abstract}
% \begin{abstract}
-% The \textsc{NJuThesis} class is intended for
-% typesetting Nanjing University thesis with \hologo{LaTeX},
-% providing support for bachelor, master, and doctoral thesis.
+% The \cls{njuthesis} class is intended for typesetting Nanjing University
+% dissertations with \hologo{LaTeX}, providing support for bachelor, masters,
+% and doctoral thesis.
% \end{abstract}
%
% \vspace{2cm}
% \def\abstractname{特别声明}
% \begin{abstract}
-% 请注意,本模板仍未完成开发,出现bug或者文档不完善属于正常情况,提issue或Pull Request即可。
-% \href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU LUG}始终欢迎您的加入与贡献!
+% 请注意,本模板仍未完成开发,出现bug或者文档不完善属于正常情况,欢迎提交
+% issue 或 Pull Request。
+%
+% 本模板未经学校官方部门的审核,作者不对使用本模板产生的格式审查问题负责。
+%
+% \href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU LUG}始终欢迎
+% 您的加入!
% \end{abstract}
%
% \clearpage
%
% \setcounter{tocdepth}{4}
% \tableofcontents
+%
% \clearpage
%
% \EnableDocumentation
-%^^A \DisableDocumentation
%
% \begin{documentation}
%
%
% \section{模板介绍}
-% \textsc{NJuThesis},即南京大学学位论文模板,是一个由南京大学LUG组织维护的,用于处理本校学生毕业论文排版需求的\hologo{LaTeX}模板。
+% \cls{njuthesis},即南京大学学位论文模板,是一个由南京大学 LUG 组织维护的,用于处理本校学生毕业论文排版需求的 \hologo{LaTeX} 模板。
%
% \subsection{历史沿革}
%
@@ -217,7 +225,7 @@ through XeTeX.
% \end{itemize}
%
% \subsection{君\hologo{LaTeX}本当上手}
-% \hologo{LaTeX}并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须要面对的情况。目前,中文互联网上的\hologo{LaTeX}写作教程不能说屈指可数,起码也是汗牛充栋,比较著名的包括刘海洋的《\hologo{LaTeX}入门》等等都是不错的参考资料。然而如何快速准确找到所需要的用法,尤其是\hologo{LaTeX3}的新接口,需要一定的时间或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您的相关知识体系,只能\textbf{尽力做到有求必应},在需要的地方顺带提一嘴,保证您少走点弯路。
+% \hologo{LaTeX}并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须要面对的情况。目前,中文互联网上的 \hologo{LaTeX} 写作教程不能说屈指可数,起码也是汗牛充栋,比较著名的包括刘海洋的《\hologo{LaTeX}入门》等等都是不错的参考资料。然而如何快速准确找到所需要的用法,尤其是 \hologo{LaTeX3} 的新接口,需要一定的时间或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您的相关知识体系,只能\emph{尽力做到有求必应},在需要的地方顺带提一嘴,保证您少走点弯路。
%
% \subsection{关于本说明手册}
%
@@ -236,12 +244,14 @@ through XeTeX.
%
% \subsubsection{自动安装}
%
-% \pkg{njuthesis}已经于2021年9月12日\href{https://ctan.org/pkg/njuthesis}{发布在CTAN}(Comprehensive \hologo{TeX} Archive Network),将在明年进入\hologo{TeX}\,Live 2022。
+% \href{https://ctan.org/pkg/njuthesis}{\cls{njuthesis}} 已经于2021年9月12日发布在CTAN(Comprehensive \hologo{TeX} Archive Network),将在明年进入\hologo{TeX}\,Live 2022。
+% \href{https://ctan.org/pkg/njuvisual}{\pkg{njuvisual}} 也已于同年11月28日发布。
% 目前,南大\hologo{TeX}已预置本模板,详见\ref{subsec:onlinecompile}。
% 您可以通过 \hologo{TeX}\,Live Manager 或者 \hologo{MiKTeX} Console 等
-% 图形化包管理器直接安装并使用最新的稳定版,也可以使用 \pkg{tlmgr}
+% 图形化包管理器直接安装并使用以上两个宏包最新的稳定版,也可以使用 \pkg{tlmgr}
% \begin{ctexexam}
% tlmgr install njuthesis
+% tlmgr install njuvisual
% \end{ctexexam}
%
% 我们强烈建议使用这一类安装方式。
@@ -290,8 +300,6 @@ through XeTeX.
% \color{njuyellow}\file{njuthesis.ins} & 文档类安装脚本 \\
% \file{njuthesis.pdf} & 用户手册(本文档) \\
% \file{njuthesis-sample.tex} & 示例文档,不妨以此为基础撰写论文 \\
-% \color{njuyellow}\file{njuvisual.dtx} & 视觉识别系统源代码 \\
-% \file{njuvisual.sty} & 南京大学视觉识别系统 \\
% \file{README.md} & 自述文件 \\
% \bottomrule
% \end{tabular}
@@ -300,69 +308,95 @@ through XeTeX.
% \subsection{本地编译}
% \label{subsec:localcompile}
%
+% 本地编译的安装过程分为两个阶段:安装 \hologo{TeX} 发行版以及配置编辑器。前者提供了可以被命令行终端调用的编译程序,后者则提供了语法高亮、自动编译等人性化功能。
+%
% \subsubsection{安装\hologo{TeX}发行版}
%
-% 首先需要下载\hologo{TeX}软件发行版,校园网环境中使用\href{https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南大镜像站}可以获得最好的体验。\textbf{推荐使用最新的\hologo{TeX}\,Live 2021或者\hologo{MiKTeX} 21以避免潜在的兼容性问题。使用\hologo{LuaLaTeX}编译需要将\pkg{LuaTeX-ja}包更新至2021-09-19或更新的版本}
+% 首先需要下载并安装 \hologo{TeX} 软件发行版,各操作系统适用情况请参考表\ref {tab:texdistribution}。第一次编译前请务必通过 MiKTeX Console、TeX Live Manager 等图形化程序或 \pkg{tlmgr}\emph{手动更新全部宏包}以避免潜在的兼容性问题。
+%
+% \begin{table}[H]
+% \centering
+% \caption{\hologo{TeX} 软件发行版一览}
+% \label{tab:texdistribution}
+% \begin{tabular}{cccc}
+% \toprule
+% \hologo{TeX} & Windows & macOS & Linux \\
+% \midrule
+% \hologo{TeX}\,Live & $\bullet$ & $\bullet$ & $\bullet$ \\
+% mac\hologo{TeX} & & $\bullet$ & \\
+% \hologo{MiKTeX} & $\bullet$ & $\bullet$ & \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
%
+% 以下是一些值得注意的要点:
% \begin{itemize}
-% \item 为了避免不必要的麻烦,请尽可能下载 full 版本,如 texlive-full。简而言之,下载大的那个。
-% \item 并且,尽可能使用最新版(截至目前是 2021)。2020 及之前版本使用 PDF 格式的图片可能会出现加粗问题以及l3语法解释错误。
+% \item 校园网环境中访问\href{https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南大镜像站}可以获得最佳的下载体验。
+% \item 使用最新的发行版,即版本号为2021或者21。
+% \item 对于 Windows 和 macOS 用户,更推荐轻量化的 \hologo{MiKTeX} 套件。
+% \item Linux用户请尽可能下载 full 版本,如 |texlive-full|。换言之,下载最大的软件包。
+% \item 对于一部分用到新版本特性的宏包,\cls{njuthesis}内置了版本检查,请确认各宏包已升级至最新版。
% \end{itemize}
%
-% 下表是目前经过测试的环境。如果有其他可用不可用的环境,欢迎补充。
-% \begin{table}[ht]
-% \centering
-% \caption{经过测试的环境}
-% \label{tab:1}
-% \begin{tabular}{ccc}
-% \toprule
-% OS & TeX & 测试情况 \\
-% \midrule
-% Windows 10 & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\
-% Windows 10 & \hologo{TeX}\,Live 2021 & 通过 \\
-% Windows 10 & \hologo{MiKTeX} & 通过 \\
-% macOS 10.15 & mac\hologo{TeX} 2021 & 通过 \\
-% Ubuntu 20.04 & \hologo{TeX}\,Live 2021 & 通过 \\
-% Arch Linux & \hologo{TeX}\,Live 2021 & 通过 \\
-% \bottomrule
-% \end{tabular}
-% \end{table}
-%
-% \subsubsection{选择编辑器}
+% \subsubsection{配置编辑器}
+% \changes{v0.11}{2021/11/23}{提供TeXstudio配置文件。}
%
-% 配置完编译器后,还需要一个\textbf{文本编辑器}作为前端来完成\file{.tex}文件内容的写作。
+% 配置完编译器后,还需要一个\emph{文本编辑器}来完成\file{.tex}文件内容的写作。
%
-% 至今仍有相当一部分人认为Windows自带的\emph{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\textbf{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}},来完成论文编写。你也可以根据个人的喜好随便使用其他编辑器,如 TeXworks、TeX Studio 等,顺手就行。
+% 关于具体使用哪一种,至今仍有相当一部分人认为Windows自带的\emph{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\emph{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}}。你也可以根据个人的喜好随意使用 TeXworks、TeXstudio 等编辑器,顺手就行。
%
-% 若使用 \hologo{LaTeX} Workshop 插件,本项目在|.vscode/|中提供一份简易配置,可以省略初始配置步骤直接使用。
+% \cls{njuthesis} 为一些常见编辑器提供了配置文件,如
+% \begin{description}
+% \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}
%
% \subsubsection{编译顺序}
-% 假设即将使用的文件名为\file{mynjuthesis.tex}
-% 应采用以下命令顺序进行编译,以生成正确的目录、编号和参考文献条目。
+% \label{subsubsec:compileseq}
+% \hologo{TeX} 本身是命令行程序,通过不同的命令调用所需的编译引擎。
+% 尽管上述的文本编辑器已经提供了自动化编译的方法,为了便于排查运行错误,以下通过具体终端命令简要描述编译过程。
+%
+% 编译本模板概括为如下步骤:生成初始文档,编译参考文献,生成页码、编号、目录,需要编译4次。
+% \emph{假设即将使用的文件名为 \file{mynjuthesis.tex}},
+% 应采用以下命令顺序进行编译,以生成内容正确的 \file{mynjuthesis.pdf}。输出的 PDF 文档位于同一目录下。
+%
+% 编译命令具体为引擎名称加文件名,在编译\file{.tex}文件时,文件扩展名可以省略不写。现阶段 \cls{njuthesis} 仅支持 \hologo{XeLaTeX} 与 \hologo{LuaLaTeX}。请注意,几种命令的输出文件基本相同,可以任取一种;但如果你不清楚这两种编译引擎的区别,我们建议优先使用|latexmk -xelatex|。
+%
+% \subparagraph{使用 \hologo{XeLaTeX}}
+%
% \begin{ctexexam}
% xelatex mynjuthesis
% biber mynjuthesis
% xelatex mynjuthesis
% xelatex mynjuthesis
% \end{ctexexam}
-% 使用 \pkg{latexmk}
-% \begin{ctexexam}
-% latexmk -xelatex mynjuthesis
-% \end{ctexexam}
%
+% \subparagraph{使用 \hologo{LuaLaTeX}}
% \begin{ctexexam}
% lualatex mynjuthesis
% biber mynjuthesis
% lualatex mynjuthesis
% lualatex mynjuthesis
% \end{ctexexam}
-% 使用 \pkg{latexmk}
+%
+% \subparagraph{使用 \pkg{latexmk}}
+% \href{https://mg.readthedocs.io/latexmk.html}{\pkg{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} 单独安装。
+% \end{description}
+%
+% 该命令的使用方法为
% \begin{ctexexam}
-% latexmk -lualatex mynjuthesis
+% latexmk mynjuthesis
% \end{ctexexam}
%
-% 编译产物为\file{njuthesis.pdf},位于主目录下。此外还会生成一系列中间文件,可以选择使用以下命令进行清理。
+% 如需指定编译器,可以加入|-xelatex|或|-lualatex|参数,例如指定 \hologo{XeLaTeX} 的命令为
+% \begin{ctexexam}
+% latexmk -xelatex mynjuthesis
+% \end{ctexexam}
%
+% 此外可以选择使用以下命令清理编译生成的临时文件。
% \begin{ctexexam}
% latexmk -c
% \end{ctexexam}
@@ -370,19 +404,19 @@ through XeTeX.
% \subsection{在线编译}
% \label{subsec:onlinecompile}
%
-% 相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长,占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{其实这三点都是对广大的Windows用户说的,同一个模板在Linux编译可以节省一半耗时}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。
+% 相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长\footnote{因此对于 Windows 推荐 \hologo{MiKTeX}。},占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{同一个模板在 Linux 编译可以相对 Windows 节省一半耗时。}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。
%
% \subsubsection{南大\hologo{TeX}平台简介}
% \changes{v0.2}{2021/09/07}{添加对南大\hologo{TeX}的支持。}
%
-% \href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的ShareLaTeX平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,面向南京大学全体师生开放,首次使用需凭学校邮箱自助注册账号。
+% \href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的 ShareLaTeX 平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,是 \href{https://sci.nju.edu.cn/}{eScience 中心}为南大在校师生提供的 \hologo{LaTeX} 在线编译平台,首次使用需凭学校邮箱自助注册账号。
%
% \subsubsection{操作步骤}
%
% \begin{enumerate}
% \item 访问\href{https://tex.nju.edu.cn}{南大\hologo{TeX}},点击界面右上方Register,使用\emph{南京大学邮箱}注册账号并登录
% \item 在项目页面左上角的Menu中,将编译器改为\hologo{XeLaTeX}或者\hologo{LuaLaTeX}
-% \item 仿照\file{njuthesis-sample.tex}编写论文
+% \item 仿照 \file{njuthesis-sample.tex} 编写论文
% \item 点击Compile按钮进行编译和预览
% \end{enumerate}
%
@@ -390,9 +424,11 @@ through XeTeX.
%
% \subsubsection{关于Overleaf}
%
-% 由于\href{https://www.overleaf.com/}{Overleaf平台}的\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了若干问题。因此\emph{请务必不要使用Overleaf官网进行编译}。
+% 由于\href{https://www.overleaf.com/}{Overleaf} 平台的\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了若干问题。因此\emph{请务必不要使用Overleaf官网进行编译}。
%
+% \subsubsection{关于TeXPage}
%
+% \href{https://www.texpage.com/}{TeXPage} 是国人研发的\hologo{LaTeX}在线编辑器,当前版本已具备较为完善的编辑编译功能,而且免费版相对 Overleaf 增加了公式识别、编辑历史等实用工具,也可以作为一个备选项。目前的缺憾是对于 \cls{njuthesis} 的编译速度较慢。
%
% \section{使用方法}
%
@@ -434,7 +470,7 @@ through XeTeX.
% degree = <(ug)|mg|mf|phd>
% \end{syntax}
%
-% 选择学位,分别为本科、学术型硕士、专业硕士、博士。
+% 选择学位,分别为学士、学术型硕士、专业硕士、博士。
% \end{function}
%
% \begin{function}[added=2021-09-07]{nlcover}
@@ -545,15 +581,15 @@ through XeTeX.
%
% 若要手动选择字体,则需将字体设置为 \opt{none},再通过 \pkg{fontspec} 宏包或 \pkg{ctex} 宏包中给出的命令来实现。
%
-% 最后,出于统一格式的需要,本模板还选取了与正文字体相似度最高的数学字体(\href{https://www.stixfonts.org}{STIX 字体})用于公式排版。
+% 最后,出于统一格式的需要,本模板还选取了与正文字体相似度最高的数学字体(\href{https://github.com/aliftype/xits}{XITS 字体})用于公式排版。
%
% 本节提及的字库中,中文字库只有方正书宋、方正黑体、方正楷体、方正仿宋、两种思源字体和四种Fandol字体能够\emph{免费商用};
-% 英文字库中只有 Times New Roman、STIX 和三种\Hologo{TeX} Gyre字体能够\emph{免费商用}。
+% 英文字库中只有 Times New Roman、XITS 和三种\Hologo{TeX} Gyre字体能够\emph{免费商用}。
% 因此,若需要将本模板用于商业相关的活动,请咨询专业人士。
%
% \subsection{个人信息}
%
-% \begin{function}[added=2021-09-10]{\njusetup}
+% \begin{function}[updated=2021-10-01]{\njusetup}
% \begin{syntax}
% \tn{njusetup}\Arg{键值列表}
% \end{syntax}
@@ -663,11 +699,12 @@ through XeTeX.
% udc = \Arg{udc}
% supervisor-contact = \Arg{导师联系方式}
% \end{syntax}
-% 国家图书馆封面相关,包括中图分类号、密级和udc。
+% 国家图书馆封面相关,包括中图分类号、密级、udc和导师联系方式。
% \end{function}
%
-% 本科生可以参考如下列表输入个人信息。注意不能有空行。
+% \subsubsection{输入示范}
%
+% 本科生可以参考如下列表输入个人信息。注意不能有空行。
%
% \begin{ctexexam}
% \njusetup {
@@ -793,7 +830,7 @@ through XeTeX.
% \end{ctexexam}
%
%
-% 文字环绕图像,\env{wrapfigure}后面不能有空行
+% 对于较为瘦长,或者仅起到辅助作用的图像,可以使用\env{wrapfigure}实现文字环绕效果。注意这个环境后紧跟的一行不能为空。
%
% \begin{ctexexam}
% \begin{wrapfigure}{r}{0cm}
@@ -804,7 +841,7 @@ through XeTeX.
% <text>
% \end{ctexexam}
%
-% TODO:使用\pkg{subcaption}的\env{subfigure}实现多张图片并排的效果
+% TODO:使用\pkg{subcaption}的\env{subfigure}实现多张图片并排的效果。较为老旧的\pkg{subfigure}并不在此受到支持。
%
% \begin{ctexexam}
% \begin{figure}
@@ -829,9 +866,7 @@ through XeTeX.
%
% \subsubsection{表格}
%
-% 下面这个例子展示了如何插入一张表格。
-%
-% 通过\pkg{booktabs}提供的\tn{toprule}、\tn{midrule}和\tn{bottomrule},我们可以很轻松地绘制出一张漂亮规范的三线表。
+% 下面这个例子展示了如何插入一张表格。通过 \pkg{booktabs} 提供的 \tn{toprule}、\tn{midrule} 和 \tn{bottomrule},我们可以很轻松地绘制出一张漂亮规范的三线表。
% \begin{ctexexam}
% \begin{table}[htbp]
% \caption{我的表}
@@ -871,7 +906,7 @@ through XeTeX.
%
% \subsubsection{数学}
%
-% 符号表可以参考\url{https://www.caam.rice.edu/~heinken/latex/symbols.pdf}。单位请参考\pkg{siunitx}。
+% 符号表可以参考\url{https://www.caam.rice.edu/~heinken/latex/symbols.pdf}。单位请参考\pkg{siunitx}。\pkg{siunitx}是一个更新频繁的包,可能会引发兼容性问题。
%
% 行内公式形如|$\mathrm{e}^{(a+2b)x}$|
%
@@ -1052,50 +1087,18 @@ through XeTeX.
% \end{function}
%
% \subsection{视觉识别系统}
-%
-% \begin{function}[added=2021-09-24]{njuviolet,njumagenta,njublue,njuyellow}
-% \begin{syntax}
-% \tn{color}\Arg{颜色}
-% \end{syntax}
-% 定义并使用南京大学视觉形象规范化标准中给定的四种标准色:
-%
-% {\color{njuviolet}紫色}\hspace{1em}{\color{njumagenta}洋红}\hspace{1em}
-% {\color{njublue}蓝色}\hspace{1em}{\color{njuyellow}黄色}
-%
-% \end{function}
-%
-% \begin{function}[added=2021-09-24]{\njuemblem}
-% \begin{syntax}
-% \tn{njuemblem}\oarg{颜色}\Arg{宽度}\Arg{高度}
-% \end{syntax}
-% 生成指定颜色和大小的南京大学校徽。
-% \end{function}
-%
-% \begin{function}[added=2021-09-24]{\njuname,\njuname*}
-% \begin{syntax}
-% \tn{njuname}\oarg{颜色}\Arg{宽度}\Arg{高度}
-% \tn{njuname*}\oarg{颜色}\Arg{宽度}\Arg{高度}
-% \end{syntax}
-% 生成指定颜色和大小的南京大学校名,加星号的为英文校名。
-% \end{function}
-%
-%
-% \begin{function}[added=2021-09-24]{\njumotto}
-% \begin{syntax}
-% \tn{njumotto}\oarg{颜色}\Arg{宽度}\Arg{高度}
-% \end{syntax}
-% 生成指定颜色和大小的南京大学校训。
-% \end{function}
-%
-%
-% \begin{function}[added=2021-09-24]{\njuspirit}
-% \begin{syntax}
-% \tn{njuspirit}\oarg{颜色}\Arg{宽度}\Arg{高度}
-% \end{syntax}
-% 生成指定颜色和大小的南京大学校徽。
-% \end{function}
%
+% 视觉识别系统 \pkg{njuvisual} 现已被分离为独立宏包,基本使用方法举例如下:
+% \begin{ctexexam}
+% \njuemblem{!}{3cm} % 默认生成指定大小的紫色南大校徽
+% \njuname{4cm}{!} % 默认生成指定大小的紫色南大中文校名
+% \njuname*{4cm}{!} % 默认生成指定大小的紫色南大英文校名
+% \njuemblem[black]{!}{3cm} % 黑色的南大校徽
+% \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标
+% \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标
+% \end{ctexexam}
%
+% 本宏包的详细使用方法请参考其\href{http://mirrors.ctan.org/macros/latex/contrib/njuvisual/njuvisual.pdf}{说明文档}。
%
% \end{documentation}
%
@@ -1104,16 +1107,81 @@ through XeTeX.
% \section{代码实现}
% \changes{v0.10}{2021/09/26}{对代码实现部分进行了整理。}
%
-% |@@| 在 \pkg{l3docstrip} 中表示名空间,在删除注释生成格式文件时会被等号后的字段替换,譬如在本模板\pkg{njuthesis}中 |@@=nju|。
-% 尖括号包裹的|<*class>||</class>|用来指定某段代码属于哪个文件。
+% 本模板使用 \hologo{LaTeX3} 语法编写,依赖 \pkg{expl3} 环境,
+% 并需调用 \pkg{l3packages} 中的相关宏包。
+%
+% 以下代码中有一些形如 |<*class>|
+% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。
+% “|*|”和“|/|”分别表示该部分的开始和结束。不含
+% “|*|”和“|/|”的 guard 出现在行号右侧,它们用来确定
+% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。
+%
+% 另有若干包含|@@|的guard,在 \pkg{l3docstrip} 中表示名空间(模块)。
+% 在删除注释生成格式文件时,变量名称中的|@@|会被等号后的字段替换,
+% 譬如在本模板\cls{njuthesis}中 |@@=nju|。
+%
+% \subsection{准备}
%
% \begin{macrocode}
-%<@@=nju>
%<*class>
+%<@@=nju>
+% \end{macrocode}
+%
+% \changes{v0.11}{2021/10/23}{添加了若干环境检查与警告信息。}
+% 检查 \hologo{LaTeX3} 编程环境。
+% \begin{macrocode}
+\RequirePackage { xtemplate, l3keys2e }
+\msg_new:nnn { njuthesis } { l3-too-old }
+ {
+ Package~ "#1"~ is~ too~ old. \\\\
+ Please~ update~ an~ up-to-date~ version~ of~ \\
+ the~ bundles "l3kernel"~ and~ "l3packages"~ \\
+ using~ your~ TeX~ package manager~ or~ from~ \\
+ CTAN.
+ }
+\clist_map_inline:nn { xtemplate, l3keys2e }
+ {
+ \@ifpackagelater {#1} { 2021/08/27 }
+ { } { \msg_error:nnn { njuthesis } { l3-too-old } {#1} }
+ }
+
+% \end{macrocode}
+%
+% 目前 \cls{njuthesis} 仅支持 \hologo{XeTeX} 和 \hologo{LuaTeX}。
+% \begin{macrocode}
+\msg_new:nnn { njuthesis } { unsupported-engine }
+ {
+ The~ njuthesis~ class~ requires~ either~ \\
+ XeTeX~ or~ LuaTeX. \\\\
+ "#1"~ is~ not~ supported~ at~ present.~ \\
+ You~ must~ change your~ typesetting~ engine~ \\
+ to~ "xelatex"~ or~ "lualatex".
+ }
+\sys_if_engine_xetex:F
+ {
+ \sys_if_engine_luatex:F
+ {
+ \msg_fatal:nnx { njuthesis } { unsupported-engine }
+ { \c_sys_engine_str }
+ }
+ }
% \end{macrocode}
%
% \subsection{定义常量}
%
+% \begin{variable}{\c_@@_name_type_clist,
+% \c_@@_name_degree_clist,\c_@@_name_degree_en_clist}
+% 论文类型与学位类型。
+% \begin{macrocode}
+\clist_const:Nn \c_@@_name_type_clist
+ { 毕业论文, 毕业设计 }
+\clist_const:Nn \c_@@_name_degree_clist
+ { 学士, 硕士, 硕士专业, 博士 }
+\clist_const:Nn \c_@@_name_degree_en_clist
+ { Bachelor, Master, Master, Doctor~of~Philosophy }
+% \end{macrocode}
+% \end{variable}
+%
% \begin{macro}{\@@_define_name:nn,\@@_define_name:nnn}
% 用来定义默认名称的辅助函数。
% \begin{macrocode}
@@ -1142,17 +1210,15 @@ through XeTeX.
% \end{macrocode}
%
% \subsection{模板选项}
+% \changes{v0.11}{2021/11/15}{进行了效率优化。}
%
-% 用于配置模板选项的宏包。
-% \begin{macrocode}
-\RequirePackage{xparse,xtemplate,l3keys2e}
-% \end{macrocode}
-%
-% \begin{variable}{\l_@@_info_degree_tl,\l_@@_info_type_tl}
+% \begin{variable}{\g_@@_info_degree_int,\g_@@_info_type_int,
+% \g_@@_info_diploma_tl}
% 用于存储学位名称的变量,注意宏的命名,l代表局部变量,g代表全局变量
% \begin{macrocode}
-\tl_new:N \l_@@_info_degree_tl
-\tl_new:N \l_@@_info_type_tl
+\int_new:N \g_@@_info_degree_int
+\int_new:N \g_@@_info_type_int
+\tl_new:N \g_@@_info_diploma_tl
% \end{macrocode}
% \end{variable}
%
@@ -1174,8 +1240,8 @@ through XeTeX.
% 学位类型。
% \begin{macrocode}
degree .choices:nn =
- { ug, mg, mg, phd }
- { \tl_set_eq:NN \l_@@_info_degree_tl \l_keys_choice_tl },
+ { ug, mg, mf, phd }
+ { \int_set_eq:NN \g_@@_info_degree_int \l_keys_choice_int },
degree .initial:n = ug,
% \end{macrocode}
% \end{macro}
@@ -1185,7 +1251,7 @@ through XeTeX.
% \begin{macrocode}
type .choices:nn =
{ thesis, design }
- { \tl_set_eq:NN \l_@@_info_type_tl \l_keys_choice_tl },
+ { \int_set_eq:NN \g_@@_info_type_int \l_keys_choice_int },
type .initial:n = thesis,
% \end{macrocode}
% \end{macro}
@@ -1212,12 +1278,18 @@ through XeTeX.
% \end{macro}
%
% \begin{macro}{\ProcessKeysOptions}
-% 在定义完全部设置以后从tex文件导言区输入参数
+% 在定义完全部设置以后从tex文件导言区输入参数。
% \begin{macrocode}
\ProcessKeysOptions { nju }
% \end{macrocode}
% \end{macro}
%
+% 进行学位的判断。
+% \begin{macrocode}
+\int_compare:nTF { \g_@@_info_degree_int == 1 }
+ { \tl_set:Nn \g_@@_info_diploma_tl { ug } }
+ { \tl_set:Nn \g_@@_info_diploma_tl { g } }
+% \end{macrocode}
%
%
%
@@ -1236,7 +1308,7 @@ through XeTeX.
% \end{macrocode}
%
% \begin{macro}{info/titlea,info/titleb,info/titlec,info/title*}
-% 题目
+% 题目。以下标注星号(*)的为对应的英文字段。
% \begin{macrocode}
titlea .tl_set:N = \l_@@_info_title_a_tl,
titleb .tl_set:N = \l_@@_info_title_b_tl,
@@ -1247,7 +1319,7 @@ through XeTeX.
%
% \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,
@@ -1255,7 +1327,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \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,
@@ -1297,7 +1369,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \end{macro}
%
% \begin{macro}{info/submit-date,info/submit-date*}
- % 提交日期
+% 提交日期
% \begin{macrocode}
submit-date .tl_set:N = \l_@@_submit_date_tl,
submit-date* .tl_set:N = \l_@@_submit_date_en_tl,
@@ -1305,7 +1377,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \end{macro}
%
% \begin{macro}{info/defend-date,info/chairman,info/reviewer}
-% 答辩 TODO: 用clist处理答辩委员会成员名称
+% 答辩信息。
% \begin{macrocode}
defend-date .tl_set:N = \l_@@_defend_date_tl,
chairman .tl_set:N = \l_@@_info_chairman_tl,
@@ -1314,7 +1386,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \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,
@@ -1337,7 +1409,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
%
% \subsection{载入宏包}
%
-% 使用\pkg{ctexbook}文档类。
+% 使用\pkg{ctexbook}作为基础文档类。
% \begin{macrocode}
\LoadClass[
a4paper,
@@ -1346,7 +1418,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
scheme=chinese,
% \end{macrocode}
% 关于行距,\hologo{LaTeX}默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故
-% \[ 1.5\times\frac{1.3}{1.2} = 1.625\]
+% $1.5\times\frac{1.3}{1.2} = 1.625$
% \begin{macrocode}
linespread=1.625,
% \end{macrocode}
@@ -1443,6 +1515,31 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\RequirePackage{blindtext,zhlipsum}
% \end{macrocode}
%
+% \begin{macro}{\@@_check_package:nnn}
+% 检查过时宏包。
+% \begin{macrocode}
+\msg_new:nnn { njuthesis } { package-too-old }
+ {
+ Package~ "#1"~ is~ too~ old. \\
+ The~ njuthesis~ class~ only~ supports~ "#1"~ with~ \\
+ a~ version higher~ than~ v#2. \\\\
+ Please~ update~ an~ up-to-date~ version~ of~ it~ \\
+ using~ your TeX~ package~ manager~ or~ from~ CTAN.
+ }
+\cs_new_protected:Npn \@@_check_package:nnn #1#2#3
+ {
+ \@ifpackagelater {#1} {#2}
+ { } { \msg_error:nnnn { njuthesis } { package-too-old } {#1} {#3} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 检查绘制下划线所需的 \pkg{luatexja} 包版本。该宏包在2021-09-18的解决了下划线中断问题,然而在2021-10-24的更新才提供了正确的内嵌日期。
+% \begin{macrocode}
+\sys_if_engine_luatex:T
+ { \@@_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } }
+% \end{macrocode}
+%
% \subsection{字体设置}
%
% \pkg{fontspec}已在C\hologo{TeX}套件中包含,无需另外载入。
@@ -1635,6 +1732,12 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_cjk_font_founder:
{
+ \sys_if_engine_luatex:T
+ {
+ % 在 LuaTeX 中调整方正字体括号位置
+ % XeTeX 暂无好的解决方法
+ \defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}}
+ }
\setCJKmainfont{FZSSK}[% 方正书宋
Extension=.ttf,
BoldFont=FZXBSK,% 方正小标宋
@@ -1659,6 +1762,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% {FZYouHK_508R}[% 方正悠黑508R
% Extension=.ttf,
% BoldFont=FZYouHK_511M]% 方正悠黑511M
+ \defaultCJKfontfeatures{}
}
% \end{macrocode}
% \end{macro}
@@ -1724,7 +1828,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
%
% \changes{v0.10}{2021/09/28}{修正了数学字体。}
%
-% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近)
+% 设置数学字体 (XITS, 或者 \href{https://www.stixfonts.org}{STIX}, 与 Times New Roman 最为相近)
% \begin{macrocode}
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
@@ -1742,7 +1846,8 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \begin{macrocode}
\geometry{
vmargin = 2.5 cm,
- hmargin = 3.2 cm,
+ hmargin = 3.2 cm,
+ headheight = 15 pt
}
% \end{macrocode}
%
@@ -1768,7 +1873,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
%
% 载入页眉页脚设置。此处\tn{flushbottom}是为了防止目录页出现underfull \tn{vbox}信息。
% \begin{macrocode}
-\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug }
+\int_compare:nTF { \g_@@_info_degree_int == 1 }
{
% the header line
\tl_set:Nn \headrulewidth {0pt}
@@ -1781,7 +1886,6 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\tl_set:Nn \headrulewidth {1pt}
% the footer line
\tl_set:Nn \footrulewidth {0pt}
- \setlength{\headheight}{20pt}
\AtBeginDocument{\pagestyle{fancy}\flushbottom} % 研究生有页眉页脚
}
% \end{macrocode}
@@ -2130,7 +2234,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}}
% \end{macrocode}
%
-%
+% TODO: 简化数学环境的定义方法
% \begin{macrocode}
\declaretheorem[
name=算法,
@@ -2274,10 +2378,9 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
%
% 判断学位进行命令定义
% \begin{macrocode}
-\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug }
+\int_compare:nTF { \g_@@_info_degree_int == 1 }
{
% 本科
- \tl_const:Nn \l_@@_name_diploma_tl { 本科 }
\tl_const:Nn \c_@@_name_title_tl { 题\hfill 目 }
\tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt }
@@ -2293,7 +2396,6 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
}
{
% 本科以外都是研究生
- \tl_const:Nn \l_@@_name_diploma_tl { 研究生 }
\tl_const:Nn \c_@@_name_title_tl { 论\hfill 文\hfill 题\hfill 目 }
\tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt }
@@ -2303,19 +2405,6 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\tl_const:Nn \c_@@_cover_uline_bskip_tl { \hspace{1em} }
\tl_const:Nn \c_@@_cover_box_len_tl { 6em }
-
- % 研究生学位名称
- \str_if_eq:NNTF { \l_@@_info_degree_tl } { phd }
- {
- \tl_set:Nn \l_@@_name_degree_tl { 博士 }
- \tl_set:Nn \l_@@_name_degree_en_tl { Doctor~of~Philosophy }
- }
- {
- \tl_set:Nn \l_@@_name_degree_en_tl { Master }
- \str_if_eq:NNTF { \l_@@_info_degree_tl } { mg }
- { \tl_set:Nn \l_@@_name_degree_tl { 硕士 } }
- { \tl_set:Nn \l_@@_name_degree_tl { 硕士专业 } }
- }
}
% \end{macrocode}
% \begin{macro}{\@@_spread_box:nn}
@@ -2371,17 +2460,14 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_name_diploma_tl}
-% 判断类型
+% \begin{macro}{\@@_cover_degree:}
+% 学位类型。
% \begin{macrocode}
-\str_if_eq:NNTF { \l_@@_info_type_tl } { thesis }
-{
- \tl_const:Nn \l_@@_info_type_tl_name
- { \l_@@_name_diploma_tl 毕业论文 }
-}
+\cs_new_protected:Npn \@@_cover_degree:
{
- \tl_const:Nn \l_@@_info_type_tl_name
- { \l_@@_name_diploma_tl 毕业设计 }
+ { (申请 }
+ \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int }
+ { 学位) }
}
% \end{macrocode}
% \end{macro}
@@ -2419,7 +2505,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_covertab:
{%
- \str_if_eq:NNTF { \l_@@_info_degree_tl } { ug }
+\int_compare:nTF { \g_@@_info_degree_int == 1 }
{
\begin{tabular}{p{4.2em}c}
\@@_cover_box:n {院\hfill 系}
@@ -2576,7 +2662,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\begin{center}
\njuname{!}{3.35cm}
\vskip 10mm
- {\zihao{1}\bf\songti\@@_spread_box:nn {9em}{\l_@@_info_type_tl_name}}
+ {\zihao{1}\bf\songti\@@_spread_box:nn {9em}{本科毕业论文}}
\vfill
\vskip\stretch{0}
{\bgroup
@@ -2615,9 +2701,9 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\vskip 15mm
\bgroup
\zihao{1}\bf\kaishu
- \@@_spread_box:nn {10em}{\l_@@_info_type_tl_name}
+ \@@_spread_box:nn {10em}{研究生毕业论文}
\vskip 5mm
- {(申请\l_@@_name_degree_tl 学位)}
+ \@@_cover_degree:
\egroup
\par\vfill\vskip\stretch{0}
\bgroup
@@ -2651,15 +2737,8 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\vskip 15mm
\end{spacing}
\cleardoublepage
-}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_print_cover_en:}
+
% 研究生英文封面
-% \begin{macrocode}
-\cs_new_protected:Npn \@@_print_cover_en:
-{
\thispagestyle{empty}
\pdfbookmark{英文封面}{cover-en} % 将封面插入pdf书签
\begin{center}
@@ -2678,11 +2757,13 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
\l_@@_info_supv_b_title_en_tl
\hspace{.5em}\l_@@_info_supv_b_en_tl
\vskip\stretch{1}
- \normalsize\rmfamily{%
+ \normalsize\rmfamily{
A~dissertation~submitted~to\\
the~graduate~school~of~Nanjing~University\\
in~partial~fulfilment~of~the~requirements~for~the~degree~of\\
- {\textsc{\l_@@_name_degree_en_tl}}\\
+ \textsc{
+ \clist_item:Nn \c_@@_name_degree_en_clist { \g_@@_info_degree_int }
+ }\\
in\\
{\l_@@_major_en_tl}
}
@@ -2705,16 +2786,9 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% 重定义maketitle生成封面
% \begin{macrocode}
\tl_set:Nn \maketitle
-{%
- \str_if_eq:NNTF { \l_@@_info_degree_tl } { ug }
- {
- \@@_print_cover_ug: % 本科封面
- }
- {
- \bool_if:NT \g_@@_nlcover_bool { \@@_print_cover_nl: } % 国家图书馆封面
- \@@_print_cover_g: % 研究生封面
- \@@_print_cover_en: % 英文封面
- }
+{
+ \bool_if:NT \g_@@_nlcover_bool { \@@_print_cover_nl: } % 国家图书馆封面
+ \use:c { @@_print_cover_ \g_@@_info_diploma_tl : }
}
% \end{macrocode}
% \end{macro}
@@ -2810,7 +2884,7 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
毕业论文题目:\hspace{0.5em}\njuline{\l_@@_info_title_tl\hfill}\\
\njuline{\makebox[11em]{\l_@@_major_tl}}专业
\njuline{\makebox[4em]{\l_@@_info_grade_tl}}级
- \str_if_eq:NNTF {\l_@@_info_degree_tl} { phd } {博}{硕}
+ \int_compare:nTF { \g_@@_info_degree_int == 4} { 博 } { 硕 }
士生姓名:\njuline{\hfill\l_@@_info_author_tl\hfill}\\
指导教师(姓名、职称):\njuline{\hfill\l_@@_info_supv_full_tl\hfill}\par
\egroup
@@ -2837,29 +2911,25 @@ keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
}
% \end{macrocode}
% \end{macro}
-%
%
-% 判断学位
-%
+% \begin{macro}{abstract}
+% 中文摘要环境。
% \begin{macrocode}
-\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug }
-{
- \NewDocumentEnvironment{abstract} {}
- {\@@_print_abstract_ug:}{\@@_print_keywords:\newpage}
- \NewDocumentEnvironment{abstract*} {}
- {\@@_print_abstract_en_ug:}{\@@_print_keywords_en:\cleardoublepage}
-}
-{
- \NewDocumentEnvironment{abstract} {}
- {\@@_print_abstract_g:}{\@@_print_keywords:\newpage}
- \NewDocumentEnvironment{abstract*} {}
- {\@@_print_abstract_en_g:}{\@@_print_keywords_en:\cleardoublepage}
-}
+\NewDocumentEnvironment{abstract} { +b }
+ { \use:c { @@_print_abstract_ \g_@@_info_diploma_tl : } #1 }
+ { \@@_print_keywords: \newpage }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{abstract*}
+% 英文摘要环境。\pkg{xparse} 目前不支持合并带有星号的环境,因此需要单独定义。
+% \begin{macrocode}
+\NewDocumentEnvironment{abstract*} { +b }
+ { \use:c { @@_print_abstract_en_ \g_@@_info_diploma_tl : } #1 }
+ { \@@_print_keywords_en: \cleardoublepage }
%</class>
% \end{macrocode}
-%
-%
-%
+% \end{macro}
%
% \end{implementation}
%