Newer
Older
% \iffalse meta-comment
%
% Copyright (C) 2005-2021 by Nanjing University Linux User Group <my@yaoge123.com>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{njuthesis.dtx}[2021/09/12 0.8.3 Nanjing University Thesis Template]
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesExplClass{njuthesis}{2021-09-12}{0.8.3}{NJU Thesis LaTeX Template}
%
%<*driver>
\EnableCrossrefs
\CodelineIndex
\begin{document}
\DocInput{njuthesis.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
%
% \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode}
% \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter}
% \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection}
% \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter}
% \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut}
% \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage}
% \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\}
% \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi}
% \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand}
% \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect}
% \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize}
% \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny}
% \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty}
% \DoNotIndex{\textbf,\textit,\textsf,\textsc}
% \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad}
% \DoNotIndex{\centering,\raggedright,\ref}
% \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize}
% \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne}
% \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument}
%
%
% \changes{v0.8.3}{2021/09/12}{Initial docstrip version}
%
% \GetFileInfo{njuthesis.dtx}
%
% \def\indexname{索引}
% \IndexPrologue{\section{\indexname}}
%
% \title{南京大学学位论文模板}
% \author{Nanjing University Linux User Group \\[5pt]\texttt{my@yaoge123.com}}
% \date{v\fileversion\ (\filedate)}
% \maketitle\thispagestyle{empty}
%
%
% \begin{abstract}\noindent
% 南京大学学位论文\hologo{LaTeX}模板基于本科生院的论文撰写规范制作,同时参考研究生院提供的硕士、博士学位材料包,用于生成符合南京大学学位论文排版要求和相应的国家规范、行业标准的学位论文,旨在为同学提供毕业论文书写的方便。
% \end{abstract}
%
%
% \clearpage
% \pagestyle{fancy}
% \begin{multicols}{2}[
% \setlength{\columnseprule}{.4pt}
% \setlength{\columnsep}{18pt}]
% \tableofcontents
% \end{multicols}
% \clearpage
%
%
% \section{模板介绍}
%
% \section{贡献者}
% \label{sec:contributors}
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
% \section{配置环境}
% \label{sec:setup}
%
% 下表是目前经过测试的环境。如果有其他可用不可用的环境,欢迎补充。
%
% \begin{table}[ht]
% \caption{经过测试的环境}
% % \label{tab:1}
% \begin{tabular}{ccc}
% \toprule
% OS & TeX & 测试情况 \\
% \midrule
% Windows 10 & \hologo{TeX}\,Live 2021 & 通过 \\
% Windows 10 & \hologo{MiKTeX} & 通过 \\
% Windows 10 & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\
% macOS 10.15 & \hologo{TeX}\,Live 2021 & 通过 \\
% Ubuntu 20.04 & \hologo{TeX}\,Live 2021 & 通过 \\
% 南大\hologo{TeX} & \hologo{TeX}\,Live 2021 & 通过 \\
% Overleaf & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\
% \bottomrule
% \end{tabular}
% \end{table}
%
% \section{本地编译}
%
% \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以避免潜在的兼容性问题。}
%
% \begin{itemize}
% \item 为了避免不必要的麻烦,请尽可能下载 full 版本,如 texlive-full。简而言之,下载大的那个。
% \item 并且,尽可能使用最新版(截至目前是 2021)。2020 及之前版本使用 PDF 格式的图片可能会出现加粗问题。
% \end{itemize}
%
% \subsubsection{选择编辑器}
%
% 配置完编译器后,还需要一个\textbf{文本编辑器}作为前端来完成\texttt{.tex}文件内容的写作。
%
% 至今仍有相当一部分人认为Windows自带的\textit{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\textbf{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}},来完成论文编写。你也可以根据个人的喜好随便使用其他编辑器,如 TeXworks、TeX Studio 等,顺手就行。
%
% 若使用 LaTeX Workshop 插件,本项目在\lstinline|.vscode/|中提供一份简易配置,可以省略初始配置步骤直接使用。
%
% \subsubsection{编译顺序}
% 应采用以下命令顺序进行编译,以生成正确的目录、编号和参考文献条目。
% \begin{enumerate}
% \item \lstinline|xelatex| / \lstinline|lualatex|
% \item \lstinline|biber|
% \item \lstinline|xelatex| / \lstinline|lualatex|
% \item \lstinline|xelatex| / \lstinline|lualatex|
% \end{enumerate}
%
% 编译产物\footnote{作为化学学生,俺认为用“产物”代替“编译生成的文件”是一个通俗易懂的说法}为\lstinline|njuthesis.pdf|,位于主目录下。此外还会生成一系列中间文件,可以选择使用\lstinline|latexmk -c|进行清理。
%
% \subsection{在线编译}
%
% 相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长,占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{其实这三点都是对广大的Windows用户说的,同一个模板在Linux编译可以节省一半耗时}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。
%
% \subsubsection{南大\hologo{TeX}平台简介}
%
% \href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的ShareLaTeX平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,面向南京大学全体师生开放,首次使用需凭学校邮箱自助注册账号。
%
% \subsubsection{操作步骤}
%
% \begin{enumerate}
% \item 下载\href{https://github.com/nju-lug/NJUThesisUndergraduate/archive/refs/heads/master.zip}{模板全部文件}
% \item 访问\href{https://tex.nju.edu.cn}{南大\hologo{TeX}},点击界面右上方Register,使用\emph{南京大学邮箱}注册账号并登录
% \item 点击New Project -> Upload Project上传刚刚得到的zip文件,上传后njuthesis.tex、njuthesis.cls等文件应在根目录,目录结构如{{sec:directory}}所示
% \item 在项目页面左上角的Menu中,将编译器改为\hologo{XeLaTeX}或者\hologo{LuaLaTeX}
% \item 编写论文
% \item 点击Compile按钮进行编译和预览
% \item 点击编译按钮右侧第三个按钮下载产物
% \end{enumerate}
%
% \subsubsection{关于Overleaf平台}
%
% 由于\href{https://www.overleaf.com/}{Overleaf平台}的\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了这一问题。因此\emph{请务必不要使用Overleaf官网进行编译}。
%
% \subsection{字体}
%
% 学校论文格式要求使用的字体一般已经预装在各个操作系统,本模板针对不同平台进行了自动检测适配,可以开箱即用。
%
% 各个系统的默认字体请参考{tab:defaultfontset}。可以看到,不同系统上使用的字体有所差别,实际输出结果可能存在细微不同, 使用时请注意。例如,在Linux平台或者使用了Ubuntu后端的南大\hologo{TeX}上,宋体加粗效果更明显;另一方面,在Windows平台进行编译的效果更接近Word加粗\footnote{因为SimSun没有原生粗体,通过AutoFakeBold=2.17进行模仿}。
%
%
% \begin{macrocode}
\LoadClass[
a4paper,
twoside,
UTF8,
scheme=chinese,
linespread=1.625,% laTex默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故1.5/1.2*1.3 = 1.625
fontset=none,
zihao=-4
]{ctexbook}[2018/04/01]
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\RequirePackage{l3keys2e}
% \end{macrocode}
%
% \DescribeMacro{\dummyMacro}
% This macro does nothing.\index{doing nothing|usage} It is merely an
% example. If this were a real macro, you would put a paragraph here
% describing what the macro is supposed to do, what its mandatory and
% optional arguments are, and so forth.
% \begin{macrocode}
\keys_define:nn { nju }
{
titlelength .int_set:N = \nju_titlelength,
titlelength .initial:n = 1,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
secondmentor .bool_set:N = \nju_second_mentor,
secondmentor .initial:n = false,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
nlcover .bool_set:N = \nju_nl_cover,
nlcover .initial:n = false,
% \end{macrocode}
%
% \subsection{学位}
% \DescribeOption{degree}
% 选择学位,可选:
% \option{ug}(默认),\option{mg},\option{mf},\option{phd}。
% \begin{macrocode}
degree .initial:n = ug,
% \end{macrocode}
%
% \subsection{类型}
% \DescribeOption{type}
% 选择学位,可选:
% \option{thesis}(默认),\option{design}。
% \begin{macrocode}
type .tl_set:N = \nju_type,
type .initial:n = thesis,
% \end{macrocode}
%
% \DescribeOption{systemfont}
% 是否使用系统预装的字体,可选:
% \option{true}(默认),\option{false}。
% \begin{macrocode}
systemfont .bool_set:N = \nju_systemfont,
systemfont .initial:n = true,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
customlatinfont .tl_set:N = \nju_customlatinfont,
customlatinfont .initial:n = windows,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
customchinesefont .tl_set:N = \nju_customchinesefont,
customchinesefont .initial:n = windows,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
info .meta:nn = { nju / info } { #1 }
}
% \end{macrocode}
%
% Put text here.
%
% \begin{macrocode}
\keys_define:nn { nju / info }
{
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 题目
TitleA .tl_set:N = \nju_title_a,
TitleB .tl_set:N = \nju_title_b,
TitleC .tl_set:N = \nju_title_c,
TitleEN .tl_set:N = \nju_title_en,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 年级学号姓名
Grade .tl_set:N = \nju_grade,
StudentID .tl_set:N = \nju_student_id,
StudentName .tl_set:N = \nju_student_name,
StudentNameEN .tl_set:N = \nju_student_name_en,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 院系专业方向
Department .tl_set:N = \nju_department,
DepartmentEN .tl_set:N = \nju_department_en,
Major .tl_set:N = \nju_major,
MajorEN .tl_set:N = \nju_major_en,
Field .tl_set:N = \nju_field,
FieldEN .tl_set:N = \nju_field_en,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 导师
MentorA .tl_set:N = \nju_mentor_a,
MentorAEN .tl_set:N = \nju_mentor_a_en,
MentorATitle .tl_set:N = \nju_mentor_a_title,
MentorATitleEN .tl_set:N = \nju_mentor_a_title_en,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 第二导师
MentorB .tl_set:N = \nju_mentor_b,
MentorBEN .tl_set:N = \nju_mentor_b_en,
MentorBTitle .tl_set:N = \nju_mentor_b_title,
MentorBTitleEN .tl_set:N = \nju_mentor_b_title_en,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 答辩
DefendDate .tl_set:N = \nju_defend_date,
ReviewerChairman .tl_set:N = \nju_reviewer_chairman,
ReviewerA .tl_set:N = \nju_reviewer_a,
ReviewerB .tl_set:N = \nju_reviewer_b,
ReviewerC .tl_set:N = \nju_reviewer_c,
ReviewerD .tl_set:N = \nju_reviewer_d,
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 国家图书馆封面相关
Classification .tl_set:N = \nju_classification,
SecurityLevel .tl_set:N = \nju_securitylevel,
UDC .tl_set:N = \nju_udc,
MentorInfo .tl_set:N = \nju_mentor_info,
}
% \end{macrocode}
%
% \DescribeEnv{dummyEnv}
% This environment does nothing. It is merely an example.
% If this were a real environment, you would put a paragraph here
% describing what the environment is supposed to do, what its
% mandatory and optional arguments are, and so forth.
% \begin{macrocode}
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
\NewDocumentCommand \njusetup { m }
{ \keys_set:nn { nju } { #1 } }
% \end{macrocode}
% mandatory and optional arguments are, and so forth.
% \begin{macrocode}
\ProcessKeysOptions { nju }
% \end{macrocode}
%
% mandatory and optional arguments are, and so forth.
% \begin{macrocode}
\RequirePackage{expl3}
\RequirePackage{fontspec}
\RequirePackage[
top=2.5cm,
bottom=2.5cm,
left=3.2cm,
right=3.2cm
]{geometry}
% \RequirePackage{ifthen}
\RequirePackage{xparse}
% \RequirePackage{etoolbox}
% \RequirePackage{titlesec} % 修改章节标题功能由CTeX提供
\RequirePackage{titletoc} % 修改目录内标题格式
% \RequirePackage{appendix} % 定义附录样式
\RequirePackage{fancyhdr} % 调整页眉页脚
\RequirePackage[hyphens]{url} % generate better linebreaks in the url
% \RequirePackage[normalem]{ulem} % 绘制下划线
% \RequirePackage{soul} % 用不起来
% \RequirePackage{soulutf8}
\RequirePackage{dashundergaps}
\RequirePackage{setspace}
\RequirePackage{lastpage}
\RequirePackage{emptypage} % 清除空白页的页码
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\RequirePackage{listings} % 代码环境
\RequirePackage{enumitem} % 用于修改列表环境
\RequirePackage{caption}
\RequirePackage{floatrow} % 用于图表等页面元素的定位
\RequirePackage{booktabs} % 用于绘制三线表
\RequirePackage{multirow} % Cells occupying multiple rows in tables
\RequirePackage{multicol} % Multiple columns in dictionary
\RequirePackage{siunitx} % 用于书写单位符号
\RequirePackage[version=4]{mhchem} % 用于绘制分子式
\RequirePackage{hologo} % 用于生成可以被插入书签的LaTeX logo
% \RequirePackage{needspace} % Required to prevent page break right after a sectioning command
% \RequirePackage{xspace} % Better print trailing whitespace
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\sys_if_engine_xetex:T
{
\RequirePackage{microtype}
% 加中文下划线,不能用于lualatex
\RequirePackage{xeCJKfntef}
\cs_new:Npn \nju_underline:n #1 {\CJKunderline{#1}}
}
\sys_if_engine_luatex:T{
% 加中文下划线
\RequirePackage{lua-ul}
\cs_new:Npn \nju_underline:n #1 {\underLine{#1}}
% emoji支持
% \RequirePackage{emoji}
% \setemojifont{Segoe~UI~Emoji} % windows
% \setemojifont{Apple~Color~Emoji} % macos
% \setemojifont{Noto~Color~Emoji}
% For windows.
% Shipped with the best `grinning-face-with-sweat' support.
}
% \end{macrocode}
%
% 几个用来进行开发测试的包
% \begin{macrocode}
\RequirePackage{blindtext} % 生成用于测试的大段无意义英文文字
\RequirePackage{zhlipsum} % 生成用于测试的大段无意义中文文字
% \RequirePackage{showframe} % 加载以后展示内容边界
\RequirePackage{amsmath} % Must be loaded before unicode-math
\RequirePackage{amsthm} % Mathematical environments
\RequirePackage{mathtools} % Mathematical tools to use with amsmath
\RequirePackage{thmtools} % Theorem styles
\RequirePackage[
warnings-off={% 消除与mathtools合用产生的警告
mathtools-colon,
mathtools-overbracket}
]{unicode-math} % Math fonts in xetex or luatex
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\RequirePackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png}
\graphicspath{{figure/}} % 图片路径
\RequirePackage{wrapfig} % Wrap text around figures
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 必须以该顺序加载以下三个包
% \RequirePackage{varioref}
\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref}
\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref}
% \end{macrocode}
%
% and so forth.
% \begin{macrocode}
% 设置西文字体
\NewDocumentCommand\set_latin_fontset_windows{}{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\NewDocumentCommand\set_latin_fontset_macos{}{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\NewDocumentCommand\set_latin_fontset_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}
%
% Put text here.
% \begin{macrocode}
% 设置中文字体
\NewDocumentCommand\set_chinese_fontset_windows{}{
\setCJKmainfont{SimSun}[
AutoFakeBold=2.17,
ItalicFont=KaiTi]
\setCJKsansfont{SimHei}
\setCJKmonofont{FangSong}
\setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhhei}{SimHei}
\setCJKfamilyfont{zhfs}{FangSong}
\setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[BoldFont=Microsoft~YaHei~Bold]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\NewDocumentCommand\set_chinese_fontset_macos{}{
\msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告
\setCJKmainfont{Songti~SC~Light}[
BoldFont=Songti~SC~Bold,
ItalicFont=Kaiti~SC,
BoldItalicFont=Kaiti~SC~Bold]
\setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKmonofont{STFangsong}
\setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold]
\setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKfamilyfont{zhfs}{STFangsong}
\setCJKfamilyfont{zhkai}{Kaiti~SC}
[
BoldFont=Kaiti~SC~Bold,
% 参考CTeX手册第9节 LuaLATEX 下的中文支持方式
% AlternateFont =
% {
% {⟨character range1⟩} {⟨alternate font name1⟩}
% {⟨alternate font features2⟩} ,
% ......
% }
]
\setCJKfamilyfont{zhnewhei}{PingFang~SC}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\NewDocumentCommand\set_chinese_fontset_fandol{}{
\msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告
\setCJKmainfont{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold,
ItalicFont=FandolKai-Regular]
\setCJKsansfont{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKmonofont{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhsong}{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold]
\setCJKfamilyfont{zhhei}{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhkai}{FandolKai-Regular}[
Extension=.otf,
AutoFakeBold=2.17]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
% 方正字符集
\NewDocumentCommand\set_chinese_fontset_founder{}{
% FZSSK 方正书宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/151 免费商用
% FZXBSK 方正小标宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/164 设计师非商免费
% FZKTK 方正楷体(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/137 免费商用
\setCJKmainfont{FZSSK}[
Extension=.ttf,
BoldFont=FZXBSK,
ItalicFont=FZKTK]
% FZXH1K 方正细黑一(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/161 设计师非商免费
% FZHTK 方正黑体(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/131 免费商用
\setCJKsansfont{FZXH1K}[
Extension=.ttf,
BoldFont=FZHTK]
% FZFSK 方正仿宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/128
\setCJKmonofont{FZFSK}[Extension=.ttf]
\setCJKfamilyfont{zhsong}{FZSSK}[
Extension=.ttf,
BoldFont=FZXBSK]
\setCJKfamilyfont{zhhei}{FZHTK}[
Extension=.ttf,
AutoFakeBold=2.17]
\setCJKfamilyfont{zhfs}{FZFSK}[Extension=.ttf]
\setCJKfamilyfont{zhkai}{FZKTK}[Extension=.ttf]
% FZYouHK_508R 方正悠黑508R(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/244 设计师非商免费
% FZYouHK_511M 方正悠黑511M(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/244 设计师非商免费
\setCJKfamilyfont{zhnewhei}{FZYouHK_508R}[
Extension=.ttf,
BoldFont=FZYouHK_511M]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
\NewDocumentCommand\set_chinese_fontset_noto{}{
% 思源宋体 https://www.google.com/get/noto/#serif-hans
\setCJKmainfont[
UprightFont=NotoSerifCJKsc-Regular,
BoldFont=NotoSerifCJKsc-Bold,
ItalicFont=NotoSerifCJKsc-Regular,
BoldItalicFont=NotoSerifCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Serif~CJK~SC}
% 思源黑体 https://www.google.com/get/noto/#sans-hans
\setCJKsansfont[
UprightFont=NotoSansCJKsc-Regular,
BoldFont=NotoSansCJKsc-Bold,
ItalicFont=NotoSansCJKsc-Regular,
BoldItalicFont=NotoSansCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Sans~CJK~SC}
% 包含于上述思源黑体
\setCJKmonofont[
UprightFont=NotoSansMonoCJKsc-Regular,
BoldFont=NotoSansMonoCJKsc-Bold,
ItalicFont=NotoSansMonoCJKsc-Regular,
BoldItalicFont=NotoSansMonoCJKsc-Bold,
ItalicFeatures=FakeSlant,
BoldItalicFeatures=FakeSlant]{Noto~Sans~Mono~SC}
\setCJKfamilyfont{zhsong}{Noto~Serif~CJK~SC}
\setCJKfamilyfont{zhhei}{Noto~Sans~CJK~SC}
% 方正楷体、方正仿宋为免费商用字体,且支持CJK字符集
% 方正仿宋 http://www.foundertype.com/index.php/FontInfo/index/id/128.html
% 方正楷体 http://www.foundertype.com/index.php/FontInfo/index/id/137.html
\setCJKfamilyfont{zhfs}{方正仿宋简体}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17]
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
% 字体判断
\bool_if:NTF \nju_systemfont
% 根据操作系统自动选择相应字体
{
% 检测是否是 Windows
\sys_if_platform_windows:TF
{
\set_latin_fontset_windows
\set_chinese_fontset_windows
}
{
% 检测是否是 macOS
\ctex_if_platform_macos:TF
{
\set_latin_fontset_macos
\set_chinese_fontset_macos
}
% 其余系统一律使用自由字体
{
\set_latin_fontset_gyre
\set_chinese_fontset_fandol
}
}
}
{
% 如果用户需要自定义字体
% 此处需要使用\str_case_e而不是\str_case使宏展开为字符串
\str_case_e:nn { \nju_customlatinfont }
{
{ windows } { \set_latin_fontset_windows }
{ macos } { \set_latin_fontset_macos }
{ gyre } { \set_latin_fontset_gyre }
{ null } {}
}
\str_case_e:nn { \nju_customchinesefont }
{
{ windows } { \set_chinese_fontset_windows }
{ macos } { \set_chinese_fontset_macos }
{ gyre } { \set_chinese_fontset_gyre }
{ founder } { \set_chinese_fontset_founder }
{ noto } { \set_chinese_fontset_noto }
{ null } {}
}
}
% 选择其他字体,请确保相应字体已安装
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近)
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
BoldFont = XITSMath-Bold,
Extension = .otf]
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\NewDocumentCommand\songti{}{\CJKfamily{zhsong}}
\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}}
\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}}
\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}}
% \NewDocumentCommand\lishu{}{\CJKfamily{zhli}}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 本科生页眉页脚
\fancypagestyle{njuplain}{%
\fancyhead{}
\fancyfoot[C]{\zihao{5}\thepage} % 页脚居中 五号新罗马体数字
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% TODO: 研究生页眉页脚
\fancypagestyle{njuheadings}{%
\fancyhead{}
\fancyfoot[C]{\zihao{5}\thepage}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\str_if_eq:NNTF {\nju_degree} { ug }
{
% the header line
\tl_set:Nn \headrulewidth {0pt}
% the footer line
\tl_set:Nn \footrulewidth {0pt}
\AtBeginDocument{\pagestyle{njuplain}} % 本科无页眉页脚
}
{
% the header line
\tl_set:Nn \headrulewidth {1pt}
% the footer line
\tl_set:Nn \footrulewidth {0pt}
% \AtBeginDocument{\pagestyle{njuplain}} % 无页眉页脚
\AtBeginDocument{\pagestyle{headings}} % 研究生有页眉页脚
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
% ctex格式设置
% 目录标题 三号宋体加粗
% 各部分标题 四号黑体
\ctexset{
contentsname = 目录,
listfigurename = 插图清单,
listtablename = 表格清单,
chapter/format = \zihao{4}\heiti\centering,
chapter/beforeskip = 10pt,
chapter/afterskip = 60pt,
section/format = \zihao{4}\heiti\raggedright,
subsection/format = \zihao{4}\heiti\raggedright,
subsubsection/format = \zihao{4}\heiti\raggedright
}
% 重定义目录中章节标题样式
% 目录内容中章的标题 四号黑体
% 目录中其他内容 小四号宋体
\titlecontents{chapter}% 标题级别
[5em]% 标题左间距
{\heiti\zihao{4}\vspace{10pt}}% 标题格式
{\contentslabel{4em}}% 标题标志
{\hspace*{-4em}}% 无序号标题
{~\titlerule*[0.6pc]{$.$}~\contentspage}% 指引线与页码
\titlecontents{section}
[5em]
{\zihao{-4}\vspace{0pt}}
{\contentslabel{2.5em}}
{\hspace*{-4em}}
{~\titlerule*[0.6pc]{$.$}~\contentspage}
\titlecontents{subsection}
[8em]
{\zihao{-4}\vspace{0pt}}
{\contentslabel{3em}}
{\hspace*{-4em}}
{~\titlerule*[0.6pc]{$.$}~\contentspage}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\cs_set:Npn \CTEX@addtocline #1#2
{
\addcontentsline { toc } {#1}
{ \use:c { CTEX@#1@tocline } {#1} {#2} }
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 目录页面格式修改
\cs_new:Npn \nju_tocpagestyle:nnn #1 #2 #3
{
\newpage
\hspace{0pt}
\vskip 10pt
\begin{center}
\mbox{\songti\bf\zihao{3}{#1}} % 目录页面标题
\phantomsection
\addcontentsline{toc}{chapter}{#2} % 插入目录
\end{center}
\vskip 40pt
\@starttoc{#3}%
\cleardoublepage
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\tl_set:Nn \tableofcontents
{
\nju_tocpagestyle:nnn {目\hspace{2em}录}{\contentsname}{toc}
}
\tl_set:Nn \listoffigures
{
\nju_tocpagestyle:nnn {\listfigurename}{\listfigurename}{lof}
}
\tl_set:Nn \listoftables
{
\nju_tocpagestyle:nnn {\listtablename}{\listtablename}{lot}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 定制前言、致谢环境
\newenvironment{preface}
{%
\chapter*{前言}
\addcontentsline{toc}{chapter}{前言}
}{}
% \end{macrocode}
%
% \DescribeEnv{acknowledgements}
% 单独制作的致谢页。
% \begin{macrocode}
\newenvironment{acknowledgement}
{%
\chapter*{致谢}
\addcontentsline{toc}{chapter}{致谢}
}{}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% biblatex设置
\RequirePackage[
style=gb7714-2015,
%style=numeric-comp,
%citestyle=authortitle-icomp,
% citestyle=numeric-comp,
%bibstyle=authoryear,
% bibstyle=numeric,
sorting=none,
%sorting=nyt,
%sortcites=true,
%autocite=footnote,
backend=biber, % Compile the bibliography with biber
hyperref=true,
backref=false,
citecounter=true,
pagetracker=true,
citetracker=true,
ibidtracker=context,
autopunct=true,
autocite=plain,
% gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' in reference entries, GitHub Issue (#47)
% gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author names in reference entries, GitHub Issue (#23)
]{biblatex}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% Remove some unwanted entries from the bibliography
\AtEveryBibitem{
\clearfield{abstract}
\clearfield{issn}
\clearfield{isbn}
\clearfield{archivePrefix}
\clearfield{arxivId}
\clearfield{pmid}
\clearfield{eprint}
\ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}}
% \ifentrytype{book}{\clearfield{doi}}{}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
% 修改标签名称
\crefdefaultlabelformat{#2#1#3\,} % 默认在名称后面添加空格
\crefname{figure}{图}{图}
\crefname{table}{表}{表}
% \crefname{equation}{公式}{公式}
\crefformat{equation}{公式~#2#1#3~} % 删除公式编号的括号
\crefformat{chapter}{第#2#1#3章}
\crefformat{section}{第~#2#1#3~节}
\crefformat{subsection}{第~#2#1#3~小节}
\crefformat{subsubsection}{第~#2#1#3~小节}
% \crefname{chapter}{§}{§}
% \crefname{section}{§}{§}
% \crefname{subsection}{§}{§}
% \crefname{subsubsection}{§}{§}
\crefname{appendix}{附录}{附录}
% \crefname{definition}{定义}{定义}
% \crefname{axiom}{公理}{公理}
% \crefname{property}{性质}{性质}
% \crefname{proposition}{命题}{命题}
% \crefname{lemma}{引理}{引理}
% \crefname{corollary}{推论}{推论}
% \crefname{remark}{注解}{注解}
% \crefname{condition}{条件}{条件}
% \crefname{conclusion}{结论}{结论}
% \crefname{assumption}{假设}{假设}
% \end{macrocode}
%
% soifjsojfosjfos
% \begin{macrocode}
% 图表位置调整
\floatsetup[lstlisting]{ % Captions for lstlistings
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[figure]{ % Captions for figures
capposition=bottom,%
margins=centering,%
floatwidth=\textwidth%
}
\floatsetup[table]{ % Captions for tables
capposition=above,%
margins=centering,%
floatwidth=\textwidth%
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 代码样式
\lstset{
basicstyle=\ttfamily\linespread{1}\small\selectfont,
keywordstyle=\bfseries,% use bold style for keywords
commentstyle=\rmfamily\itshape,% use italic style for comments
stringstyle=\ttfamily,% 字符串风格
flexiblecolumns,% ?
numbers=left,% left-aligned numbering
showspaces=false,% hide markers for spaces
showstringspaces=false,
captionpos=t,% place the caption at the top
% frame=lrtb,% show all four sides of the frame
% linewidth=.8\textwidth,
% breakatwhitespace=true,
breaklines=true,
xleftmargin=2em,xrightmargin=2em,% set the width of the code environment
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\lstdefinestyle{LaTeX}{
language=TeX,
morekeywords={begin, caption, label, mathrm, frac, toprule, midrule, bottomrule, includegraphics}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 图表标题样式
\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti}
\captionsetup{
font=small,%
labelfont=songticap,
textfont=songticap,
strut=no,%
hypcap=true, % Links point to the top of the figure
% indention=0pt, % Suppress indentation
% % parindent=0pt, % Suppress space between paragraphs
aboveskip=6pt, % Increase the space between the figure and the caption
belowskip=6pt, % Increase the space between the caption and the table
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% list configuration
\renewcommand{\labelitemi}{\tiny$\blacktriangleright$}
\renewcommand{\labelitemii}{\textbullet}
\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\setlist[description]{noitemsep}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 数学环境
\declaretheoremstyle[
%spaceabove=.5\thm@preskip,
%spacebelow=.5\thm@postskip,
headfont=\bf\songti,%\scshape,
notefont=\songti,% notebraces={ (}{)},
bodyfont=\songti,
%headformat={\NAME\space\NUMBER\space\NOTE},
headpunct={},
%postheadspace={.5em plus .1em minus .1em},
%prefoothook={\hfill\qedsymbol}
]{njuthm}
\theoremstyle{njuthm}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
\let\oldproofname=\proofname
\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
\declaretheorem[
name=算法,
style=njuthm,
refname={算法,算法},
Refname={算法,算法},
% numberwithin=section,
]{algorithm}
\declaretheorem[
name=假设,
style=njuthm,
refname={假设,假设},
Refname={假设,假设},
% numberwithin=section,
]{assumption}
\declaretheorem[
name=公理,
style=njuthm,
refname={公理,公理},
Refname={公理,公理},
% numberwithin=section,
]{axiom}
\declaretheorem[
name=结论,
style=njuthm,
refname={结论,结论},
Refname={结论,结论},
% numberwithin=section,
]{conclusion}
\declaretheorem[
name=条件,
style=njuthm,
refname={条件,条件},
Refname={条件,条件},
% numberwithin=section,
]{condition}
\declaretheorem[
name=推论,
style=njuthm,
refname={推论,推论},
Refname={推论,推论},
% numberwithin=section,
]{corollary}
\declaretheorem[
name=定义,
style=njuthm,
refname={定义,定义},
Refname={定义,定义},
% numberwithin=section,
]{definition}
\declaretheorem[
name=例,
style=njuthm,
refname={例,例},
Refname={例,例},
% numberwithin=section,
]{example}
\declaretheorem[
name=引理,
style=njuthm,
refname={引理,引理},
Refname={引理,引理},
% numberwithin=section,
]{lemma}
\declaretheorem[
name=性质,
style=njuthm,
refname={性质,性质},
Refname={性质,性质},
% numberwithin=section,
]{property}
\declaretheorem[
name=命题,
style=njuthm,
refname={命题,命题},
Refname={命题,命题},
% numberwithin=section,
]{proposition}
\declaretheorem[
name=注解,
style=njuthm,
refname={注解,注解},
Refname={注解,注解},
% numberwithin=section,
]{remark}
\declaretheorem[
name=定理,
style=njuthm,
refname={定理,定理},
Refname={定理,定理},
numberwithin=section,
]{theorem}
% \end{macrocode}
%
% \section{封面设计}
% \begin{macrocode}
% 拼合标题
\tl_const:Nn \nju_title {\nju_title_a \nju_title_b \nju_title_c}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
% 拼合导师
\bool_if:NTF \nju_second_mentor
{
\tl_const:Nn \nju_mentor_full
{
\nju_mentor_a\ \nju_mentor_a_title
\ \ \nju_mentor_b\ \nju_mentor_b_title
}
\tl_const:Nn \nju_mentor_full_en
{
\nju_mentor_a_en\ \nju_mentor_a_title_en
\ \ \nju_mentor_b_en\ \nju_mentor_b_title_en
}
}
{
\tl_const:Nn \nju_mentor_full
{
\nju_mentor_a\ \nju_mentor_a_title
}
\tl_const:Nn \nju_mentor_full_en
{
\nju_mentor_a_en\ \nju_mentor_a_title_en
}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
% 判断学位进行命令定义
\str_if_eq:NNTF {\nju_degree} { ug }
{
% 本科
\tl_const:Nn \nju_degree_name {本\hfill 科\hfill }
% 本科强制不打印国家图书馆封面
\bool_set_false:N \nju_nl_cover
% 封面下划线
\cs_new:Npn \nju_cover_underline_ug:nn #1 #2
{
\uline{\makebox[#1]{\rm\songti#2}}
}
% 封面表格边框
\cs_new:Npn \nju_coverbox_ug:n #1
{
\makebox[4.2em][s]{#1}
}
}
{
% 本科以外都是研究生
\tl_const:Nn \nju_degree_name {研\hfill 究\hfill 生\hfill }
% 封面下划线
\cs_new:Npn \nju_cover_underline_g:n #1
{
\uline{\makebox[250pt]{\rm\kaishu#1}}
}
% 国家图书馆封面下划线
\cs_new:Npn \nju_cover_underline_nl:nn #1 #2
{
\uline{\makebox[#1]{#2}}
}
% 封面表格边框
\cs_new:Npn \nju_coverbox_g:n #1
{
\makebox[6em][s]{#1\hspace{1em}}
}
% 研究生学位分类
\str_case:Nn { \nju_degree }
{
{ mg } { \tl_const:Nn \nju_degree_title {硕士} }
{ mf } { \tl_const:Nn \nju_degree_title {硕士专业} }
{ phd } { \tl_const:Nn \nju_degree_title {博士} }
}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 判断类型
\str_if_eq:NNTF {\nju_type} {thesis}
{
\tl_const:Nn \nju_type_name
{ \nju_degree_name 毕\hfill 业\hfill 论\hfill 文 }
}
{
\tl_const:Nn \nju_type_name
{ \nju_degree_name 毕\hfill 业\hfill 设\hfill 计 }
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
% 封面信息栏 本科
\tl_new:N \nju_printcoverinfo_ug
\tl_set:Nn \nju_printcoverinfo_ug
{
\begin{tabular}{p{4.2em}c}
\nju_coverbox_ug:n {院\hfill 系}
& \nju_cover_underline_ug:nn {250pt}{\nju_department}\\
\nju_coverbox_ug:n {专\hfill 业}
& \nju_cover_underline_ug:nn {250pt}{\nju_major}\\
% 标题换行
\int_case:nn { \nju_titlelength }
{
{ 1 } {
\nju_coverbox_ug:n {题\hfill 目}
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\ }
{ 2 } {
\nju_coverbox_ug:n {题\hfill 目}
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\ }
{ 3 } {
\nju_coverbox_ug:n {题\hfill 目}
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\
& \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_c}} \\}
}
\end{tabular}\\
\begin{tabular}{p{4.2em}cp{4.2em}c}
\nju_coverbox_ug:n {年\hfill 级}
& \nju_cover_underline_ug:nn {90pt}{\nju_grade}
& \nju_coverbox_ug:n {学\hfill 号}
& \nju_cover_underline_ug:nn {90pt}{\nju_student_id}\\
\end{tabular}\\
\begin{tabular}{p{4.2em}c}
\nju_coverbox_ug:n {学\hfill 生\hfill 姓\hfill 名}
& \nju_cover_underline_ug:nn {250pt}{\nju_student_name}
\end{tabular}\\
\begin{tabular}{p{4.2em}cp{4.2em}c}
\nju_coverbox_ug:n {导\hfill 师}
& \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a}
& \nju_coverbox_ug:n {职\hfill 称}
& \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a_title}\\
% 第二导师
\bool_if:NT \nju_second_mentor
{
\nju_coverbox_ug:n {第\hfill 二\hfill 导\hfill 师}
& \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b}
& \nju_coverbox_ug:n {职\hfill 称}
& \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b_title}\\
}
\end{tabular}\\
\begin{tabular}{p{4.2em}c}
\nju_coverbox_ug:n {提\hfill 交\hfill 日\hfill 期}
& \nju_cover_underline_ug:nn {250pt}{\nju_submit_date}\\
\end{tabular}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
% 封面信息栏 研究生
\tl_new:N \nju_printcoverinfo_g
\tl_set:Nn \nju_printcoverinfo_g
{
\begin{tabular}{p{6em}c}
% 标题换行
\int_case:nn {\nju_titlelength}
{
{ 1 } {
\nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
& \nju_cover_underline_g:n {\nju_title_a} \\ }
{ 2 } {
\nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
& \nju_cover_underline_g:n {\nju_title_a} \\
& \nju_cover_underline_g:n {\nju_title_b} \\ }
{ 3 } {
\nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目}
& \nju_cover_underline_g:n {\nju_title_a} \\
& \nju_cover_underline_g:n {\nju_title_b} \\
& \nju_cover_underline_g:n {\nju_title_c} \\}
}
\nju_coverbox_g:n {作\hfill 者\hfill 姓\hfill 名}
& \nju_cover_underline_g:n {\nju_student_name}\\
\nju_coverbox_g:n {专\hfill 业\hfill 名\hfill 称}
& \nju_cover_underline_g:n {\nju_major}\\
\nju_coverbox_g:n {研\hfill 究\hfill 方\hfill 向}
& \nju_cover_underline_g:n {\nju_field}\\
\nju_coverbox_g:n {指\hfill 导\hfill 教\hfill 师}
& \nju_cover_underline_g:n {\nju_mentor_full}\\
\end{tabular}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
% 绘制封面命令
\tl_new:N \nju_printcover_nl % 国家图书馆封面
\tl_new:N \nju_printcover_ug % 本科封面
\tl_new:N \nju_printcover_g % 研究生封面
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
% 按需绘制国家图书馆封面,修改自旧模板
\bool_if:NT \nju_nl_cover
{
\tl_set:Nn \nju_printcover_nl
{
\thispagestyle{empty}
\pdfbookmark[0]{国家图书馆封面}{nl}
{
% 顶端
\hspace{0mm}
\vskip -20mm \hskip -15mm
\songti\zihao{-4}
\makebox[40pt][l]{分类号}
\nju_cover_underline_nl:nn {150pt}{\nju_classification}
\hfill
\makebox[40pt][l]{密级}
\nju_cover_underline_nl:nn {150pt}{\nju_securitylevel}
\vskip 10pt \hskip -15mm
\makebox[40pt][l]{UDC}
\nju_cover_underline_nl:nn {150pt}{\nju_udc}
}
% 中部
\vskip\stretch{2}
\begin{center}
\def\ULthickness{1pt}
{\kaishu\zihao{-0} 学\hspace{0.5em}位\hspace{0.5em}论\hspace{0.5em}文}
{
\kaishu\zihao{1}
\vskip \stretch{1}
\nju_cover_underline_nl:nn {14em}{\nju_title_a}\\
\nju_cover_underline_nl:nn {14em}{\nju_title_b}\\
\nju_cover_underline_nl:nn {14em}{\nju_title_c}\\
}
\vskip \stretch{1}
{\kaishu\zihao{4}(题名和副题名)}
\vskip \stretch{1} \vskip 5mm
{\kaishu\zihao{1}\uline{\makebox{\nju_student_name}}}
\vskip \stretch{1}
{\kaishu\zihao{4}(作者姓名)}
\end{center}
% 底部
\vskip\stretch{1}
{
\kaishu\zihao{4}
\noindent 指导教师姓名、职务、职称、学位、单位名称及地址%
\nju_cover_underline_nl:nn {94pt}{\nju_mentor_a}\par
\noindent\nju_cover_underline_nl:nn {\textwidth}{%
\nju_mentor_info}\par
\noindent 申请学位级别%
\nju_cover_underline_nl:nn {9em}{\nju_degree_title}%
\noindent 专业名称%
\uline{\hfill\nju_major\hfill}\par% 需要调整下划线长度
\noindent 论文提交日期%
\nju_cover_underline_nl:nn {9em}{\nju_submit_date}%
论文答辩日期%
\uline{\hfill\nju_defend_date\hfill}\par% 需要调整下划线长度
\noindent 学位授予单位和日期\uline{\hfill}\par
\noindent\hfill 答辩委员会主席:%
\nju_cover_underline_nl:nn {9em}{\nju_reviewer_chairman}\par
\noindent\hfill 评阅人:%
\nju_cover_underline_nl:nn {9em}{\nju_reviewer_a}\par
\noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_b}\par
\noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_c}\par
\noindent\hfill\nju_cover_underline_nl:nn {9em}{\nju_reviewer_d}\par
\begin{center}
\kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日
\end{center}
\vskip -10mm
}
\cleardoublepage
}
}
% 本科封面
\tl_set:Nn \nju_printcover_ug
{
\thispagestyle{empty}
\pagenumbering{Roman}
% Start
\pdfbookmark{封面}{封面} % 将封面插入pdf书签
\begin{spacing}{1.25}
\vskip 0mm
\hspace{-10mm}
\includegraphics[height=3cm]{njulogo}\smallskip
\begin{center}
\includegraphics[height=3.35cm]{njuname}
\vskip 10mm
{\zihao{1}\makebox[9em][s]{\bf{\songti\nju_type_name}}}
\vfill
\vskip\stretch{0}
{\bgroup
\kaishu\zihao{3}
\def\tabcolsep{1pt}
\def\arraystretch{1.5}
\nju_printcoverinfo_ug % 绘制信息框
\egroup}
\vfill
\end{center}
\end{spacing}
\cleardoublepage
% \vfill
% \newpage
}
% 研究生封面
\tl_set:Nn \nju_printcover_g
{
\thispagestyle{empty}
\pagenumbering{Roman}
% Start
\pdfbookmark{封面}{封面} % 将封面插入pdf书签
\begin{spacing}{1.25}
\begin{center}
\hspace{0pt} \vskip 5mm
\includegraphics[height=1.9cm]{njulogo}
\vskip 10mm
\includegraphics[height=2cm]{njuname-large}
\vskip 15mm
{\zihao{1}\makebox[10em][s]{\bf{\kaishu\nju_type_name}}}
\vskip 5mm
{\zihao{1}\bf{\kaishu{(申请\nju_degree_title 学位)}}}
\par\vfill
\vskip\stretch{0}
{\bgroup
\bf\kaishu\zihao{3}
\def\tabcolsep{1pt}
\def\arraystretch{1.5}
\vskip 10mm
\nju_printcoverinfo_g % 绘制信息框
\egroup}
\vfill
\vskip 10mm
\bf\kaishu\zihao{4}\nju_submit_date
\vskip 15mm
\end{center}
\end{spacing}
\newpage % 封面背面
\thispagestyle{empty}
\begin{spacing}{1.625}
% TODO: 等待调整格式
\hspace{0pt} \vfill
{\bgroup
\kaishu\zihao{3}
\makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\nju_student_id}
\par
\makebox[6em][s]{\bf\kaishu 论文答辩日期}:\nju_defend_date
\par
\makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字)
\par
\egroup}
\vskip 15mm
\end{spacing}
\cleardoublepage
}
% 重定义maketitle生成封面
\tl_set:Nn \maketitle
{%
\str_if_eq:NNTF { \nju_degree } { ug }
{
\nju_printcover_nl % 国家图书馆封面
\nju_printcover_ug % 本科封面
}
{
\nju_printcover_nl % 国家图书馆封面
\nju_printcover_g % 研究生封面
}
}
% \end{macrocode}
%
% Put text here.
% \begin{macrocode}
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
% 判断学位
\str_if_eq:NNTF {\nju_degree} { ug }
{
% 本科摘要环境
\NewDocumentEnvironment{abstract} {}
{%
% \pagestyle{plain}
% \pagenumbering{Roman}
% \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
\pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}}
\end{center}
{\bgroup
\kaishu\zihao{-4}
\tl_set:Nn \tabcolsep {0pt}
\tl_set:Nn \arraystretch {0.8}
\noindent
题目: \nju_title \\
院系: \nju_department \\
专业: \nju_major \\
本科生姓名: \nju_student_name \\
指导教师(姓名、职称):\nju_mentor_full \\
摘要:
\egroup
}
\kaishu\zihao{-4}\par%
}{%
\newpage
}
% 中文关键词
\NewDocumentCommand \keywords {m} {%
\par\vspace{2ex}\noindent%
{\kaishu\zihao{-4}\makebox[4em][s]{关键词{:}}}~{#1}%
}
% 英文摘要
\NewDocumentEnvironment{englishabstract} {}
{%
\pagestyle{plain}
% \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
\pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)英文摘要}}}
\end{center}
{
\bgroup
THESIS: ~~\nju_title_en \\
DEPARTMENT: ~~\nju_department_en \\
SPECIALIZATION: ~~\nju_major_en \\
UNDERGRADUATE:~~\nju_student_name_en \\
MENTOR:~~\nju_mentor_full_en \\
ABSTRACT:
\egroup
}
\zihao{-4}\par%
}{%
\cleardoublepage
\newpage
}
% 英文关键词
\NewDocumentCommand \englishkeywords {m} {%
\par\vspace{2ex}\noindent%
{KEYWORDS{:}}~~{#1}%
}
}
{
% 研究生摘要环境
\NewDocumentEnvironment{abstract} {}
{%
\pagestyle{plain}
\pagenumbering{Roman}
% \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签
\pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文中文摘要首页用纸}}}
\end{center}
\bgroup
\kaishu\zihao{4}
\tl_set:Nn \tabcolsep {0pt}
\tl_set:Nn \arraystretch {0.8}
\noindent
毕业论文题目:\hspace{0.5em}\nju_underline:n {\nju_title\hfill}\\
\uline{\makebox[9em]{\nju_major}}专业\uline{\makebox[4em]{\nju_grade}}级
\str_if_eq:NNTF {\nju_degree} { phd } {博}{硕}
士生姓名:\uline{\hfill\nju_student_name\hfill} \\
指导教师(姓名、职称):\uline{\hfill\nju_mentor_full\hfill}\par
\egroup
\kaishu\zihao{4}\par%
}{%
\newpage
}
% 中文关键词
\NewDocumentCommand \keywords {m} {%
\par\vspace{2ex}\noindent%
{\kaishu\zihao{4}\makebox[4em][s]{关键词{:}}}~{#1}%
}
% 英文摘要
\NewDocumentEnvironment{englishabstract} {}
{%
\pagestyle{plain}
% \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签
\pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存
\begin{center}
\kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文英文摘要首页用纸}}}
\end{center}
{
\bgroup
\zihao{4}
THESIS: ~~\nju_title_en \\
SPECIALIZATION: ~~\nju_major_en \\
POSTGRADUATE:~~\nju_student_name_en \\
MENTOR:~~\nju_mentor_full_en\par
\egroup
}
\zihao{4}\par%
}{%
\cleardoublepage
\newpage
}
% 英文关键词
\NewDocumentCommand \englishkeywords {m} {%
\par\vspace{2ex}\noindent%
{KEYWORDS{:}}~~{#1}%
}
}