Debian Codegraph @

texmf-dist/source/latex/thuthesis/thuthesis.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2005-2026 by Tsinghua University TUNA Association <[email protected]>
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3c
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % https://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2008 or later.
12 %
13 % \fi
14 %
15 % \iffalse
16 %<*driver>
17 \ProvidesFile{thuthesis.dtx}[2026/05/26 7.7.1 Tsinghua University Thesis Template]
18 \documentclass{ltxdoc}
19 \usepackage{dtx-style}
20
21 \EnableCrossrefs
22 \CodelineIndex
23
24 \begin{document}
25 \DocInput{\jobname.dtx}
26 \end{document}
27 %</driver>
28 % \fi
29 %
30 % \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode}
31 % \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter}
32 % \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection}
33 % \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter}
34 % \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut}
35 % \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage}
36 % \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\}
37 % \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi}
38 % \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand}
39 % \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect}
40 % \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize}
41 % \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny}
42 % \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty}
43 % \DoNotIndex{\textbf,\textit,\textsf,\textsc}
44 % \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad}
45 % \DoNotIndex{\centering,\raggedright,\ref}
46 % \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize}
47 % \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne}
48 % \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass}
49 % \DoNotIndex{\AtBeginDocument,\AtEndDocument}
50 %
51 % \GetFileInfo{\jobname.dtx}
52 %
53 % \def\indexname{索引}
54 % \IndexPrologue{\section{\indexname}}
55 %
56 % \title{\bfseries\color{violet}\thuthesis:清华大学学位论文模板}
57 % \author{{\fangsong 清华大学 TUNA 协会}\\[5pt]\texttt{[email protected]}}
58 % \date{v\fileversion\ (\filedate)}
59 % \maketitle\thispagestyle{empty}
60 %
61 %
62 % \begin{abstract}\noindent
63 % 此宏包旨在建立一个简单易用的清华大学学位论文模板,包括本科综合论文训练、硕士
64 % 论文、博士论文以及博士后出站报告。
65 % \end{abstract}
66 %
67 % \vskip2cm
68 % \def\abstractname{免责声明}
69 % \begin{abstract}
70 % \noindent
71 % \begin{enumerate}
72 % \item 本模板的发布遵守 \href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)},使用前请认真阅读协议内
73 % 容。
74 % \item 本模板为作者根据
75 % 清华大学研究生院颁发的《
76 % \href{https://info2021.tsinghua.edu.cn/f/info/xxfb_fg/xnzx/template/detail?xxid=fa880bdf60102a29fbe3c31f36b76c7e}{%
77 % 研究生学位论文写作指南}》(更新到 2025 年 3 月版本,限校内网络访问)、
78 % 英文版 \emph{Guide to Thesis Writing for Graduate Students}、
79 % 清华大学教务处颁发的《
80 % \href{https://info2021.tsinghua.edu.cn/f/info/xxfb_fg/xnzx/template/detail?xxid=b2d1a49d7e48c8e9b0f7e82f033dbb2b}{%
81 % 清华大学综合论文训练写作规范(试行)}》、
82 % 外文系的《英语专业本科生综合论文训练》和
83 % 清华大学《
84 % \href{http://postdoctor.tsinghua.edu.cn/info/czxz/1283}{%
85 % 编写“清华大学博士后研究报告”参考意见}》
86 % 编写而成,旨在供清华大学毕业生撰写学位论文使用。
87 % \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵
88 % 守 \LaTeX{} Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与
89 % 本模板作者无关。
90 % \end{enumerate}
91 % \end{abstract}
92 %
93 %
94 % \clearpage
95 % \pagestyle{fancy}
96 % \begin{multicols}{2}[
97 % \setlength{\columnseprule}{.4pt}
98 % \setlength{\columnsep}{18pt}]
99 % \tableofcontents
100 % \end{multicols}
101 % \clearpage
102 %
103 % \section{模板介绍}
104 % \thuthesis{}(\textbf{T}sing\textbf{h}ua \textbf{U}niversity \LaTeX{}
105 % \textbf{Thesis} Template)是为了帮助清华大学毕业生撰写毕业论文而编写
106 % 的 \LaTeX{} 论文模板。
107 %
108 % 本文档将尽量完整地介绍模板的使用方法,如有不清楚之处,或者想提出改进建议,
109 % 可以在 \href{https://github.com/tuna/thuthesis/issues/}{GitHub Issues}
110 % 参与讨论或提问。
111 % 有兴趣者都可以参与完善此手册,也非常欢迎对代码的贡献。
112 %
113 % \note[注意:]{模板的作用在于减少论文写作过程中格式调整的时间。前提是遵守模板的
114 % 用法,否则即便用了 \thuthesis{} 也难以保证输出的论文符合学校规范。}
115 %
116 % 用户如果遇到 bug,或者发现与学校《写作指南》 的要求不一致,可以尝试以下办法:
117 % \begin{enumerate}
118 % \item 将模板升级到最新,见第~\ref{sec:upgrade} 节;
119 % \item 阅读 \href{https://github.com/tuna/thuthesis/wiki/FAQ}{FAQ};
120 % \item 在 GitHub Issues 中按照说明
121 % \href{https://github.com/tuna/thuthesis/issues/new?template=bug_report.md}{报告 bug}。
122 % \end{enumerate}
123 %
124 % \section{贡献者}
125 % \label{sec:contributors}
126 %
127 % \thuthesis{} 的开发过程中,主要的维护者包括:
128 %
129 % \begin{itemize}
130 % \item 薛瑞尼(\githubuser{xueruini}):最早的开发者,2005 年创建 \thuthesis{} 并长期进行维护工作。
131 % \item 赵涛(\githubuser{alick}):2011-2015 年活跃,较早期阶段的开发者。
132 % \item 李泽平(\githubuser{zepinglee}):2016 年至今活跃,为目前主要维护者。
133 % \item 陈晟祺(\githubuser{Harry-Chen}):2020 年至今活跃,主要负责非开发性事宜。
134 % \end{itemize}
135 %
136 % 同时,也要感谢所有在 GitHub 上提出问题与贡献代码的同学、老师们。
137 % \thuthesis{} 的持续发展,离不开你们的帮助与支持。
138 %
139 % \section{安装}
140 % \label{sec:installation}
141 %
142 % \thuthesis{} 已经包含在主要的 \TeX{} 发行版中,但是通常版本较旧,而且不方便更新。
143 % 建议从下列途径下载最新版:
144 % \begin{description}
145 % \item[GitHub] \url{https://github.com/tuna/thuthesis},从 Release 中下载 zip 文件。
146 % \item[TUNA 镜像站] \url{https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/},也可在首页选择“获取下载链接——应用软件——\thuthesis{}论文模板”。
147 % \end{description}
148 %
149 %
150 % 模板支持在 TeX Live、MacTeX 和 MiKTeX 平台下进行编译,但要求 2017 年或更新的发行版。
151 % 当然,尽可能使用最新的版本可以避免 bug。
152 %
153 % \subsection{模板的组成}
154 % 下表列出了 \thuthesis{} 的主要文件及其功能介绍:
155 %
156 % \begin{longtable}{l|p{8cm}}
157 % \toprule
158 % {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule
159 % \endfirsthead
160 % \midrule
161 % {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule
162 % \endhead
163 % \endfoot
164 % \endlastfoot
165 % thuthesis.ins & \textsc{DocStrip} 驱动文件(开发用) \\
166 % thuthesis.dtx & \textsc{DocStrip} 源文件(开发用)\\\midrule
167 % thuthesis.cls & 模板类文件\\
168 % thuthesis-*.bst & \hologo{BibTeX} 参考文献表样式文件\\
169 % thuthesis-*.bbx & BibLaTeX 参考文献表样式文件\\
170 % thuthesis-*.cbx & BibLaTeX 参考文献引用样式文件\\
171 % tsinghua-name-bachelor.pdf & 校名 logo,本科生封面使用 \\\midrule
172 % thuthesis-example.tex & 示例文档主文件\\
173 % ref/ & 示例文档参考文献目录\\
174 % data/ & 示例文档章节具体内容\\
175 % figures/ & 示例文档图片路径\\
176 % thusetup.tex & 示例文档基本配置\\\midrule
177 % Makefile & Makefile\\
178 % latexmkrc & latexmk 配置文件 \\
179 % README.md & Readme\\
180 % \textbf{thuthesis.pdf} & 用户手册(本文档)\\\bottomrule
181 % \end{longtable}
182 %
183 % 几点说明:
184 % \begin{itemize}
185 % \item \file{thuthesis.cls} 可由 \file{thuthesis.ins}
186 % 和 \file{thuthesis.dtx} 生成,但为了降低新手用户的使用难度,故
187 % 将 \file{thuthesis.cls} 文件一起发布。
188 % \item 使用前阅读文档:\file{thuthesis.pdf}。
189 % \end{itemize}
190 %
191 % \subsection{生成模板}
192 % \label{sec:generate-cls}
193 % 模板的源文件(\file{thuthesis.dtx})中包含了大量的注释,需要将注释去掉生成轻量
194 % 级的 \file{.cls} 文件供 \cs{documentclass} 调用。
195 %
196 % \begin{shell}
197 % $ xetex thuthesis.ins
198 % \end{shell}
199 %
200 % \note[注意:]{如果没有生成的模板 \file{thuthesis.cls} 文件
201 % (跟 \file{thuthesis-example.tex} 同一目录下),
202 % \LaTeX{} 在编译时可能找到发行版中较旧版本的 \file{.cls},从而造成冲突。}
203 %
204 % \subsection{编译论文}
205 % \label{sec:generate-thesis}
206 % 本节介绍几种常见的生成论文的方法。用户可根据自己的情况选择。
207 %
208 % 在撰写论文时,我们\textbf{不推荐}使用原有的 \file{thuthesis-example.tex} 这一名称。
209 % 建议将其复制一份,改为其他的名字(如 \file{thesis.tex} 或者 \file{main.tex})。
210 % 需要注意,如果使用了来自 \file{data} 目录中的 \file{tex} 文件,
211 % 则重命名主文件后,其顶端的 \texttt{!TEX root} 选项也需要相应修改。
212 %
213 % \subsubsection{GNU make}
214 % \label{sec:make}
215 % 如果用户可以使用 GNU make 工具,这是最方便的办法。
216 % 所以 \thuthesis{} 提供了 \file{Makefile}:
217 % \begin{shell}
218 % $ make thesis # 生成论文示例 thuthesis-example.pdf
219 % $ make doc # 生成说明文档 thuthesis.pdf
220 % $ make clean # 清理编译生成的辅助文件
221 % \end{shell}
222 %
223 % 需要注意,如果更改了主文件的名称,则需要修改 \file{Makefile} 顶端的 \texttt{THESIS} 变量定义。
224 %
225 % \subsubsection{latexmk}
226 % \label{sec:latexmk}
227 % \texttt{latexmk} 命令支持全自动生成 \LaTeX{} 编写的文档,并且支持使用不同的工具
228 % 链来进行生成,它会自动运行多次工具直到交叉引用都被解决。
229 % \begin{shell}
230 % $ latexmk thuthesis-example.tex # 生成示例论文 thuthesis-example.pdf
231 % $ latexmk thuthesis.dtx # 生成说明文档 thuthesis.pdf
232 % $ latexmk -c # 清理编译生成的辅助文件
233 % \end{shell}
234 % \texttt{latexmk} 的编译过程是通过 \file{latexmkrc} 文件来配置的,如果要进一步了解,
235 % 可以参考 \pkg{latexmk} 文档。
236 %
237 % \subsubsection{\XeLaTeX}
238 % \label{sec:xelatex}
239 % 如果用户无法使用以上两种较为方便的编译方法,就只能按照以下复杂的办法手动编译。
240 %
241 % 首先,更新模板:
242 % \begin{shell}
243 % $ xetex thuthesis.ins # 生成 thuthesis.cls
244 % \end{shell}
245 %
246 % 然后,生成论文以及书脊:
247 % \begin{shell}
248 % $ xelatex thuthesis-example.tex
249 % $ bibtex thuthesis-example.aux # 生成 bbl 文件
250 % $ bibtex thuthesis-example-appendix-a.aux # 附录 A 的的参考文献
251 % $ bibtex thuthesis-example-appendix-b.aux # 附录 B 的的参考文献……
252 % $ xelatex thuthesis-example.tex # 解决引用
253 % $ xelatex thuthesis-example.tex # 生成论文 PDF
254 %
255 % $ xelatex spine.tex # 生成书脊 PDF
256 % \end{shell}
257 %
258 % 下面的命令用来生成用户手册:
259 % \begin{shell}
260 % $ xelatex -shell-escape thuthesis.dtx
261 % $ makeindex -s gind.ist -o thuthesis.ind thuthesis.idx
262 % $ xelatex -shell-escape thuthesis.dtx
263 % $ xelatex -shell-escape thuthesis.dtx # 生成说明文档 thuthesis.pdf
264 % \end{shell}
265 %
266 % \subsection{升级}
267 % \label{sec:upgrade}
268 % 如果需要升级 \thuthesis{},应当从 GitHub 下载最新的版本,
269 % 将 \file{thuthesis.dtx},\file{thuthesis.ins},\file{tsinghua-name-bachelor.pdf} 和
270 % \file{thuthesis-*.bst} 拷贝至工作目录覆盖相应的文件,然后按照
271 % 第~\ref{sec:generate-cls} 节的内容生成新的模板和使用说明。
272 %
273 % 有时模板可能进行了重要的修改,不兼容已写好的正文内容,用户应按照示例
274 % 文档重新调整。
275 %
276 % \section{使用说明}
277 % \label{sec:usage}
278 % 本手册假定用户已经能处理一般的 \LaTeX{} 文档,并对 \hologo{BibTeX} 有一定了解。如果
279 % 从未接触过 \TeX{} 和 \LaTeX,建议先学习相关的基础知识。
280 %
281 % \subsection{示例文件}
282 % \label{sec:userguide}
283 %
284 % 模板核心文件有:\file{thuthesis.cls},\file{tsinghua-name-bachelor.pdf},
285 % \file{thuthesis-*.bst}(\hologo{BibTeX}),
286 % \file{thuthesis-*.bbx} 和 \file{thuthesis-*.cbx}(BibLaTeX),
287 % 但如果没有示例文档会较难下手,所以推荐从模板自带的示例文档入手。其中包括了论文
288 % 写作用到的所有命令及其使用方法,只需用自己的内容进行相应替换就可以。对于不清
289 % 楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自于示例文档,
290 % 具体内容可以参考模板附带的 \file{thuthesis-example.tex} 和 \file{data/}。
291 %
292 % \subsection{论文选项}
293 % \label{sec:option}
294 %
295 % \subsubsection{学位}
296 % \DescribeOption{degree}
297 % 选择学位,可选:
298 % \option{bachelor},\option{master},\option{doctor}(默认),\option{postdoc}。
299 % 本节中的 \emph{key-value} 选项只能在文档类的选项中进行设置,
300 % 不能用于 \cs{thusetup} 命令。
301 % \begin{latex}
302 % % 博士论文
303 % \documentclass[degree=doctor]{thuthesis}
304 % \end{latex}
305 %
306 % \subsubsection{学位类型}
307 % \label{sec:degree-type}
308 % \DescribeOption{degree-type}
309 % 定义研究生学位的类型,可选:\option{academic}(默认)、\option{professional},
310 % 本科生不受影响。
311 % \begin{latex}
312 % \documentclass[degree=master, degree-type=professional]{thuthesis}
313 % \end{latex}
314 %
315 % \subsubsection{学院特殊格式}
316 % \label{sec:style-override}
317 % \DescribeOption{style-override}
318 % 选择苏世民学院的特殊格式,可选:\option{none}(默认)、\option{schwarzman}。
319 % \begin{latex}
320 % \documentclass[degree=master, style-override=schwarzman]{thuthesis}
321 % \end{latex}
322 %
323 % \subsubsection{字体配置}
324 % \label{sec:font-config}
325 % \DescribeOption{fontset}
326 % 模板默认会自动根据操作系统配置合适的字体,
327 % 用户也可以通过 \option{fontset} 时指定使用预设的字库,如:
328 % \begin{latex}
329 % \documentclass[fontset=windows]{thuthesis}
330 % \end{latex}
331 % 允许的选项有 \option{windows}、\option{mac}、\option{ubuntu} 和 \option{fandol},
332 % 具体使用的字体见表~\ref{tab:fontset}。
333 % 用户也可以设置为 \option{none} 并自行配置字体。
334 %
335 % \begin{table}[htb]
336 % \centering
337 % \caption{\thuthesis{} 预设的字体}
338 % \label{tab:fontset}
339 % \begin{tabular}{cccc}
340 % \toprule
341 % \option{windows} & \option{mac} & \option{ubuntu} & \option{fandol} \\
342 % \midrule
343 % Times New Roman & Times New Roman & TeX Gyre Termes & TeX Gyre Termes \\
344 % Arial & Arial & TeX Gyre Heros & TeX Gyre Heros \\
345 % Courier & Menlo & TeX Gyre Cursor & TeX Gyre Cursor \\
346 % 中易宋体 & 华文宋体 & 思源宋体 & Fandol 宋体 \\
347 % 中易黑体 & 华文黑体 & 思源黑体 & Fandol 黑体 \\
348 % 中易仿宋 & 华文仿宋 & Fandol 仿宋 & Fandol 仿宋 \\
349 % 中易楷体 & 华文楷体 & Fandol 楷体 & Fandol 楷体 \\
350 % \bottomrule
351 % \end{tabular}
352 % \end{table}
353 %
354 % 需要注意,建议用户在提交终版前使用 Windows 平台的字体进行编译。
355 % 这样中文字体同 Word 模板一致。
356 %
357 % 关于字体的配置,
358 % 详见 \pkg{fontspec}、\pkg{xeCJK}、\pkg{ctex} 等宏包的使用说明和代码。
359 %
360 % \DescribeOption{font}
361 % 配置全文使用的西文字体。所有可选项目为 \option{auto}(默认)、\option{times}、\option{termes}、
362 % \option{stix}、\option{xits}、\option{libertinus}、\option{newcm}、\option{lm}、
363 % \option{newtx}、\option{none}。
364 % 通常来说,用户\textbf{不需要}调整此选项。
365 %
366 % \DescribeOption{cjk-font}
367 % 配置全文使用的中文字体。所有可选项为 \option{auto}(默认)、\option{windows}、\option{windows-local}、
368 % \option{mac}、\option{mac-word}、\option{noto}、\option{fandol} 和 \option{none}。
369 % 通常来说,用户\textbf{不需要}调整此选项,模板会自动通过 \option{fontset} 选项选择合适的字体。
370 %
371 % \DescribeOption{windows-font-dir}
372 % 配置搜索 Windows 字体的路径,仅适用于 Overleaf 等不方便全局安装字体的环境。如果此目录下能找到中易宋体,
373 % 则将自动使用这些字体编译。如有可能,始终建议全局安装相应字体,模板能够自动检测。
374 %
375 % \subsection{论文设置}
376 % 论文的设置可以通过统一命令 \cs{thusetup} 设置 \emph{key=value} 形式完成。
377 %
378 % \DescribeMacro{\thusetup}
379 % \cs{thusetup} 用法与常见 \emph{key=value} 命令相同,如下:
380 % \begin{latex}
381 % \thusetup{
382 % key1 = value1,
383 % key2 = {a value, with comma},
384 % }
385 % % 可以多次调用
386 % \thusetup{
387 % key3 = value3,
388 % key1 = value11, % 覆盖 value1
389 % }
390 % \end{latex}
391 %
392 % \note[注意:]{\cs{thusetup} 使用 \pkg{kvsetkeys} 机制,所以配置项之间不能有空行,否则
393 % 会报错。}
394 %
395 % \subsubsection{输出格式}
396 % \DescribeOption{output}
397 % 选择输出的格式是打印版还是电子版(用于提交),可选:\option{print}(默认)、\option{electronic}。
398 % 打印版 \option{print} 自动在单面打印的部分插入空白页(比如封面),并且保证正文第 1 页在右侧。
399 % 电子版 \option{electronic} 选项会去掉空白页,这是因为一些院系要求提交的电子版不含空白页。
400 %
401 % \begin{latex}
402 % \thusetup{
403 % output = electronic,
404 % }
405 % \end{latex}
406 %
407 % 另外本科生要求有 0.2cm 留给装订线的宽度,这只有在打印版中才会生效。
408 %
409 %
410 % \subsubsection{书写语言}
411 % \DescribeOption{language}
412 % 在导言区设置 \option{language} 会修改论文的主要语言,如章节标题等。
413 % 在正文中设置 \option{language} 只修改接下来部分的书写语言,
414 % 如标点格式、图表名称,但不影响章节标题等。
415 %
416 % \begin{latex}
417 % \thusetup{
418 % language = english,
419 % }
420 % \end{latex}
421 %
422 % 论文的一些部分(如英文摘要、本科生的外文调研报告)要求使用特定的语言,
423 % 模板已经进行配置,并在这些部分结束后自动恢复为主要语言。
424 %
425 % 注意,本科生《写作规范》要求“本科生(含国外来华留学本科生)非外语专业论文统一要求
426 % 用中文书写。”研究生《写作指南》要求“外国人来华留学生可以用英文撰写学位论文,但
427 % 须采用中文封面”,“除留学生外,学位论文一律须用汉语书写”,用户须提前与导师和院系
428 % 的审查教师协商使用何种语言书写论文。
429 %
430 % \subsubsection{开题报告}
431 % \DescribeOption{thesis-type}
432 % 模板还支持本科生、研究生论文开题报告的格式,可以通过设置 \option{thesis-type=proposal} 得到。
433 %
434 % 开题报告与学位论文有两点不同:
435 % \begin{enumerate}
436 % \item 封面的信息和格式有区别,尤其是增加了一行“学号”信息,需要通过 \option{student-id} 填写;
437 % \item 开题报告不含英文标题页。
438 % \end{enumerate}
439 % \begin{latex}
440 % \thusetup{
441 % thesis-type = proposal,
442 % student-id = {2000310000},
443 % }
444 % \end{latex}
445 %
446 % \subsection{封面信息}
447 % \label{sec:titlepage}
448 % 封面信息可以通过统一设置命令 \cs{thusetup} 设置 \emph{key=value} 形式完成;
449 % 带 * 号的键通常是对应的英文。
450 %
451 % \subsubsection{论文标题}
452 % 中英文标题。可以在标题内部使用换行|\\|。
453 % \begin{latex}
454 % \thusetup{
455 % title = {论文中文题目},
456 % title* = {Thesis English Title},
457 % }
458 % \end{latex}
459 %
460 % \subsubsection{申请学位名称}
461 % \label{sec:degree-category}
462 % 学位名称的设置比较复杂,见表~\ref{tab:degree-category}。
463 %
464 % \begin{table}[h]
465 % \caption{学位名称的要求}
466 % \label{tab:degree-category}
467 % \begin{tabular}{p{2cm}p{6cm}p{6cm}}
468 % \toprule
469 % 学位类型 & degree-category & degree-category* \\
470 % \midrule
471 % 学术型博士 & 需注明所属的学科门类,例如:
472 % 哲学、经济学、法学、教育学、文学、历史学、理学、工学、农学、医学、
473 % 军事学、管理学、艺术学
474 % & Doctor of Philosophy \\
475 % \midrule
476 % 学术型硕士 & 同上
477 % & 哲学、文学、历史学、法学、教育学、艺术学门类
478 % 填写“Master of Arts“,其它填写“Master of Science” \\
479 % \midrule
480 % 专业型研究生学位 & 专业学位的名称,例如:教育博士、工程硕士
481 % & 专业学位的名称,例如:Doctor of Education, Master of Engineering \\
482 % \midrule
483 % 本科生 & - & - \\
484 % \bottomrule
485 % \end{tabular}
486 % \end{table}
487 %
488 % \begin{latex}
489 % \thusetup{
490 % degree-category = {工学硕士},
491 % degree-category* = {Master of Science},
492 % }
493 % \end{latex}
494 %
495 % \subsubsection{院系名称}
496 % 院系名称。
497 % \begin{latex}
498 % \thusetup{
499 % department = {计算机科学与技术系},
500 % }
501 % \end{latex}
502 %
503 % \subsubsection{学科名称}
504 %
505 % \begin{itemize}
506 % \item 研究生学术型学位:获得一级学科授权的学科填写一级学科名称,其他填写二级学科名称;
507 % \item 本科生:专业名称,第二学位论文需标注“(第二学位)”。
508 % \end{itemize}
509 %
510 % \begin{latex}
511 % \thusetup{
512 % discipline = {学科名称},
513 % discipline* = {Discipline in English},
514 % }
515 % \end{latex}
516 %
517 % \subsubsection{专业领域}
518 %
519 % 仅用于研究生专业型学位。
520 %
521 % \begin{itemize}
522 % \item 设置专业领域的专业学位类别,填写相应专业领域名称;
523 % \item 2019 级及之前工程硕士学位论文,在 \option{engineering-field} 填写相应工程领域名称;
524 % \item 其他专业学位类别的学位论文无需此信息。
525 % \end{itemize}
526 %
527 % \begin{latex}
528 % \thusetup{
529 % professional-field = {计算机技术},
530 % professional-field* = {Computer Technology},
531 % }
532 % \end{latex}
533 %
534 %
535 % \subsubsection{作者姓名}
536 % 作者姓名。
537 % \begin{latex}
538 % \thusetup{
539 % author = {中文姓名},
540 % author* = {Name in Pinyin},
541 % }
542 % \end{latex}
543 %
544 % \subsubsection{学号}
545 % 学号,仅用于本、研论文开题报告。
546 % \begin{latex}
547 % \thusetup{
548 % student-id = {20000310000},
549 % }
550 % \end{latex}
551 %
552 % \subsubsection{导师}
553 % \myentry{导师}
554 % 导师的姓名与职称之间以“,”(西文逗号,U+002C)隔开,下同。
555 % \begin{latex}
556 % \thusetup{
557 % supervisor = {导师姓名, 教授},
558 % supervisor* = {Professor Supervisor Name},
559 % }
560 % \end{latex}
561 %
562 % \myentry{副导师}
563 % 本科生的辅导教师,硕士的副指导教师。
564 % \begin{latex}
565 % \thusetup{
566 % associate-supervisor = {副导师姓名, 副教授},
567 % associate-supervisor* = {Professor Assoc-Supervisor Name},
568 % }
569 % \end{latex}
570 %
571 % \myentry{联合指导教师}
572 % \begin{latex}
573 % \thusetup{
574 % co-supervisor = {联合指导教师姓名, 教授},
575 % co-supervisor* = {Professor Join-Supervisor Name},
576 % }
577 % \end{latex}
578 %
579 % \subsubsection{成文日期}
580 % 默认为当前日期,也可以自己指定,要求使用 ISO 格式。
581 % \begin{latex}
582 % \thusetup{
583 % date = {2011-07-01},
584 % }
585 % \end{latex}
586 %
587 % \subsubsection{密级}
588 % \label{sec:setup-secret}
589 % 定义秘密级别和年限。如果定义了 \option{secret-level},
590 % 则会在封面上显示对应密级,并且从声明页中将移除“不包含涉及国家秘密的内容”字样(2025年3月写作指南更新有此要求)。
591 % \begin{latex}
592 % \thusetup{
593 % secret-year = 10,
594 % secret-level = {秘密},
595 % }
596 % \end{latex}
597 %
598 % \subsubsection{博士后专用参数}
599 % \begin{latex}
600 % \thusetup{
601 % clc = {分类号},
602 % udc = {udc},
603 % id = {id},
604 % discipline-level-1 = {流动站(一级学科)名称},
605 % discipline-level-2 = {专业(二级学科)名称},
606 % start-date = {2011-07-01}, % 研究工作起始时间
607 % }
608 % \end{latex}
609 %
610 % \myentry{生成封面}
611 % \DescribeMacro{\maketitle}
612 % 生成封面,不含授权说明,摘要等。
613 % \begin{latex}
614 % % 直接生成封面
615 % \maketitle
616 % \end{latex}
617 %
618 % \subsection{前言部分}
619 %
620 % \subsubsection{指导小组、公开评阅人和答辩委员会名单}
621 % \myentry{答辩委员会名单}
622 % \DescribeEnv{committee}
623 % 学位论文指导小组、公开评阅人和答辩委员会名单可以由 \env{committee} 环境生成,
624 % 其中的可选参数可以使用 \option{name} 根据是有无指导小组设置合适的标题,比如
625 % \begin{latex}
626 % \begin{committee}[name={学位论文公开评阅人和答辩委员会名单}]
627 % ...
628 % \end{committee}
629 % \end{latex}
630 %
631 % 答辩委员会名单中的表格使用 LaTeX 生成可能略麻烦,也可以导入 Word 版转成的 PDF 文件,
632 % \begin{latex}
633 % \begin{committee}[file=figures/committee.pdf]
634 % \end{committee}
635 % \end{latex}
636 %
637 % \subsubsection{授权说明}
638 % \myentry{授权说明}
639 % \DescribeMacro{\copyrightpage}
640 % 可选参数为扫描得到的 PDF 文件名,例如:
641 % \begin{latex}
642 % % 将签字扫描后授权文件 scan-copyright.pdf 替换原始页面
643 % \copyrightpage[file=scan-copyright.pdf]
644 % \end{latex}
645 %
646 % \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。
647 %
648 % \subsubsection{摘要}
649 % \myentry{摘要正文}
650 % \DescribeEnv{abstract}
651 % \DescribeEnv{abstract*}
652 %
653 % 摘要直接在正文中使用 \env{abstract}、\env{abstract*} 环境生成。
654 %
655 % \begin{latex}
656 % \begin{abstract}
657 % 摘要请写在这里...
658 % \end{abstract}
659 %
660 % \begin{abstract*}
661 % Here comes the abstract in English...
662 % \end{abstract*}
663 % \end{latex}
664 %
665 % \myentry{关键词}
666 % 关键词需要使用 \cs{thusetup} 进行设置。关键词之间以\emph{西文逗号}隔开,模板会
667 % 自动调整为要求的格式。关键词的设置只要在摘要环境结束前即可。
668 % \begin{latex}
669 % \thusetup{
670 % keywords = {关键词 1, 关键词 2},
671 % keywords* = {keyword 1, keyword 2},
672 % }
673 % \end{latex}
674 %
675 % \subsubsection{目录和索引表}
676 % 目录、插图、表格、公式和算法等索引命令分别如下,将其插入到期望的位置即可(带*的命令表
677 % 示对应的索引表不会出现在目录中):
678 %
679 % \DescribeMacro{\tableofcontents}
680 % \DescribeMacro{\listoffigures}
681 % \DescribeMacro{\listoftables}
682 % \DescribeMacro{\listoffiguresandtables}
683 % \DescribeMacro{\listofalgorithms}
684 % \begin{longtable}{ll}
685 % \toprule
686 % {\heiti 用途} & {\heiti 命令} \\\midrule
687 % 目录 & \cs{tableofcontents} \\
688 % 插图清单 & \cs{listoffigures} \\
689 % 附表清单 & \cs{listoftables} \\
690 % 插图和附表清单 & \cs{listoffiguresandtables} \\
691 % 算法清单 & \cs{listofalgorithms} \\
692 % \bottomrule
693 % \end{longtable}
694 %
695 % \LaTeX{} 默认支持插图和表格索引,是通过 \cs{caption} 命令完成的,因此它们必须出
696 % 现在浮动环境中,否则不被计数。
697 %
698 % 如果不想让某个表格或者图片出现在索引里面,那么请使用命令 \cs{caption*},这
699 % 个命令不会给表格编号,也就是出来的只有标题文字而没有“表~xx”,“图~xx”,否则
700 % 索引里面序号不连续就显得不伦不类,这也是 \LaTeX{} 里星号命令默认的规则。
701 %
702 % 如果的确想让其编号,但又不想出现在索引中的话,目前模板暂不支持。
703 %
704 % \subsubsection{符号对照表}
705 % \DescribeEnv{denotation}
706 % 主要符号表环境,跟 \env{description} 类似,使用方法参见示例文件。带一个可选参数,
707 % 用来指定符号列的宽度(默认为 2.5cm)。
708 % \begin{latex}
709 % \begin{denotation}
710 % \item[E] 能量
711 % \item[m] 质量
712 % \item[c] 光速
713 % \end{denotation}
714 % \end{latex}
715 %
716 % 如果默认符号列的宽度不满意,可以通过参数来调整:
717 % \begin{latex}
718 % \begin{denotation}[1.5cm] % 设置为 1.5cm
719 % \item[E] 能量
720 % \item[m] 质量
721 % \item[c] 光速
722 % \end{denotation}
723 % \end{latex}
724 %
725 % 符号对照表的另外一种方法是调用 \pkg{nomencl} 宏包,需要在导言区设置:
726 %
727 % \begin{latex}
728 % \usepackage{nomencl}
729 % \makenomenclature
730 % \end{latex}
731 %
732 % 然后在正文中任意位置使用 \cs{nomenclature} 声明需要添加到主要符号表的符号:
733 %
734 % \begin{latex}
735 % \nomenclature{$m$}{The mass of one angel}
736 % \end{latex}
737 %
738 % 最后使用 \cs{printnomenclature} 命令生成符号表。更详细的使用方法参
739 % 见 \pkg{nomencl} 宏包的文档。
740 %
741 % \subsection{正文部分}
742 % \subsubsection{图表编号}
743 % \DescribeOption{figure-number-separator}
744 % \DescribeOption{table-number-separator}
745 % \DescribeOption{equation-number-separator}
746 % 研究生要求图表和公式的编号使用“.”或“-”连接,模板默认使用句点“.”。
747 % 用户也可以通过 \option{figure-number-separator}、\option{table-number-separator}
748 % 等选项分别设置:
749 % \begin{latex}
750 % \thusetup{
751 % figure-number-separator = {-},
752 % table-number-separator = {-},
753 % equation-number-separator = {-},
754 % }
755 % \end{latex}
756 % \DescribeOption{number-separator}
757 % 也可以使用 \option{number-separator} 同时设置图、表、公式三项的编号连接符,
758 % 比如 |\thusetup{number-separator = -}|。
759 %
760 % 本科生要求“附录中图、表、公式的编号,应与正文中的编号区分开”,
761 % 应理解为将章号改变为附录对应的大写字母编号,连接符不宜改变。
762 %
763 % \subsubsection{数学符号}
764 % \label{sec:math}
765 % 中文论文的数学符号默认遵循 GB/T 3102.11—1993《物理科学和技术中使用的数学符号》
766 % \footnote{原 GB 3102.11—1993,自 2017 年 3 月 23 日起,该标准转为推荐性标准。}。
767 % 该标准参照采纳 ISO 31-11:1992 \footnote{目前已更新为 ISO 80000-2:2019。},
768 % 但是与 \TeX{} 默认的美国数学学会(AMS)的习惯有许多差异。
769 % 这将在下文详细论述。
770 %
771 % \DescribeOption{math-style}
772 % 用户可以通过设置 \option{math-style} 选择数学符号样式(可选:
773 % \option{GB}(中文默认),\option{TeX}(英文默认)和 \option{ISO}),比如:
774 % \begin{latex}
775 % \thusetup{
776 % math-style = TeX,
777 % }
778 % \end{latex}
779 %
780 % 用户也可以逐项修改数学样式,包括:
781 % \newcommand\dif{\mathop{}\!\mathrm{d}}
782 % \begin{enumerate}
783 % \item \DescribeOption{uppercase-greek}
784 % 大写希腊字母的正/斜体,可选:\option{italic}、\option{upright}。
785 % 有限增量符号 $\increment x$ 固定使用正体,推荐使用 \cs{increment} 表示。
786 % \item \DescribeOption{less-than-or-equal}
787 % 小于等于号和大于等于号的字形,可选:\option{slanted}、\option{horizontal}。
788 % 这将控制 \cs{le}、\cs{ge}、\cs{leq} 和 \cs{geq} 的符号
789 % 是“$\leqslant$、$\geqslant$”还是“$\leq$、$\geq$”。
790 % \item \DescribeOption{integral}
791 % 积分号的正/斜体,可选:\option{upright}、\option{slanted}。
792 % 该选项需要字体的支持,目前仅限 \option{xits}、\option{stix}、
793 % \option{libertinus} 和 \option{newcm}。参考下文关于数学字体的选择。
794 % \item \DescribeOption{integral-limits}
795 % 积分号上下限的位置,可选:\option{true}(在上下)、\option{false}(在右侧)。
796 % 这个设置只影响行间公式,行内公式统一居右侧,不受影响。
797 % \item \DescribeOption{partial}
798 % 偏微分符号的正/斜体,可选:\option{upright}、\option{italic}。
799 % \item \DescribeOption{math-ellipsis}
800 % 省略号 \cs{dots} 的样式,可选:\option{centered}(按照中文的习惯固定居中)、
801 % \option{lower} 和 \option{AMS}(取决于前后符号的位置)。
802 % 其他的省略号命令如 \cs{ldots}、\cs{cdots} 则不受影响。
803 % \item \DescribeOption{real-part}
804 % 实部 \cs{Re} 和虚部 \cs{Im} 的字体,可选:\option{roman} 和 \option{fraktur}。
805 % \end{enumerate}
806 %
807 % 如果数学符号选择国标样式 |math-style = GB|,相当于设置了
808 % \begin{latex}
809 % \thusetup{
810 % uppercase-greek = italic,
811 % less-than-or-equal = slanted,
812 % integral = upright,
813 % integral-limits = false,
814 % partial = upright,
815 % math-ellipsis = centered,
816 % real-part = roman,
817 % }
818 % \end{latex}
819 %
820 % 另外,国标的数学样式与 AMS 还有一些差异无法统一设置,需要用户在写作时进行处理。
821 % \begin{enumerate}
822 % \item 数学常数和特殊函数名用正体,如 $\uppi = 3.14\dots$;$\symup{i}^2 = -1$;
823 % $\symup{e} = \lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)^n$。
824 % \item 微分号使用正体,比如 $\dif y / \dif x$。
825 % \item 向量、矩阵和张量用粗斜体(\cs{symbf}),如 $\symbf{x}$、$\symbf{\Sigma}$、$\symbfsf{T}$。
826 % \end{enumerate}
827 %
828 % 需要注意,上述关于数学符号风格的设置在设置数学字体(\option{math-font})时才会生效。
829 %
830 % \DescribeOption{math-font}
831 % 模板使用默认使用 XITS Math 作为数学字体。
832 % 用户也可以使用 \option{math-font} 选项切换其他数学字体,可选:
833 % \option{stix}(STIX Two Math)、
834 % \option{libertinus}(Libertinus Math)、
835 % \option{newcm}(New Computer Modern Math)、
836 % \option{lm}(Latin Modern Math)。
837 %
838 % 其中 \option{lm} 和 \option{newcm} 的字形比较搭配 TeX 原生的 Computer Modern 字体,
839 % 但与《指南》要求的西文字体 Times New Roman 并不搭配。
840 % 可能会造成正文和公式中的数字字体不一致,需要谨慎使用。
841 %
842 % 以上字体都是 OpenType 格式的字体,需要配合
843 % \href{http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unicode-math.pdf}{\pkg{unicode-math}}
844 % 宏包使用。
845 % 全部数学符号的命令参考
846 % \href{http://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf}{\pkg{unimath-symbols}}。
847 % 注意,\pkg{unicode-math} 宏包与 \pkg{amsfonts}、\pkg{amssymb}、\pkg{bm}、
848 % \pkg{mathrsfs}、\pkg{upgreek} 等宏包\emph{不}兼容。
849 % 模板作了处理,用户可以直接使用这些宏包的命令,如 \cs{bm}、\cs{mathscr}、
850 % \cs{uppi}。
851 %
852 % 另外,模板还为 |math-font| 提供了传统的 Type 1 字体 \option{newtx}。
853 % 该选项会调用 \pkg{newtxmath} 宏包。
854 % 但是,如果西文字体已经使用了 OpenType 的 Times New Roman,
855 % 混用 Type 1 字体可能会导致问题,尤其是使用 \pkg{siunitx} 宏包时。
856 % 该选项还处于测试阶段,需要谨慎使用。
857 %
858 % \DescribeOption{eqn-paren-style}
859 % 控制中文论文中,数学公式编号两边的括号样式。可选项包括:\option{full}(全角,默认) / \option{half}(半角)。
860 % 在语言为英语(|language = english|)时,此选项无效,仅使用半角括号。
861 %
862 % \subsubsection{定理环境}
863 % \label{sec:theorem}
864 % \thuthesis{} 定义了常用的数学环境:
865 %
866 % \begin{center}
867 % \begin{tabular}{*{7}{l}}\toprule
868 % axiom & theorem & definition & proposition & lemma & conjecture &\\
869 % 公理 & 定理 & 定义 & 命题 & 引理 & 猜想 &\\\midrule
870 % proof & corollary & example & exercise & assumption & remark & problem \\
871 % 证明 & 推论 & 例子& 练习 & 假设 & 注释 & 问题\\\bottomrule
872 % \end{tabular}
873 % \end{center}
874 %
875 % 比如:
876 % \begin{latex}
877 % \begin{definition}
878 % 道千乘之国,敬事而信,节用而爱人,使民以时。
879 % \end{definition}
880 % \end{latex}
881 % 产生(自动编号):
882 % \medskip
883 %
884 % \noindent\framebox[\linewidth][l]{{\heiti 定义~1.1~~~} % {道千乘之国,敬事而信,节用而爱人,使民以时。}}
885 %
886 % \smallskip
887 % 列举出来的数学环境毕竟是有限的,如果想用\emph{胡说}这样的数学环境,那么可以定义:
888 % \begin{latex}
889 % \newtheorem{nonsense}{胡说}[chapter]
890 % \end{latex}
891 %
892 % 然后这样使用:
893 % \begin{latex}
894 % \begin{nonsense}
895 % 契丹武士要来中原夺武林秘笈。—— 慕容博
896 % \end{nonsense}
897 % \end{latex}
898 %
899 % 产生(自动编号):
900 %
901 % \medskip
902 % \noindent\framebox[\linewidth][l]{{\heiti 胡说~1.1~~~} % {契丹武士要来中原夺武林秘笈。—— 慕容博}}
903 %
904 % \subsubsection{列表环境}
905 % \DescribeEnv{itemize}
906 % \DescribeEnv{enumerate}
907 % \DescribeEnv{description}
908 % 为了适合中文习惯,模板将这三个常用的列表环境用 \pkg{enumitem} 进行了纵向间距压
909 % 缩。一方面清除了多余空间,另一方面用户可以自己指定列表环境的样式(如标签符号,
910 % 缩进等)。细节请参看 \pkg{enumitem} 文档,此处不再赘述。
911 %
912 % \subsubsection{引用方式}
913 % \label{sec:citestyle}
914 % 模板支持两种引用方式,分别为理工科常用的“顺序编码制”和文科常用
915 % 的“著者-出版年制”。
916 % 使用者在设置参考文献表的格式
917 % (\cs{bibliographystyle},见第~\ref{sec:bibliography} 节)时,
918 % 正文中引用文献的标注会自动调整为对应的格式。
919 %
920 % 如果需要标出引文的页码,可以写在 \cs{cite} 的可选参数中,如
921 % |\cite[42]{knuth84}|。
922 %
923 % \paragraph{顺序编码制}
924 % \DescribeMacro{\inlinecite}
925 % 顺序编码制的参考文献引用分为两种模式:
926 % \begin{enumerate}
927 % \item 上标模式,比如“同样的工作有很多\textsuperscript{[1-2]}……”;
928 % \item 正文模式,比如“文 [3] 中详细说明了……”。
929 % \end{enumerate}
930 %
931 % \DescribeOption{cite-style}
932 % 用户可以将引用标注的格式设为正文模式:
933 % \begin{latex}
934 % \thusetup{
935 % cite-style = inline,
936 % }
937 % \end{latex}
938 % 也可以使用 \cs{inlinecite}\marg{key} 临时使用正文模式的引用标注。
939 %
940 % \paragraph{著者-出版年制}
941 % 著者-出版年制的参考文献引用有两种模式:
942 % \begin{enumerate}
943 % \item \cs{citep}:著者与年份均在括号中,比如“(Zhang, 2008)”,
944 % 同默认的 \cs{cite} 命令;
945 % \item \cs{citet}:著者姓名作为正文的一部分,比如“Zhang (2008)”;
946 % \end{enumerate}
947 %
948 % 另外,\pkg{natbib} 还提供了其他方便引用的命令,
949 % 比如 \cs{citeauthor}、\cs{citeyear} 等,
950 % 更多细节参考 \pkg{natbib} 的文档。
951 %
952 % \subsection{其他部分}
953 %
954 % \subsubsection{参考文献}
955 % \label{sec:bibliography}
956 %
957 % 参考文献通常可以使用 \hologo{BibTeX} 或 biblatex 生成。
958 % \hologo{BibTeX} 是 LaTeX 处理参考文献的传统的方式,
959 % 需要在使用 \cs{bibliographystyle}\marg{style} 选择样式
960 % 并用 \cs{bibliography} 设置 \file{.bib} 的路径。
961 % 然后使用 \texttt{bibtex} 对 \file{.aux} 文件进行编译得到 \file{.bbl} 文件。
962 % 其中的参考文献表内容会在后续编译时替换到 \cs{bibliography} 的位置。
963 % Biblatex 是较新的方式,需要在载入宏包时通过 \option{style} 选择样式,
964 % 在导言区使用 \cs{addbibresource} 声明数据库的路径,
965 % 并在输出参考文献表的位置使用 \cs{printbibliography} 命令,
966 % 而且编译参考文献的命令需要换为 biber。
967 % 这两种方式各有优缺点,比如 BibTeX 无法对中文按照拼音排序,一些样式更新不够及时;
968 % Biblatex 运行较缓慢,无法对多个参考文献表使用不同样式。
969 % 用户需要根据实际选择合适的方式。
970 %
971 % 研究生要求的参考文献格式基于《信息与文献 参考文献著录规则》(GB/T 7714—2015)
972 % 进行了少量改编(如英文姓名不使用全大写),
973 % 可以选择“顺序编码制”和“著者-出版年制”。
974 % 如果使用 BibTeX 的方式,需要在导言区载入 \pkg{natbib} 宏包并选择样式,如:
975 % \begin{latex}
976 % % 顺序编码制
977 % \usepackage[sort]{natbib}
978 % \bibliographystyle{thuthesis-numeric}
979 % \end{latex}
980 % 或
981 % \begin{latex}
982 % % 著者-出版年制
983 % \usepackage{natbib}
984 % \bibliographystyle{thuthesis-author-year}
985 % \end{latex}
986 % 其中的 \option{sort} 选项会将同一处引用的多个文献编号严格按照顺序排序,
987 % 这并非《写作指南》要求,但是推荐使用。
988 % 这里调用的样式由 \href{http://ctan.org/pkg/gbt7714}{\pkg{gbt7714}} 的 \file{.bst} 进行了少量修改。
989 %
990 % 参考文献表采用“著者-出版年”制组织时,各篇文献首先按文种集中,然后按著者字
991 % 顺和出版年排列;中文文献可以按著者汉语拼音字顺排列,也可以按著者的笔画笔顺排列。
992 % 但由于 \hologo{BibTeX} 功能的局限性,无法自动获取著者姓名的拼音或笔画笔顺进行正确排序。
993 % 一种解决方法是在 \file{.bib} 数据库的中文文献的 |key| 域手动录入著者姓名的拼音,
994 % 这比较适合中文文献数量较少的情况,如:
995 % \begin{latex}
996 % @book{capital,
997 % author = {马克思 and 恩格斯},
998 % key = {ma3 ke4 si1 & en1 ge2 si1},
999 % ...
1000 % }
1001 % \end{latex}
1002 % 另一种方式是使用 biblatex,应在导言区设置
1003 % \begin{latex}
1004 % \usepackage[style=thuthesis-author-year]{biblatex}
1005 % \addbibresource{ref/refs.bib}
1006 % \end{latex}
1007 % 这里的样式由 \href{https://ctan.org/pkg/biblatex-gb7714-2015}{biblatex-gb7714-2015} 进行了少量改编,
1008 % 一些额外用法可以参考该宏包的文档。
1009 % 注意 \pkg{biblatex} 跟 \pkg{natbib} 不兼容,
1010 % 而且 \cs{addbibresource} 必须在导言区设置。
1011 % 输出参考文献表应使用 \cs{printbibliography} 命令。
1012 %
1013 % 本科生要求的中文参考文献格式严格遵从 GB/T 7714—2015,
1014 % 附录中调研报告的英文参考文献可以自行选择合适的风格。
1015 % 但是 biblatex 不支持同一文档中使用不同的格式,
1016 % 所以只能使用 \hologo{BibTeX}:
1017 % \begin{latex}
1018 % % 本科生参考文献的著录格式
1019 % \usepackage[sort]{natbib}
1020 % \bibliographystyle{thuthesis-bachelor}
1021 % \end{latex}
1022 % 调研报告的参考文献需要选择与 \pkg{natbib} 兼容的样式。
1023 %
1024 % 本科生外文系要求使用 APA 或 MLA。
1025 % APA 的 BibTeX 样式由 \pkg{apacite} 宏包提供,需要在导言区调用:
1026 % \begin{latex}
1027 % \usepackage[natbibapa]{apacite}
1028 % \bibliographystyle{apacite}
1029 % \end{latex}
1030 % 其中 \option{natbibapa} 会调用 \pkg{natbib} 来处理引用,
1031 % 这也是宏包推荐的用法。
1032 % 注意目前的 \pkg{apacite} 只支持到 APA 第 6 版。
1033 % 更推荐使用已经更新到 APA 第 7 版的 \pkg{biblatex-apa}:
1034 % \begin{latex}
1035 % \usepackage[style=apa]{biblatex}
1036 % \addbibresource{refs-apa.bib}
1037 % \end{latex}
1038 % 注意,如果参考文献中引用了中文文献的话,这两种方法都不能正确调整格式,
1039 % 需要手动进行修改 \file{.bbl} 文件的内容,
1040 % 这时 BibTeX 比 biblatex 更简单些。
1041 %
1042 % BibTeX 没有用于 MLA 的样式,所以对于 MLA 只能使用 biblatex:
1043 % \begin{latex}
1044 % \usepackage[style=mla-new]{biblatex}
1045 % \addbibresource{refs-apa.bib}
1046 % \end{latex}
1047 % 注意这里 \option{mla-new} 对应于 MLA 第 8 版的格式,
1048 % \option{mla} 是第 7 版的。
1049 %
1050 % \subsubsection{致谢}
1051 %
1052 % \DescribeEnv{acknowledgements}
1053 % 把致谢做成一个环境更好一些,直接往里面写感谢的话就可以啦。
1054 %
1055 % \begin{latex}
1056 % \begin{acknowledgements}
1057 % …
1058 % 还要特别感谢 \thuthesis{} 节省了论文排版时间!
1059 % \end{acknowledgements}
1060 % \end{latex}
1061 %
1062 % \subsubsection{声明}
1063 % \DescribeMacro{\statement}
1064 % 直接使用 \cs{statement} 命令可以编译生成声明页。
1065 % 在打印、签字、扫描后如果要插入扫描页,将可选参数 \option{file} 指定为 PDF 文件名,例如:
1066 % \begin{latex}
1067 % \statement[file=scan-statement.pdf]
1068 % \end{latex}
1069 %
1070 % 由于正文篇幅可能有变化,声明的页码可能不同。
1071 % 而且扫描件的页眉线可能有偏差
1072 % 所以为了避免重复打印扫描,
1073 % 在提交终稿 PDF 时,先编译不含页眉页脚的声明页。
1074 % 在打印、签名、扫描成 PDF 文档后,再插入 \file{scan-statement.pdf} 替换原始页面,
1075 % 并加上页眉页脚。
1076 %
1077 % 用户可以通过可选参数 \option{page-style} 手动控制声明页是否含页眉页脚。
1078 % 例如编译生成声明页时不含页眉页脚:
1079 % \begin{latex}
1080 % \statement[page-style=empty]
1081 % \end{latex}
1082 % 插入扫描页时加上页眉页脚:
1083 % \begin{latex}
1084 % \statement[file=scan-statement.pdf, page-style=plain]
1085 % \end{latex}
1086 %
1087 % \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。
1088 %
1089 % \subsubsection{附录}
1090 %
1091 % 附录由 \cs{appendix} 命令开启,然后像正文一样书写。
1092 % \begin{latex}
1093 % \appendix
1094 % \chapter{...}
1095 % ...
1096 % \end{latex}
1097 %
1098 % \DescribeOption{toc-depth}
1099 % 一些院系要求目录中只出现附录的章标题,不出现附录中的一级、二级节标题。模板默认
1100 % 如此设置,用户也可以在 \cs{appendix} 命令后手动控制加入目录的标题层级,其
1101 % 中 |0| 表示章标题,|1| 表示一级节标题,以此类推。
1102 %
1103 % \begin{latex}
1104 % \appendix
1105 % \thusetup{toc-depth=0} % 目录只出现章标题
1106 % \end{latex}
1107 %
1108 % \subsubsection{个人简历、在学期间完成的相关学术成果}
1109 % \DescribeEnv{resume}
1110 % 研究生的标题为“个人简历、在学期间完成的相关学术成果”,
1111 % 本科生的标题为“在学期间参加课题的研究成果”或“PUBLICATIONS”。
1112 %
1113 % \DescribeEnv{achievements}
1114 % 本章的其他标题同样使用 \cs{section*},\cs{subsection*} 等命令生成,
1115 % 研究成果用 \env{achievements} 环境罗列。
1116 %
1117 % \begin{latex}
1118 % \begin{resume}
1119 % \section*{个人简历}
1120 % ……
1121 %
1122 % \section*{在学期间完成的相关学术成果}
1123 %
1124 % \subsection*{学术论文}
1125 % \begin{achievements}
1126 % \item ……
1127 % \item ……
1128 % \end{achievements}
1129 %
1130 % \subsection*{专利}
1131 % \begin{achievements}
1132 % \item ……
1133 % \item ……
1134 % \end{achievements}
1135 % \end{resume}
1136 % \end{latex}
1137 %
1138 % \subsubsection{综合论文训练记录表}
1139 % \DescribeMacro{\record}
1140 % 本科生需要在最后附上综合论文训练记录表,可以用如下命令:
1141 %
1142 % \begin{latex}
1143 % \record{file=scan-record.pdf}
1144 % \end{latex}
1145 %
1146 % \textbf{注意:}此命令只能使用一次。如果多次使用将会报错。
1147 %
1148 %
1149 % \subsection{书脊}
1150 % \DescribeMacro{\spine}
1151 % \DescribeOption{spine-font}
1152 % \DescribeOption{spine-title}
1153 % \DescribeOption{spine-author}
1154 % 生成装订的书脊,为竖排格式。内容默认使用论文的标题和作者。
1155 % 可以设置 \option{spine-title} 和 \option{spine-author} 来修改。
1156 %
1157 % 博士论文的书脊字体默认为三号字,硕士的为小三号。
1158 % 本科生要求字体大小根据论文的薄厚而定,可以使用 \option{spine-font} 设置字号。
1159 % \begin{latex}
1160 % \thusetup{
1161 % spine-font = {\zihao{3}},
1162 % spine-title = {书脊的标题},
1163 % spine-author = {书脊的作者姓名},
1164 % }
1165 % \end{latex}
1166 %
1167 % 由于 Fandol 字体在 \XeTeX 中的竖排存在一些问题,如果书脊使用的字体是 Fandol 仿宋
1168 %(\option{fontset} 为 \texttt{fandol} 或者 \texttt{ubuntu} 时),则它\textbf{必须作为独立文件生成},
1169 % 否则可能导致后续内容文字方向错乱的问题。
1170 %
1171 % \DescribeOption{include-spine}
1172 % 一些院系要求把书脊插进论文里,需要在 \cs{maketitle} 前设置。
1173 % \begin{latex}
1174 % \thusetup{
1175 % include-spine = true,
1176 % }
1177 % \end{latex}
1178 % 打开此选项后,书脊会出现在中文封面后面的第一个空白页。如果有英文封面,则在英文封面之前。
1179 % 如果需要书脊出现在其他位置,请手工使用 \cs{spine} 生成,不要使用此选项。
1180 %
1181 % \section{致谢}
1182 % \label{sec:thanks}
1183 % 感谢这些年来一直陪伴 \thuthesis{} 成长的新老同学!
1184 %
1185 % 欢迎各位到 \href{http://github.com/tuna/thuthesis/}{\thuthesis{} GitHub 主页}贡献!
1186 %
1187 %
1188 % ^^A redefine some commands in markdown package to remove annoying section numbering
1189 % \renewcommand{\markdownRendererHeadingTwo}[1]{\subsection*{#1}}
1190 % \renewcommand{\markdownRendererHeadingThree}[1]{\subsubsection*{#1}}
1191 % ^^A render changelog from markdown
1192 % \markdownInput{CHANGELOG.md}
1193 %
1194 %
1195 % \StopEventually{\PrintIndex}
1196 % \clearpage
1197 %
1198 % \section{实现细节}
1199 %
1200 % \subsection{基本信息}
1201 % \begin{macrocode}
1202 %<cls>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
1203 %<cls>\ProvidesClass{thuthesis}
1204 %<cls>[2026/05/26 7.7.1 Tsinghua University Thesis Template]
1205 % \end{macrocode}
1206 %
1207 % 报错
1208 % \begin{macrocode}
1209 \newcommand\thu@error[1]{%
1210 \ClassError{thuthesis}{#1}{}%
1211 }
1212 \newcommand\thu@warning[1]{%
1213 \ClassWarning{thuthesis}{#1}%
1214 }
1215 \newcommand\thu@debug[1]{%
1216 \typeout{Package thuthesis Info: #1}%
1217 }
1218 \newcommand\thu@patch@error[1]{%
1219 \thu@error{Failed to patch command \protect#1}%
1220 }
1221 \newcommand\thu@deprecate[2]{%
1222 \def\thu@@tmp{#2}%
1223 \thu@warning{%
1224 The #1 is deprecated%
1225 \ifx\thu@@tmp\@empty\else
1226 . Use #2 instead%
1227 \fi
1228 }%
1229 }
1230 % \end{macrocode}
1231 %
1232 % 将某个宏的定义替换为报错信息,用于只应该使用一次的命令。
1233 % 如:\cs{statement}、\cs{copyrightpage}, \cs{record} 等。
1234 % \begin{macrocode}
1235 \newcommand\thu@replace@with@error[1]{%
1236 \expandafter\def\csname #1\endcsname{%
1237 \thu@error{%
1238 \expandafter\protect\csname #1\endcsname\space can only be used once.
1239 \MessageBreak
1240 Please remove the duplicate call%
1241 }%
1242 }%
1243 }
1244 % \end{macrocode}
1245 %
1246 % 检查 \LaTeXe{} kernel 版本
1247 % \begin{macrocode}
1248 \@ifl@t@r\fmtversion{2017/04/15}{}{
1249 \thu@error{%
1250 TeX Live 2017 or later version is required to compile this document%
1251 }
1252 }
1253 % \end{macrocode}
1254 %
1255 % 检查编译引擎,要求使用 \XeLaTeX。
1256 % \begin{macrocode}
1257 \RequirePackage{iftex}
1258 \ifXeTeX\else
1259 \ifLuaTeX\else
1260 \thu@error{XeLaTeX or LuaLaTeX is required to compile this document}
1261 \fi
1262 \fi
1263 % \end{macrocode}
1264 %
1265 % 载入用于测试的配置。
1266 % \begin{macrocode}
1267 \InputIfFileExists{thuthesis-pdf-test-config.tex}{}{
1268 \InputIfFileExists{thuthesis-log-test-config.tex}{}{}
1269 }
1270 % \end{macrocode}
1271 %
1272 % \subsection{定义选项}
1273 % \label{sec:defoption}
1274 % 定义论文类型以及是否涉密
1275 % \begin{macrocode}
1276 %<*cls>
1277 \hyphenation{Thu-Thesis}
1278 \def\thuthesis{ThuThesis}
1279 \def\version{7.7.1}
1280 \RequirePackage{kvdefinekeys}
1281 \RequirePackage{kvsetkeys}
1282 \RequirePackage{kvoptions}
1283 \SetupKeyvalOptions{
1284 family=thu,
1285 prefix=thu@,
1286 setkeys=\kvsetkeys}
1287 % \end{macrocode}
1288 %
1289 % \begin{macro}{\thusetup}
1290 % 提供一个 \cs{thusetup} 命令支持 \emph{key-value} 的方式来设置。
1291 % \begin{macrocode}
1292 \let\thu@setup@hook\@empty
1293 \newcommand\thusetup[1]{%
1294 \let\thu@setup@hook\@empty
1295 \kvsetkeys{thu}{#1}%
1296 \thu@setup@hook
1297 }
1298 % \end{macrocode}
1299 % \end{macro}
1300 %
1301 % 同时用 \emph{key-value} 的方式来定义这些接口:
1302 % \begin{latex}
1303 % \thu@define@key{
1304 % <key> = {
1305 % name = <name>,
1306 % choices = {
1307 % <choice1>,
1308 % <choice2>,
1309 % },
1310 % default = <default>,
1311 % },
1312 % }
1313 % \end{latex}
1314 %
1315 % 其中 |choices| 设置允许使用的值,默认为第一个(或者 \meta{default});
1316 % \meta{code} 是相应的内容被设置时执行的代码。
1317 %
1318 % \begin{macrocode}
1319 \newcommand\thu@define@key[1]{%
1320 \kvsetkeys{thu@key}{#1}%
1321 }
1322 \kv@set@family@handler{thu@key}{%
1323 % \end{macrocode}
1324 %
1325 % \cs{thusetup} 会将 \meta{value} 存到 \cs{thu@\meta{key}},
1326 % 但是宏的名字包含 “-” 这样的特殊字符时不方便直接调用,比如 |key = math-style|,
1327 % 这时可以用 |name| 设置 \meta{key} 的别称,比如 |key = math@style|,
1328 % 这样就可以通过 \cs{thu@math@style} 来引用。
1329 % |default| 是定义该 \meta{key} 时默认的值,缺省为空。
1330 %
1331 % \begin{macrocode}
1332 \@namedef{thu@#1@@name}{#1}%
1333 \def\thu@@default{}%
1334 \def\thu@@choices{}%
1335 \kv@define@key{thu@value}{name}{%
1336 \@namedef{thu@#1@@name}{##1}%
1337 }%
1338 % \end{macrocode}
1339 %
1340 % 由于在定义接口时,\cs{thu@\meta{key}@@code} 不一定有定义,
1341 % 而且在文档类/宏包中还有可能对该 |key| 的 |code| 进行添加。
1342 % 所以 \cs{thu@\meta{key}@@code} 会检查如果在定义文档类/宏包时则推迟执行,否则立即执行。
1343 %
1344 % \begin{macrocode}
1345 \@namedef{thu@#1@@check}{}%
1346 \@namedef{thu@#1@@code}{}%
1347 % \end{macrocode}
1348 %
1349 % 保存下 |choices = {}| 定义的内容,在定义 \cs{thu@\meta{name}} 后再执行。
1350 %
1351 % \begin{macrocode}
1352 \kv@define@key{thu@value}{choices}{%
1353 \def\thu@@choices{##1}%
1354 \@namedef{thu@#1@@reset}{}%
1355 % \end{macrocode}
1356 %
1357 % \cs{thu@\meta{key}@check} 检查 |value| 是否有效,
1358 % 并设置 \cs{ifthu@\meta{name}@\meta{value}}。
1359 %
1360 % \begin{macrocode}
1361 \@namedef{thu@#1@@check}{%
1362 \@ifundefined{%
1363 ifthu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}%
1364 }{%
1365 \thu@error{Invalid value "#1 = \@nameuse{thu@\@nameuse{thu@#1@@name}}"}%
1366 }%
1367 \@nameuse{thu@#1@@reset}%
1368 \@nameuse{thu@\@nameuse{thu@#1@@name}@\@nameuse{thu@\@nameuse{thu@#1@@name}}true}%
1369 }%
1370 }%
1371 \kv@define@key{thu@value}{default}{%
1372 \def\thu@@default{##1}%
1373 }%
1374 \kvsetkeys{thu@value}{#2}%
1375 \@namedef{thu@\@nameuse{thu@#1@@name}}{}%
1376 % \end{macrocode}
1377 %
1378 % 第一个 \meta{choice} 设为 \meta{default},
1379 % 并且对每个 \meta{choice} 定义 \cs{ifthu@\meta{name}@\meta{choice}}。
1380 %
1381 % \begin{macrocode}
1382 \kv@set@family@handler{thu@choice}{%
1383 \ifx\thu@@default\@empty
1384 \def\thu@@default{##1}%
1385 \fi
1386 \expandafter\newif\csname ifthu@\@nameuse{thu@#1@@name}@##1\endcsname
1387 \expandafter\g@addto@macro\csname thu@#1@@reset\endcsname{%
1388 \@nameuse{thu@\@nameuse{thu@#1@@name}@##1false}%
1389 }%
1390 }%
1391 \kvsetkeys@expandafter{thu@choice}{\thu@@choices}%
1392 % \end{macrocode}
1393 %
1394 % 将 \meta{default} 赋值到 \cs{thu@\meta{name}},如果非空则执行相应的代码。
1395 %
1396 % \begin{macrocode}
1397 \expandafter\let\csname thu@\@nameuse{thu@#1@@name}\endcsname\thu@@default
1398 \expandafter\ifx\csname thu@\@nameuse{thu@#1@@name}\endcsname\@empty\else
1399 \@nameuse{thu@#1@@check}%
1400 \fi
1401 % \end{macrocode}
1402 %
1403 % 定义 \cs{thusetup} 接口。
1404 %
1405 % \begin{macrocode}
1406 \kv@define@key{thu}{#1}{%
1407 \@namedef{thu@\@nameuse{thu@#1@@name}}{##1}%
1408 \@nameuse{thu@#1@@check}%
1409 \@nameuse{thu@#1@@code}%
1410 }%
1411 }
1412 % \end{macrocode}
1413 %
1414 % 定义接口向 |key| 添加 |code|:
1415 %
1416 % \begin{macrocode}
1417 \newcommand\thu@option@hook[2]{%
1418 \expandafter\g@addto@macro\csname thu@#1@@code\endcsname{#2}%
1419 }
1420 % \end{macrocode}
1421 %
1422 % \begin{macrocode}
1423 \thu@define@key{
1424 thesis-type = {
1425 name = thesis@type,
1426 choices = {
1427 thesis,
1428 proposal,
1429 },
1430 default = thesis,
1431 },
1432 degree = {
1433 choices = {
1434 bachelor,
1435 master,
1436 doctor,
1437 postdoc,
1438 },
1439 default = doctor,
1440 },
1441 degree-type = {
1442 choices = {
1443 academic,
1444 professional,
1445 },
1446 name = degree@type,
1447 },
1448 % \end{macrocode}
1449 %
1450 % 论文的主要语言。
1451 % \begin{macrocode}
1452 main-language = {
1453 name = main@language,
1454 choices = {
1455 chinese,
1456 english,
1457 },
1458 },
1459 % \end{macrocode}
1460 %
1461 % 用于设置局部语言。
1462 % \begin{macrocode}
1463 language = {
1464 choices = {
1465 chinese,
1466 english,
1467 },
1468 },
1469 % \end{macrocode}
1470 %
1471 % 字体
1472 % \begin{macrocode}
1473 system = {
1474 choices = {
1475 auto,
1476 mac,
1477 unix,
1478 windows,
1479 },
1480 default = auto,
1481 },
1482 fontset = {
1483 choices = {
1484 auto,
1485 windows,
1486 mac,
1487 ubuntu,
1488 fandol,
1489 none,
1490 },
1491 default = auto,
1492 },
1493 font = {
1494 choices = {
1495 auto,
1496 times,
1497 termes,
1498 stix,
1499 xits,
1500 libertinus,
1501 newcm,
1502 lm,
1503 newtx,
1504 none,
1505 },
1506 default = auto,
1507 },
1508 cjk-font = {
1509 name = cjk@font,
1510 choices = {
1511 auto,
1512 windows,
1513 windows-local,
1514 mac,
1515 mac-word,
1516 noto,
1517 fandol,
1518 none,
1519 },
1520 default = auto,
1521 },
1522 windows-font-dir = {
1523 name = windows@font@dir,
1524 default = {.},
1525 },
1526 math-font = {
1527 name = math@font,
1528 choices = {
1529 auto,
1530 stix,
1531 xits,
1532 libertinus,
1533 newcm,
1534 lm,
1535 newtx,
1536 none,
1537 },
1538 default = auto,
1539 },
1540 math-style = {
1541 name = math@style,
1542 choices = {
1543 GB,
1544 ISO,
1545 TeX,
1546 },
1547 },
1548 uppercase-greek = {
1549 name = uppercase@greek,
1550 choices = {
1551 italic,
1552 upright,
1553 },
1554 },
1555 less-than-or-equal = {
1556 name = leq,
1557 choices = {
1558 slanted,
1559 horizontal,
1560 },
1561 },
1562 integral = {
1563 choices = {
1564 upright,
1565 slanted,
1566 },
1567 },
1568 integral-limits = {
1569 name = integral@limits,
1570 choices = {
1571 true,
1572 false,
1573 },
1574 },
1575 partial = {
1576 choices = {
1577 upright,
1578 italic,
1579 },
1580 },
1581 math-ellipsis = {
1582 name = math@ellipsis,
1583 choices = {
1584 centered,
1585 lower,
1586 AMS,
1587 },
1588 },
1589 real-part = {
1590 name = real@part,
1591 choices = {
1592 roman,
1593 fraktur,
1594 },
1595 },
1596 % \end{macrocode}
1597 %
1598 % 选择打印版还是用于上传的电子版。
1599 % \begin{macrocode}
1600 output = {
1601 choices = {
1602 print,
1603 electronic,
1604 },
1605 default = print,
1606 },
1607 % \end{macrocode}
1608 %
1609 % 数学公式编号的括号使用全角还是半角。
1610 % \begin{macrocode}
1611 eqn-paren-style = {
1612 name = eqn@paren@style,
1613 choices = {
1614 full,
1615 half,
1616 }
1617 },
1618 % \end{macrocode}
1619 %
1620 % 苏世民学院的格式相比学校有如下变动:全文的脚注都连续编号(包括到附录中),不使用带圈数字;
1621 % 全文图、表、公式连续编号。
1622 % \begin{macrocode}
1623 style-override = {
1624 name = style@override,
1625 choices = {
1626 none,
1627 schwarzman,
1628 },
1629 },
1630 footnote-numbering = {
1631 name = footnote@numbering,
1632 choices = {
1633 page,
1634 chapter,
1635 global,
1636 },
1637 },
1638 footnote-style = {
1639 name = footnote@style,
1640 choices = {
1641 circled,
1642 plain,
1643 },
1644 },
1645 figure-numbering = {
1646 name = figure@numbering,
1647 choices = {
1648 chapter,
1649 global,
1650 },
1651 },
1652 table-numbering = {
1653 name = table@numbering,
1654 choices = {
1655 chapter,
1656 global,
1657 },
1658 },
1659 equation-numbering = {
1660 name = equation@numbering,
1661 choices = {
1662 chapter,
1663 global,
1664 },
1665 },
1666 }
1667 \newif\ifthu@degree@graduate
1668 \newcommand\thu@set@graduate{%
1669 \thu@degree@graduatefalse
1670 \ifthu@degree@doctor
1671 \thu@degree@graduatetrue
1672 \fi
1673 \ifthu@degree@master
1674 \thu@degree@graduatetrue
1675 \fi
1676 }
1677 \thu@set@graduate
1678 \thu@option@hook{degree}{%
1679 \thu@set@graduate
1680 }
1681 % \end{macrocode}
1682 %
1683 % 设置默认 \option{openany}。
1684 % \begin{macrocode}
1685 \DeclareBoolOption[false]{openright}
1686 \DeclareComplementaryOption{openany}{openright}
1687 % \end{macrocode}
1688 %
1689 % \option{raggedbottom} 选项(默认打开)
1690 % \begin{macrocode}
1691 \DeclareBoolOption[true]{raggedbottom}
1692 % \end{macrocode}
1693 %
1694 % 将选项传递给 \pkg{ctexbook}。
1695 % \begin{macrocode}
1696 \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
1697 % \end{macrocode}
1698 %
1699 % 解析用户传递过来的选项,并加载 \pkg{ctexbook}。
1700 % \begin{macrocode}
1701 \ProcessKeyvalOptions*
1702 % \end{macrocode}
1703 %
1704 % 设置默认 \option{openany}。
1705 % \begin{macrocode}
1706 \ifthu@openright
1707 \PassOptionsToClass{openright}{book}
1708 \else
1709 \PassOptionsToClass{openany}{book}
1710 \fi
1711 % \end{macrocode}
1712 %
1713 % \pkg{unicode-math} 和 \pkg{newtx} 都不需要 \pkg{fontspec} 设置数学字体。
1714 % \begin{macrocode}
1715 \PassOptionsToPackage{no-math}{fontspec}
1716 % \end{macrocode}
1717 %
1718 % 处理苏世民学院的格式。
1719 % \begin{macrocode}
1720 \ifthu@style@override@schwarzman
1721 \thusetup{
1722 footnote-numbering = global,
1723 footnote-style = plain,
1724 figure-numbering = global,
1725 table-numbering = global,
1726 equation-numbering = global,
1727 }
1728 \fi
1729 \thu@option@hook{style-override}{\thu@error{%
1730 The 'style-override' option is only valid in class options.%
1731 }}%
1732 \thu@option@hook{footnote-numbering}{\thu@error{%
1733 The 'footnote-numbering' option is only valid in class options.%
1734 }}%
1735 \ifthu@footnote@numbering@page
1736 \PassOptionsToPackage{perpage}{footmisc}%
1737 \fi
1738 % \end{macrocode}
1739 %
1740 % 使用 \pkg{ctexbook} 类,优于调用 \pkg{ctex} 宏包。
1741 % \begin{macrocode}
1742 \LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01]
1743 % \end{macrocode}
1744 %
1745 %
1746 % \subsection{装载宏包}
1747 % \label{sec:loadpackage}
1748 %
1749 % 引用的宏包和相应的定义。
1750 % \begin{macrocode}
1751 \RequirePackage{etoolbox}
1752 \RequirePackage{filehook}
1753 \RequirePackage{xparse}
1754 % \end{macrocode}
1755 %
1756 % \begin{macrocode}
1757 \RequirePackage{geometry}%
1758 % \end{macrocode}
1759 %
1760 % 利用 \pkg{fancyhdr} 设置页眉页脚。
1761 % \begin{macrocode}
1762 \RequirePackage{fancyhdr}
1763 % \end{macrocode}
1764 %
1765 % \begin{macrocode}
1766 \RequirePackage{titletoc}
1767 % \end{macrocode}
1768 %
1769 % 利用 \pkg{notoccite} 避免目录中引用编号混乱。
1770 % \begin{macrocode}
1771 \RequirePackage{notoccite}
1772 % \end{macrocode}
1773 %
1774 % \AmSTeX\ 宏包,用来排出更加漂亮的公式。
1775 % \begin{macrocode}
1776 \RequirePackage{amsmath}
1777 % \end{macrocode}
1778 %
1779 % 图形支持宏包。
1780 % \begin{macrocode}
1781 \RequirePackage{graphicx}
1782 % \end{macrocode}
1783 %
1784 % 并排图形。\pkg{subfigure}、\pkg{subfig} 已经不再推荐,用新的 \pkg{subcaption}。
1785 % 浮动图形和表格标题样式。\pkg{caption2} 已经不推荐使用,采用新的 \pkg{caption}。
1786 % \begin{macrocode}
1787 \RequirePackage[labelformat=simple]{subcaption}
1788 % \end{macrocode}
1789 %
1790 % \pkg{pdfpages} 宏包便于我们插入扫描后的授权说明和声明页 PDF 文档。
1791 %
1792 % 由于 \pkg{pdfpages} 跟 \pkg{TikZ} 的 \pkg{external} 库冲突,
1793 % 需要在导言区的结尾进行处理,见
1794 % \href{https://github.com/tuna/thuthesis/issues/693}{\#693}。
1795 % \begin{macrocode}
1796 \RequirePackage{pdfpages}
1797 \includepdfset{fitpaper=true}
1798 \AtEndPreamble{
1799 \ifx\tikzifexternalizing\@undefined\else
1800 \tikzifexternalizing{
1801 \renewcommand*\includepdf[2][]{}
1802 }{}
1803 \fi
1804 }
1805 % \end{macrocode}
1806 %
1807 % 更好的列表环境。
1808 % \begin{macrocode}
1809 \RequirePackage[shortlabels]{enumitem}
1810 \RequirePackage{environ}
1811 % \end{macrocode}
1812 %
1813 % 禁止 \LaTeX{} 自动调整多余的页面底部空白,并保持脚注仍然在底部。
1814 % 脚注按页编号。
1815 % \begin{macrocode}
1816 \ifthu@raggedbottom
1817 \RequirePackage[bottom,hang]{footmisc}
1818 \raggedbottom
1819 \else
1820 \RequirePackage[hang]{footmisc}
1821 \fi
1822 % \end{macrocode}
1823 %
1824 % 利用 \pkg{xeCJKfntef} 实现汉字的下划线和盒子内两段对齐,并可以避免
1825 % \cs{makebox}\oarg{width}\oarg{s} 可能产生的 underful boxes。
1826 % \begin{macrocode}
1827 \ifXeTeX
1828 \RequirePackage{xeCJKfntef}
1829 \else
1830 \RequirePackage{ulem}
1831 \fi
1832 % \end{macrocode}
1833 %
1834 % 表格控制
1835 % \begin{macrocode}
1836 \RequirePackage{array}
1837 % \end{macrocode}
1838 %
1839 % 使用三线表:\cs{toprule},\cs{midrule},\cs{bottomrule}。
1840 % \begin{macrocode}
1841 \RequirePackage{booktabs}
1842 % \end{macrocode}
1843 %
1844 % \begin{macrocode}
1845 \RequirePackage{url}
1846 % \end{macrocode}
1847 %
1848 % 如果用户在导言区未调用 \pkg{biblatex},则自动调用 \pkg{natbib}。
1849 % \begin{macrocode}
1850 \AtEndPreamble{
1851 \@ifpackageloaded{biblatex}{}{
1852 \@ifpackageloaded{apacite}{}{
1853 \RequirePackage{natbib}
1854 }
1855 }
1856 }
1857 \AtEndOfPackageFile*{natbib}{
1858 \@ifpackageloaded{apacite}{}{
1859 \RequirePackage{bibunits}
1860 }
1861 }
1862 % \end{macrocode}
1863 %
1864 % 对冲突的宏包报错。
1865 % \begin{macrocode}
1866 \newcommand\thu@package@conflict[2]{%
1867 \AtEndOfPackageFile*{#1}{%
1868 \AtBeginOfPackageFile*{#2}{%
1869 \thu@error{The "#2" package is incompatible with "#1"}%
1870 }%
1871 }%
1872 }
1873 \thu@package@conflict{biblatex}{bibunits}
1874 \thu@package@conflict{biblatex}{chapterbib}
1875 \thu@package@conflict{biblatex}{cite}
1876 \thu@package@conflict{biblatex}{multibib}
1877 \thu@package@conflict{biblatex}{natbib}
1878
1879 \thu@package@conflict{bibunits}{biblatex}
1880 \thu@package@conflict{bibunits}{chapterbib}
1881 \thu@package@conflict{bibunits}{multibib}
1882
1883 \thu@package@conflict{unicode-math}{amscd}
1884 \thu@package@conflict{unicode-math}{amsfonts}
1885 \thu@package@conflict{unicode-math}{amssymb}
1886 \thu@package@conflict{unicode-math}{bbm}
1887 \thu@package@conflict{unicode-math}{bm}
1888 \thu@package@conflict{unicode-math}{eucal}
1889 \thu@package@conflict{unicode-math}{eufrak}
1890 \thu@package@conflict{unicode-math}{mathrsfs}
1891 \thu@package@conflict{unicode-math}{newtxmath}
1892 \thu@package@conflict{unicode-math}{upgreek}
1893
1894 \thu@package@conflict{natbib}{biblatex}
1895 \thu@package@conflict{natbib}{cite}
1896
1897 \thu@package@conflict{newtxmath}{amsfonts}
1898 \thu@package@conflict{newtxmath}{amssymb}
1899 \thu@package@conflict{newtxmath}{unicode-math}
1900 \thu@package@conflict{newtxmath}{upgreek}
1901 % \end{macrocode}
1902 %
1903 % \pkg{amsthm} 需要在 \pkg{newtx} 前载入,参考 \pkg{newtx} 的文档。
1904 % \begin{macrocode}
1905 \AtBeginOfPackageFile*{amsthm}{
1906 \@ifpackageloaded{newtxmath}{
1907 \thu@error{The "amsthm" package should be loaded before setting "newtxmath"}
1908 }{}
1909 }%
1910 % \end{macrocode}
1911 %
1912 % \subsection{页面设置}
1913 % \label{sec:layout}
1914 %
1915 % 研究生《写作指南》:
1916 % 页边距:上下左右均为 3.0 厘米,装订线 0 厘米;
1917 % 页眉距边界:2.2 厘米,页脚距边界:2.2 厘米。
1918 %
1919 % 本科生《写作规范》:
1920 % 页边距:3 厘米,装订线:0 厘米。
1921 % 本科生 Word 模板:
1922 % 无页眉,页脚距边界:1.5 厘米。
1923 %
1924 % \pkg{fancyhdr} 的页眉是沿底部对齐的,所以只需设置 \cs{headsep},
1925 % \cs{headheight} 可以适当增加高度允许多行页眉。
1926 % 研究生:\cs{headsep} = $\SI{3}{cm} - \SI{2.2}{cm} - \SI{10.5}{bp} \times 1.3
1927 % \approx \SI{0.3}{cm}$。
1928 %
1929 % \begin{macrocode}
1930 \geometry{
1931 paper = a4paper, % 210 * 297mm
1932 marginparwidth = 2cm,
1933 marginparsep = 0.5cm,
1934 }
1935 \newcommand\thu@set@geometry{%
1936 \ifthu@degree@bachelor
1937 \geometry{
1938 margin = 3cm,
1939 footskip = 1.5cm,
1940 }%
1941 \else
1942 \geometry{
1943 margin = 3cm,
1944 headheight = 2.7cm,
1945 headsep = 0.3cm,
1946 footskip = 0.8cm,
1947 }%
1948 \fi
1949 }
1950 \thu@set@geometry
1951 \thu@option@hook{degree}{\thu@set@geometry}
1952 \thu@option@hook{output}{\thu@set@geometry}
1953 % \end{macrocode}
1954 %
1955 %
1956 % \subsection{语言设置}
1957 %
1958 % 定义 \cs{thu@main@language},当在导言区修改 \option{language} 时,
1959 % 保存为论文的主要语言;
1960 % \cs{thu@reset@main@language} 则用于正文中恢复为主要语言。
1961 % \begin{macrocode}
1962 \thusetup{main-language=\thu@language}%
1963 \let\thu@main@language\thu@language
1964 \thu@option@hook{language}{%
1965 \ifx\@begindocumenthook\@undefined\else
1966 \thusetup{main-language=\thu@language}%
1967 \let\thu@main@language\thu@language
1968 \fi
1969 }
1970 \newcommand\thu@reset@main@language{%
1971 \thusetup{language = \thu@main@language}%
1972 \let\thu@language\thu@main@language
1973 }
1974 % \end{macrocode}
1975 %
1976 % 根据语言设置各章节的名称,只有在导言区设置 \option{degree} 和
1977 % \option{language} 时会修改,而在正文局部切换语言时则不变。
1978 % \begin{macrocode}
1979 \newcommand\thu@set@chapter@names{%
1980 \ifthu@degree@bachelor
1981 \def\thu@statement@name{声明}%
1982 \else
1983 \def\thu@statement@name{声\hspace{1em}明}%
1984 \fi
1985 \ifthu@main@language@chinese
1986 \def\listfigurename{插图清单}%
1987 \def\listtablename{附表清单}%
1988 \def\thu@list@figure@table@name{插图和附表清单}%
1989 \def\thu@list@algorithm@name{算法清单}%
1990 \def\thu@denotation@name{符号和缩略语说明}%
1991 \def\thu@comments@name{指导教师评语}%
1992 \def\bibname{参考文献}%
1993 \def\appendixname{附录}%
1994 \def\indexname{索引}%
1995 \def\thu@resolution@name{答辩委员会决议书}%
1996 \ifthu@degree@bachelor
1997 \def\contentsname{目录}%
1998 \def\thu@acknowledgements@name{致谢}%
1999 \def\listequationname{公式索引}%
2000 \def\thu@resume@name{在学期间参加课题的研究成果}%
2001 \else
2002 \def\listequationname{公式清单}%
2003 \def\thu@acknowledgements@name{致\quad 谢}%
2004 \ifthu@degree@graduate
2005 \def\contentsname{目\quad 录}%
2006 \def\thu@resume@name{个人简历、在学期间完成的相关学术成果}%
2007 \else % degree = postdoc
2008 \def\contentsname{目\qquad 次}%
2009 \def\thu@denotation@name{符号表}%
2010 \def\thu@resume@name{个人简历、发表的学术论文与科研成果}%
2011 \fi
2012 \fi
2013 \else
2014 \ifthu@main@language@english
2015 \def\thu@comments@name{Comments from Thesis Supervisor}%
2016 \def\thu@resolution@name{Resolution of Thesis Defense Committee}%
2017 \def\indexname{Index}%
2018 \ifthu@degree@bachelor
2019 \def\contentsname{CONTENTS}%
2020 \def\listfigurename{FIGURES}%
2021 \def\listtablename{TABLES}%
2022 \def\thu@list@figure@table@name{FIGURES AND TABLES}%
2023 \def\thu@list@algorithm@name{ALGORITHMS}%
2024 \def\listequationname{EQUATIONS}%
2025 \def\thu@denotation@name{ABBREVIATIONS}%
2026 \def\bibname{REFERENCES}%
2027 \def\appendixname{APPENDIX}%
2028 \def\thu@acknowledgements@name{ACKNOWLEDGEMENTS}%
2029 \def\thu@resume@name{PUBLICATIONS}%
2030 \else
2031 \def\contentsname{Table of Contents}%
2032 \def\listfigurename{List of Figures}%
2033 \def\listtablename{List of Tables}%
2034 \def\thu@list@figure@table@name{List of Figures and Tables}%
2035 \def\thu@list@algorithm@name{List of Algorithms}%
2036 \def\listequationname{List of Equations}%
2037 \def\thu@denotation@name{List of Symbols and Acronyms}%
2038 \def\bibname{References}%
2039 \def\appendixname{Appendix}%
2040 \def\thu@acknowledgements@name{Acknowledgements}%
2041 \def\thu@resume@name{Resume}%
2042 \fi
2043 \fi
2044 \fi
2045 }
2046 \thu@set@chapter@names
2047 \thu@option@hook{degree}{\thu@set@chapter@names}
2048 \thu@option@hook{main-language}{\thu@set@chapter@names}
2049 % \end{macrocode}
2050 %
2051 % 这部分名称在正文中局部地修改语言时会发生变化,比如英文摘要、
2052 % 本科生附录的阅读报告。
2053 % \begin{macrocode}
2054 \newcommand\thu@set@names{%
2055 \ifthu@language@chinese
2056 \ctexset{
2057 figurename = 图,
2058 tablename = 表,
2059 }%
2060 \def\thu@algorithm@name{算法}%
2061 \def\thu@equation@name{公式}%
2062 \def\thu@assumption@name{假设}%
2063 \def\thu@definition@name{定义}%
2064 \def\thu@proposition@name{命题}%
2065 \def\thu@lemma@name{引理}%
2066 \def\thu@theorem@name{定理}%
2067 \def\thu@axiom@name{公理}%
2068 \def\thu@corollary@name{推论}%
2069 \def\thu@exercise@name{练习}%
2070 \def\thu@example@name{例}%
2071 \def\thu@remark@name{注释}%
2072 \def\thu@problem@name{问题}%
2073 \def\thu@conjecture@name{猜想}%
2074 \def\thu@proof@name{证明}%
2075 \def\thu@theorem@separator{:}%
2076 \else
2077 \ifthu@language@english
2078 \ctexset{
2079 figurename = {Figure},
2080 tablename = {Table},
2081 }%
2082 \def\thu@algorithm@name{Algorithm}%
2083 \def\thu@equation@name{Equation}%
2084 \def\thu@assumption@name{Assumption}%
2085 \def\thu@definition@name{Definition}%
2086 \def\thu@proposition@name{Proposition}%
2087 \def\thu@lemma@name{Lemma}%
2088 \def\thu@theorem@name{Theorem}%
2089 \def\thu@axiom@name{Axiom}%
2090 \def\thu@corollary@name{Corollary}%
2091 \def\thu@exercise@name{Exercise}%
2092 \def\thu@example@name{Example}%
2093 \def\thu@remark@name{Remark}%
2094 \def\thu@problem@name{Problem}%
2095 \def\thu@conjecture@name{Conjecture}%
2096 \def\thu@proof@name{Proof}%
2097 \def\thu@theorem@separator{: }%
2098 \fi
2099 \fi
2100 }
2101 \thu@set@names
2102 \thu@option@hook{language}{\thu@set@names}
2103 % \end{macrocode}
2104 %
2105 % 带圈数字和星号使用中文字体。
2106 % \begin{macrocode}
2107 \ifLuaTeX
2108 % ctex 将带圈数字 U+2460–U+2473 归入字符范围 3(ALchar),这里改回范围 6(JAchar)
2109 \ltjdefcharrange{6}{"2460-"2473, "2605}
2110 \else
2111 \ifXeTeX
2112 \xeCJKDeclareCharClass{CJK}{"2460 -> "2473, "2605}
2113 \fi
2114 \fi
2115 % \end{macrocode}
2116 %
2117 % \newcommand\unicodechar[1]{U+#1(\symbol{"#1})}
2118 % 由于 Unicode 的一些标点符号是中西文混用的:
2119 % \unicodechar{00B7}、
2120 % \unicodechar{2013}、
2121 % \unicodechar{2014}、
2122 % \unicodechar{2018}、
2123 % \unicodechar{2019}、
2124 % \unicodechar{201C}、
2125 % \unicodechar{201D}、
2126 % \unicodechar{2025}、
2127 % \unicodechar{2026}、
2128 % \unicodechar{2E3A},
2129 % 所以要根据语言设置正确的字体。
2130 % \footnote{\url{https://github.com/CTeX-org/ctex-kit/issues/389}}
2131 % 此外切换语言时,有一部分名称是需要被重新定义的。
2132 % \begin{macrocode}
2133 \newcommand\thu@set@punctuations{%
2134 \ifthu@language@chinese
2135 \ifLuaTeX
2136 \ltjsetparameter{jacharrange={+9}}
2137 \else
2138 \ifXeTeX
2139 \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}%
2140 \xeCJKDeclareCharClass{FullRight}{
2141 "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
2142 }%
2143 \fi
2144 \fi
2145 \else
2146 \ifthu@language@english
2147 \ifLuaTeX
2148 \ltjsetparameter{jacharrange={-9}}
2149 \else
2150 \ifXeTeX
2151 \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
2152 \xeCJKDeclareCharClass{HalfRight}{
2153 "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
2154 }%
2155 \fi
2156 \fi
2157 \fi
2158 \fi
2159 }
2160 \thu@set@punctuations
2161 \thu@option@hook{language}{\thu@set@punctuations}
2162 % \end{macrocode}
2163 %
2164 % \subsection{字体}
2165 % \label{sec:font}
2166 %
2167 % \subsubsection{字号}
2168 %
2169 % \begin{macro}{\normalsize}
2170 % 正文小四号(12bp)字,行距为固定值 20 bp。
2171 % 其他字号的行距按照相同的比例设置。
2172 %
2173 % 注意重定义 \cs{normalsize} 应在 \pkg{unicode-math} 的 \cs{setmathfont} 前。
2174 %
2175 % 表达式行的行距为单倍行距,段前空 6 磅,段后空 6 磅。
2176 %
2177 % \cs{small} 等其他命令通常用于表格等环境中,这部分要求单倍行距,与正文的字号-行距比例不同,
2178 % 所以保留默认的 1.2 倍字号的行距,作为单倍行距在英文(1.15 倍字号)和中文(1.3倍字号)
2179 % 两种情况的折衷。
2180 % \begin{macrocode}
2181 \renewcommand\normalsize{%
2182 \@setfontsize\normalsize{12bp}{20bp}%
2183 \abovedisplayskip 6bp%
2184 \abovedisplayshortskip 6bp%
2185 \belowdisplayshortskip 6bp%
2186 \belowdisplayskip \abovedisplayskip
2187 }
2188 \normalsize
2189 \ifx\MakeRobust\@undefined \else
2190 \MakeRobust\normalsize
2191 \fi
2192 % \end{macrocode}
2193 % \end{macro}
2194 %
2195 % WORD 中的字号对应该关系如下(1bp = 72.27/72 pt):
2196 % \begin{center}
2197 % \begin{longtable}{llll}
2198 % \toprule
2199 % 初号 & 42bp & 14.82mm & 42.1575pt \\
2200 % 小初 & 36bp & 12.70mm & 36.135 pt \\
2201 % 一号 & 26bp & 9.17mm & 26.0975pt \\
2202 % 小一 & 24bp & 8.47mm & 24.09pt \\
2203 % 二号 & 22bp & 7.76mm & 22.0825pt \\
2204 % 小二 & 18bp & 6.35mm & 18.0675pt \\
2205 % 三号 & 16bp & 5.64mm & 16.06pt \\
2206 % 小三 & 15bp & 5.29mm & 15.05625pt \\
2207 % 四号 & 14bp & 4.94mm & 14.0525pt \\
2208 % 小四 & 12bp & 4.23mm & 12.045pt \\
2209 % 五号 & 10.5bp & 3.70mm & 10.59375pt \\
2210 % 小五 & 9bp & 3.18mm & 9.03375pt \\
2211 % 六号 & 7.5bp & 2.56mm & \\
2212 % 小六 & 6.5bp & 2.29mm & \\
2213 % 七号 & 5.5bp & 1.94mm & \\
2214 % 八号 & 5bp & 1.76mm & \\\bottomrule
2215 % \end{longtable}
2216 % \end{center}
2217 %
2218 % \begin{macro}{\thu@def@fontsize}
2219 % 根据习惯定义字号。用法:
2220 %
2221 % \cs{thu@def@fontsize}\marg{字号名称}\marg{磅数}
2222 %
2223 % 避免了字号选择和行距的紧耦合。所有字号定义时为单倍行距,并提供选项指定行距倍数。
2224 % \begin{macrocode}
2225 \def\thu@def@fontsize#1#2{%
2226 \expandafter\newcommand\csname #1\endcsname[1][1.3]{%
2227 \fontsize{#2}{##1\dimexpr #2}\selectfont}}
2228 % \end{macrocode}
2229 % \end{macro}
2230 %
2231 % 一组字号定义。
2232 % \begin{macrocode}
2233 \thu@def@fontsize{chuhao}{42bp}
2234 \thu@def@fontsize{xiaochu}{36bp}
2235 \thu@def@fontsize{yihao}{26bp}
2236 \thu@def@fontsize{xiaoyi}{24bp}
2237 \thu@def@fontsize{erhao}{22bp}
2238 \thu@def@fontsize{xiaoer}{18bp}
2239 \thu@def@fontsize{sanhao}{16bp}
2240 \thu@def@fontsize{xiaosan}{15bp}
2241 \thu@def@fontsize{sihao}{14bp}
2242 \thu@def@fontsize{xiaosi}{12bp}
2243 \thu@def@fontsize{wuhao}{10.5bp}
2244 \thu@def@fontsize{xiaowu}{9bp}
2245 \thu@def@fontsize{liuhao}{7.5bp}
2246 \thu@def@fontsize{xiaoliu}{6.5bp}
2247 \thu@def@fontsize{qihao}{5.5bp}
2248 \thu@def@fontsize{bahao}{5bp}
2249 % \end{macrocode}
2250 %
2251 % 检测系统。
2252 % \begin{macrocode}
2253 \ifthu@system@auto
2254 \IfFileExists{/System/Library/Fonts/Menlo.ttc}{
2255 \thusetup{system = mac}
2256 }{
2257 \IfFileExists{/dev/null}{
2258 \IfFileExists{null:}{
2259 \thusetup{system = windows}
2260 }{
2261 \thusetup{system = unix}
2262 }
2263 }{
2264 \thusetup{system = windows}
2265 }
2266 }
2267 \thu@debug{Detected system: \thu@system}
2268 \fi
2269 % \end{macrocode}
2270 %
2271 % 使用 \pkg{fontspec} 配置字体。
2272 % \begin{macrocode}
2273 \newcommand\thu@mac@word@font@dir{%
2274 /Applications/Microsoft Word.app/Contents/Resources/DFonts%
2275 }
2276 \ifthu@fontset@auto
2277 \ifthu@system@windows
2278 \thusetup{fontset = windows}
2279 \else
2280 \IfFontExistsTF{SimSun}{
2281 \thusetup{fontset = windows}
2282 }{
2283 \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{
2284 \thusetup{fontset = windows, cjk-font = windows-local}
2285 }{
2286 \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{
2287 \thusetup{fontset = windows, cjk-font = mac-word}
2288 }{
2289 \ifthu@system@mac
2290 \thusetup{fontset = mac}
2291 \else
2292 \IfFontExistsTF{Noto Serif CJK SC}{
2293 \thusetup{fontset = ubuntu}
2294 }{
2295 \thusetup{fontset = fandol}
2296 }
2297 \fi
2298 }
2299 }
2300 }
2301 \fi
2302 \thu@debug{Detected fontset: \thu@fontset}
2303 \fi
2304 % \end{macrocode}
2305 %
2306 % \subsubsection{西文字体}
2307 %
2308 % 《指南》要求西文字体使用 Times New Roman 和 Arial,
2309 % 但是在 Linux 下没有这两个字体,所以使用它们的克隆版 TeX Gyre Termes 和
2310 % TeX Gyre Heros。
2311 % \begin{macrocode}
2312 \newcommand\thu@set@font{%
2313 \@nameuse{thu@set@font@\thu@font}%
2314 }
2315 \thu@option@hook{font}{\thu@set@font}
2316 % \end{macrocode}
2317 %
2318 % \begin{macrocode}
2319 \newcommand\thu@set@font@auto{%
2320 \ifthu@font@auto
2321 \ifthu@fontset@windows
2322 \thusetup{font=times}%
2323 \else
2324 \ifthu@fontset@mac
2325 \thusetup{font=times}%
2326 \else
2327 \thusetup{font=termes}%
2328 \fi
2329 \fi
2330 \fi
2331 }
2332 \thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@font@auto}}
2333 \AtBeginOfPackageFile*{siunitx}{\thu@set@font@auto}
2334 \AtEndPreamble{\thu@set@font@auto}
2335 % \end{macrocode}
2336 %
2337 % Times New Roman + Arial
2338 % \begin{macrocode}
2339 \newcommand\thu@set@font@times{%
2340 \setmainfont{Times New Roman}%
2341 \setsansfont{Arial}%
2342 \ifthu@fontset@mac
2343 \setmonofont{Menlo}[Scale = MatchLowercase]%
2344 \else
2345 \setmonofont{Courier New}[Scale = MatchLowercase]%
2346 \fi
2347 }
2348 % \end{macrocode}
2349 %
2350 % TeX Gyre Termes
2351 % \begin{macrocode}
2352 \newcommand\thu@set@font@termes{%
2353 \setmainfont{texgyretermes}[
2354 Extension = .otf,
2355 UprightFont = *-regular,
2356 BoldFont = *-bold,
2357 ItalicFont = *-italic,
2358 BoldItalicFont = *-bolditalic,
2359 ]%
2360 \thu@set@texgyre@sans@mono
2361 }
2362 \newcommand\thu@set@texgyre@sans@mono{%
2363 \setsansfont{texgyreheros}[
2364 Extension = .otf,
2365 UprightFont = *-regular,
2366 BoldFont = *-bold,
2367 ItalicFont = *-italic,
2368 BoldItalicFont = *-bolditalic,
2369 ]%
2370 \setmonofont{texgyrecursor}[
2371 Extension = .otf,
2372 UprightFont = *-regular,
2373 BoldFont = *-bold,
2374 ItalicFont = *-italic,
2375 BoldItalicFont = *-bolditalic,
2376 Scale = MatchLowercase,
2377 Ligatures = CommonOff,
2378 ]%
2379 }
2380 % \end{macrocode}
2381 %
2382 % STIX Two 字体。
2383 % STIX 文件名在 v2.10 2020-12-19 从
2384 % \file{STIX2Text-Regular.otf}、\file{STIX2Math.otf} 分别改为
2385 % \file{STIXTwoText-Regular.otf}、\file{STIXTwoMath-Regular.otf}。
2386 % \begin{macrocode}
2387 \let\thu@font@family@stix\@empty
2388 \newcommand\thu@set@stix@names{%
2389 \ifx\thu@font@family@stix\@empty
2390 \IfFontExistsTF{STIXTwoText-Regular.otf}{%
2391 \gdef\thu@font@family@stix{STIXTwoText}%
2392 \gdef\thu@font@name@stix@math{STIXTwoMath-Regular}%
2393 }{%
2394 \gdef\thu@font@family@stix{STIX2Text}%
2395 \gdef\thu@font@name@stix@math{STIX2Math}%
2396 }%
2397 \fi
2398 }
2399 \newcommand\thu@set@font@stix{%
2400 \thu@set@stix@names
2401 \setmainfont{\thu@font@family@stix}[
2402 Extension = .otf,
2403 UprightFont = *-Regular,
2404 BoldFont = *-Bold,
2405 ItalicFont = *-Italic,
2406 BoldItalicFont = *-BoldItalic,
2407 ]%
2408 \thu@set@texgyre@sans@mono
2409 }
2410 % \end{macrocode}
2411 %
2412 % XITS 字体。
2413 % XITS 的文件名在 v1.109 2018-09-30
2414 % 从 \file{xits-regular.otf}、\file{xits-math.otf} 分别改为
2415 % \file{XITS-Regular.otf}、\file{XITSMath-Regular.otf}。
2416 % \begin{macrocode}
2417 \let\thu@font@family@xits\@empty
2418 \newcommand\thu@set@xits@names{%
2419 \ifx\thu@font@family@xits\@empty
2420 \IfFontExistsTF{XITSMath-Regular.otf}{%
2421 \gdef\thu@font@family@xits{XITS}%
2422 \gdef\thu@font@style@xits@rm{Regular}%
2423 \gdef\thu@font@style@xits@bf{Bold}%
2424 \gdef\thu@font@style@xits@it{Italic}%
2425 \gdef\thu@font@style@xits@bfit{BoldItalic}%
2426 \gdef\thu@font@name@xits@math{XITSMath-Regular}%
2427 }{%
2428 \gdef\thu@font@family@xits{xits}%
2429 \gdef\thu@font@style@xits@rm{regular}%
2430 \gdef\thu@font@style@xits@bf{bold}%
2431 \gdef\thu@font@style@xits@it{italic}%
2432 \gdef\thu@font@style@xits@bfit{bolditalic}%
2433 \gdef\thu@font@name@xits@math{xits-math}%
2434 }%
2435 \fi
2436 }
2437 \newcommand\thu@set@font@xits{%
2438 \thu@set@xits@names
2439 \setmainfont{\thu@font@family@xits}[
2440 Extension = .otf,
2441 UprightFont = *-\thu@font@style@xits@rm,
2442 BoldFont = *-\thu@font@style@xits@bf,
2443 ItalicFont = *-\thu@font@style@xits@it,
2444 BoldItalicFont = *-\thu@font@style@xits@bfit,
2445 ]%
2446 \thu@set@texgyre@sans@mono
2447 }
2448 % \end{macrocode}
2449 %
2450 % Libertinus 字体。
2451 % Libertinus 的文件名在 v6.7 2019-04-03 从小写改为驼峰式,
2452 % 在大小写敏感的平台上需要进行判断。
2453 % \begin{macrocode}
2454 \let\thu@font@family@libertinus\@empty
2455 \newcommand\thu@set@libertinus@names{%
2456 \ifx\thu@font@family@libertinus\@empty
2457 \IfFontExistsTF{LibertinusSerif-Regular.otf}{%
2458 \gdef\thu@font@family@libertinus@serif{LibertinusSerif}%
2459 \gdef\thu@font@family@libertinus@sans{LibertinusSans}%
2460 \gdef\thu@font@name@libertinus@math{LibertinusMath-Regular}%
2461 \gdef\thu@font@style@libertinus@rm{Regular}%
2462 \gdef\thu@font@style@libertinus@bf{Bold}%
2463 \gdef\thu@font@style@libertinus@it{Italic}%
2464 \gdef\thu@font@style@libertinus@bfit{BoldItalic}%
2465 }{%
2466 \gdef\thu@font@family@libertinus@serif{libertinusserif}%
2467 \gdef\thu@font@family@libertinus@sans{libertinussans}%
2468 \gdef\thu@font@name@libertinus@math{libertinusmath-regular}%
2469 \gdef\thu@font@style@libertinus@rm{regular}%
2470 \gdef\thu@font@style@libertinus@bf{bold}%
2471 \gdef\thu@font@style@libertinus@it{italic}%
2472 \gdef\thu@font@style@libertinus@bfit{bolditalic}%
2473 }%
2474 \fi
2475 }
2476 \newcommand\thu@set@font@libertinus{%
2477 \thu@set@libertinus@names
2478 \setmainfont{\thu@font@family@libertinus@serif}[
2479 Extension = .otf,
2480 UprightFont = *-\thu@font@style@libertinus@rm,
2481 BoldFont = *-\thu@font@style@libertinus@bf,
2482 ItalicFont = *-\thu@font@style@libertinus@it,
2483 BoldItalicFont = *-\thu@font@style@libertinus@bfit,
2484 ]%
2485 \setsansfont{\thu@font@family@libertinus@sans}[
2486 Extension = .otf,
2487 UprightFont = *-\thu@font@style@libertinus@rm,
2488 BoldFont = *-\thu@font@style@libertinus@bf,
2489 ItalicFont = *-\thu@font@style@libertinus@it,
2490 ]%
2491 \setmonofont{lmmonolt10}[
2492 Extension = .otf,
2493 UprightFont = *-regular,
2494 BoldFont = *-bold,
2495 ItalicFont = *-oblique,
2496 BoldItalicFont = *-boldoblique,
2497 ]%
2498 }
2499 % \end{macrocode}
2500 %
2501 % New Computer Modern
2502 % \begin{macrocode}
2503 \newcommand\thu@set@font@newcm{%
2504 \setmainfont{NewCM10}[
2505 Extension = .otf,
2506 UprightFont = *-Book,
2507 BoldFont = *-Bold,
2508 ItalicFont = *-BookItalic,
2509 BoldItalicFont = *-BoldItalic,
2510 ]%
2511 \setsansfont{NewCMSans10}[
2512 Extension = .otf,
2513 UprightFont = *-Book,
2514 BoldFont = *-Bold,
2515 ItalicFont = *-BookOblique,
2516 BoldItalicFont = *-BoldOblique,
2517 ]%
2518 \setmonofont{NewCMMono10}[
2519 Extension = .otf,
2520 UprightFont = *-Book,
2521 ItalicFont = *-BookItalic,
2522 BoldFont = *-Bold,
2523 BoldItalicFont = *-BoldOblique,
2524 ]%
2525 }
2526 % \end{macrocode}
2527 %
2528 % Latin Modern
2529 % \begin{macrocode}
2530 \newcommand\thu@set@font@lm{%
2531 \setmainfont{lmroman10}[
2532 Extension = .otf,
2533 UprightFont = *-regular,
2534 BoldFont = *-bold,
2535 ItalicFont = *-italic,
2536 BoldItalicFont = *-bolditalic,
2537 ]%
2538 \setsansfont{lmsans10}[
2539 Extension = .otf,
2540 UprightFont = *-regular,
2541 BoldFont = *-bold,
2542 ItalicFont = *-oblique,
2543 BoldItalicFont = *-boldoblique,
2544 ]%
2545 \setmonofont{lmmonolt10}[
2546 Extension = .otf,
2547 UprightFont = *-regular,
2548 BoldFont = *-bold,
2549 ItalicFont = *-oblique,
2550 BoldItalicFont = *-boldoblique,
2551 ]%
2552 }
2553 % \end{macrocode}
2554 %
2555 % NewTX
2556 % \begin{macrocode}
2557 \newcommand\thu@set@font@newtx{%
2558 \RequirePackage{newtxtext}%
2559 }
2560 % \end{macrocode}
2561 %
2562 % \subsubsection{中文字体}
2563 %
2564 % \begin{macrocode}
2565 \ifthu@cjk@font@auto
2566 \ifthu@fontset@mac
2567 \thusetup{cjk-font = mac}
2568 \else
2569 \ifthu@fontset@windows
2570 \IfFontExistsTF{SimSun}{
2571 \thusetup{cjk-font = windows}
2572 }{
2573 \IfFileExists{\thu@windows@font@dir/Simsun.ttc}{
2574 \thusetup{cjk-font = windows-local}
2575 }{
2576 \IfFileExists{\thu@mac@word@font@dir/Simsun.ttc}{
2577 \thusetup{cjk-font = mac-word}
2578 }{
2579 \thu@error{Cannot find "SimSun" font}
2580 }
2581 }
2582 }
2583 \else
2584 \ifthu@fontset@ubuntu
2585 \thusetup{cjk-font = noto}
2586 \else
2587 \thusetup{cjk-font = fandol}
2588 \fi
2589 \fi
2590 \fi
2591 \thu@debug{Detected CJK font: \thu@cjk@font}
2592 \fi
2593 % \end{macrocode}
2594 %
2595 % Windows 的中易字体。
2596 % \begin{macrocode}
2597 \newcommand\thu@set@cjk@font@windows{%
2598 \setCJKmainfont{SimSun}[
2599 AutoFakeBold = 3,
2600 ItalicFont = KaiTi,
2601 ]%
2602 \setCJKsansfont{SimHei}[AutoFakeBold = 3]%
2603 \setCJKmonofont{FangSong}%
2604 \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold = 3]%
2605 \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold = 3]%
2606 \setCJKfamilyfont{zhkai}{KaiTi}%
2607 \setCJKfamilyfont{zhfs}{FangSong}%
2608 }
2609 % \end{macrocode}
2610 %
2611 % 使用本地的 Windows 字体文件。
2612 %
2613 % Windows 的中易楷体和仿宋字体文件名分别为 \file{Simkai.ttf} 和
2614 % \file{Simfang.ttf}(见
2615 % \url{https://learn.microsoft.com/en-us/typography/fonts/windows_11_font_list}),
2616 % 而 macOS 版 Word 对应的字体名为 \file{Kaiti.ttf} 和 \file{Fangsong.ttf}。
2617 % 所以需要进行判断。
2618 % \begin{macrocode}
2619 \@namedef{thu@set@cjk@font@windows-local}{%
2620 \IfFileExists{\thu@windows@font@dir/Kaiti.ttf}{
2621 \setCJKmainfont{SimSun}[%
2622 Path = \thu@windows@font@dir/,
2623 Extension = .ttc,
2624 AutoFakeBold = 3,
2625 ItalicFont = Kaiti,
2626 ItalicFeatures = {Extension = .ttf},
2627 ]%
2628 \setCJKmonofont{Fangsong}[
2629 Path = \thu@windows@font@dir/,
2630 Extension = .ttf,
2631 ]%
2632 \setCJKfamilyfont{zhkai}{Kaiti}[
2633 Path = \thu@windows@font@dir/,
2634 Extension = .ttf,
2635 ]%
2636 \setCJKfamilyfont{zhfs}{Fangsong}[
2637 Path = \thu@windows@font@dir/,
2638 Extension = .ttf,
2639 ]%
2640 }{
2641 \setCJKmainfont{SimSun}[%
2642 Path = \thu@windows@font@dir/,
2643 Extension = .ttc,
2644 AutoFakeBold = 3,
2645 ItalicFont = Simkai,
2646 ItalicFeatures = {Extension = .ttf},
2647 ]%
2648 \setCJKmonofont{Simfang}[
2649 Path = \thu@windows@font@dir/,
2650 Extension = .ttf,
2651 ]%
2652 \setCJKfamilyfont{zhkai}{Simkai}[
2653 Path = \thu@windows@font@dir/,
2654 Extension = .ttf,
2655 ]%
2656 \setCJKfamilyfont{zhfs}{Simfang}[
2657 Path = \thu@windows@font@dir/,
2658 Extension = .ttf,
2659 ]%
2660 }
2661 \setCJKsansfont{SimHei}[%
2662 Path = \thu@windows@font@dir/,
2663 Extension = .ttf,
2664 AutoFakeBold = 3,
2665 ]%
2666 \setCJKfamilyfont{zhsong}{SimSun}[%
2667 Path = \thu@windows@font@dir/,
2668 Extension = .ttc,
2669 AutoFakeBold = 3,
2670 ]%
2671 \setCJKfamilyfont{zhhei}{SimHei}[%
2672 Path = \thu@windows@font@dir/,
2673 Extension = .ttf,
2674 AutoFakeBold = 3,
2675 ]%
2676 }
2677 % \end{macrocode}
2678 %
2679 % macOS 的 Microsoft Word 字体。
2680 % \begin{macrocode}
2681 \@namedef{thu@set@cjk@font@mac-word}{%
2682 \let\thu@windows@font@dir\thu@mac@word@font@dir
2683 \@nameuse{thu@set@cjk@font@windows-local}%
2684 }
2685 % \end{macrocode}
2686 %
2687 % macOS 的华文字体。
2688 % \begin{macrocode}
2689 \newcommand\thu@set@cjk@font@mac{%
2690 \defaultCJKfontfeatures{}%
2691 \setCJKmainfont{Songti SC}[
2692 UprightFont = * Light,
2693 BoldFont = * Bold,
2694 ItalicFont = Kaiti SC Regular,
2695 BoldItalicFont = Kaiti SC Bold,
2696 ]%
2697 \setCJKsansfont{Heiti SC}[
2698 UprightFont = * Light,
2699 BoldFont = * Medium,
2700 ]%
2701 \setCJKmonofont{STFangsong}
2702 \setCJKfamilyfont{zhsong}{Songti SC}[
2703 UprightFont = * Light,
2704 BoldFont = * Bold,
2705 ]%
2706 \setCJKfamilyfont{zhhei}{Heiti SC}[
2707 UprightFont = * Light,
2708 BoldFont = * Medium,
2709 ]%
2710 \setCJKfamilyfont{zhfs}{STFangsong}%
2711 \setCJKfamilyfont{zhkai}{Kaiti SC}[
2712 UprightFont = * Regular,
2713 BoldFont = * Bold,
2714 ]%
2715 \setCJKfamilyfont{zhli}{Baoli SC}%
2716 \setCJKfamilyfont{zhyuan}{Yuanyi SC}[
2717 UprightFont = * Light,
2718 BoldFont = * Bold,
2719 ]%
2720 }
2721 % \end{macrocode}
2722 %
2723 % 思源字体。
2724 % 注意 Noto CJK 的 regular 字重名字不带“Regular”。
2725 % \begin{macrocode}
2726 \newcommand\thu@set@cjk@font@noto{%
2727 \defaultCJKfontfeatures{}%
2728 \setCJKmainfont{Noto Serif CJK SC}[
2729 UprightFont = * Light,
2730 BoldFont = * Bold,
2731 ItalicFont = FandolKai-Regular,
2732 ItalicFeatures = {Extension = .otf},
2733 Script = CJK,
2734 ]%
2735 \setCJKsansfont{Noto Sans CJK SC}[
2736 BoldFont = * Medium,
2737 Script = CJK,
2738 ]%
2739 \setCJKmonofont{Noto Sans Mono CJK SC}[
2740 Script = CJK,
2741 ]%
2742 \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[
2743 UprightFont = * Light,
2744 UprightFont = * Bold,
2745 Script = CJK,
2746 ]%
2747 \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[
2748 BoldFont = * Medium,
2749 Script = CJK,
2750 ]%
2751 \setCJKfamilyfont{zhfs}{FandolFang}[
2752 Extension = .otf,
2753 UprightFont = *-Regular,
2754 ]%
2755 \setCJKfamilyfont{zhkai}{FandolKai}[
2756 Extension = .otf,
2757 UprightFont = *-Regular,
2758 ]%
2759 }
2760 % \end{macrocode}
2761 %
2762 % Fandol 字体。
2763 % \begin{macrocode}
2764 \newcommand\thu@set@cjk@font@fandol{%
2765 \defaultCJKfontfeatures{}%
2766 \setCJKmainfont{FandolSong}[
2767 Extension = .otf,
2768 UprightFont = *-Regular,
2769 BoldFont = *-Bold,
2770 ItalicFont = FandolKai-Regular,
2771 ItalicFeatures = {Extension = .otf},
2772 ]%
2773 \setCJKsansfont{FandolHei}[
2774 Extension = .otf,
2775 UprightFont = *-Regular,
2776 BoldFont = *-Bold,
2777 ]%
2778 \setCJKmonofont{FandolFang}[
2779 Extension = .otf,
2780 UprightFont = *-Regular,
2781 ]%
2782 \setCJKfamilyfont{zhsong}{FandolSong}[
2783 Extension = .otf,
2784 UprightFont = *-Regular,
2785 BoldFont = *-Bold,
2786 ]%
2787 \setCJKfamilyfont{zhhei}{FandolHei}[
2788 Extension = .otf,
2789 UprightFont = *-Regular,
2790 BoldFont = *-Bold,
2791 ]%
2792 \setCJKfamilyfont{zhfs}{FandolFang}[
2793 Extension = .otf,
2794 UprightFont = *-Regular,
2795 ]%
2796 \setCJKfamilyfont{zhkai}{FandolKai}[
2797 Extension = .otf,
2798 UprightFont = *-Regular,
2799 ]%
2800 }
2801 \ifthu@cjk@font@none\else
2802 \providecommand\songti{\CJKfamily{zhsong}}
2803 \providecommand\heiti{\CJKfamily{zhhei}}
2804 \providecommand\fangsong{\CJKfamily{zhfs}}
2805 \providecommand\kaishu{\CJKfamily{zhkai}}
2806 \fi
2807 \newcommand\thu@set@cjk@font{%
2808 \@nameuse{thu@set@cjk@font@\thu@cjk@font}%
2809 }
2810 \thu@set@cjk@font
2811 \thu@option@hook{cjk-font}{\thu@set@cjk@font}
2812 % \end{macrocode}
2813 %
2814 % \subsubsection{数学字体}
2815 %
2816 % 使用 \pkg{unicode-math} 配置数学符号格式。
2817 % \begin{macrocode}
2818 \newcommand\thu@set@math@style{%
2819 \ifthu@math@style@TeX
2820 \thusetup{
2821 uppercase-greek = upright,
2822 less-than-or-equal = horizontal,
2823 integral = slanted,
2824 integral-limits = false,
2825 partial = italic,
2826 math-ellipsis = AMS,
2827 real-part = fraktur,
2828 }%
2829 \else
2830 \thusetup{
2831 uppercase-greek = italic,
2832 integral = upright,
2833 partial = upright,
2834 real-part = roman,
2835 }%
2836 \ifthu@math@style@ISO
2837 \thusetup{
2838 less-than-or-equal = horizontal,
2839 integral-limits = true,
2840 math-ellipsis = lower,
2841 }%
2842 \else
2843 \ifthu@math@style@GB
2844 \thusetup{
2845 less-than-or-equal = slanted,
2846 integral-limits = false,
2847 math-ellipsis = centered,
2848 }%
2849 \fi
2850 \fi
2851 \fi
2852 }
2853 \ifthu@main@language@chinese
2854 \thusetup{math-style=GB}%
2855 \else
2856 \thusetup{math-style=TeX}%
2857 \fi
2858 \thu@set@math@style
2859 \thu@option@hook{math-style}{\thu@set@math@style}
2860 \thu@option@hook{main-language}{%
2861 \ifthu@main@language@chinese
2862 \thusetup{math-style=GB}%
2863 \else
2864 \thusetup{math-style=TeX}%
2865 \fi
2866 }
2867 % \end{macrocode}
2868 %
2869 % 针对 \pkg{unicode-math} 逐项配置数学符号。
2870 % \begin{macrocode}
2871 \newcommand\thu@set@unimath@leq{%
2872 \ifthu@leq@horizontal
2873 \ifx\@begindocumenthook\@undefined
2874 \let\le\thu@save@leq
2875 \let\ge\thu@save@geq
2876 \let\leq\thu@save@leq
2877 \let\geq\thu@save@geq
2878 \else
2879 \AtBeginDocument{%
2880 \let\le\thu@save@leq
2881 \let\ge\thu@save@geq
2882 \let\leq\thu@save@leq
2883 \let\geq\thu@save@geq
2884 }%
2885 \fi
2886 \else
2887 \ifthu@leq@slanted
2888 \ifx\@begindocumenthook\@undefined
2889 \let\le\leqslant
2890 \let\ge\geqslant
2891 \let\leq\leqslant
2892 \let\geq\geqslant
2893 \else
2894 \AtBeginDocument{%
2895 \let\le\leqslant
2896 \let\ge\geqslant
2897 \let\leq\leqslant
2898 \let\geq\geqslant
2899 }%
2900 \fi
2901 \fi
2902 \fi
2903 }
2904 \newcommand\thu@set@unimath@integral@limits{%
2905 \ifthu@integral@limits@true
2906 \removenolimits{%
2907 \int\iint\iiint\iiiint\oint\oiint\oiiint
2908 \intclockwise\varointclockwise\ointctrclockwise\sumint
2909 \intbar\intBar\fint\cirfnint\awint\rppolint
2910 \scpolint\npolint\pointint\sqint\intlarhk\intx
2911 \intcap\intcup\upint\lowint
2912 }%
2913 \else
2914 \addnolimits{%
2915 \int\iint\iiint\iiiint\oint\oiint\oiiint
2916 \intclockwise\varointclockwise\ointctrclockwise\sumint
2917 \intbar\intBar\fint\cirfnint\awint\rppolint
2918 \scpolint\npolint\pointint\sqint\intlarhk\intx
2919 \intcap\intcup\upint\lowint
2920 }%
2921 \fi
2922 }
2923 \newcommand\thu@set@unimath@ellipsis{%
2924 \ifthu@math@ellipsis@centered
2925 \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}%
2926 \else
2927 \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}%
2928 \fi
2929 }
2930 \newcommand\thu@set@unimath@real@part{%
2931 \ifthu@real@part@roman
2932 \AtBeginDocument{%
2933 \def\Re{\operatorname{Re}}%
2934 \def\Im{\operatorname{Im}}%
2935 }%
2936 \else
2937 \AtBeginDocument{%
2938 \let\Re\thu@save@Re
2939 \let\Im\thu@save@Im
2940 }%
2941 \fi
2942 }
2943 \newcommand\thu@set@unimath@style{%
2944 \ifthu@uppercase@greek@upright
2945 \unimathsetup{math-style = TeX}%
2946 \else
2947 \ifthu@uppercase@greek@italic
2948 \unimathsetup{math-style = ISO}%
2949 \fi
2950 \fi
2951 \ifthu@math@style@TeX
2952 \unimathsetup{bold-style = TeX}%
2953 \else
2954 \unimathsetup{bold-style = ISO}%
2955 \fi
2956 \thu@set@unimath@leq
2957 \thu@set@unimath@integral@limits
2958 \ifthu@partial@upright
2959 \unimathsetup{partial = upright}%
2960 \else
2961 \ifthu@partial@italic
2962 \unimathsetup{partial = italic}%
2963 \fi
2964 \fi
2965 \thu@set@unimath@ellipsis
2966 \thu@set@unimath@real@part
2967 }
2968 % \end{macrocode}
2969 %
2970 % \begin{macrocode}
2971 \newcommand\thu@qed{\rule{1ex}{1ex}}
2972 \newcommand\thu@load@unimath{%
2973 \@ifpackageloaded{unicode-math}{}{%
2974 \RequirePackage{unicode-math}%
2975 \AtBeginDocument{%
2976 \let\thu@save@leq\leq
2977 \let\thu@save@geq\geq
2978 \let\thu@save@Re\Re
2979 \let\thu@save@Im\Im
2980 }%
2981 % \end{macrocode}
2982 %
2983 % 兼容旧的粗体命令:\pkg{bm} 的 \cs{bm} 和 \pkg{amsmath} 的 \cs{boldsymbol}。
2984 % \begin{macrocode}
2985 \DeclareRobustCommand\bm[1]{{\symbfit{##1}}}%
2986 \DeclareRobustCommand\boldsymbol[1]{{\symbfit{##1}}}%
2987 % \end{macrocode}
2988 %
2989 % 兼容 \pkg{amsfonts} 和 \pkg{amssymb} 中的一些命令。
2990 % \begin{macrocode}
2991 \newcommand\square{\mdlgwhtsquare}%
2992 \newcommand\blacksquare{\mdlgblksquare}%
2993 \AtBeginDocument{%
2994 \renewcommand\checkmark{\ensuremath{\symbol{"2713}}}%
2995 }%
2996 % \end{macrocode}
2997 %
2998 % 兼容 \pkg{amsthm} 的 \cs{qedsymbol}。
2999 % \begin{macrocode}
3000 \renewcommand\thu@qed{\ensuremath{\QED}}%
3001 }%
3002 }
3003 % \end{macrocode}
3004 %
3005 % STIX Two Math
3006 % \begin{macrocode}
3007 \newcommand\thu@set@math@font@stix{%
3008 \thu@set@stix@names
3009 \setmathfont{\thu@font@name@stix@math}[
3010 Extension = .otf,
3011 Scale = MatchLowercase,
3012 StylisticSet = \thu@xits@integral@stylistic@set,
3013 ]%
3014 \setmathfont{\thu@font@name@stix@math}[
3015 Extension = .otf,
3016 Scale = MatchLowercase,
3017 StylisticSet = 1,
3018 range = {scr,bfscr},
3019 ]%
3020 }
3021 % \end{macrocode}
3022 %
3023 % XITS Math
3024 % \begin{macrocode}
3025 \newcommand\thu@xits@integral@stylistic@set{%
3026 \ifthu@integral@upright
3027 8%
3028 \fi
3029 }
3030 \newcommand\thu@set@math@font@xits{%
3031 \thu@set@xits@names
3032 \setmathfont{\thu@font@name@xits@math}[
3033 Extension = .otf,
3034 StylisticSet = \thu@xits@integral@stylistic@set,
3035 ]%
3036 \setmathfont{\thu@font@name@xits@math}[
3037 Extension = .otf,
3038 StylisticSet = 1,
3039 range = {cal,bfcal},
3040 ]%
3041 }
3042 % \end{macrocode}
3043 %
3044 % Libertinus Math
3045 % \begin{macrocode}
3046 \newcommand\thu@libertinus@integral@stylistic@set{%
3047 \ifthu@integral@slanted
3048 8%
3049 \fi
3050 }
3051 \newcommand\thu@set@math@font@libertinus{%
3052 \thu@set@libertinus@names
3053 \setmathfont{\thu@font@name@libertinus@math}[
3054 Extension = .otf,
3055 StylisticSet = \thu@libertinus@integral@stylistic@set,
3056 ]%
3057 }
3058 % \end{macrocode}
3059 %
3060 % New Computer Modern Math
3061 % \begin{macrocode}
3062 \newcommand\thu@newcm@integral@stylistic@set{%
3063 \ifthu@integral@upright
3064 2%
3065 \fi
3066 }
3067 \newcommand\thu@set@math@font@newcm{%
3068 \setmathfont{NewCMMath-Book}[
3069 Extension = .otf,
3070 StylisticSet = \thu@newcm@integral@stylistic@set,
3071 ]%
3072 \setmathfont{NewCMMath-Book}[
3073 Extension = .otf,
3074 StylisticSet = 1,
3075 range = {scr,bfscr},
3076 ]%
3077 \setmathrm{NewCM10}[
3078 Extension = .otf,
3079 UprightFont = *-Book,
3080 BoldFont = *-Bold,
3081 ItalicFont = *-BookItalic,
3082 BoldItalicFont = *-BoldItalic,
3083 ]%
3084 \setmathsf{NewCMSans10}[
3085 Extension = .otf,
3086 UprightFont = *-Book,
3087 BoldFont = *-Bold,
3088 ItalicFont = *-BookOblique,
3089 BoldItalicFont = *-BoldOblique,
3090 ]%
3091 \setmathtt{NewCMMono10}[
3092 Extension = .otf,
3093 UprightFont = *-Book,
3094 ItalicFont = *-BookItalic,
3095 BoldFont = *-Bold,
3096 BoldItalicFont = *-BoldOblique,
3097 ]%
3098 }
3099 % \end{macrocode}
3100 %
3101 % Latin Modern Math
3102 % \begin{macrocode}
3103 \newcommand\thu@set@math@font@lm{%
3104 \setmathfont{latinmodern-math}[Extension=.otf]%
3105 \setmathrm{lmroman10}[
3106 Extension = .otf,
3107 UprightFont = *-regular,
3108 BoldFont = *-bold,
3109 ItalicFont = *-italic,
3110 BoldItalicFont = *-bolditalic,
3111 ]%
3112 \setmathsf{lmsans10}[
3113 Extension = .otf,
3114 UprightFont = *-regular,
3115 BoldFont = *-bold,
3116 ItalicFont = *-oblique,
3117 BoldItalicFont = *-boldoblique,
3118 ]%
3119 \setmathtt{lmmonolt10}[
3120 Extension = .otf,
3121 UprightFont = *-regular,
3122 BoldFont = *-bold,
3123 ItalicFont = *-oblique,
3124 BoldItalicFont = *-boldoblique,
3125 ]%
3126 }
3127 % \end{macrocode}
3128 %
3129 % NewTX Math
3130 % \begin{macrocode}
3131 \newcommand\thu@set@math@font@newtx{%
3132 \ifthu@font@newtx\else
3133 \let\thu@save@encodingdefault\encodingdefault
3134 \let\thu@save@rmdefault\rmdefault
3135 \let\thu@save@sfdefault\sfdefault
3136 \let\thu@save@ttdefault\ttdefault
3137 \RequirePackage[T1]{fontenc}%
3138 \renewcommand{\rmdefault}{ntxtlf}%
3139 \renewcommand{\sfdefault}{qhv}%
3140 \renewcommand{\ttdefault}{ntxtt}%
3141 \fi
3142 \ifthu@uppercase@greek@italic
3143 \PassOptionsToPackage{slantedGreek}{newtxmath}%
3144 \fi
3145 \ifthu@integral@upright
3146 \PassOptionsToPackage{upint}{newtxmath}%
3147 \fi
3148 \RequirePackage{newtxmath}%
3149 \let\thu@save@leq\leq
3150 \let\thu@save@geq\geq
3151 \ifthu@leq@slanted
3152 \let\le\leqslant
3153 \let\ge\geqslant
3154 \let\leq\leqslant
3155 \let\geq\geqslant
3156 \fi
3157 \ifthu@integral@limits@true
3158 \let\ilimits@\displaylimits
3159 \fi
3160 \let\thu@save@partial\partial
3161 \ifthu@partial@upright
3162 \let\partial\uppartial
3163 \fi
3164 \ifthu@math@ellipsis@centered
3165 \DeclareRobustCommand\mathellipsis{\mathinner{\cdotp\cdotp\cdotp}}%
3166 \else
3167 \DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}%
3168 \fi
3169 \let\thu@save@Re\Re
3170 \let\thu@save@Im\Im
3171 \ifthu@real@part@roman
3172 \def\Re{\operatorname{Re}}%
3173 \def\Im{\operatorname{Im}}%
3174 \fi
3175 \RequirePackage{bm}%
3176 \ifthu@font@newtx\else
3177 \let\encodingdefault\thu@save@encodingdefault
3178 \let\rmdefault\thu@save@rmdefault
3179 \let\sfdefault\thu@save@sfdefault
3180 \let\ttdefault\thu@save@ttdefault
3181 \fi
3182 \DeclareRobustCommand\symup[1]{{\mathrm{##1}}}%
3183 \DeclareRobustCommand\symbf[1]{{\bm{##1}}}%
3184 \DeclareRobustCommand\symbfsf[1]{{\bm{\mathsf{##1}}}}%
3185 \let\increment\upDelta%
3186 \renewcommand\thu@qed{\openbox}%
3187 }
3188 % \end{macrocode}
3189 %
3190 % \begin{macrocode}
3191 \newcommand\thu@set@math@font{%
3192 \ifthu@math@font@none\else
3193 \ifthu@math@font@newtx
3194 \thu@set@math@font@newtx
3195 \else
3196 \thu@load@unimath
3197 \thu@set@unimath@style
3198 \@nameuse{thu@set@math@font@\thu@math@font}%
3199 \fi
3200 \fi
3201 }
3202 \thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@math@font}}
3203 \newcommand\thu@set@math@font@auto{%
3204 \ifthu@math@font@auto
3205 \thusetup{math-font=xits}%
3206 \fi
3207 }
3208 \AtBeginOfPackageFile*{siunitx}{\thu@set@math@font@auto}
3209 \AtEndPreamble{\thu@set@math@font@auto}
3210 % \end{macrocode}
3211 %
3212 %
3213 % \subsection{主文档格式}
3214 % \label{sec:mainbody}
3215 %
3216 % \subsubsection{Three matters}
3217 % \begin{macro}{\cleardoublepage}
3218 % 对于 \textsl{openright} 选项,必须保证章首页右开,且如果前章末页无内容须
3219 % 清空其页眉页脚。
3220 % \begin{macrocode}
3221 \def\cleardoublepage{%
3222 \clearpage
3223 \if@twoside
3224 \ifthu@output@print
3225 \ifodd\c@page
3226 \else
3227 \thispagestyle{empty}%
3228 \hbox{}%
3229 \newpage
3230 \if@twocolumn
3231 \hbox{}\newpage
3232 \fi
3233 \fi
3234 \fi
3235 \fi
3236 }
3237 % \end{macrocode}
3238 % \end{macro}
3239 %
3240 % \begin{macro}{\frontmatter}
3241 % \begin{macro}{\mainmatter}
3242 % \begin{macro}{\backmatter}
3243 % 我们的单面和双面模式与常规的不太一样。
3244 % \begin{macrocode}
3245 \renewcommand\frontmatter{%
3246 \cleardoublepage
3247 \@mainmatterfalse
3248 \pagenumbering{Roman}%
3249 }
3250 \renewcommand\mainmatter{%
3251 \cleardoublepage
3252 \@mainmattertrue
3253 \pagenumbering{arabic}%
3254 }
3255 \renewcommand\backmatter{%
3256 \clearpage
3257 \@mainmatterfalse
3258 \thusetup{toc-depth = 0}%
3259 }
3260 % \end{macrocode}
3261 % \end{macro}
3262 % \end{macro}
3263 % \end{macro}
3264 %
3265 % \subsubsection{页眉页脚}
3266 % \label{sec:headerfooter}
3267 %
3268 % \pkg{fancyhdr} 定义页眉页脚很方便,但是有一个非常隐蔽的坑。
3269 % 第一次调用 \pkg{fancyhdr} 定义的样式时会修改 \cs{chaptermark},
3270 % 这会导致页眉信息错误(多余章号并且英文大写)。
3271 % 这是因为在 \cs{ps@fancy} 中对 \cs{chaptermark} 进行重定义,
3272 % 所以我们先调用 \cs{ps@fancy},再修改 \cs{chaptermark}。
3273 % \begin{macrocode}
3274 \pagestyle{fancy}
3275 % \end{macrocode}
3276 %
3277 % 定义页眉和页脚。
3278 % 研究生要求:
3279 % 页眉宋体五号字,宋体五号字居中书写;
3280 % 页码五号 Times New Roman 体。
3281 %
3282 % 本科生要求:
3283 % 页眉:无;
3284 % 页码:位于页面底端,居中书写。
3285 %
3286 % 本科外文专业要求页码字号 12pt。
3287 % \begin{macrocode}
3288 \fancypagestyle{plain}{%
3289 \fancyhf{}%
3290 \renewcommand\footrulewidth{0pt}%
3291 \ifthu@degree@bachelor
3292 \renewcommand\headrulewidth{0pt}%
3293 \fancyfoot[C]{
3294 \ifthu@main@language@chinese
3295 \fontsize{10.5bp}{12.075bp}\selectfont
3296 \else
3297 \normalsize
3298 \fi
3299 \thepage
3300 }%
3301 \let\@mkboth\@gobbletwo
3302 \let\chaptermark\@gobble
3303 \else
3304 \renewcommand\headrulewidth{0.75bp}%
3305 \fancyhead[C]{%
3306 \wuhao
3307 \ifthu@main@language@chinese
3308 \leftmark
3309 \else
3310 \MakeUppercase{\leftmark}%
3311 \fi
3312 }%
3313 \fancyfoot[C]{\wuhao\thepage}%
3314 \let\@mkboth\markboth
3315 \def\chaptermark##1{%
3316 \markboth{%
3317 \CTEXifname{%
3318 \CTEXthechapter
3319 \ifthu@main@language@chinese
3320 \quad
3321 \else
3322 \space
3323 \fi
3324 }{}##1%
3325 }{}%
3326 }%
3327 \fi
3328 \let\sectionmark\@gobble
3329 }
3330 \pagestyle{plain}
3331 % \end{macrocode}
3332 %
3333 % \cs{chapter} 会调用特殊的 page style。
3334 % \begin{macrocode}
3335 \def\ps@chapter{}
3336 \ctexset{chapter/pagestyle = chapter}
3337 % \end{macrocode}
3338 %
3339 %
3340 % \subsubsection{段落}
3341 % \label{sec:paragraph}
3342 %
3343 % 全文首行缩进 2 字符,标点符号用全角
3344 % \begin{macrocode}
3345 \ctexset{%
3346 punct=quanjiao,
3347 }
3348 \newcommand\thu@set@indent{%
3349 \ifthu@main@language@chinese
3350 \ctexset{autoindent=2}%
3351 \else
3352 \ifthu@degree@bachelor
3353 \ctexset{autoindent=0.8cm}%
3354 \else
3355 \ctexset{autoindent=0.74cm}%
3356 \fi
3357 \fi
3358 }
3359 \thu@set@indent
3360 \thu@option@hook{degree}{\thu@set@indent}
3361 \thu@option@hook{main-language}{\thu@set@indent}
3362 % \end{macrocode}
3363 %
3364 % 设置 url 样式,与上下文一致
3365 % \begin{macrocode}
3366 \urlstyle{same}
3367 % \end{macrocode}
3368 %
3369 % 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。
3370 % \begin{macrocode}
3371 \g@addto@macro\UrlBreaks{%
3372 \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
3373 \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
3374 \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
3375 \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
3376 \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
3377 }
3378 \Urlmuskip=0mu plus 0.1mu
3379 % \end{macrocode}
3380 %
3381 % 取消列表的间距,以符合中文习惯。
3382 % \begin{macrocode}
3383 \partopsep=\z@skip
3384 \def\@listi{\leftmargin\leftmargini
3385 \parsep \z@skip
3386 \topsep \z@skip
3387 \itemsep\z@skip}
3388 \let\@listI\@listi
3389 \@listi
3390 \def\@listii {\leftmargin\leftmarginii
3391 \labelwidth\leftmarginii
3392 \advance\labelwidth-\labelsep
3393 \topsep \z@skip
3394 \parsep \z@skip
3395 \itemsep \z@skip}
3396 \def\@listiii{\leftmargin\leftmarginiii
3397 \labelwidth\leftmarginiii
3398 \advance\labelwidth-\labelsep
3399 \topsep \z@skip
3400 \parsep \z@skip
3401 \partopsep \z@skip
3402 \itemsep \z@skip}
3403 % \end{macrocode}
3404 %
3405 % 使用 \pkg{enumitem} 命令调整默认列表环境间的距离,
3406 % \begin{macrocode}
3407 \setlist{nosep}
3408 % \end{macrocode}
3409 %
3410 %
3411 % \subsubsection{脚注}
3412 % \label{sec:footnote}
3413 %
3414 % 严格禁止脚注跨页,参考 \href{https://github.com/tuna/thuthesis/issues/778}{\#778}
3415 % 和 \url{https://texfaq.org/FAQ-splitfoot}。
3416 % \begin{macrocode}
3417 \interfootnotelinepenalty=10000
3418 % \end{macrocode}
3419 %
3420 % 脚注内容采用小五号字,中文用宋体,英文和数字用 Times New Roman 体按两端对齐格式书写,
3421 % 单倍行距,段前段后均空 0 磅。
3422 % 脚注的序号按页编排,不同页的脚注序号不需要连续。
3423 %
3424 % 脚注处序号“1,……,10”的字体是“正文”,不是“上标”,序号与脚注内容文字之间空半个汉字符,
3425 % 脚注的段落格式为:单倍行距,段前空 0 磅,段后空 0 磅,悬挂缩进 1.5 字符;
3426 % 字号为小五号字,汉字用宋体,外文用 Times New Roman 体。
3427 %
3428 % 苏世民学院的格式与学校不同,全文的脚注都连续编号(包括到附录中),并且不使用带圈数字。
3429 % \begin{macrocode}
3430 \ifthu@footnote@numbering@global
3431 \@removefromreset{footnote}{chapter}%
3432 \fi
3433 % \end{macrocode}
3434 %
3435 % 脚注序号使用带圈数字。
3436 % \begin{macro}{\thu@circled}
3437 % 生成带圈的脚注数字,最多处理到 10。
3438 % \begin{macrocode}
3439 \newcommand\thu@circled[1]{%
3440 \ifnum#1 >10\relax
3441 \thu@warning{%
3442 Too many footnotes in this page.
3443 Keep footnote less than 10%
3444 }%
3445 \fi
3446 {\symbol{\the\numexpr#1+"245F\relax}}%
3447 }
3448 \ifthu@footnote@style@circled
3449 \renewcommand{\thefootnote}{\thu@circled{\c@footnote}}%
3450 \renewcommand{\thempfootnote}{\thu@circled{\c@mpfootnote}}%
3451 \else
3452 \renewcommand{\thefootnote}{\arabic{footnote}}%
3453 \renewcommand{\thempfootnote}{\arabic{mpfootnote}}%
3454 \fi
3455 % \end{macrocode}
3456 % \end{macro}
3457 %
3458 % 定义脚注分割线,字号(宋体小五),以及悬挂缩进(1.5字符)。
3459 % \begin{macrocode}
3460 \def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@}
3461 \footnotemargin=13.5bp
3462 % \end{macrocode}
3463 %
3464 % 修改 \pkg{footmisc} 定义的脚注格式。
3465 % \begin{macrocode}
3466 \long\def\@makefntext#1{%
3467 \begingroup
3468 % 序号取消上标
3469 \def\@makefnmark{\hbox{\normalfont\@thefnmark}}%
3470 \xiaowu
3471 \ifFN@hangfoot
3472 \bgroup
3473 \setbox\@tempboxa\hbox{%
3474 \ifdim\footnotemargin>\z@
3475 \hb@xt@\footnotemargin{\@makefnmark\hss}%
3476 \else
3477 \@makefnmark
3478 \fi
3479 }%
3480 \leftmargin\wd\@tempboxa
3481 \rightmargin\z@
3482 \linewidth \columnwidth
3483 \advance \linewidth -\leftmargin
3484 \parshape \@ne \leftmargin \linewidth
3485 % \footnotesize
3486 \xiaowu
3487 \@setpar{{\@@par}}%
3488 \leavevmode
3489 \llap{\box\@tempboxa}%
3490 \parskip\hangfootparskip\relax
3491 \parindent\hangfootparindent\relax
3492 \else
3493 \parindent1em%
3494 \noindent
3495 \ifdim\footnotemargin>\z@
3496 \hb@xt@ \footnotemargin{\hss\@makefnmark}%
3497 \else
3498 \ifdim\footnotemargin=\z@
3499 \llap{\@makefnmark}%
3500 \else
3501 \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}%
3502 \fi
3503 \fi
3504 \fi
3505 \footnotelayout#1%
3506 \ifFN@hangfoot
3507 \par\egroup
3508 \fi
3509 \endgroup
3510 }
3511 % \end{macrocode}
3512 %
3513 %
3514 % \subsubsection{数学相关}
3515 % \label{sec:equation}
3516 % 允许太长的公式断行、分页等。
3517 % \begin{macrocode}
3518 \allowdisplaybreaks[4]
3519 % \end{macrocode}
3520 %
3521 % 公式距前后文的距离由 4 个参数控制,参见 \cs{normalsize} 的定义。
3522 %
3523 % 中文模板的公式编号使用中文括号。需要修改 \pkg{amsmath} 的 \cs{tagform@}。
3524 % 其中 |\kern 0pt| 防止中文左括号与前面文字的距离过窄。
3525 % \begin{macrocode}
3526 \newcommand\thu@put@parentheses[1]{%
3527 \ifthu@language@chinese
3528 \ifthu@eqn@paren@style@full
3529 \kern 0pt\relax
3530 (#1)%
3531 \else
3532 (#1)%
3533 \fi
3534 \else
3535 (#1)%
3536 \fi
3537 }
3538 % \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
3539 \def\tagform@#1{%
3540 \maketag@@@{\thu@put@parentheses{\ignorespaces#1\unskip\@@italiccorr}}%
3541 }
3542 % \end{macrocode}
3543 %
3544 % 重定义 \cs{eqref},其中 \cs{unskip} 是为了“|式~\eqref|”这样的写法不产生额外的空格。
3545 % \begin{macrocode}
3546 % \DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}
3547 \DeclareRobustCommand{\eqref}[1]{%
3548 \ifthu@language@chinese
3549 \ifthu@eqn@paren@style@full
3550 \unskip
3551 \fi
3552 \fi
3553 \textup{\tagform@{\ref{#1}}}%
3554 \ifthu@language@chinese
3555 \ifthu@eqn@paren@style@full
3556 \ignorespaces
3557 \fi
3558 \fi
3559 }
3560 % \end{macrocode}
3561 %
3562 % \subsubsection{浮动对象:插图和表格}
3563 % \label{sec:float}
3564 %
3565 % 图表浮动体的默认位置设为 |h|。
3566 % \begin{macrocode}
3567 \def\fps@figure{htbp}
3568 \def\fps@table{htbp}
3569 % \end{macrocode}
3570 %
3571 % 设置浮动对象和文字之间的距离
3572 % \begin{macrocode}
3573 \setlength{\floatsep}{12\p@ \@plus 2\p@ \@minus 2\p@}
3574 \setlength{\textfloatsep}{12\p@ \@plus 2\p@ \@minus 2\p@}
3575 \setlength{\intextsep}{12\p@ \@plus 2\p@ \@minus 2\p@}
3576 \setlength{\@fptop}{0bp \@plus1.0fil}
3577 \setlength{\@fpsep}{12bp \@plus2.0fil}
3578 \setlength{\@fpbot}{0bp \@plus1.0fil}
3579 % \end{macrocode}
3580 %
3581 % 由于 LaTeX2e kernel 的问题,图表等浮动体与文字前后的距离不一致,需要进行 patch。
3582 % 参考 \href{https://github.com/tuna/thuthesis/issues/614}{tuna/thuthesis/issues\#614}、
3583 % \url{https://www.zhihu.com/question/46618031} 和
3584 % \url{https://tex.stackexchange.com/a/40363/82731}。
3585 % \begin{macrocode}
3586 \patchcmd{\@addtocurcol}%
3587 {\vskip \intextsep}%
3588 {\edef\save@first@penalty{\the\lastpenalty}\unpenalty
3589 \ifnum \lastpenalty = \@M % hopefully the OR penalty
3590 \unpenalty
3591 \else
3592 \penalty \save@first@penalty \relax % put it back
3593 \fi
3594 \ifnum\outputpenalty <-\@Mii
3595 \addvspace\intextsep
3596 \vskip\parskip
3597 \else
3598 \addvspace\intextsep
3599 \fi}%
3600 {}{\thu@patch@error{\@addtocurcol}}
3601 \patchcmd{\@addtocurcol}%
3602 {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
3603 {\ifnum\outputpenalty <-\@Mii
3604 \aftergroup\vskip\aftergroup\intextsep
3605 \aftergroup\nointerlineskip
3606 \else
3607 \vskip\intextsep
3608 \fi}%
3609 {}{\thu@patch@error{\@addtocurcol}}
3610 \patchcmd{\@getpen}{\@M}{\@Mi}
3611 {}{\thu@patch@error{\@getpen}}
3612 % \end{macrocode}
3613 %
3614 % 将浮动参数设为较宽松的值。
3615 % \begin{macrocode}
3616 \renewcommand{\textfraction}{0.15}
3617 \renewcommand{\topfraction}{0.85}
3618 \renewcommand{\bottomfraction}{0.65}
3619 \renewcommand{\floatpagefraction}{0.60}
3620 % \end{macrocode}
3621 %
3622 % 允许用户设置图表编号和连接符。
3623 % \begin{macrocode}
3624 \thu@define@key{
3625 figure-number-separator = {
3626 name = figure@number@separator,
3627 default = {.},
3628 },
3629 table-number-separator = {
3630 name = table@number@separator,
3631 default = {.},
3632 },
3633 equation-number-separator = {
3634 name = equation@number@separator,
3635 default = {.},
3636 },
3637 number-separator = {
3638 name = number@separator,
3639 default = {.},
3640 },
3641 }
3642 \newcommand\thu@set@figure@numbering{%
3643 \ifthu@figure@numbering@chapter
3644 \@addtoreset{figure}{chapter}%
3645 \else
3646 \@removefromreset{figure}{chapter}%
3647 \fi
3648 }
3649 \thu@set@figure@numbering
3650 \thu@option@hook{figure-numbering}{\thu@set@figure@numbering}
3651 \renewcommand\thefigure{%
3652 \ifthu@figure@numbering@chapter
3653 \ifnum\c@chapter>\z@
3654 \thechapter
3655 \thu@figure@number@separator
3656 \fi
3657 \fi
3658 \@arabic\c@figure
3659 }
3660 \newcommand\thu@set@table@numbering{%
3661 \ifthu@table@numbering@chapter
3662 \@addtoreset{table}{chapter}%
3663 \else
3664 \@removefromreset{table}{chapter}%
3665 \fi
3666 }
3667 \thu@set@table@numbering
3668 \thu@option@hook{table-numbering}{\thu@set@table@numbering}
3669 \renewcommand\thetable{%
3670 \ifthu@table@numbering@chapter
3671 \ifnum\c@chapter>\z@
3672 \thechapter
3673 \thu@table@number@separator
3674 \fi
3675 \fi
3676 \@arabic\c@table
3677 }
3678 \newcommand\thu@set@equation@numbering{%
3679 \ifthu@equation@numbering@chapter
3680 \@addtoreset{equation}{chapter}%
3681 \else
3682 \@removefromreset{equation}{chapter}%
3683 \fi
3684 }
3685 \thu@set@equation@numbering
3686 \thu@option@hook{equation-numbering}{\thu@set@equation@numbering}
3687 \renewcommand\theequation{%
3688 \ifthu@equation@numbering@chapter
3689 \ifnum\c@chapter>\z@
3690 \thechapter
3691 \thu@equation@number@separator
3692 \fi
3693 \fi
3694 \@arabic\c@equation
3695 }
3696 \newcommand\thu@set@number@separator{%
3697 \let\thu@figure@number@separator\thu@number@separator
3698 \let\thu@table@number@separator\thu@number@separator
3699 \let\thu@equation@number@separator\thu@number@separator
3700 }
3701 \thu@option@hook{number-separator}{\thu@set@number@separator}
3702 % \end{macrocode}
3703 %
3704 % 定制浮动图形和表格标题样式:
3705 % \begin{itemize}
3706 % \item 图表标题字体为 11pt
3707 % \item 去掉图表号后面的冒号,图序与图名文字之间空一个汉字符宽度
3708 % \item 图:caption 在下,段前空 6 磅,段后空 12 磅
3709 % \item 表:caption 在上,段前空 12 磅,段后空 6 磅
3710 % \end{itemize}
3711 % \begin{macrocode}
3712 \DeclareCaptionFont{thu}{%
3713 \ifthu@degree@bachelor
3714 \fontsize{11bp}{15bp}\selectfont
3715 \else
3716 \ifthu@language@chinese
3717 \fontsize{11bp}{14.3bp}\selectfont
3718 \else
3719 \fontsize{11bp}{12.65bp}\selectfont
3720 \fi
3721 \fi
3722 }
3723 \captionsetup{
3724 font = thu,
3725 labelsep = quad,
3726 skip = 6bp,
3727 figureposition = bottom,
3728 tableposition = top,
3729 }
3730 \captionsetup[sub]{font=thu}
3731 \renewcommand{\thesubfigure}{(\alph{subfigure})}
3732 \renewcommand{\thesubtable}{(\alph{subtable})}
3733 % \renewcommand{\p@subfigure}{:}
3734 % \end{macrocode}
3735 %
3736 % 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距。段前空 3 磅,段后空 3 磅。
3737 % 对于中文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.3) \approx 1.42$。
3738 % 对于英文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.15) \approx 1.47$。
3739 %
3740 % 注意不能简单地把行距设为 $\SI{11}{pt} \times 1.3 + \SI{6}{pt} = \SI{20.3}{pt}$,
3741 % 这会导致含有多行文字的单元格中行距有误。
3742 %
3743 % 其他浮动体中(比如 \env{algorithm})的字号默认同表格一致。
3744 % \begin{macrocode}
3745 \newcommand\thu@set@table@font{
3746 \ifthu@language@chinese
3747 \def\thu@table@font{%
3748 \fontsize{11bp}{14.3bp}\selectfont
3749 \renewcommand\arraystretch{1.42}%
3750 }%
3751 \else
3752 \def\thu@table@font{%
3753 \fontsize{11bp}{12.65bp}\selectfont
3754 \renewcommand\arraystretch{1.47}%
3755 }%
3756 \fi
3757 }
3758 \thu@set@table@font
3759 \thu@option@hook{language}{\thu@set@table@font}
3760 \patchcmd\@floatboxreset{%
3761 \normalsize
3762 }{%
3763 \thu@table@font
3764 }{}{\thu@patch@error{\@floatboxreset}}
3765 % \end{macrocode}
3766 %
3767 % 对 \pkg{longtable} 跨页表格进行相同的设置。
3768 %
3769 % 在 Word 模板中按照正确的设置(需要去掉文档网格),
3770 % 中文模板每页能装下 1 行标题、1 行表头、30 行表身,
3771 % 英文模板每页能装下 1 行标题、1 行表头、33 行表身。
3772 % \begin{macrocode}
3773 \AtEndOfPackageFile*{longtable}{
3774 \AtBeginEnvironment{longtable}{%
3775 \thu@table@font
3776 }
3777 }
3778 % \end{macrocode}
3779 %
3780 % 研究生和本科生都推荐使用三线表,并且要求表的上、下边线为单直线,线粗为 1.5 磅;
3781 % 第三条线为单直线,线粗为 1 磅。
3782 % 这里设置 \pkg{booktabs} 线粗的默认值。
3783 % \begin{macrocode}
3784 \heavyrulewidth=1.5bp
3785 \lightrulewidth=1bp
3786 % \end{macrocode}
3787 %
3788 % \begin{macrocode}
3789 \AtEndOfPackageFile*{threeparttable}{
3790 \g@addto@macro\TPT@defaults{\wuhao}
3791 }
3792 % \end{macrocode}
3793 %
3794 % \subsubsection{章节标题}
3795 % \label{sec:theor}
3796 % \begin{macrocode}
3797 \newcommand{\thu@abstract@name}{摘\quad 要}
3798 \newcommand{\thu@abstract@name@en}{Abstract}
3799 % \end{macrocode}
3800 %
3801 % 各级标题格式设置。
3802 % \begin{macrocode}
3803 \ctexset{%
3804 chapter = {
3805 nameformat = {},
3806 numberformat = {},
3807 titleformat = {},
3808 fixskip = true,
3809 afterindent = true,
3810 lofskip = 0pt,
3811 lotskip = 0pt,
3812 },
3813 section = {
3814 afterindent = true,
3815 },
3816 subsection = {
3817 afterindent = true,
3818 },
3819 subsubsection = {
3820 afterindent = true,
3821 },
3822 paragraph/afterindent = true,
3823 subparagraph/afterindent = true,
3824 }
3825 % \end{macrocode}
3826 %
3827 % 本科生要求:
3828 % \begin{center}
3829 % \begin{tabular}{lclll}
3830 % \toprule
3831 % 标题 & 中文 & 英文 & 段前/后间距 & 行距 \\
3832 % \midrule
3833 % 章标题 & 黑体三号 & Arial 16pt & 24/18 pt & 单倍 \\
3834 % 一级节标题 & 黑体四号 & Arial 14pt & 24/6 pt & 20pt \\
3835 % 二级节标题 & 黑体 13pt & Arial 13pt & 12/6 pt & 20pt \\
3836 % 三级节标题 & 黑体小四号 & Arial 12pt & 12/6 pt & 20pt \\
3837 % \bottomrule
3838 % \end{tabular}
3839 % \end{center}
3840 %
3841 % 这里三级节标题的“中文黑体小四号”和“英文 Arial 13pt”不一致,取 13pt。
3842 % \begin{macrocode}
3843 \newcommand\thu@set@section@format{%
3844 \ifthu@degree@bachelor
3845 \ctexset{%
3846 chapter = {
3847 format = \centering\sffamily\fontsize{16bp}{20.8bp}\selectfont,
3848 titleformat = \thu@stretch{3em},
3849 aftername = \quad,
3850 beforeskip = 27bp,
3851 afterskip = 27bp,
3852 },
3853 section = {
3854 format = \sffamily\fontsize{14bp}{20bp}\selectfont,
3855 aftername = \quad,
3856 beforeskip = 24bp,
3857 afterskip = 6bp,
3858 },
3859 subsection = {
3860 format = \sffamily\fontsize{13bp}{20bp}\selectfont,
3861 aftername = \quad,
3862 beforeskip = 12bp,
3863 afterskip = 6bp,
3864 },
3865 subsubsection = {
3866 format = \sffamily\fontsize{12bp}{20bp}\selectfont,
3867 aftername = \quad,
3868 beforeskip = 12bp,
3869 afterskip = 6bp,
3870 },
3871 }%
3872 \ifthu@main@language@chinese
3873 \ctexset{
3874 chapter = {
3875 name = {第,章},
3876 number = \thechapter,
3877 },
3878 }%
3879 \else
3880 \ctexset{
3881 chapter = {
3882 name = \chaptername\space,
3883 number = \thu@english@number{chapter},
3884 },
3885 }%
3886 \fi
3887 % \end{macrocode}
3888 %
3889 % 研究生要求:
3890 % \begin{itemize}
3891 % \item 各章标题,例如:“\textsf{第 1 章 引言}”。
3892 %
3893 % 章序号与章名之间空一个汉字符。
3894 % 采用黑体三号字,居中书写,单倍行距,
3895 % 段前空 24 磅,段后空 18 磅。
3896 %
3897 % \item 一级节标题,例如:“\textsf{2.1 实验装置与实验方法}”。
3898 %
3899 % 节标题序号与标题名之间空一个汉字符(下同)。
3900 % 采用黑体四号(14pt)字居左书写,行距为固定值 20 磅,
3901 % 段前空 24 磅,段后空 6 磅。
3902 %
3903 % \item 二级节标题,例如:“\textsf{2.1.1 实验装置}”。
3904 %
3905 % 采用黑体 13pt 字居左书写,行距为固定值 20 磅,
3906 % 段前空 12 磅,段后空 6 磅。
3907 %
3908 % \item 三级节标题,例如:“\textsf{2.1.2.1 归纳法}”。
3909 %
3910 % 采用黑体小四号(12pt)字居左书写,行距为固定值 20 磅,
3911 % 段前空 12 磅,段后空 6 磅。
3912 % \end{itemize}
3913 %
3914 % 由于 Word 的行距算法不同,这里进行了一些调整使得视觉上更接近。
3915 % \begin{macrocode}
3916 \else
3917 \ctexset{%
3918 chapter = {
3919 titleformat = {},
3920 beforeskip = 27bp,
3921 afterskip = 27bp,
3922 number = \thechapter,
3923 },
3924 section = {
3925 beforeskip = 24bp,
3926 afterskip = 6bp,
3927 },
3928 subsection = {
3929 beforeskip = 12bp,
3930 afterskip = 6bp,
3931 },
3932 subsubsection = {
3933 beforeskip = 12bp,
3934 afterskip = 6bp,
3935 },
3936 }%
3937 \ifthu@main@language@chinese
3938 \ctexset{%
3939 chapter = {
3940 format = \centering\sffamily\sanhao,
3941 nameformat = {},
3942 titleformat = {},
3943 name = {第,章},
3944 aftername = \quad,
3945 },
3946 section = {
3947 format = \sffamily\fontsize{14bp}{20bp}\selectfont,
3948 aftername = \quad,
3949 },
3950 subsection = {
3951 format = \sffamily\fontsize{13bp}{20bp}\selectfont,
3952 aftername = \quad,
3953 },
3954 subsubsection = {
3955 format = \sffamily\fontsize{12bp}{20bp}\selectfont,
3956 aftername = \quad,
3957 },
3958 }%
3959 \else
3960 \ctexset{%
3961 chapter = {
3962 format = \centering\sffamily\bfseries\fontsize{16bp}{20bp}\selectfont,
3963 nameformat = \MakeUppercase,
3964 titleformat = \MakeUppercase,
3965 name = \chaptername\space,
3966 aftername = \space,
3967 },
3968 section = {
3969 format = \sffamily\bfseries\fontsize{14bp}{20bp}\selectfont,
3970 aftername = \space,
3971 },
3972 subsection = {
3973 format = \sffamily\bfseries\fontsize{13bp}{20bp}\selectfont,
3974 aftername = \space,
3975 },
3976 subsubsection = {
3977 format = \sffamily\bfseries\fontsize{12bp}{20bp}\selectfont,
3978 aftername = \space,
3979 },
3980 }%
3981 \fi
3982 \fi
3983 }
3984 \thu@set@section@format
3985 \thu@option@hook{degree}{\thu@set@section@format}
3986 \thu@option@hook{main-language}{\thu@set@section@format}
3987 % \end{macrocode}
3988 %
3989 % \begin{macrocode}
3990 \newcommand\thu@english@number[1]{%
3991 \expandafter\ifcase\csname c@#1\endcsname
3992 Zero\or
3993 One\or
3994 Two\or
3995 Three\or
3996 Four\or
3997 Five\or
3998 Six\or
3999 Seven\or
4000 Eight\or
4001 Nine\or
4002 Ten\or
4003 Eleven\or
4004 Twelve\or
4005 Thirteen\or
4006 Fourteen\or
4007 Fifteen\or
4008 Sixteen\or
4009 Seventeen\or
4010 Eighteen\or
4011 Nineteen\or
4012 Twenty\or
4013 \thu@error{You are genius}%
4014 \fi
4015 }
4016 % \end{macrocode}
4017 %
4018 % \begin{macro}{\thu@chapter*}
4019 % 默认的 \cs{chapter*} 很难同时满足研究生院和本科生的论文要求。本科论文要求所有的
4020 % 章都出现在目录里,比如摘要、Abstract、主要符号表等,所以可以简单的扩展默
4021 % 认\cs{chapter*} 实现这个目的。但是研究生又不要这些出现在目录中,而且致谢和声明
4022 % 部分的章名、页眉和目录都不同,所以定义一个灵活的 \cs{thu@chapter*} 专门处理这些
4023 % 要求。
4024 %
4025 % \cs{thu@chapter*}\oarg{tocline}\marg{title}\oarg{header}: tocline 是出现在目录
4026 % 中的条目,如果为空则此 chapter 不出现在目录中,如果省略表示目录出现 title;
4027 % title 是章标题;header 是页眉出现的标题,如果忽略则取 title。通过这个宏我才真
4028 % 正体会到 \TeX{} macro 的力量!
4029 % \begin{macrocode}
4030 \newcommand\thu@pdfbookmark[2]{}
4031 \newcommand\thu@phantomsection{}
4032 \NewDocumentCommand\thu@chapter{s o m o}{%
4033 \IfBooleanF{#1}{%
4034 \thu@error{You have to use the star form: \string\thu@chapter*}%
4035 }%
4036 \if@openright\cleardoublepage\else\clearpage\fi%
4037 \IfValueTF{#2}{%
4038 \ifthenelse{\equal{#2}{}}{%
4039 \thu@pdfbookmark{0}{#3}%
4040 }{%
4041 \thu@phantomsection
4042 \addcontentsline{toc}{chapter}{#2}%
4043 }%
4044 }{%
4045 \thu@phantomsection
4046 \addcontentsline{toc}{chapter}{#3}%
4047 }%
4048 \chapter*{#3}%
4049 \IfValueTF{#4}{%
4050 \ifthenelse{\equal{#4}{}}{%
4051 \@mkboth{}{}%
4052 }{%
4053 \@mkboth{#4}{#4}%
4054 }%
4055 }{%
4056 \@mkboth{#3}{#3}%
4057 }%
4058 }
4059 % \end{macrocode}
4060 % \end{macro}
4061 %
4062 %
4063 % \subsubsection{目录}
4064 % \label{sec:toc}
4065 % 最多 4 层,即: x.x.x.x,对应的命令和层序号分别是:
4066 % \cs{chapter}(0), \cs{section}(1), \cs{subsection}(2), \cs{subsubsection}(3)。
4067 % \begin{macrocode}
4068 \setcounter{secnumdepth}{3}
4069 \setcounter{tocdepth}{2}
4070 % \end{macrocode}
4071 %
4072 % \begin{macro}{\tableofcontents}
4073 % 目录生成命令。
4074 % \begin{macrocode}
4075 \renewcommand\tableofcontents{%
4076 \ifthu@degree@graduate
4077 \thu@chapter*{\contentsname}%
4078 \else
4079 \ifthu@degree@bachelor
4080 \ctexset{chapter/titleformat = \thu@stretch{2.5em}}%
4081 \thu@chapter*[]{\contentsname}%
4082 \ctexset{chapter/titleformat = \thu@stretch{3em}}%
4083 \else
4084 \thu@chapter*[]{\contentsname}%
4085 \fi
4086 \fi
4087 \@starttoc{toc}%
4088 }
4089 \thu@define@key{
4090 toc-chapter-style = {
4091 name = toc@chapter@style,
4092 choices = {
4093 arial,
4094 times,
4095 },
4096 default = arial,
4097 },
4098 }
4099 \thu@option@hook{toc-chapter-style}{\thu@deprecate{"toc-chapter-style" option}{}}
4100 \newcommand\thu@contents@label@delimiter{%
4101 \ifthu@degree@bachelor
4102 \ifthu@main@language@chinese
4103 \space
4104 \else
4105 \quad
4106 \fi
4107 \else
4108 \quad
4109 \fi
4110 }
4111 \newcommand\thu@leaders{\nobreak\titlerule*[4bp]{.}\nobreak}
4112 \newcommand\thu@set@toc@format{%
4113 \contentsmargin{\z@}%
4114 % \end{macrocode}
4115 %
4116 % 本科生:
4117 % 目录从第 1 章开始,每章标题用黑体小四号字,行间距为 20pt,
4118 % 行前空 6pt,行后空 0pt。
4119 % 其它级节标题用宋体小四字,行间距为 20pt。
4120 %
4121 % 注意示例中章标题的字母和数字是衬线体,所以这里用 \cs{heiti}。
4122 % 示例中的一级和二级节标题分别缩进 1 和 1.5 个汉字符。
4123 % \begin{macrocode}
4124 \ifthu@degree@bachelor
4125 \ifthu@main@language@chinese
4126 \titlecontents{chapter}
4127 [0pt]{\sffamily}
4128 {\contentspush{\thecontentslabel\space}\thu@stretch{3em}}{\thu@stretch{3em}}
4129 {\rmfamily\thu@leaders\thecontentspage}%
4130 \titlecontents{section}
4131 [1em]{}
4132 {\contentspush{\thecontentslabel\space}}{}
4133 {\thu@leaders\thecontentspage}%
4134 \titlecontents{subsection}
4135 [2em]{}
4136 {\contentspush{\thecontentslabel\space}}{}
4137 {\thu@leaders\thecontentspage}%
4138 \else
4139 % \end{macrocode}
4140 %
4141 % 本科生英文专业要求“左侧按级依次缩进 0.5cm”。
4142 % \begin{macrocode}
4143 \ifthu@main@language@english
4144 \titlecontents{chapter}
4145 [\z@]{\addvspace{6bp}\sffamily}
4146 {\contentspush{\thecontentslabel\quad}}{}
4147 {\rmfamily\thu@leaders\thecontentspage}%
4148 \titlecontents{section}
4149 [0.5cm]{}
4150 {\contentspush{\thecontentslabel\quad}}{}
4151 {\thu@leaders\thecontentspage}%
4152 \titlecontents{subsection}
4153 [1cm]{}
4154 {\contentspush{\thecontentslabel\quad}}{}
4155 {\thu@leaders\thecontentspage}%
4156 \fi
4157 \fi
4158 % \end{macrocode}
4159 %
4160 % 研究生:
4161 % \begin{enumerate}
4162 % \item 目录中的章标题行采用黑体小四号字,固定行距 20 磅,段前段后 0 磅;
4163 % 其他内容采用宋体小四号字,行距为固定值 20 磅,
4164 % 段前、段后均为 0 磅。
4165 % \item 目录中的章标题行居左书写,一级节标题行缩进 1 个汉字符,
4166 % 二级节标题行缩进 2 个汉字符。
4167 % \end{enumerate}
4168 %
4169 % 注意示例中章标题的字母和数字是无衬线体,所以用这里用 \cs{sffamily},
4170 % 但是页码仍然用 \cs{rmfamily}。
4171 % \begin{macrocode}
4172 \else
4173 \ifthu@main@language@chinese
4174 \titlecontents{chapter}
4175 [\z@]{\sffamily}
4176 {\contentspush{\thecontentslabel\quad}}{}
4177 {\rmfamily\thu@leaders\thecontentspage}%
4178 \titlecontents{section}
4179 [1em]{}
4180 {\contentspush{\thecontentslabel\quad}}{}
4181 {\thu@leaders\thecontentspage}%
4182 \titlecontents{subsection}
4183 [2em]{}
4184 {\contentspush{\thecontentslabel\quad}}{}
4185 {\thu@leaders\thecontentspage}%
4186 \else
4187 \titlecontents{chapter}
4188 [\z@]{\heiti}
4189 {\contentspush{\MakeUppercase{\thecontentslabel}\space}\MakeUppercase}{\MakeUppercase}
4190 {\rmfamily\thu@leaders\thecontentspage}%
4191 \titlecontents{section}
4192 [1em]{}
4193 {\contentspush{\thecontentslabel\space}}{}
4194 {\thu@leaders\thecontentspage}%
4195 \titlecontents{subsection}
4196 [2em]{}
4197 {\contentspush{\thecontentslabel\space}}{}
4198 {\thu@leaders\thecontentspage}%
4199 \fi
4200 \fi
4201 }
4202 \thu@set@toc@format
4203 \thu@option@hook{degree}{\thu@set@toc@format}
4204 \thu@option@hook{main-language}{\thu@set@toc@format}
4205 % \end{macrocode}
4206 % \end{macro}
4207 %
4208 %
4209 % \subsubsection{封面和封底}
4210 % \label{sec:cover}
4211 % 定义密级参数。
4212 % \begin{macrocode}
4213 \thu@define@key{
4214 secret-level = {
4215 name = secret@level,
4216 },
4217 secret-year = {
4218 name = secret@year,
4219 },
4220 % \end{macrocode}
4221 %
4222 % 论文中英文题目。
4223 % \begin{macrocode}
4224 title = {
4225 default = {标题},
4226 },
4227 title* = {
4228 default = {Title},
4229 name = title@en,
4230 },
4231 % \end{macrocode}
4232 %
4233 % 作者、导师、副导师、联合指导老师。
4234 % \begin{macrocode}
4235 author = {
4236 default = {姓名},
4237 },
4238 author* = {
4239 default = {Name of author},
4240 name = author@en,
4241 },
4242 student-id = {
4243 name = student@id,
4244 },
4245 supervisor = {
4246 default = {导师姓名},
4247 },
4248 supervisor* = {
4249 default = {Name of supervisor},
4250 name = supervisor@en,
4251 },
4252 associate-supervisor = {
4253 name = associate@supervisor,
4254 },
4255 associate-supervisor* = {
4256 name = associate@supervisor@en,
4257 },
4258 co-supervisor = {
4259 name = co@supervisor,
4260 },
4261 co-supervisor* = {
4262 name = co@supervisor@en,
4263 },
4264 % Reserved for compatibility
4265 joint-supervisor = {
4266 name = co@supervisor,
4267 },
4268 joint-supervisor* = {
4269 name = co@supervisor@en,
4270 },
4271 % \end{macrocode}
4272 %
4273 % 学位中英文。
4274 % \begin{macrocode}
4275 degree-category = {
4276 default = {工学博士},
4277 name = degree@category,
4278 },
4279 degree-category* = {
4280 default = {Doctor of Philosophy},
4281 name = degree@category@en,
4282 },
4283 }
4284 % \end{macrocode}
4285 %
4286 % 院系中英文名称。
4287 % \begin{macrocode}
4288 \thu@define@key{
4289 department = {
4290 default = {计算机科学与技术系},
4291 },
4292 % \end{macrocode}
4293 %
4294 % 学科中英文名称。
4295 % \begin{macrocode}
4296 discipline = {
4297 % default = {计算机科学与技术},
4298 },
4299 discipline* = {
4300 % default = {Computer Science and Technology},
4301 name = discipline@en,
4302 },
4303 }
4304 \thu@option@hook{discipline}{%
4305 \ifthu@degree@type@professional
4306 \thu@warning{`discipline' for professional degree is deprecated. Use `professional-field' instead.}%
4307 \let\thu@professional@field\thu@discipline
4308 \let\thu@discipline\@empty
4309 \fi
4310 }
4311 \thu@option@hook{discipline*}{%
4312 \ifthu@degree@type@professional
4313 \thu@warning{`discipline*' for professional degree is deprecated. Use `professional-field*' instead.}%
4314 \let\thu@professional@field@en\thu@discipline@en
4315 \let\thu@discipline@en\@empty
4316 \fi
4317 }
4318 % \end{macrocode}
4319 %
4320 % 专业领域。
4321 % \begin{macrocode}
4322 \thu@define@key{
4323 professional-field = {
4324 name = professional@field,
4325 },
4326 professional-field* = {
4327 name = professional@field@en,
4328 },
4329 % \end{macrocode}
4330 %
4331 % 工程领域。
4332 % \begin{macrocode}
4333 engineering-field = {
4334 name = engineering@field,
4335 },
4336 engineering-field* = {
4337 name = engineering@field@en,
4338 },
4339 % \end{macrocode}
4340 %
4341 % 论文成文日期。
4342 % \begin{macrocode}
4343 date = {
4344 default = {\the\year-\two@digits{\month}-\two@digits{\day}},
4345 },
4346 % \end{macrocode}
4347 %
4348 % 博士后专用封面参数。
4349 % \begin{macrocode}
4350 clc,
4351 udc,
4352 id,
4353 discipline-level-1 = {
4354 default = {一级学科名称},
4355 name = discipline@level@i,
4356 },
4357 discipline-level-2 = {
4358 default = {二级学科名称},
4359 name = discipline@level@ii,
4360 },
4361 start-date = {
4362 name = start@date,
4363 default = {\the\year-\two@digits{\month}-\two@digits{\day}},
4364 },
4365 end-date = {
4366 name = end@date,
4367 default = {\the\year-\two@digits{\month}-\two@digits{\day}},
4368 },
4369 % \end{macrocode}
4370 %
4371 % 中文封面后是否生成书脊页。
4372 % \begin{macrocode}
4373 include-spine = {
4374 name = include@spine,
4375 choices = {
4376 false,
4377 true,
4378 },
4379 default = false,
4380 },
4381 }
4382 % \end{macrocode}
4383 %
4384 % 输出日期的给定格式:\cs{thu@format@date}\marg{format}\marg{date},
4385 % 其中格式 \meta{format} 接受三个参数分别对应年、月、日,
4386 % \meta{date} 是 ISO 格式的日期(yyyy-mm-dd)。
4387 % \begin{macrocode}
4388 \newcommand\thu@format@date[2]{%
4389 \edef\thu@@date{#2}%
4390 \def\thu@@process@date##1-##2-##3\@nil{%
4391 #1{##1}{##2}{##3}%
4392 }%
4393 \expandafter\thu@@process@date\thu@@date\@nil
4394 }
4395 \newcommand\thu@date@zh@digit[3]{#1 年 \number#2 月 \number#3 日}
4396 \newcommand\thu@date@zh@digit@short[3]{#1 年 \number#2 月}
4397 \newcommand\thu@date@zh@short[3]{\zhdigits{#1}年\zhnumber{#2}月}
4398 \newcommand\thu@date@month[1]{%
4399 \ifcase\number#1\or
4400 January\or February\or March\or April\or May\or June\or
4401 July\or August\or September\or October\or November\or December%
4402 \fi
4403 }
4404 \newcommand\thu@date@en@short[3]{\thu@date@month{#2}, #1}
4405 % \end{macrocode}
4406 %
4407 % 下划线命令。
4408 % \pkg{ulem} 的下划线 \cs{uline} 可以控制粗细和深度。
4409 % \begin{macrocode}
4410 \newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt}
4411 \newcommand\thu@uline[2][6em]{\uline{\hb@xt@ #1{\hss#2\hss}}}
4412 % \end{macrocode}
4413 %
4414 % 将内容拉伸或压缩到固定宽度。
4415 % \begin{macrocode}
4416 \newcommand\thu@fixed@box[2]{%
4417 \begingroup
4418 \ifLuaTeX
4419 \ltjsetparameter{kanjiskip = {0pt plus 2filll minus 1filll}}%
4420 \else
4421 \renewcommand\CJKglue{\hspace{0pt plus 2filll minus 1filll}}%
4422 \fi
4423 \makebox[#1][l]{#2}%
4424 \endgroup
4425 }
4426 % \end{macrocode}
4427 %
4428 % 如果内容小于给定宽度,则拉伸至该宽度,否则取自然宽度。
4429 % \begin{macrocode}
4430 \newbox\thu@stretch@box
4431 \newcommand\thu@stretch[2]{%
4432 \sbox\thu@stretch@box{#2}%
4433 \ifdim \wd\thu@stretch@box < #1\relax
4434 \begingroup
4435 \ifLuaTeX
4436 \ltjsetparameter{kanjiskip = {0pt plus 2filll}}%
4437 \else
4438 \renewcommand\CJKglue{\hspace{0pt plus 2filll}}%
4439 \fi
4440 \makebox[#1][l]{#2}%
4441 \endgroup
4442 \else
4443 \box\thu@stretch@box
4444 \fi
4445 }
4446 % \end{macrocode}
4447 %
4448 % 如果内容小于给定宽度,则在右侧填充空白至该宽度,否则取自然宽度。
4449 % \begin{macrocode}
4450 \newbox\thu@pad@box
4451 \newcommand\thu@pad[2]{%
4452 \sbox\thu@pad@box{#2}%
4453 \ifdim \wd\thu@pad@box < #1\relax
4454 \makebox[#1][l]{\box\thu@pad@box}%
4455 \else
4456 \box\thu@pad@box
4457 \fi
4458 }
4459 % \end{macrocode}
4460 %
4461 % 导师的姓名和职称使用“,”分开,所以这里用 \pkg{kvsetkeys} 的 \cs{comma@parse} 来处理。
4462 % \begin{macrocode}
4463 \newcounter{thu@csl@count}
4464 \newcommand\thu@name@title@process[1]{%
4465 \ifcase\c@thu@csl@count % == 0
4466 \gdef\thu@@name{#1}%
4467 \or % == 1
4468 \gdef\thu@@title{#1}%
4469 \fi
4470 \stepcounter{thu@csl@count}%
4471 }
4472 \newcommand\thu@name@title@format[2]{%
4473 \thu@pad{3cm}{\thu@stretch{4em}{#1}}%
4474 \thu@stretch{3em}{#2}%
4475 }
4476 \newcommand\thu@name@title[1]{%
4477 \setcounter{thu@csl@count}{0}%
4478 \gdef\thu@@name{}%
4479 \gdef\thu@@title{}%
4480 \expandafter\comma@parse\expandafter{#1}{\thu@name@title@process}%
4481 \thu@name@title@format{\thu@@name}{\thu@@title}%
4482 }
4483 % \end{macrocode}
4484 %
4485 % \myentry{封面}
4486 % \begin{macro}{\maketitle}
4487 % 生成封面(题名页)总命令。
4488 % \begin{macrocode}
4489 \renewcommand\maketitle{%
4490 \cleardoublepage
4491 \pagenumbering{Alph}%
4492 \thu@pdfbookmark{-1}{\thu@title}%
4493 \thu@titlepage
4494 \ifthu@include@spine@true
4495 \spine
4496 \fi
4497 \ifthu@degree@graduate
4498 \ifthu@thesis@type@thesis
4499 \cleardoublepage
4500 \thu@titlepage@en
4501 \fi
4502 \fi
4503 \clearpage
4504 }
4505 % \end{macrocode}
4506 % \end{macro}
4507 %
4508 % \begin{macro}{\thu@titlepage}
4509 % 中文封面(题名页)
4510 %
4511 % \begin{macrocode}
4512 \newcommand\thu@titlepage{%
4513 \thusetup{language = chinese}%
4514 \ifthu@degree@graduate
4515 % 研究生
4516 \thu@titlepage@thesis
4517 \else
4518 \ifthu@degree@bachelor
4519 % 本科生
4520 \thu@titlepage@bachelor
4521 \else
4522 \ifthu@degree@postdoc
4523 % 博后
4524 \thu@cover@postdoc
4525 \cleardoublepage
4526 \thu@titlepage@postdoc
4527 \fi
4528 \fi
4529 \fi
4530 \thu@reset@main@language
4531 }
4532 % \end{macrocode}
4533 % \end{macro}
4534 %
4535 % \myentry{研究生中文封面}
4536 % 《写作指南》规定中文封面页边距:
4537 % 上—6. 0 厘米,下—5.5 厘米,左—4.0 厘米,右—4.0 厘米,装订线 0 厘米。
4538 % 然而作为事实标准的 Word 模板的页边距是上下 6.0 厘米,左右 4.0 厘米。
4539 % 这里缩小上边距以方便排版保密信息。
4540 % \begin{macrocode}
4541 \newcommand\thu@titlepage@thesis{%
4542 \newgeometry{
4543 top = 2cm,
4544 bottom = 6cm,
4545 hmargin = 3.5cm,
4546 }%
4547 \thispagestyle{empty}%
4548 \null\vskip 8.1pt%
4549 \begingroup
4550 \centering
4551 \parbox[t][2cm][t]{\textwidth}{%
4552 \hskip -21.5pt%
4553 \thu@titlepage@secret
4554 }\par
4555 \vskip 40.5pt%
4556 \begingroup
4557 \sffamily\fontsize{26bp}{46.8bp}\selectfont
4558 \thu@title\par
4559 \endgroup
4560 \ifthu@main@language@english
4561 \vskip 5.4pt%
4562 \begingroup
4563 \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont
4564 \thu@title@en\par
4565 \endgroup
4566 \vskip -9.2pt%
4567 \fi
4568 \vskip 24.1pt%
4569 \thu@title@page@degree@category\par
4570 \vfill
4571 \ifthu@degree@type@academic
4572 \parbox[t][7.25cm][t]{\textwidth}{%
4573 \fangsong\fontsize{16bp}{31.2bp}\selectfont
4574 \thu@titlepage@info
4575 }\par
4576 \else
4577 \parbox[t][5.25cm][b]{\textwidth}{%
4578 \fangsong\fontsize{16bp}{31.2bp}\selectfont
4579 \thu@titlepage@info
4580 }\par
4581 \vskip 62pt%
4582 \fi
4583 \parbox[t][1.03cm][t]{\textwidth}{\centering\thu@titlepage@date}\par
4584 \endgroup
4585 \clearpage
4586 \restoregeometry
4587 }
4588 % \end{macrocode}
4589 %
4590 % 选题报告封面需要提供学号
4591 % \begin{macrocode}
4592 \newcommand\thu@set@student@id{%
4593 \ifthu@thesis@type@proposal\else
4594 \ifx\thu@student@id\@empty\else
4595 \thu@warning{`student-id' in "\protect\thusetup" would be ignored when `thesis-type' is not proposal.}%
4596 \fi
4597 \fi
4598 }
4599 \thu@set@student@id
4600 \thu@option@hook{thesis-type}{\thu@set@student@id}
4601 \thu@option@hook{student-id}{\thu@set@student@id}
4602 % \end{macrocode}
4603 %
4604 % 涉密信息
4605 % \begin{macrocode}
4606 \newcommand\thu@titlepage@secret{%
4607 \sffamily\sanhao
4608 \ifx\thu@secret@level\@empty
4609 \phantom{秘密}%
4610 \else
4611 \thu@secret@level\symbol{"2605}\makebox[3em][c]{\thu@secret@year}年%
4612 \fi\par
4613 }
4614 % \end{macrocode}
4615 %
4616 % 申请学位的学科门类或专业学位类别: 三号(16bp)宋体字,字距延伸 0.5bp,
4617 % 所以 \cs{CJKglue} 应该设为 1 bp。
4618 % \begin{macrocode}
4619 \newcommand\thu@title@page@degree@category{%
4620 \begingroup
4621 \fontsize{16bp}{22bp}\selectfont
4622 \ifLuaTeX
4623 \fontspec{\CJK@family}%
4624 \ltjsetparameter{kanjiskip = {1bp}}%
4625 \else
4626 \CJKfamily+{}%
4627 \renewcommand\CJKglue{\hspace{1bp}}%
4628 \fi
4629 \ifthu@thesis@type@thesis
4630 (申请清华大学\thu@degree@category
4631 \ifthu@degree@type@professional
4632 专业%
4633 \fi
4634 学位论文)%
4635 \else
4636 \ifthu@thesis@type@proposal
4637 (清华大学%
4638 \ifthu@degree@doctor
4639 博士%
4640 \else
4641 \ifthu@degree@master
4642 硕士%
4643 \fi
4644 \fi
4645 学位论文选题报告)%
4646 \fi
4647 \fi
4648 \par
4649 \endgroup
4650 }
4651 % \end{macrocode}
4652 %
4653 % 作者及指导教师信息
4654 % \begin{macrocode}
4655 \newcommand\thu@titlepage@info{%
4656 \thu@titlepage@info@tabular{2.3cm}{2.85cm}{2.75cm}{0.77cm}{%
4657 \thu@info@item{培养单位}{}{\thu@department}%
4658 \ifthu@degree@type@academic
4659 \thu@info@item{学科}{}{\thu@discipline}%
4660 \thu@info@item{研究生}{\thu@name@title}{\thu@author}%
4661 \else
4662 \thu@info@item{专业领域}{}{\thu@professional@field}%
4663 \thu@info@item{工程领域}{}{\thu@engineering@field}%
4664 \thu@info@item{申请人}{\thu@name@title}{\thu@author}%
4665 \fi
4666 \ifthu@thesis@type@proposal
4667 \ifx\thu@student@id\@empty
4668 \thu@warning{Missing option `student-id' in "\protect\thusetup", ID will not appear on cover.}%
4669 \else
4670 \thu@info@item{学号}{}{\thu@student@id}%
4671 \fi
4672 \fi
4673 \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
4674 \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
4675 \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}%
4676 }\par
4677 }
4678 % \end{macrocode}
4679 %
4680 % 标题页作者信息表
4681 % \texttt{\#1}: 表格左侧至版心的距离;\\
4682 % \texttt{\#2}: “培养单位”的边框宽度;\\
4683 % \texttt{\#3}: “培养单位”的文字宽度;\\
4684 % \texttt{\#4}: 冒号的边框;\\
4685 % \texttt{\#5}: 表格内容。
4686 % \begin{macrocode}
4687 \newcommand\thu@titlepage@info@tabular[5]{%
4688 \def\thu@info@item##1##2##3{%
4689 \ifx##3\@empty\else
4690 \thu@pad{#2}{\thu@fixed@box{#3}{##1}}%
4691 \thu@pad{#4}{:}%
4692 ##2{##3}\\
4693 \fi
4694 }%
4695 \hspace{#1}%
4696 \begin{tabular}{l}%
4697 \renewcommand\arraystretch{1}%
4698 #5%
4699 \end{tabular}%
4700 }
4701 % \end{macrocode}
4702 %
4703 % 论文成文打印的日期,用三号宋体汉字,字距延伸 0.5bp,
4704 % 所以 \cs{CJKglue} 应该设为 1 bp。
4705 % \begin{macrocode}
4706 \newcommand\thu@titlepage@date{%
4707 \begingroup
4708 \sanhao
4709 \ifLuaTeX
4710 \ltjsetparameter{kanjiskip = {1bp}}%
4711 \else
4712 \renewcommand\CJKglue{\hspace{1bp}}%
4713 \fi
4714 \thu@format@date{\thu@date@zh@short}{\thu@date}\par
4715 \endgroup
4716 }
4717 % \end{macrocode}
4718 %
4719 % \myentry{研究生英文封面}
4720 % \begin{macro}{\thu@titlepage@en}
4721 % \begin{macrocode}
4722 \newcommand{\thu@titlepage@en}{%
4723 \newgeometry{
4724 top = 5.5cm,
4725 bottom = 5cm,
4726 hmargin = 3.4cm,
4727 }%
4728 \thispagestyle{empty}%
4729 \thusetup{language = english}%
4730 \ifthu@degree@type@academic
4731 \thu@titlepage@en@graduate@academic
4732 \else
4733 \thu@titlepage@en@graduate@professional
4734 \fi
4735 \thu@reset@main@language
4736 \clearpage
4737 \restoregeometry
4738 }
4739 \newcommand\thu@titlepage@en@graduate@academic{%
4740 \begingroup
4741 \centering
4742 \null\vskip -0.31cm%
4743 \parbox[t][143bp][t]{\textwidth}{%
4744 \centering\thu@titlepage@en@title
4745 }\par
4746 \sanhao[1.725]%
4747 \thu@titlepage@en@degree
4748 \vskip 3bp%
4749 in\par
4750 \vskip 3.5bp%
4751 {\bfseries\sffamily\thu@discipline@en\par}%
4752 \vfill
4753 {\sffamily by\par}%
4754 \vskip 0.24cm%
4755 {\sffamily\bfseries\thu@author@en\par}%
4756 \vskip 0.18cm%
4757 \parbox[t][3.0cm][t]{\textwidth}{%
4758 \centering
4759 \xiaosan[2.1]%
4760 \thu@titlepage@en@supervisor
4761 }\par
4762 \thu@titlepage@en@date
4763 \vskip 0.7cm%
4764 \endgroup
4765 }
4766 \newcommand\thu@titlepage@en@graduate@professional{%
4767 \begingroup
4768 \centering
4769 \null\vskip -0.31cm%
4770 \parbox[t][143bp][t]{\textwidth}{%
4771 \centering\thu@titlepage@en@title
4772 }\par
4773 \sanhao[1.725]%
4774 \thu@titlepage@en@degree
4775 \vfill
4776 {\sffamily by\par}%
4777 \vskip 0.24cm%
4778 {\sffamily\bfseries\thu@author@en\par}%
4779 \ifx\thu@professional@field@en\empty
4780 \vskip 1.95cm%
4781 \else
4782 \vskip -0.1cm%
4783 {\sffamily\bfseries(\thu@professional@field@en)\par}%
4784 \vskip 1.1cm%
4785 \fi
4786 \parbox[t][3.37cm][t]{\textwidth}{%
4787 \centering
4788 \xiaosan[1.82]%
4789 \thu@titlepage@en@supervisor
4790 }\par
4791 \thu@titlepage@en@date
4792 \vskip 0.3cm%
4793 \endgroup
4794 }
4795 \newcommand\thu@titlepage@en@title{%
4796 \begingroup
4797 % 对齐到网格,每行 15.6bp
4798 \sffamily\bfseries\fontsize{20bp}{31.2bp}\selectfont
4799 \thu@title@en\par
4800 \endgroup
4801 }
4802 \newcommand\thu@thesis@name@en{%
4803 \ifthu@degree@master
4804 Thesis%
4805 \else
4806 Dissertation%
4807 \fi
4808 }
4809 \newcommand\thu@titlepage@en@degree{%
4810 \thu@thesis@name@en{} submitted to\par
4811 {\bfseries Tsinghua University\par}%
4812 in partial fulfillment of the requirement\par
4813 for the
4814 \ifthu@degree@type@professional
4815 professional
4816 \fi
4817 degree of\par
4818 {\sffamily\bfseries\thu@degree@category@en\par}%
4819 }
4820 \newcommand\thu@titlepage@en@supervisor{%
4821 \begin{tabular}{r@{\makebox[20.5bp][l]{\hspace{2bp}:}}l}%
4822 \renewcommand\arraystretch{1}%
4823 \thu@thesis@name@en{} Supervisor & \thu@supervisor@en \\
4824 \ifx\thu@associate@supervisor@en\@empty\else
4825 Associate Supervisor & \thu@associate@supervisor@en \\
4826 \fi
4827 \ifx\thu@co@supervisor@en\@empty\else
4828 Co-supervisor & \thu@co@supervisor@en \\
4829 \fi
4830 \end{tabular}%
4831 }
4832 \newcommand\thu@titlepage@en@date{%
4833 \begingroup
4834 \sffamily\bfseries\sanhao
4835 \thu@format@date{\thu@date@en@short}{\thu@date}\par
4836 \endgroup
4837 }
4838 % \end{macrocode}
4839 % \end{macro}
4840 %
4841 % \myentry{本科生封面}
4842 % 本科生封面要求:
4843 % \begin{itemize}
4844 % \item 题目:1 号黑体字,1.2 倍行距。
4845 % \item 系别、专业、姓名及指导教师信息部分使用三号仿宋\_GB2312 字。
4846 % \item 论文成文打印的日期用阿拉伯数字,采用小四号宋体。
4847 % \item 涉密的论文在封面右上角处注明论文密级,采用小四号宋体。
4848 % \end{itemize}
4849 %
4850 % 外文系英语专业要求题目先写中文标题,再写英文标题,字号 26pt,32 磅行距。
4851 % \begin{macrocode}
4852 \newlength\thu@info@label@width
4853 \newlength\thu@info@label@text@width
4854 \newcommand\thu@titlepage@bachelor{%
4855 \newgeometry{
4856 top = 3.8cm,
4857 bottom = 3.2cm,
4858 left = 3.2cm, % 装订线靠左 0.2 cm
4859 right = 3cm,
4860 }%
4861 \thispagestyle{empty}%
4862 \begingroup
4863 \centering
4864 \parbox[t][0cm][t]{\textwidth}{%
4865 \hfill
4866 \xiaosi
4867 \ifx\thu@secret@level\@empty\else
4868 \thu@secret@level\space\thu@secret@year 年\par
4869 \fi
4870 }\par
4871 \endgroup
4872 \vspace{19bp}%
4873 \begingroup
4874 \centering
4875 \hspace*{-5bp}%
4876 \includegraphics[width=50.4bp]{thu-fig-logo.pdf}%
4877 \hspace{10bp}%
4878 \raisebox{7bp}{\includegraphics[width=117bp]{thu-text-logo.pdf}}%
4879 \par
4880 \vspace{17bp}%
4881 \begingroup
4882 \sffamily\bfseries\xiaochu\ziju{0.3}%
4883 综合论文训练%
4884 \ifthu@thesis@type@proposal
4885 \\开题报告
4886 \fi
4887 \par
4888 \endgroup
4889 \vspace{48bp}%
4890 \parbox[t][136bp]{\linewidth}{%
4891 \centering
4892 \heiti\fontsize{26bp}{32.5bp}\selectfont
4893 \thu@title\par
4894 \ifthu@main@language@english
4895 \thusetup{language=english}%
4896 \thu@title@en\par
4897 \thusetup{language=chinese}%
4898 \fi
4899 }\par
4900 \endgroup
4901 \begingroup
4902 \fangsong
4903 \fontsize{16bp}{30.96bp}\selectfont
4904 \noindent
4905 \def\thu@name@title@format##1##2{%
4906 \thu@stretch{4em}{##1}%
4907 \hspace{1.5em}%
4908 \thu@stretch{2.5em}{##2}%
4909 }%
4910 \ifx\thu@co@supervisor\@empty
4911 \setlength\thu@info@label@width{2.5cm}%
4912 \setlength\thu@info@label@text@width{4em}%
4913 \else
4914 \setlength\thu@info@label@width{86bp}%
4915 \setlength\thu@info@label@text@width{5em}%
4916 \fi
4917 \thu@titlepage@info@tabular{81bp}{\thu@info@label@width}{\thu@info@label@text@width}{0.82cm}{%
4918 \thu@info@item{系别}{}{\thu@department}%
4919 \thu@info@item{专业}{}{\thu@discipline}%
4920 \thu@info@item{姓名}{\thu@name@title}{\thu@author}%
4921 \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
4922 \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
4923 \thu@info@item{联合指导教师}{\thu@name@title}{\thu@co@supervisor}%
4924 }\par
4925 \endgroup
4926 \vfill
4927 \begingroup
4928 \centering
4929 \fontsize{16bp}{24bp}\selectfont
4930 \ziju{0.03}%
4931 \thu@format@date{\thu@date@zh@short}{\thu@date}\par
4932 \endgroup
4933 \vspace*{60bp}%
4934 \clearpage
4935 \restoregeometry
4936 }
4937 % \end{macrocode}
4938 %
4939 % \myentry{博士后封面}
4940 % \begin{macrocode}
4941 \newcommand\thu@cover@postdoc{%
4942 \thispagestyle{empty}%
4943 \begin{center}%
4944 \renewcommand\ULthickness{0.7pt}%
4945 \vspace*{0.35cm}%
4946 {\sihao[2.6]%
4947 \thu@stretch{3.1em}{分类号}\thu@underline[3.7cm]{\thu@clc}\hfill
4948 密级\thu@underline[3.7cm]{\thu@secret@level}\par
4949 \thu@stretch{3.1em}{U D C}\thu@underline[3.7cm]{\thu@udc}\hfill
4950 编号\thu@underline[3.7cm]{\thu@id}\par
4951 }%
4952 \vskip 3.15cm%
4953 {\sffamily\bfseries\xiaoer[2.6]%
4954 {\ziju{1.5}清华大学\par}%
4955 {\ziju{0.5}博士后研究工作报告\par}%
4956 }%
4957 \vskip 0.2cm%
4958 \parbox[t][4.0cm][c]{\textwidth}{%
4959 \centering\sihao[3.46]%
4960 \renewcommand\ULdepth{1em}%
4961 \expandafter\uline\expandafter{\thu@title}\par
4962 }\par
4963 \vskip 0.4cm%
4964 {\xiaosi\thu@author\par}%
4965 \vskip 1.4cm%
4966 {\xiaosi[1.58]%
4967 \renewcommand\ULdepth{0.9em}%
4968 工作完成日期\quad
4969 \thu@uline[5.9cm]{%
4970 \thu@format@date{\thu@date@zh@digit@short}{\thu@start@date}—%
4971 \thu@format@date{\thu@date@zh@digit@short}{\thu@end@date}%
4972 }\par
4973 \vskip 0.55cm%
4974 报告提交日期\quad
4975 \thu@uline[5.9cm]{\thu@format@date{\thu@date@zh@digit@short}{\thu@date}}\par
4976 }%
4977 \vskip 0.45cm%
4978 {\xiaosi[2]{\ziju{1}清华大学}\quad (北京)\par}%
4979 \vskip 0.25cm%
4980 {\xiaosi[2]\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}%
4981 \end{center}%
4982 }
4983 % \end{macrocode}
4984 %
4985 % \myentry{博士后题名页}
4986 % \begin{macrocode}
4987 \newcommand\thu@titlepage@postdoc{%
4988 \thispagestyle{empty}%
4989 \begin{center}%
4990 \vspace*{1.5cm}%
4991 \parbox[t][3cm][c]{\textwidth}{%
4992 \centering\sanhao[1.95]\thu@title\par
4993 }\par
4994 \vskip 0.15cm%
4995 \parbox[t][3cm][c]{\textwidth}{%
4996 \centering\sihao[1.36]\thu@title@en\par
4997 }\par
4998 \vskip 0.4cm%
4999 {\xiaosi[2.6]%
5000 \begin{tabular}{l@{\quad}l}%
5001 \renewcommand\arraystretch{1}%
5002 \thu@stretch{11em}{博士后姓名} & \thu@author \\
5003 \thu@stretch{11em}{流动站(一级学科)名称} & \thu@discipline@level@i \\
5004 \thu@stretch{11em}{专\quad{}业(二级学科)名称} & \thu@discipline@level@ii \\
5005 \end{tabular}\par
5006 }%
5007 \vskip 2.7cm%
5008 {\xiaosi[2.6]%
5009 研究工作起始时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@start@date}\par
5010 \vskip 0.1cm%
5011 研究工作期满时间\quad\thu@format@date{\thu@date@zh@digit}{\thu@end@date}\par
5012 }%
5013 \vskip 2.1cm%
5014 {\xiaosi[2.6]清华大学人事处(北京)\par}%
5015 \vskip 0.6cm%
5016 {\wuhao\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}%
5017 \end{center}%
5018 }
5019 % \end{macrocode}
5020 %
5021 % \subsubsection{答辩委员会名单}
5022 % \begin{environment}{committee}
5023 % 学位论文指导小组、公开评阅人和答辩委员会名单。
5024 % \begin{macrocode}
5025 \def\thu@committee@name{学位论文指导小组、公开评阅人和答辩委员会名单}
5026 \NewEnviron{committee}[1][]{%
5027 \ifthu@degree@graduate
5028 \cleardoublepage
5029 \let\thu@committee@file\@empty
5030 \kv@define@key{thu@committee}{name}{\let\thu@committee@name\kv@value}%
5031 \kv@define@key{thu@committee}{file}{\let\thu@committee@file\kv@value}%
5032 \kv@set@family@handler{thu@committee}{%
5033 \ifx\kv@value\relax
5034 \let\thu@committee@file\kv@key
5035 \else
5036 \kv@handled@false
5037 \fi
5038 }%
5039 \kvsetkeys{thu@committee}{#1}%
5040 \ifx\thu@committee@file\@empty
5041 \begingroup
5042 \ctexset{
5043 chapter = {
5044 format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont,
5045 afterskip = 49bp,
5046 },
5047 section = {
5048 beforeskip = 26bp,
5049 afterskip = 9.5bp,
5050 format += \centering,
5051 numbering = false,
5052 afterindent = false,
5053 },
5054 }%
5055 \thu@chapter*[]{\thu@committee@name}%
5056 \thispagestyle{empty}%
5057 \thusetup{language=chinese}%
5058 \BODY\clearpage
5059 \thu@reset@main@language
5060 \endgroup
5061 \else
5062 \thu@pdfbookmark{0}{\thu@committee@name}%
5063 \includepdf{\thu@committee@file}%
5064 \fi
5065 \fi
5066 }
5067 % \end{macrocode}
5068 % \end{environment}
5069 %
5070 % \subsubsection{授权说明}
5071 % \begin{macro}{\copyrightpage}
5072 % 授权说明
5073 % \begin{macrocode}
5074 \newcommand\copyrightpage[1][]{%
5075 \ifthu@degree@postdoc\relax\else
5076 \cleardoublepage
5077 \def\thu@@tmp{#1}%
5078 \ifx\thu@@tmp\@empty
5079 \thusetup{language=chinese}%
5080 \ifthu@degree@bachelor
5081 \thu@copyright@page@bachelor
5082 \else
5083 \thu@copyright@page@graduate
5084 \fi
5085 \clearpage
5086 \thu@reset@main@language
5087 \else
5088 \thispagestyle{empty}%
5089 \thu@pdfbookmark{0}{关于学位论文使用授权的说明}%
5090 \thu@phantomsection
5091 \kv@define@key{thu@copyright}{file}{\includepdf{\kv@value}}%
5092 \kv@set@family@handler{thu@copyright}{%
5093 \ifx\kv@value\relax
5094 \includepdf{\kv@key}%
5095 \else
5096 \kv@handled@false
5097 \fi
5098 }%
5099 \kvsetkeys{thu@copyright}{#1}%
5100 \fi
5101 \fi
5102 \thu@replace@with@error{copyrightpage}
5103 }
5104 % \end{macrocode}
5105 %
5106 % 支持扫描文件替换。
5107 % \begin{macrocode}
5108 \newcommand{\thu@authorization@frontdate}{%
5109 日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:}
5110 \newcommand\thu@copyright@page@graduate{%
5111 \begingroup
5112 \ctexset{
5113 chapter = {
5114 format = {\centering\sffamily\erhao},
5115 beforeskip = 40bp,
5116 afterskip = 36bp,
5117 },
5118 }%
5119 \thu@chapter*[]{关于学位论文使用授权的说明}%
5120 \endgroup
5121 \thispagestyle{empty}%
5122 \vskip 13bp%
5123 \begingroup
5124 \fontsize{14bp}{26bp}\selectfont
5125 本人完全了解清华大学有关保留、使用学位论文的规定,即:\par
5126 清华大学拥有在著作权法规定范围内学位论文的使用权,其中包括:%
5127 (1)\nobreak 已获学位的研究生必须按学校规定提交学位论文,%
5128 学校可以采用影印、缩印或其他复制手段保存研究生上交的学位论文;\allowbreak
5129 (2)\nobreak 为教学和科研目的,学校可以将公开的学位论文作为资料在图书馆、资料室等场所供校内师生阅读,%
5130 或在校园网上供校内师生浏览部分内容;\allowbreak
5131 \hbox{}(3)\nobreak 根据《中华人民共和国学位法》及上级教育主管部门要求,
5132 报送相应的学位论文。\par
5133 本人保证遵守上述规定。\par
5134 \endgroup
5135 \vskip 33bp%
5136 \begingroup
5137 \fontsize{12bp}{23.4bp}\selectfont
5138 \parindent\z@
5139 \leftskip 43bp%
5140 作者签名:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}%
5141 导师签名:\hspace{4bp}\thu@underline[7em]{}\par
5142 \vskip 6bp%
5143 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}%
5144 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\par
5145 \endgroup
5146 }
5147 \newcommand\thu@copyright@page@bachelor{%
5148 \begingroup
5149 \ctexset{
5150 chapter = {
5151 format = {\centering\sffamily\erhao},
5152 beforeskip = 40bp,
5153 afterskip = 37bp,
5154 },
5155 }%
5156 \thu@chapter*[]{关于论文使用授权的说明}%
5157 \endgroup
5158 \thispagestyle{empty}%
5159 \vspace*{13bp}%
5160 \begingroup
5161 \fontsize{14bp}{26bp}\selectfont
5162 本人完全了解清华大学有关保留、使用综合论文训练论文的规定,即:%
5163 学校有权保留论文的复印件,允许论文被查阅和借阅;%
5164 学校可以公布论文的全部或部分内容,可以采用影印、缩印或其他复制手段保存论文。\par
5165 \endgroup
5166 \vspace{71bp}%
5167 \begingroup
5168 \setlength{\parindent}{0pt}%
5169 \fontsize{12bp}{18bp}\selectfont
5170 \hspace*{42bp}作者签名:\hspace{118bp}导师签名:\par
5171 \vspace{11bp}%
5172 \hspace*{42bp}日\hspace{2em}期:\hspace{118bp}日\hspace{2em}期:\par
5173 \endgroup
5174 }
5175 % \end{macrocode}
5176 % \end{macro}
5177 %
5178 % \subsubsection{摘要}
5179 % \label{sec:abstractformat}
5180 %
5181 % \begin{macro}{\thu@clist@use}
5182 % 不同论文格式关键词之间的分割不太相同,我们用 \option{keywords} 和
5183 % \option{keywords*} 来收集关键词列表,然后用本命令来生成符合要求的格式,
5184 % 类似于 \LaTeX3 的 \cs{clist\_use:Nn}。
5185 % \begin{macrocode}
5186 \thu@define@key{
5187 keywords,
5188 keywords* = {
5189 name = keywords@en,
5190 },
5191 }
5192 \newcommand\thu@clist@use[2]{%
5193 \def\thu@@tmp{}%
5194 \def\thu@clist@processor##1{%
5195 \ifx\thu@@tmp\@empty
5196 \def\thu@@tmp{#2}%
5197 \else
5198 #2%
5199 \fi
5200 ##1%
5201 }%
5202 \expandafter\comma@parse\expandafter{#1}{\thu@clist@processor}%
5203 }
5204 % \end{macrocode}
5205 % \end{macro}
5206 %
5207 % \begin{environment}{abstract}
5208 % 中文摘要部分的标题为“\textbf{摘要}”,用黑体三号字。
5209 % 摘要内容用小四号字书写,两端对齐,汉字用宋体,外文字用 Times New Roman 体,
5210 % 标点符号一律用中文输入状态下的标点符号。
5211 % \begin{macrocode}
5212 \newenvironment{abstract}{%
5213 \thusetup{language = chinese}%
5214 \ifthu@degree@graduate
5215 \begingroup
5216 \ifthu@main@language@english
5217 \ctexset{%
5218 chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont,
5219 }%
5220 \fi
5221 \thu@chapter*{\thu@abstract@name}%
5222 \endgroup
5223 \else
5224 \thu@chapter*[]{\thu@abstract@name}%
5225 \fi
5226 }{%
5227 \par
5228 \null\par
5229 \ifthu@degree@postdoc
5230 \textbf{关键词:}%
5231 \else
5232 \noindent
5233 \textsf{关键词:}%
5234 \fi
5235 \thu@clist@use{\thu@keywords}{;}\par
5236 \gdef\thu@keywords{}%
5237 \thu@reset@main@language % switch back to main language
5238 }
5239 % \end{macrocode}
5240 % \end{environment}
5241 %
5242 % \begin{environment}{abstract*}
5243 % 英文摘要部分的标题为 \textbf{Abstract},用 Arial 体三号字。
5244 % 摘要内容用小四号 Times New Roman。
5245 % \begin{macrocode}
5246 \newenvironment{abstract*}{%
5247 \thusetup{language = english}%
5248 \ifthu@degree@bachelor
5249 \begingroup
5250 \ctexset{chapter/afterskip = 30bp}%
5251 \thu@chapter*[]{\thu@abstract@name@en}%
5252 \endgroup
5253 \else
5254 \ifthu@degree@graduate
5255 \thu@chapter*{\thu@abstract@name@en}%
5256 \else
5257 \thu@chapter*[]{\thu@abstract@name@en}%
5258 \fi
5259 \fi
5260 }{%
5261 \par
5262 \null\par
5263 \ifthu@degree@postdoc\else
5264 \noindent
5265 \fi
5266 \textbf{Keywords:} \thu@clist@use{\thu@keywords@en}{; }\par
5267 \thu@reset@main@language % switch back to main language
5268 }
5269 % \end{macrocode}
5270 % \end{environment}
5271 %
5272 % \subsubsection{符号和缩略语说明}
5273 % \label{sec:denotationfmt}
5274 % \begin{environment}{denotation}
5275 % 符号和缩略语说明。
5276 % \begin{macrocode}
5277 \newenvironment{denotation}[1][2.5cm]{%
5278 \ifthu@degree@bachelor
5279 \ifthu@main@language@chinese
5280 \thu@chapter*[]{\thu@denotation@name}%
5281 \else
5282 \thu@chapter*{\thu@denotation@name}%
5283 \fi
5284 \else
5285 \ifthu@degree@graduate
5286 \thu@chapter*{\thu@denotation@name}%
5287 \else
5288 \thu@chapter*[]{\thu@denotation@name}%
5289 \fi
5290 \fi
5291 \begin{thu@denotation}[labelwidth=#1]%
5292 }{%
5293 \end{thu@denotation}%
5294 }
5295 \newlist{thu@denotation}{description}{1}
5296 \setlist[thu@denotation]{%
5297 nosep,
5298 font=\normalfont,
5299 align=left,
5300 leftmargin=!, % sum of the following 3 lengths
5301 labelindent=0pt,
5302 labelwidth=2.5cm,
5303 labelsep*=0.5cm,
5304 itemindent=0pt,
5305 }
5306 % \end{macrocode}
5307 % \end{environment}
5308 %
5309 %
5310 % \subsubsection{致谢以及声明}
5311 % \label{sec:ackanddeclare}
5312 %
5313 % \begin{environment}{acknowledgements}
5314 % 定义致谢环境
5315 % \begin{macrocode}
5316 \newcommand{\thu@statement@text@bachelor}{%
5317 本人郑重声明:所呈交的综合论文训练论文,是本人在导师指导下,独立进行研究工作所取得的成果。%
5318 尽我所知,除文中已经注明引用的内容外,本论文的研究成果不包含任何他人享有著作权的内容。%
5319 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。%
5320 }
5321 \newcommand{\thu@statement@text@graduate}{%
5322 本人郑重声明:所呈交的学位论文,是本人在导师指导下,独立进行研究工作所取得的成果%
5323 \ifx\thu@secret@level\@empty
5324 ,不包含涉及国家秘密的内容%
5325 \fi%
5326 。尽我所知,除文中已经注明引用的内容外,本学位论文的研究成果不包含任何他人享有著作权的内容。%
5327 对本论文所涉及的研究工作做出贡献的其他个人和集体,均已在文中以明确方式标明。%
5328 }
5329 \newcommand{\thu@signature}{签\hspace{1em}名:}
5330 \newcommand{\thu@backdate}{日\hspace{1em}期:}
5331 % \end{macrocode}
5332 %
5333 % 定义致谢与声明环境。
5334 % \begin{macrocode}
5335 \newenvironment{acknowledgements}{%
5336 \@mainmatterfalse
5337 \thu@end@appendix@ref@section
5338 \thu@chapter*{\thu@acknowledgements@name}%
5339 }{%
5340 }
5341 % \end{macrocode}
5342 % \end{environment}
5343 %
5344 % \begin{macro}{statement}
5345 % 声明页面样式和插入声明页(支持扫描文件替换)。
5346 % \begin{macrocode}
5347 \thu@define@key{
5348 statement-page-style = {
5349 name = statement@page@style,
5350 choices = {
5351 plain,
5352 empty,
5353 },
5354 default = plain,
5355 }
5356 }
5357 \newcommand\statement[1][]{%
5358 \@mainmatterfalse
5359 \thu@end@appendix@ref@section
5360 \let\thu@statement@file\@empty
5361 \kv@define@key{thu@statement}{page-style}{\thusetup{statement-page-style=##1}}%
5362 \kv@define@key{thu@statement}{file}{\let\thu@statement@file\kv@value}%
5363 \kv@set@family@handler{thu@statement}{%
5364 \ifx\kv@value\relax
5365 \let\thu@statement@file\kv@key
5366 \else
5367 \kv@handled@false
5368 \fi
5369 }%
5370 \kvsetkeys{thu@statement}{#1}%
5371 \ifx\thu@statement@file\@empty
5372 \thusetup{language=chinese}%
5373 \begingroup
5374 \ifthu@degree@graduate
5375 \ifthu@main@language@english
5376 \ctexset{%
5377 chapter/format = \centering\sffamily\fontsize{16bp}{20bp}\selectfont,
5378 }%
5379 \fi
5380 \fi
5381 \thu@chapter*{\thu@statement@name}%
5382 \endgroup
5383 \thispagestyle{\thu@statement@page@style}%
5384 \ifthu@degree@graduate
5385 \vspace{13bp}%
5386 \fontsize{12bp}{21bp}\selectfont
5387 \begingroup
5388 \renewcommand\CJKglue{\hspace{.15bp plus .1bp}}%
5389 \thu@statement@text@graduate\par
5390 \endgroup
5391 \vspace{78.5bp}%
5392 \begingroup
5393 \noindent\hspace{153.5bp}\fontsize{13bp}{18bp}\selectfont
5394 \thu@signature\thu@underline[76bp]{}\hspace{-3bp}%
5395 \thu@backdate\thu@underline[65bp]{}\par
5396 \endgroup
5397 \else
5398 \ifthu@degree@bachelor
5399 \begingroup
5400 \renewcommand\CJKglue{\hspace{.1bp}}%
5401 \thu@statement@text@bachelor\par
5402 \endgroup
5403 \vspace{40bp}%
5404 \hfill 签\hspace{.5em}名:\thu@underline[2.75cm]{}\hspace{.5em}%
5405 日\hspace{.5em}期:\thu@underline[2.75cm]{}\par
5406 \fi
5407 \fi
5408 \thu@reset@main@language
5409 \else
5410 \includepdf[pagecommand={%
5411 \markboth{\thu@statement@name}{}%
5412 \thu@phantomsection
5413 \addcontentsline{toc}{chapter}{\thu@statement@name}%
5414 \thispagestyle{\thu@statement@page@style}%
5415 }]{\thu@statement@file}%
5416 \fi
5417 \thu@replace@with@error{statement}
5418 }
5419 % \end{macrocode}
5420 % \end{macro}
5421 %
5422 % 兼容旧版本保留 \env{acknowledgement}。
5423 % \begin{macrocode}
5424 \let\acknowledgement\acknowledgements
5425 \let\endacknowledgement\endacknowledgements
5426 % \end{macrocode}
5427 %
5428 % \subsubsection{插图和附表清单}
5429 % \label{sec:threelists}
5430 % 定义图表以及公式目录样式。
5431 % \begin{macrocode}
5432 \def\thu@listof#1{% #1: float type
5433 \setcounter{tocdepth}{2}% restore tocdepth in case being modified
5434 \@ifstar{\thu@deprecate{starred form of \protect\listof... command}{}}{}%
5435 \ifthu@degree@bachelor
5436 \ifthu@main@language@chinese
5437 \thu@chapter*[]{\csname list#1name\endcsname}%
5438 \else
5439 \thu@chapter*{\csname list#1name\endcsname}%
5440 \fi
5441 \else
5442 \ifthu@degree@graduate
5443 \thu@chapter*{\csname list#1name\endcsname}%
5444 \else
5445 \thu@chapter*[]{\csname list#1name\endcsname}%
5446 \fi
5447 \fi
5448 \@starttoc{\csname ext@#1\endcsname}%
5449 }
5450 % \end{macrocode}
5451 %
5452 % \begin{macro}{\listoffigures}
5453 % 插图清单。
5454 % \begin{macrocode}
5455 \renewcommand\listoffigures{%
5456 \thu@listof{figure}%
5457 }
5458 \titlecontents{figure}
5459 [\z@]{}
5460 {\contentspush{\figurename~\thecontentslabel\thu@contents@label@delimiter}}{}
5461 {\thu@leaders\thecontentspage}
5462 % \end{macrocode}
5463 % \end{macro}
5464 %
5465 % \begin{macro}{\listoftables}
5466 % 附表清单。
5467 % \begin{macrocode}
5468 \renewcommand\listoftables{%
5469 \thu@listof{table}%
5470 }
5471 \titlecontents{table}
5472 [\z@]{}
5473 {\contentspush{\tablename~\thecontentslabel\thu@contents@label@delimiter}}{}
5474 {\thu@leaders\thecontentspage}
5475 % \end{macrocode}
5476 % \end{macro}
5477 %
5478 % \begin{macro}{\listoffiguresandtables}
5479 % 将插图和附表合在一起列出“插图和附表清单”。
5480 % \begin{macrocode}
5481 \newcommand\listoffiguresandtables{%
5482 \ifthu@degree@bachelor
5483 \ifthu@main@language@chinese
5484 \thu@chapter*[]{\thu@list@figure@table@name}%
5485 \else
5486 \thu@chapter*{\thu@list@figure@table@name}%
5487 \fi
5488 \else
5489 \ifthu@degree@graduate
5490 \thu@chapter*{\thu@list@figure@table@name}%
5491 \else
5492 \thu@chapter*[]{\thu@list@figure@table@name}%
5493 \fi
5494 \fi
5495 \@starttoc{lof}%
5496 \par
5497 \null\par
5498 \@starttoc{lot}%
5499 }
5500 % \end{macrocode}
5501 % \end{macro}
5502 %
5503 % 公式的 caption 已过时。
5504 % \begin{macrocode}
5505 \def\ext@equation{loe}
5506 \def\equcaption#1{%
5507 \thu@deprecate{"\protect\equcaption" command}{}%
5508 \addcontentsline{\ext@equation}{equation}%
5509 {\protect\numberline{#1}}}
5510 % \end{macrocode}
5511 %
5512 % 公式索引 \cs{listofequations} 已过时。
5513 % \begin{macrocode}
5514 \newcommand\listofequations{%
5515 \thu@deprecate{"\protect\listofequations" command}{}%
5516 \thu@listof{equation}%
5517 }
5518 \titlecontents{equation}
5519 [0pt]{\addvspace{6bp}}
5520 {\contentspush{\thu@equation@name~\thecontentslabel\thu@contents@label@delimiter}}{}
5521 {\thu@leaders\thecontentspage}
5522 \contentsuse{equation}{loe}
5523 % \end{macrocode}
5524 %
5525 %
5526 % \subsection{参考文献}
5527 % \label{sec:ref}
5528 %
5529 % 参考文献的格式根据用户选择的 \BibTeX{}/BibLaTeX 分别进行配置,
5530 % 所以使用 \pkg{filehook} 的方式。
5531 %
5532 % 设置 \option{cite-style} 的接口,只对 \BibTeX{} 的编译方式有效。
5533 % \begin{macrocode}
5534 \thu@define@key{
5535 cite-style = {
5536 name = cite@style,
5537 choices = {
5538 super,
5539 inline,
5540 author-year,
5541 }
5542 }
5543 }
5544 \newcommand\thu@bib@heading[1]{\thu@chapter*{#1}}
5545 % \end{macrocode}
5546 %
5547 % \subsubsection{BibTeX + \pkg{natbib} 宏包}
5548 %
5549 % \begin{macrocode}
5550 \def\bibliographystyle#1{%
5551 \gdef\bu@bibstyle{#1}%
5552 \ifx\@begindocumenthook\@undefined\else
5553 \expandafter\AtBeginDocument
5554 \fi
5555 {\if@filesw
5556 \immediate\write\@auxout{\string\bibstyle{#1}}%
5557 \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}%
5558 \fi}%
5559 }
5560 \def\bibliography#1{%
5561 \if@filesw
5562 \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}%
5563 \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}%
5564 \fi
5565 \gdef\bu@bibdata{#1}%
5566 \@input@{\jobname.bbl}}
5567 % \end{macrocode}
5568 %
5569 % \BibTeX{} 和 \pkg{natbib} 宏包的配置。
5570 % \begin{macrocode}
5571 \PassOptionsToPackage{compress}{natbib}
5572 \AtEndOfPackageFile*{natbib}{
5573 % \end{macrocode}
5574 % \begin{macro}{\inlinecite}
5575 % 依赖于 \pkg{natbib} 宏包,修改其中的命令。 旧命令 \cs{onlinecite} 依然可用。
5576 % \begin{macrocode}
5577 \DeclareRobustCommand\inlinecite{\@inlinecite}
5578 \def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup}
5579 \let\onlinecite\inlinecite
5580 % \end{macrocode}
5581 % \end{macro}
5582 %
5583 % 几种种引用样式,与 \file{bst} 文件名保持一致,
5584 % 这样在使用 \cs{bibliographystyle} 选择参考文献表的样式时也会设置对应的引用样式。
5585 % \begin{macrocode}
5586 \newcommand\bibstyle@super{%
5587 \bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}}
5588 \newcommand\bibstyle@inline{%
5589 \bibpunct{[}{]}{,}{n}{,}{,}}
5590 \@namedef{bibstyle@author-year}{%
5591 \bibpunct{(}{)}{;}{a}{,}{,}}
5592 % \end{macrocode}
5593 %
5594 % \begin{macrocode}
5595 \thu@option@hook{cite-style}{\@nameuse{bibstyle@\thu@cite@style}}
5596 % \end{macrocode}
5597 %
5598 % 几种种引用样式,与 \file{bst} 文件名保持一致,
5599 % 这样在使用 \cs{bibliographystyle} 选择参考文献表的样式时也会设置对应的引用样式。
5600 % \begin{macrocode}
5601 \@namedef{bibstyle@thuthesis-numeric}{\citestyle{super}}
5602 \@namedef{bibstyle@thuthesis-author-year}{\citestyle{author-year}}
5603 \@namedef{bibstyle@cell}{\citestyle{author-year}}
5604 \@namedef{bibstyle@thuthesis-bachelor}{\citestyle{super}}
5605 % \end{macrocode}
5606 %
5607 % 修改引用的样式。
5608 % 这里在 filehook 中无法使用 \cs{patchcmd},所以只能手动重定义。
5609 %
5610 % 将 \cs{citep} super 式引用的页码改为上标。
5611 % \begin{macrocode}
5612 \renewcommand\NAT@citesuper[3]{%
5613 \ifNAT@swa
5614 \if*#2*\else
5615 #2\NAT@spacechar
5616 \fi
5617 % \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%
5618 % \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup}
5619 \unskip\kern\p@
5620 \textsuperscript{%
5621 \NAT@@open#1\NAT@@close
5622 \if*#3*\else#3\fi
5623 }%
5624 \kern\p@
5625 \else
5626 #1%
5627 \fi
5628 \endgroup
5629 }
5630 % \end{macrocode}
5631 %
5632 % 将 \cs{citep} numbers 式引用的页码改为上标并置于括号外。
5633 % \begin{macrocode}
5634 \renewcommand\NAT@citenum[3]{%
5635 \ifNAT@swa
5636 \NAT@@open
5637 \if*#2*\else
5638 #2\NAT@spacechar
5639 \fi
5640 % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close
5641 #1\NAT@@close
5642 \if*#3*\else
5643 \textsuperscript{#3}%
5644 \fi
5645 \else
5646 #1%
5647 \fi
5648 \endgroup
5649 }
5650 % \end{macrocode}
5651 %
5652 % 修改 \cs{citet} 引用的样式。
5653 % \begin{macrocode}
5654 \def\NAT@citexnum[#1][#2]#3{%
5655 \NAT@reset@parser
5656 \NAT@sort@cites{#3}%
5657 \NAT@reset@citea
5658 \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
5659 \@for\@citeb:=\NAT@cite@list\do
5660 {\@safe@activestrue
5661 \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
5662 \@safe@activesfalse
5663 \@ifundefined{b@\@citeb\@extra@b@citeb}{%
5664 {\reset@font\bfseries?}
5665 \NAT@citeundefined\PackageWarning{natbib}%
5666 {Citation `\@citeb' on page \thepage \space undefined}}%
5667 {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
5668 \NAT@parse{\@citeb}%
5669 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
5670 \let\NAT@name=\NAT@all@names
5671 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
5672 \fi
5673 \ifNAT@full\let\NAT@nm\NAT@all@names\else
5674 \let\NAT@nm\NAT@name\fi
5675 \ifNAT@swa
5676 \@ifnum{\NAT@ctype>\@ne}{%
5677 \@citea
5678 \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}%
5679 }{%
5680 \@ifnum{\NAT@cmprs>\z@}{%
5681 \NAT@ifcat@num\NAT@num
5682 {\let\NAT@nm=\NAT@num}%
5683 {\def\NAT@nm{-2}}%
5684 \NAT@ifcat@num\NAT@last@num
5685 {\@tempcnta=\NAT@last@num\relax}%
5686 {\@tempcnta\m@ne}%
5687 \@ifnum{\NAT@nm=\@tempcnta}{%
5688 \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%
5689 }{%
5690 \advance\@tempcnta by\@ne
5691 \@ifnum{\NAT@nm=\@tempcnta}{%
5692 % \end{macrocode}
5693 %
5694 % 在顺序编码制下,\pkg{natbib} 只有在三个以上连续文献引用才会使用连接号,
5695 % 本科生的示例仅将连接号改为短横线。
5696 % 研究生与国标一致,连续两个序号也使用连接号,
5697 % 参考 \url{https://tex.stackexchange.com/a/86991/82731}。
5698 % \begin{macrocode}
5699 % \ifx\NAT@last@yr\relax
5700 % \def@NAT@last@yr{\@citea}%
5701 % \else
5702 % \def@NAT@last@yr{--\NAT@penalty}%
5703 % \fi
5704 \ifthu@degree@bachelor
5705 \ifx\NAT@last@yr\relax
5706 \def@NAT@last@yr{\@citea}%
5707 \else
5708 \def@NAT@last@yr{-\NAT@penalty}%
5709 \fi
5710 \else
5711 \def@NAT@last@yr{-\NAT@penalty}%
5712 \fi
5713 }{%
5714 \NAT@last@yr@mbox
5715 }%
5716 }%
5717 }{%
5718 \@tempswatrue
5719 \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}%
5720 \if@tempswa\NAT@citea@mbox\fi
5721 }%
5722 }%
5723 \NAT@def@citea
5724 \else
5725 \ifcase\NAT@ctype
5726 \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else
5727 \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}%
5728 \fi
5729 \if*#1*\else#1\NAT@spacechar\fi
5730 \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
5731 \NAT@def@citea@box
5732 \or
5733 \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
5734 \or
5735 \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
5736 \or
5737 \NAT@hyper@citea@space\NAT@alias
5738 \fi
5739 \fi
5740 }%
5741 }%
5742 \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}%
5743 \ifNAT@swa\else
5744 % \end{macrocode}
5745 %
5746 % 将页码放在括号外边,并且置于上标。
5747 % \begin{macrocode}
5748 % \@ifnum{\NAT@ctype=\z@}{%
5749 % \if*#2*\else\NAT@cmt#2\fi
5750 % }{}%
5751 \NAT@mbox{\NAT@@close}%
5752 \@ifnum{\NAT@ctype=\z@}{%
5753 \if*#2*\else
5754 \textsuperscript{#2}%
5755 \fi
5756 }{}%
5757 \NAT@super@kern
5758 \fi
5759 }{#1}{#2}%
5760 }%
5761 % \end{macrocode}
5762 %
5763 % 修改 \cs{citep} author-year 式的页码:
5764 % \begin{macrocode}
5765 \renewcommand\NAT@cite%
5766 [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
5767 % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
5768 #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup}
5769 % \end{macrocode}
5770 %
5771 % 修改 \cs{citet} author-year 式的页码:
5772 % \begin{macrocode}
5773 \def\NAT@citex%
5774 [#1][#2]#3{%
5775 \NAT@reset@parser
5776 \NAT@sort@cites{#3}%
5777 \NAT@reset@citea
5778 \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
5779 \@for\@citeb:=\NAT@cite@list\do
5780 {\@safe@activestrue
5781 \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
5782 \@safe@activesfalse
5783 \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
5784 {\reset@font\bfseries ?}\NAT@citeundefined
5785 \PackageWarning{natbib}%
5786 {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
5787 {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
5788 \NAT@parse{\@citeb}%
5789 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
5790 \let\NAT@name=\NAT@all@names
5791 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
5792 \fi
5793 \ifNAT@full\let\NAT@nm\NAT@all@names\else
5794 \let\NAT@nm\NAT@name\fi
5795 \ifNAT@swa\ifcase\NAT@ctype
5796 \if\relax\NAT@date\relax
5797 \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%
5798 \else
5799 \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
5800 \ifx\NAT@last@yr\NAT@year
5801 \def\NAT@temp{{?}}%
5802 \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
5803 {Multiple citation on page \thepage: same authors and
5804 year\MessageBreak without distinguishing extra
5805 letter,\MessageBreak appears as question mark}\fi
5806 \NAT@hyper@{\NAT@exlab}%
5807 \else\unskip\NAT@spacechar
5808 \NAT@hyper@{\NAT@date}%
5809 \fi
5810 \else
5811 \@citea\NAT@hyper@{%
5812 \NAT@nmfmt{\NAT@nm}%
5813 \hyper@natlinkbreak{%
5814 \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb
5815 }%
5816 \NAT@date
5817 }%
5818 \fi
5819 \fi
5820 \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
5821 \or\@citea\NAT@hyper@{\NAT@date}%
5822 \or\@citea\NAT@hyper@{\NAT@alias}%
5823 \fi \NAT@def@citea
5824 \else
5825 \ifcase\NAT@ctype
5826 \if\relax\NAT@date\relax
5827 \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
5828 \else
5829 \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
5830 \ifx\NAT@last@yr\NAT@year
5831 \def\NAT@temp{{?}}%
5832 \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
5833 {Multiple citation on page \thepage: same authors and
5834 year\MessageBreak without distinguishing extra
5835 letter,\MessageBreak appears as question mark}\fi
5836 \NAT@hyper@{\NAT@exlab}%
5837 \else
5838 \unskip\NAT@spacechar
5839 \NAT@hyper@{\NAT@date}%
5840 \fi
5841 \else
5842 \@citea\NAT@hyper@{%
5843 \NAT@nmfmt{\NAT@nm}%
5844 \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
5845 {\@citeb\@extra@b@citeb}%
5846 \NAT@date
5847 }%
5848 \fi
5849 \fi
5850 \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
5851 \or\@citea\NAT@hyper@{\NAT@date}%
5852 \or\@citea\NAT@hyper@{\NAT@alias}%
5853 \fi
5854 \if\relax\NAT@date\relax
5855 \NAT@def@citea
5856 \else
5857 \NAT@def@citea@close
5858 \fi
5859 \fi
5860 }}\ifNAT@swa\else
5861 % \end{macrocode}
5862 %
5863 % 将页码放在括号外边,并且置于上标。
5864 % \begin{macrocode}
5865 % \if*#2*\else\NAT@cmt#2\fi
5866 \if\relax\NAT@date\relax\else\NAT@@close\fi
5867 \if*#2*\else\textsuperscript{#2}\fi
5868 \fi}{#1}{#2}}
5869 % \end{macrocode}
5870 %
5871 % 参考文献表的正文部分用五号字。
5872 % 行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。
5873 %
5874 % 本科生要求用五号字,行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。
5875 % 采用悬挂格式,悬挂缩进 2 个汉字符或 1 厘米。
5876 %
5877 % 英文专业要求字号 10.5pt,行距用固定值 17pt,段前后 3pt,悬挂缩进 0.5inch(1.27 厘米)。
5878 %
5879 % 复用 \pkg{natbib} 的 \texttt{thebibliography} 环境,调整距离。
5880 % \begin{macrocode}
5881 \renewcommand\bibsection{\thu@bib@heading{\bibname}}
5882 \newcommand\thu@set@bibliography@format{%
5883 \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}%
5884 \setlength{\bibsep}{3bp \@plus 3bp \@minus 3bp}%
5885 \ifthu@degree@bachelor
5886 \ifthu@main@language@chinese
5887 \setlength{\bibhang}{21bp}% 2em
5888 \else
5889 \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}%
5890 \setlength{\bibsep}{6bp \@plus 3bp \@minus 3bp}%
5891 \setlength{\bibhang}{0.5in}%
5892 \fi
5893 \else
5894 \setlength{\bibhang}{21bp}% 2em
5895 \fi
5896 }
5897 \thu@set@bibliography@format
5898 \thu@option@hook{degree}{\thu@set@bibliography@format}
5899 \thu@option@hook{main-language}{\thu@set@bibliography@format}
5900 % \end{macrocode}
5901 %
5902 % 研究生要求每一条文献的内容要尽量写在同一页内。
5903 % 遇有被迫分页的情况,可通过“留白”或微调本页行距的方式尽量将同一条文献内容放在一页。
5904 % 所以上述 \cs{bibsep} 的设置允许 3pt 的伸缩,
5905 % 同时增加同一条文献内分页的惩罚,
5906 % 这里参考 \href{https://github.com/plk/biblatex/blob/e5d6e69e61613cc33ab1fcc2083a8277eb9cfce5/tex/latex/biblatex/biblatex.def}{BibLaTeX 的设置}。
5907 % \begin{macrocode}
5908 \patchcmd\thebibliography{%
5909 \clubpenalty4000%
5910 }{%
5911 \interlinepenalty=5000\relax
5912 \clubpenalty=10000\relax
5913 }{}{\thu@patch@error{\thebibliography}}
5914 \patchcmd\thebibliography{%
5915 \widowpenalty4000%
5916 }{%
5917 \widowpenalty=10000\relax
5918 }{}{\thu@patch@error{\thebibliography}}
5919 % \end{macrocode}
5920 %
5921 % 参考文献表的编号居左,宽度 1 cm。
5922 % \begin{macrocode}
5923 \def\@biblabel#1{[#1]\hfill}
5924 \renewcommand\NAT@bibsetnum[1]{%
5925 % \settowidth\labelwidth{\@biblabel{#1}}%
5926 % \setlength{\leftmargin}{\labelwidth}%
5927 % \addtolength{\leftmargin}{\labelsep}%
5928 \setlength{\labelwidth}{1cm}%
5929 \setlength{\leftmargin}{\labelwidth}%
5930 \setlength{\labelsep}{\z@}%
5931 \setlength{\itemsep}{\bibsep}%
5932 \setlength{\parsep}{\z@}%
5933 \ifNAT@openbib
5934 \addtolength{\leftmargin}{\bibindent}%
5935 \setlength{\itemindent}{-\bibindent}%
5936 \setlength{\listparindent}{\itemindent}%
5937 \setlength{\parsep}{0pt}%
5938 \fi
5939 }
5940 }
5941 % \end{macrocode}
5942 %
5943 % \subsubsection{\pkg{biblatex} 宏包}
5944 %
5945 % \begin{macrocode}
5946 \AtEndOfPackageFile*{biblatex}{
5947 \AtBeginDocument{
5948 \ifthenelse{\equal{\blx@bbxfile}{apa}}{\def\bibname{REFERENCES}}{}
5949 \ifthenelse{\equal{\blx@bbxfile}{apa6}}{\def\bibname{REFERENCES}}{}
5950 \ifthenelse{\equal{\blx@bbxfile}{mla}}{\def\bibname{WORKS CITED}}{}
5951 \ifthenelse{\equal{\blx@bbxfile}{mla-new}}{\def\bibname{WORKS CITED}}{}
5952 }
5953 \DeclareRobustCommand\inlinecite{\parencite}
5954 \defbibheading{bibliography}[\bibname]{\thu@bib@heading{#1}}
5955 \newcommand\thu@set@bibliography@format{%
5956 \renewcommand\bibfont{\fontsize{10.5bp}{16bp}\selectfont}%
5957 \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}%
5958 % 在 .bbx 中设置 \labelwidth 为 1 cm,\labelsep 为 0 pt。
5959 \setlength{\biblabelsep}{0pt}%
5960 \ifthu@degree@bachelor
5961 \ifthu@main@language@chinese
5962 \setlength{\bibhang}{21bp}% 2em
5963 \else
5964 \renewcommand\bibfont{\fontsize{10.5bp}{17bp}\selectfont}%
5965 \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}%
5966 \setlength{\bibhang}{0.5in}%
5967 \fi
5968 \else
5969 \setlength{\bibhang}{21bp}% 2em
5970 \fi
5971 }
5972 \thu@set@bibliography@format
5973 \thu@option@hook{degree}{\thu@set@bibliography@format}
5974 \thu@option@hook{main-language}{\thu@set@bibliography@format}
5975 }
5976 % \end{macrocode}
5977 %
5978 % \subsubsection{\pkg{apacite} 宏包}
5979 %
5980 % \pkg{apacite} 在 \cs{begindocument} 处载入的 \file{english.apc}
5981 % 会覆盖掉 \cs{bibname} 的定义,所以需要重新 \cs{thu@set@chapter@names}。
5982 % \begin{macrocode}
5983 \AtEndOfPackageFile*{apacite}{
5984 \AtBeginDocument{
5985 \thu@set@chapter@names
5986 }
5987 \renewcommand\bibliographytypesize{\fontsize{10.5bp}{16bp}\selectfont}
5988 \setlength{\bibitemsep}{3bp \@plus 3bp \@minus 3bp}%
5989 \ifthu@degree@bachelor
5990 \ifthu@main@language@english
5991 \renewcommand\bibliographytypesize{\fontsize{10.5bp}{17bp}\selectfont}%
5992 \setlength{\bibitemsep}{6bp \@plus 3bp \@minus 3bp}%
5993 \fi
5994 \fi
5995 \ifthu@main@language@chinese
5996 \setlength{\bibleftmargin}{1cm}
5997 \setlength{\bibindent}{-\bibleftmargin}
5998 \else
5999 \setlength{\bibleftmargin}{0.5in}
6000 \setlength{\bibindent}{-\bibleftmargin}
6001 \fi
6002 \def\st@rtbibchapter{%
6003 \if@numberedbib%
6004 \chapter{\bibname}% e.g., 6. References
6005 \else%
6006 \thu@chapter*{\bibname}% e.g., References
6007 \fi%
6008 }%
6009 }
6010 % \end{macrocode}
6011 %
6012 % \subsection{附录}
6013 % \label{sec:appendix}
6014 %
6015 % \begin{macrocode}
6016 \g@addto@macro\appendix{%
6017 \@mainmattertrue
6018 }
6019 % \end{macrocode}
6020 %
6021 % 研究生和本科生的写作指南均未规定附录的节标题是否加入目录,
6022 % 但是从示例来看,目录中只出现附录的 chapter 标题,
6023 % 不出现附录中的 section 及 subsection 的标题。
6024 % 部分院系(例如自动化系)的格式审查的老师甚至一致口头如此要求。
6025 % (\href{https://github.com/tuna/thuthesis/pull/425}{\#425})
6026 % \begin{macrocode}
6027 \thu@define@key{
6028 toc-depth = {
6029 name = toc@depth,
6030 },
6031 }
6032 % \end{macrocode}
6033 %
6034 % 这里不要使用 \cs{addcontentsline},
6035 % 避免写入 \pkg{titletoc} 的 \file{.ptc} 文件中,
6036 % 造成附录的子目录中 |tocdepth| 为 0。
6037 % \begin{macrocode}
6038 \thu@option@hook{toc-depth}{%
6039 \ifx\@begindocumenthook\@undefined
6040 \protected@write\@auxout{}{%
6041 \string\ttl@writefile{toc}{%
6042 \protect\setcounter{tocdepth}{\thu@toc@depth}%
6043 }%
6044 }%
6045 \else
6046 \setcounter{tocdepth}{\thu@toc@depth}%
6047 \fi
6048 }
6049 \g@addto@macro\appendix{%
6050 \thusetup{
6051 toc-depth = 0,
6052 }%
6053 }
6054 % \end{macrocode}
6055 %
6056 % 附录中的图、表不列入插图清单/附表清单。
6057 % \begin{macrocode}
6058 \thu@define@key{
6059 appendix-figure-in-lof = {
6060 name = appendix@figure@in@lof,
6061 choices = {
6062 true,
6063 false,
6064 },
6065 default = false,
6066 },
6067 }
6068 \thu@option@hook{appendix-figure-in-lof}{%
6069 \ifthu@appendix@figure@in@lof@true
6070 \addtocontents{lof}{\string\let\string\contentsline\string\ttl@contentsline}%
6071 \addtocontents{lot}{\string\let\string\contentsline\string\ttl@contentsline}%
6072 \addtocontents{loe}{\string\let\string\contentsline\string\ttl@contentsline}%
6073 \else
6074 \addtocontents{lof}{\string\let\string\contentsline\string\ttl@gobblecontents}%
6075 \addtocontents{lot}{\string\let\string\contentsline\string\ttl@gobblecontents}%
6076 \addtocontents{loe}{\string\let\string\contentsline\string\ttl@gobblecontents}%
6077 \fi
6078 }
6079 \g@addto@macro\appendix{%
6080 \thusetup{
6081 appendix-figure-in-lof = false,
6082 }%
6083 }
6084 % \end{macrocode}
6085 %
6086 % 附录中的参考文献等另行编序号。
6087 % \begin{macrocode}
6088 \newcommand\thu@appendix@bib@heading[1]{%
6089 \begingroup
6090 \ctexset{section/numbering = false}%
6091 \ifthu@degree@bachelor
6092 \ctexset{section = {
6093 format = \centering\fontsize{12bp}{14.4bp}\selectfont,
6094 beforeskip = 66bp,
6095 afterskip = 4bp,
6096 }}%
6097 \fi
6098 \section{#1}%
6099 \endgroup
6100 }
6101 \g@addto@macro\appendix{%
6102 \let\thu@bib@heading\thu@appendix@bib@heading
6103 }
6104 \newcommand\thu@end@appendix@ref@section{}
6105 % \end{macrocode}
6106 %
6107 % \pkg{bibunits} 在载入时会保存 \cs{bibliography} 和 \cs{bibliographystyle},
6108 % 所以在载入宏包前修改定义。
6109 % \begin{macrocode}
6110 \AtBeginOfPackageFile*{bibunits}{
6111 \def\bibliography#1{%
6112 \if@filesw
6113 \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}%
6114 % \end{macrocode}
6115 %
6116 % 正文的 \cs{bibliography} 同时设置附录参考文献的默认 \file{.bib} 数据库。
6117 % \begin{macrocode}
6118 \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}%
6119 \fi
6120 \@input@{\jobname.bbl}%
6121 \gdef\bu@bibdata{#1}%
6122 }
6123 \def\bibliographystyle#1{%
6124 \ifx\@begindocumenthook\@undefined\else
6125 \expandafter\AtBeginDocument
6126 \fi
6127 {\if@filesw
6128 \immediate\write\@auxout{\string\bibstyle{#1}}%
6129 % \end{macrocode}
6130 %
6131 % 正文的 \cs{bibliographystyle} 同时设置附录参考文献的默认 \file{.bst} 样式。
6132 % \begin{macrocode}
6133 \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}%
6134 \fi}%
6135 \gdef\bu@bibstyle{#1}%
6136 }
6137 }
6138 \AtEndOfPackageFile*{bibunits}{
6139 \def\@startbibunit{%
6140 \global\let\@startbibunitorrelax\relax
6141 \global\let\@finishbibunit\@finishstartedbibunit
6142 \global\advance\@bibunitauxcnt 1
6143 \if@filesw
6144 {\endlinechar-1
6145 % \end{macrocode}
6146 %
6147 % 使附录 aux 文件的 \cs{gdef}\cs{@localbibstyle} 能够生效。
6148 % \begin{macrocode}
6149 \makeatletter
6150 \@input{\@bibunitname.aux}}%
6151 \immediate\openout\@bibunitaux\@bibunitname.aux
6152 \immediate\write\@bibunitaux{\string\bibstyle{\@localbibstyle}}%
6153 \fi
6154 }
6155 \def\bu@bibliography#1{%
6156 \putbib[#1]%
6157 }
6158 \def\bu@bibliographystyle#1{%
6159 \if@filesw
6160 \immediate\write\@bibunitaux{\string\gdef\string\@localbibstyle{#1}}%
6161 \fi
6162 \gdef\@localbibstyle{#1}%
6163 }
6164 \providecommand\printbibliography{\putbib\relax}%
6165 \g@addto@macro\appendix{%
6166 \renewcommand\@bibunitname{\jobname-appendix-\@alph\c@chapter}%
6167 \bibliographyunit[\chapter]%
6168 % \end{macrocode}
6169 %
6170 % 研究生附录的引用编号加前缀,如附录 A 的引用 [1] 为 [A.1]。
6171 % \begin{macrocode}
6172 \renewcommand\@extra@binfo{@-\@alph\c@chapter}%
6173 \renewcommand\@extra@b@citeb{@-\@alph\c@chapter}%
6174 \ifthu@degree@bachelor\else
6175 \renewcommand\citenumfont{\@Alph\c@chapter.}%
6176 \renewcommand\bibnumfmt[1]{[\@Alph\c@chapter.#1]\hfill}%
6177 \fi
6178 }
6179 \renewcommand\thu@end@appendix@ref@section{%
6180 \bibliographyunit\relax
6181 }
6182 \AtEndDocument{\thu@end@appendix@ref@section}
6183 % \end{macrocode}
6184 %
6185 % 如果正文和附录引用了同一文献,\pkg{bibunits} 会给出无意义的警告,这里消除警告。
6186 % \begin{macrocode}
6187 % \let\@xtestdef\@gobbletwo % This doesn't work
6188 \def\bibunits@rerun@warning{\relax}
6189 }
6190 \PassOptionsToPackage{defernumbers=true}{biblatex}
6191 \AtEndOfPackageFile*{biblatex}{
6192 \DeclareRefcontext{appendix}{labelprefix=\@Alph\c@chapter.}
6193 \g@addto@macro\appendix{%
6194 % 参考 biblatex 的 refsection=chapter 选项实现方式,
6195 % 在 \@makechapterhead 和 \@makeschapterhead 进行 patch
6196 \pretocmd\@makechapterhead{%
6197 \newrefsection
6198 \ifthu@degree@bachelor\else
6199 \newrefcontext{appendix}%
6200 \fi
6201 }{}{\thu@patch@error{\@makechapterhead}}%
6202 \pretocmd\@makeschapterhead{%
6203 \newrefsection
6204 \ifthu@degree@bachelor\else
6205 \newrefcontext{appendix}%
6206 \fi
6207 }{}{\thu@patch@error{\@makeschapterhead}}%
6208 }
6209 \def\bibliographystyle#1{%
6210 \thu@warning{'bibliographystyle' invalid for 'biblatex'.}%
6211 }
6212 }
6213 % \end{macrocode}
6214 %
6215 % 注意 \pkg{titletoc} 在 2019/07/14 v2.11.1702 修改了 \cs{printcontents} 接口,
6216 % 而且 \cs{@ifpackagelater} 只能用在导言区中,所以需要定义辅助宏。
6217 % \begin{macrocode}
6218 \@ifpackagelater{titletoc}{2019/07/14}{
6219 \newcommand\thu@print@contents[5]{%
6220 \printcontents[#1]{#2}{#3}[#4]{}%
6221 }
6222 }{
6223 \newcommand\thu@print@contents[5]{%
6224 \printcontents[#1]{#2}{#3}{\setcounter{tocdepth}{#4}#5}%
6225 }
6226 }
6227 % \end{macrocode}
6228 %
6229 % 外文资料的调研阅读报告(已过时)。
6230 % \begin{macrocode}
6231 \newenvironment{survey}{%
6232 \thu@deprecate{"survey" environment}{}%
6233 \chapter{外文资料的调研阅读报告}%
6234 \thusetup{language = english}%
6235 \let\title\@gobble
6236 \let\maketitle\relax
6237 \let\tableofcontents\relax
6238 \let\appendix\relax
6239 \renewcommand\bibname{参考文献}%
6240 }{%
6241 \thu@reset@main@language % restore language
6242 }
6243 % \end{macrocode}
6244 %
6245 % 外文资料的书面翻译(已过时)。
6246 % \begin{macrocode}
6247 \newenvironment{translation}{%
6248 \thu@deprecate{"translation" environment}{}%
6249 \chapter{外文资料的书面翻译}%
6250 \thusetup{language = chinese}%
6251 \let\title\@gobble
6252 \let\maketitle\relax
6253 \renewenvironment{abstract}{%
6254 \ctexset{
6255 section = {
6256 format += \centering,
6257 numbering = false,
6258 },
6259 }%
6260 \section{摘要}%
6261 }{%
6262 \par
6263 \ifx\thu@keywords\@empty\else
6264 \textbf{关键词:}\thu@clist@use{\thu@keywords}{;}\par
6265 \fi
6266 }%
6267 \let\tableofcontents\relax
6268 \let\appendix\relax
6269 }{%
6270 \thu@reset@main@language % restore language
6271 }
6272 % \end{macrocode}
6273 %
6274 % 书面翻译对应的原文索引,区别于译文的参考文献。
6275 % \begin{macrocode}
6276 \NewEnviron{translation-index}{%
6277 \thu@deprecate{"translation-index" environment}{}%
6278 }{}
6279 % \end{macrocode}
6280 %
6281 %
6282 % \subsection{个人简历}
6283 %
6284 % \begin{environment}{resume}
6285 % 个人简历发表文章等。
6286 % \begin{macrocode}
6287 \newenvironment{resume}{%
6288 \@mainmatterfalse
6289 \thu@end@appendix@ref@section
6290 \thu@chapter*{\thu@resume@name}%
6291 \ctexset{section/numbering = false}%
6292 \ifthu@degree@bachelor
6293 \ctexset{section/aftertitle = {:\@@par}}%
6294 \else
6295 \ctexset{section/format += \centering}%
6296 \fi
6297 \ifthu@language@chinese
6298 \ctexset{
6299 subsection = {
6300 format = \sffamily\fontsize{14bp}{20bp}\selectfont,
6301 numbering = false,
6302 aftertitle = {:\@@par},
6303 },
6304 }%
6305 \setlist[achievements]{
6306 topsep = 6bp,
6307 itemsep = 6bp,
6308 leftmargin = 1cm,
6309 labelwidth = 1cm,
6310 labelsep = 0pt,
6311 first = {
6312 \ifthu@degree@graduate
6313 \fontsize{12bp}{16bp}\selectfont
6314 \fi
6315 },
6316 align = left,
6317 label = [\arabic*],
6318 resume = achievements,
6319 }%
6320 \else
6321 \ctexset{
6322 subsection = {
6323 beforeskip = 0pt,
6324 afterskip = 0pt,
6325 format = \bfseries\normalsize,
6326 indent = \parindent,
6327 numbering = false,
6328 },
6329 }%
6330 \ifthu@degree@bachelor
6331 % 内容部分用Arial字体,字号15pt,行距采用固定值20pt, 段前后 0pt。
6332 \sffamily\fontsize{15bp}{20bp}\selectfont
6333 \fi
6334 \setlist[achievements]{
6335 topsep = 0bp,
6336 itemsep = 0bp,
6337 leftmargin = 1.75cm,
6338 labelsep = 0.5cm,
6339 align = right,
6340 label = [\arabic*],
6341 resume = achievements,
6342 }%
6343 \fi
6344 }{}
6345 % \end{macrocode}
6346 % \end{environment}
6347 %
6348 % 旧的 \cs{resumeitem} 和 \cs{researchitem} 已经过时。
6349 % \begin{macrocode}
6350 \newcommand\resumeitem[1]{%
6351 \thu@error{The "\protect\resumeitem" is obsolete. Please update to the new format}%
6352 }
6353 \newcommand\researchitem[1]{%
6354 \thu@error{The "\protect\researchitem" is obsolete. Please update to the new format}%
6355 }
6356 % \end{macrocode}
6357 %
6358 % \begin{environment}{achievements}
6359 % 学术成果由 \env{achievements} 环境罗列。
6360 % \begin{macrocode}
6361 \newlist{achievements}{enumerate}{1}
6362 \setlist[achievements]{
6363 topsep = 6bp,
6364 partopsep = 0bp,
6365 itemsep = 6bp,
6366 parsep = 0bp,
6367 leftmargin = 10mm,
6368 itemindent = 0pt,
6369 align = left,
6370 label = [\arabic*],
6371 resume = achievements,
6372 }
6373 % \end{macrocode}
6374 % \end{environment}
6375 %
6376 % \begin{macrocode}
6377 \newenvironment{publications}{%
6378 \thu@deprecate{"publications" environment}{"achievements"}%
6379 \begin{achievements}%
6380 }{%
6381 \end{achievements}%
6382 }
6383 \newcommand\publicationskip{%
6384 \thu@error{The "\protect\publicationskip" is obsolete. Do not use it}%
6385 }
6386 % \end{macrocode}
6387 %
6388 % \subsection{指导教师/小组学术评语}
6389 % \begin{environment}{comments}
6390 % \begin{macrocode}
6391 \NewEnviron{comments}[1][]{%
6392 \thu@end@appendix@ref@section
6393 \ifthu@degree@graduate
6394 \@mainmatterfalse
6395 \kv@define@key{thu@comments}{name}{\let\thu@comments@name\kv@value}%
6396 \kv@set@family@handler{thu@comments}{%
6397 \ifx\kv@value\relax
6398 \let\thu@comments@name\kv@key
6399 \else
6400 \kv@handled@false
6401 \fi
6402 }%
6403 \kvsetkeys{thu@comments}{#1}%
6404 \chapter{\thu@comments@name}%
6405 \BODY\clearpage
6406 \fi
6407 }
6408 % \end{macrocode}
6409 % \end{environment}
6410 %
6411 % \subsection{答辩委员会决议书}
6412 % \begin{environment}{resolution}
6413 % \begin{macrocode}
6414 \NewEnviron{resolution}{%
6415 \thu@end@appendix@ref@section
6416 \ifthu@degree@graduate
6417 \@mainmatterfalse
6418 \chapter{\thu@resolution@name}%
6419 \BODY\clearpage
6420 \fi
6421 }
6422 % \end{macrocode}
6423 % \end{environment}
6424 %
6425 % \subsection{综合论文训练记录表}
6426 %
6427 % \begin{macro}{\record}
6428 % (本科生专用)插入综合论文训练记录表的 PDF 版本,并加入书签。
6429 %
6430 % \begin{macrocode}
6431 \newcommand{\record}[1]{%
6432 \ifthu@degree@bachelor
6433 \let\thu@record@file\@empty
6434 \kv@define@key{thu@record}{file}{\let\thu@record@file\kv@value}%
6435 \kv@set@family@handler{thu@record}{%
6436 \ifx\kv@value\relax
6437 \let\thu@record@file\kv@key
6438 \else
6439 \kv@handled@false
6440 \fi
6441 }%
6442 \kvsetkeys{thu@record}{#1}%
6443 \ifx\thu@record@file\@empty
6444 \thu@error{File path of \protect\record\space is required}
6445 \fi
6446 \clearpage
6447 \thu@pdfbookmark{0}{综合论文训练记录表}%
6448 \includepdf[pages=-]{\thu@record@file}%
6449 \fi
6450 \thu@replace@with@error{record}
6451 }
6452 % \end{macrocode}
6453 %
6454 % \end{macro}
6455 %
6456 % \subsection{其他宏包的设置}
6457 %
6458 % 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。
6459 %
6460 % \subsubsection{\pkg{hyperref} 宏包}
6461 %
6462 % 使用 \cs{PassOptionsToPackage} 的方式进行配置,允许用户在 \cs{usepackage}
6463 % 覆盖配置(\href{https://github.com/tuna/thuthesis/issues/863}{tuna/thuthesis\#863})。
6464 %
6465 % \begin{macrocode}
6466 \PassOptionsToPackage{
6467 linktoc = all,
6468 bookmarksdepth = 2,
6469 bookmarksnumbered = true,
6470 bookmarksopen = true,
6471 bookmarksopenlevel = 1,
6472 bookmarksdepth = 3,
6473 unicode = true,
6474 psdextra = true,
6475 breaklinks = true,
6476 plainpages = false,
6477 pdfdisplaydoctitle = true,
6478 hidelinks,
6479 }{hyperref}
6480 \AtEndOfPackageFile*{hyperref}{
6481 \newcounter{thu@bookmark}
6482 \renewcommand\thu@pdfbookmark[2]{%
6483 \phantomsection
6484 \stepcounter{thu@bookmark}%
6485 \pdfbookmark[#1]{#2}{thuchapter.\thethu@bookmark}%
6486 }
6487 \renewcommand\thu@phantomsection{%
6488 \phantomsection
6489 }
6490 \pdfstringdefDisableCommands{%
6491 \let\\\relax
6492 \let\quad\relax
6493 \let\qquad\relax
6494 \let\hspace\@gobble
6495 }%
6496 % \end{macrocode}
6497 %
6498 % \pkg{hyperref} 与 \pkg{unicode-math} 存在一些兼容性问题,见
6499 % \href{https://github.com/ustctug/ustcthesis/issues/223}{%
6500 % ustctug/ustcthesis\#223},
6501 % \href{https://github.com/ho-tex/hyperref/pull/90}{ho-tex/hyperref\#90} 和
6502 % \href{https://github.com/ustctug/ustcthesis/issues/235}{%
6503 % ustctug/ustcthesis/\#235}。
6504 % \begin{macrocode}
6505 \@ifpackagelater{hyperref}{2019/04/27}{}{%
6506 \g@addto@macro\psdmapshortnames{\let\mu\textmu}
6507 }%
6508 \ifthu@main@language@chinese
6509 \hypersetup{
6510 pdflang = zh-CN,
6511 }%
6512 \else
6513 \hypersetup{
6514 pdflang = en-US,
6515 }%
6516 \fi
6517 \AtBeginDocument{%
6518 \ifthu@main@language@chinese
6519 \hypersetup{
6520 pdftitle = \thu@title,
6521 pdfauthor = \thu@author,
6522 pdfsubject = \thu@discipline,
6523 pdfkeywords = \thu@keywords,
6524 }%
6525 \else
6526 \hypersetup{
6527 pdftitle = \thu@title@en,
6528 pdfauthor = \thu@author@en,
6529 pdfsubject = \thu@discipline@en,
6530 pdfkeywords = \thu@keywords@en,
6531 }%
6532 \fi
6533 \hypersetup{
6534 pdfcreator={\thuthesis-v\version}}
6535 }%
6536 }
6537 % \end{macrocode}
6538 %
6539 % \subsubsection{\pkg{mathtools} 宏包}
6540 %
6541 % \pkg{mathtools} 会修改 \pkg{unicode-math} 的 \cs{underbrace} 和 \cs{overbrace},
6542 % 需要还原为 \cs{LaTeXunderbrace} 和 \cs{LaTeXoverbrace},
6543 % 参考 \url{https://tex.stackexchange.com/q/521394/82731}。
6544 % \begin{macrocode}
6545 \AtEndOfPackageFile*{mathtools}{
6546 \@ifpackageloaded{unicode-math}{
6547 \let\underbrace\LaTeXunderbrace
6548 \let\overbrace\LaTeXoverbrace
6549 }{}
6550 \expandafter\def\csname MT_extended_eqref:n\endcsname#1{%
6551 \ifthu@language@chinese
6552 \ifthu@eqn@paren@style@full
6553 \unskip
6554 \fi
6555 \fi
6556 \protected@write\@auxout{}
6557 {\string\MT@newlabel{#1}}%
6558 \textup{\let\df@label\@empty\csname MT_prev_tagform:n\endcsname{\ref{#1}}}%
6559 \ifthu@language@chinese
6560 \ifthu@eqn@paren@style@full
6561 \ignorespaces
6562 \fi
6563 \fi
6564 }
6565 \expandafter\MakeRobust\csname MT_extended_eqref:n\endcsname
6566 }
6567 % \end{macrocode}
6568 %
6569 % \subsubsection{\pkg{nomencl} 宏包}
6570 %
6571 % \begin{macrocode}
6572 \PassOptionsToPackage{notocbasic}{nomencl}
6573 \AtEndOfPackageFile*{nomencl}{
6574 \let\nomname\thu@denotation@name
6575 \def\thenomenclature{\begin{denotation}[\nom@tempdim]}
6576 \def\endthenomenclature{\end{denotation}}
6577 }
6578 % \end{macrocode}
6579 %
6580 % \subsubsection{\pkg{siunitx} 宏包}
6581 %
6582 % \begin{macrocode}
6583 \AtEndOfPackageFile*{siunitx}{%
6584 \newcommand\thu@set@siunitx@language{%
6585 \ifthu@language@chinese
6586 \sisetup{
6587 list-final-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }},
6588 list-pair-separator = {\TextOrMath{\space}{\ }\text{和}\TextOrMath{\space}{\ }},
6589 range-phrase = {\text{~}},
6590 }%
6591 \else
6592 \ifthu@language@english
6593 \sisetup{
6594 list-final-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }},
6595 list-pair-separator = {\TextOrMath{\space}{\ }\text{and}\TextOrMath{\space}{\ }},
6596 range-phrase = {\TextOrMath{\space}{\ }\text{to}\TextOrMath{\space}{\ }},
6597 }%
6598 \fi
6599 \fi
6600 }
6601 \thu@set@siunitx@language
6602 \thu@option@hook{language}{\thu@set@siunitx@language}
6603 }
6604 % \end{macrocode}
6605 %
6606 % \subsubsection{\pkg{amsthm} 宏包}
6607 %
6608 % 定理标题使用黑体,正文使用宋体,冒号隔开。
6609 % \begin{macrocode}
6610 \AtEndOfPackageFile*{amsthm}{%
6611 \newtheoremstyle{thu}
6612 {\z@}{\z@}
6613 {\normalfont}{\z@}
6614 {\normalfont\sffamily}{\thu@theorem@separator}
6615 {0.5em}{}
6616 \theoremstyle{thu}
6617 \newtheorem{assumption}{\thu@assumption@name}[chapter]%
6618 \newtheorem{definition}{\thu@definition@name}[chapter]%
6619 \newtheorem{proposition}{\thu@proposition@name}[chapter]%
6620 \newtheorem{lemma}{\thu@lemma@name}[chapter]%
6621 \newtheorem{theorem}{\thu@theorem@name}[chapter]%
6622 \newtheorem{axiom}{\thu@axiom@name}[chapter]%
6623 \newtheorem{corollary}{\thu@corollary@name}[chapter]%
6624 \newtheorem{exercise}{\thu@exercise@name}[chapter]%
6625 \newtheorem{example}{\thu@example@name}[chapter]%
6626 \newtheorem{remark}{\thu@remark@name}[chapter]%
6627 \newtheorem{problem}{\thu@problem@name}[chapter]%
6628 \newtheorem{conjecture}{\thu@conjecture@name}[chapter]%
6629 \renewenvironment{proof}[1][\thu@proof@name]{\par
6630 \pushQED{\qed}%
6631 % \normalfont \topsep6\p@\@plus6\p@\relax
6632 \normalfont \topsep\z@\relax
6633 \trivlist
6634 \item[\hskip\labelsep
6635 % \itshape
6636 % #1\@addpunct{.}]\ignorespaces
6637 \sffamily
6638 #1]\ignorespaces
6639 }{%
6640 \popQED\endtrivlist\@endpefalse
6641 }
6642 \renewcommand\qedsymbol{\thu@qed}
6643 }
6644 % \end{macrocode}
6645 %
6646 % \subsubsection{\pkg{ntheorem} 宏包}
6647 %
6648 % 定理标题使用黑体,正文使用宋体,冒号隔开。
6649 % \begin{macrocode}
6650 \AtEndOfPackageFile*{ntheorem}{%
6651 \theorembodyfont{\normalfont}%
6652 \theoremheaderfont{\normalfont\sffamily}%
6653 \theoremsymbol{\thu@qed}%
6654 \newtheorem*{proof}{\thu@proof@name}%
6655 \theoremstyle{plain}%
6656 \theoremsymbol{}%
6657 \theoremseparator{\thu@theorem@separator}%
6658 \newtheorem{assumption}{\thu@assumption@name}[chapter]%
6659 \newtheorem{definition}{\thu@definition@name}[chapter]%
6660 \newtheorem{proposition}{\thu@proposition@name}[chapter]%
6661 \newtheorem{lemma}{\thu@lemma@name}[chapter]%
6662 \newtheorem{theorem}{\thu@theorem@name}[chapter]%
6663 \newtheorem{axiom}{\thu@axiom@name}[chapter]%
6664 \newtheorem{corollary}{\thu@corollary@name}[chapter]%
6665 \newtheorem{exercise}{\thu@exercise@name}[chapter]%
6666 \newtheorem{example}{\thu@example@name}[chapter]%
6667 \newtheorem{remark}{\thu@remark@name}[chapter]%
6668 \newtheorem{problem}{\thu@problem@name}[chapter]%
6669 \newtheorem{conjecture}{\thu@conjecture@name}[chapter]%
6670 }
6671 % \end{macrocode}
6672 %
6673 % \subsubsection{\pkg{algorithm} 宏包}
6674 %
6675 % 使 \env{algorithm} 和 \env{listing} 环境的名称随语言设置而改变,
6676 % 并使其在附录中的编号规则与图、表等一致。
6677 %
6678 % \begin{macro}{\listofalgorithm}
6679 % \begin{macro}{\listofalgorithm*}
6680 % \begin{macrocode}
6681 \PassOptionsToPackage{chapter}{algorithm}
6682 \AtEndOfPackageFile*{algorithm}{
6683 \floatname{algorithm}{\thu@algorithm@name}
6684 \renewcommand\listofalgorithms{%
6685 \thu@listof{algorithm}%
6686 }
6687 \renewcommand\listalgorithmname{\thu@list@algorithm@name}
6688 \def\ext@algorithm{loa}
6689 \contentsuse{algorithm}{loa}
6690 \titlecontents{algorithm}
6691 [\z@]{}
6692 {\contentspush{\fname@algorithm~\thecontentslabel\thu@contents@label@delimiter}}{}
6693 {\thu@leaders\thecontentspage}
6694 }
6695 % \end{macrocode}
6696 % \end{macro}
6697 % \end{macro}
6698 %
6699 % \subsubsection{\pkg{algorithm2e} 宏包}
6700 %
6701 % \begin{macrocode}
6702 \PassOptionsToPackage{algochapter}{algorithm2e}
6703 \AtEndOfPackageFile*{algorithm2e}{
6704 \renewcommand\algorithmcfname{\thu@algorithm@name}
6705 \SetAlgoCaptionLayout{thu@caption@font}
6706 \SetAlCapSty{relax}
6707 \SetAlgoCaptionSeparator{\hspace*{1em}}
6708 \SetAlFnt{\fontsize{11bp}{14.3bp}\selectfont}
6709 \renewcommand\listofalgorithms{%
6710 \thu@listof{algorithmcf}%
6711 }
6712 \renewcommand\listalgorithmcfname{\thu@list@algorithm@name}
6713 \def\ext@algorithmcf{loa}
6714 \contentsuse{algocf}{loa}
6715 \titlecontents{algocf}
6716 [\z@]{}
6717 {\contentspush{\algorithmcfname~\thecontentslabel\thu@contents@label@delimiter}}{}
6718 {\thu@leaders\thecontentspage}
6719 }
6720 % \end{macrocode}
6721 %
6722 % \subsubsection{\pkg{minted} 宏包}
6723 %
6724 % \begin{macrocode}
6725 \AtEndOfPackageFile*{minted}{
6726 \newcommand\thu@set@listing@language{%
6727 \ifthu@language@chinese
6728 \floatname{listing}{代码}%
6729 \else
6730 \floatname{listing}{Listing}%
6731 \fi
6732 }
6733 \thu@set@listing@language
6734 \thu@option@hook{language}{\thu@set@listing@language}
6735 }
6736 % \end{macrocode}
6737 %
6738 % \subsection{书脊}
6739 % \label{sec:spine}
6740 % \begin{macro}{\spine}
6741 % 单独使用书脊命令会在新的一页产生竖排书脊,
6742 % 参考 \url{https://tex.stackexchange.com/a/38585}。
6743 %
6744 % 本科生:
6745 % 书脊的书写要求:用仿宋\_GB2312 字书写,字体大小根据论文的薄厚而定。
6746 % 书脊上方写论文题目,下方写本科生姓名,距上下页边均为 3cm。
6747 %
6748 % 研究生:
6749 % 博士论文的书脊使用三号字,硕士的为小三号。
6750 % 示例中上下页边距为 5.5 cm,左右边距为 1 cm。
6751 % \begin{macrocode}
6752 \thu@define@key{
6753 spine-font = {
6754 name = spine@font,
6755 },
6756 spine-title = {
6757 name = spine@title,
6758 },
6759 spine-author = {
6760 name = spine@author,
6761 },
6762 }
6763 \renewcommand\thu@spine@font{%
6764 \ifthu@degree@doctor
6765 \fontsize{16bp}{20.8bp}\selectfont
6766 \else
6767 \fontsize{15bp}{19.5bp}\selectfont
6768 \fi
6769 }
6770 \newcommand*\CJKmovesymbol[1]{\raise.3em\hbox{#1}}
6771 \newcommand*\CJKmove{%
6772 \punctstyle{plain}%
6773 \let\CJKsymbol\CJKmovesymbol
6774 \let\CJKpunctsymbol\CJKsymbol
6775 }
6776 \NewDocumentCommand{\spine}{
6777 O{
6778 \ifx\thu@spine@title\@empty
6779 \thu@title
6780 \else
6781 \thu@spine@title
6782 \fi
6783 }
6784 O{
6785 \ifx\thu@spine@author\@empty
6786 \thu@author
6787 \else
6788 \thu@spine@author
6789 \fi
6790 }}{%
6791 \clearpage
6792 \ifthu@degree@bachelor
6793 \newgeometry{
6794 vmargin = 3cm,
6795 hmargin = 1cm,
6796 }%
6797 \else
6798 \newgeometry{
6799 vmargin = 5.5cm,
6800 hmargin = 1cm,
6801 }%
6802 \fi
6803 \thispagestyle{empty}%
6804 \ifthu@main@language@chinese
6805 \thu@pdfbookmark{0}{书脊}%
6806 \else
6807 \thu@pdfbookmark{0}{Spine}%
6808 \fi
6809 \begingroup
6810 \noindent\hfill
6811 \rotatebox[origin=lt]{-90}{%
6812 \makebox[\textheight]{%
6813 \fangsong
6814 \addCJKfontfeatures*{RawFeature={vertical}}%
6815 \thu@spine@font
6816 \CJKmove
6817 #1\hfill
6818 \thu@stretch{4.5em}{#2}%
6819 }%
6820 }%
6821 \endgroup
6822 \clearpage
6823 \restoregeometry
6824 }
6825 % \end{macrocode}
6826 % \end{macro}
6827 %
6828 %
6829 % \subsection{其它}
6830 % \label{sec:other}
6831 %
6832 % 借用 \cls{ltxdoc} 和 \cls{l3doc} 里面的几个命令方便写文档。
6833 % \begin{macrocode}
6834 \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
6835 \DeclareRobustCommand\file{\nolinkurl}
6836 \DeclareRobustCommand\env{\textsf}
6837 \DeclareRobustCommand\pkg{\textsf}
6838 \DeclareRobustCommand\cls{\textsf}
6839 % \end{macrocode}
6840 %
6841 % \begin{macrocode}
6842 \sloppy
6843 %</cls>
6844 % \end{macrocode}
6845 %
6846 %
6847 % \iffalse
6848 % \begin{macrocode}
6849 %<*dtx-style>
6850 \ProvidesPackage{dtx-style}
6851 \RequirePackage{hypdoc}
6852 \RequirePackage{ifthen}
6853 \RequirePackage{fontspec}[2017/01/20]
6854 \RequirePackage{amsmath}
6855 \RequirePackage{unicode-math}
6856 \RequirePackage{siunitx}
6857 \RequirePackage[UTF8,scheme=chinese]{ctex}
6858 \RequirePackage[
6859 top=2.5cm, bottom=2.5cm,
6860 left=4cm, right=2cm,
6861 headsep=3mm]{geometry}
6862 \RequirePackage{hologo}
6863 \RequirePackage{array,longtable,booktabs}
6864 \RequirePackage{listings}
6865 \RequirePackage{fancyhdr}
6866 \RequirePackage{xcolor}
6867 \RequirePackage{enumitem}
6868 \RequirePackage{etoolbox}
6869 \RequirePackage{metalogo}
6870 \RequirePackage[tightLists=false]{markdown}
6871
6872 \markdownSetup{
6873 renderers = {
6874 link = {\href{#2}{#1}},
6875 }
6876 }
6877
6878 \hypersetup{
6879 pdflang = zh-CN,
6880 pdftitle = {ThuThesis:清华大学学位论文模板},
6881 pdfauthor = {清华大学 TUNA 协会},
6882 pdfsubject = {清华大学学位论文模板使用说明},
6883 pdfkeywords = {论文模板; 清华大学; 使用说明},
6884 pdfdisplaydoctitle = true
6885 }%
6886
6887 \setmainfont[
6888 Extension = .otf,
6889 UprightFont = *-regular,
6890 BoldFont = *-bold,
6891 ItalicFont = *-italic,
6892 BoldItalicFont = *-bolditalic,
6893 ]{texgyrepagella}
6894 \setsansfont[
6895 Extension = .otf,
6896 UprightFont = *-regular,
6897 BoldFont = *-bold,
6898 ItalicFont = *-italic,
6899 BoldItalicFont = *-bolditalic,
6900 ]{texgyreheros}
6901 \setmonofont[
6902 Extension = .otf,
6903 UprightFont = *-regular,
6904 BoldFont = *-bold,
6905 ItalicFont = *-italic,
6906 BoldItalicFont = *-bolditalic,
6907 Scale = MatchLowercase,
6908 Ligatures = CommonOff,
6909 ]{texgyrecursor}
6910
6911 \unimathsetup{
6912 math-style=ISO,
6913 bold-style=ISO,
6914 }
6915 \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}
6916 \IfFontExistsTF{XITSMath-Regular.otf}{
6917 \setmathfont[
6918 Extension = .otf,
6919 BoldFont = XITSMath-Bold,
6920 StylisticSet = 8,
6921 ]{XITSMath-Regular}
6922 \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf}
6923 }{
6924 \setmathfont[
6925 Extension = .otf,
6926 BoldFont = *bold,
6927 StylisticSet = 8,
6928 ]{xits-math}
6929 \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf}
6930 }
6931
6932 \colorlet{thu@macro}{blue!60!black}
6933 \colorlet{thu@env}{blue!70!black}
6934 \colorlet{thu@option}{purple}
6935 \patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{}
6936 \patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{}
6937 \patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{}
6938 \patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{}
6939
6940 \def\DescribeOption{%
6941 \leavevmode\@bsphack\begingroup\MakePrivateLetters%
6942 \Describe@Option}
6943 \def\Describe@Option#1{\endgroup
6944 \marginpar{\raggedleft\PrintDescribeOption{#1}}%
6945 \thu@special@index{option}{#1}\@esphack\ignorespaces}
6946 \def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{thu@option} #1\ }
6947 \def\thu@special@index#1#2{\@bsphack
6948 \begingroup
6949 \HD@target
6950 \let\HDorg@encapchar\encapchar
6951 \edef\encapchar usage{%
6952 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
6953 }%
6954 \index{#2\actualchar{\string\ttfamily\space#2}
6955 (#1)\encapchar usage}%
6956 \index{#1:\levelchar#2\actualchar
6957 {\string\ttfamily\space#2}\encapchar usage}%
6958 \endgroup
6959 \@esphack}
6960
6961 \lstdefinestyle{lstStyleBase}{%
6962 basicstyle=\small\ttfamily,
6963 aboveskip=\medskipamount,
6964 belowskip=\medskipamount,
6965 lineskip=0pt,
6966 boxpos=c,
6967 showlines=false,
6968 extendedchars=true,
6969 upquote=true,
6970 tabsize=2,
6971 showtabs=false,
6972 showspaces=false,
6973 showstringspaces=false,
6974 numbers=none,
6975 linewidth=\linewidth,
6976 xleftmargin=4pt,
6977 xrightmargin=0pt,
6978 resetmargins=false,
6979 breaklines=true,
6980 breakatwhitespace=false,
6981 breakindent=0pt,
6982 breakautoindent=true,
6983 columns=flexible,
6984 keepspaces=true,
6985 gobble=4,
6986 framesep=3pt,
6987 rulesep=1pt,
6988 framerule=1pt,
6989 backgroundcolor=\color{gray!5},
6990 stringstyle=\color{green!40!black!100},
6991 keywordstyle=\bfseries\color{blue!50!black},
6992 commentstyle=\slshape\color{black!60}}
6993
6994 \lstdefinestyle{lstStyleShell}{%
6995 style=lstStyleBase,
6996 frame=l,
6997 rulecolor=\color{purple},
6998 language=bash}
6999
7000 \lstdefinestyle{lstStyleLaTeX}{%
7001 style=lstStyleBase,
7002 frame=l,
7003 rulecolor=\color{violet},
7004 language=[LaTeX]TeX}
7005
7006 \lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{}
7007 \lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{}
7008
7009 \setlist{nosep}
7010
7011 \DeclareDocumentCommand{\option}{m}{\textsf{#1}}
7012 \DeclareDocumentCommand{\env}{m}{\texttt{#1}}
7013 \DeclareDocumentCommand{\pkg}{s m}{%
7014 \textsf{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}}
7015 \DeclareDocumentCommand{\cls}{s m}{%
7016 \textsf{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}}
7017 \DeclareDocumentCommand{\file}{s m}{%
7018 \nolinkurl{#2}\IfBooleanF#1{\thu@special@index{file}{#2}}}
7019 \newcommand{\myentry}[1]{%
7020 \marginpar{\raggedleft\color{purple}\bfseries\strut #1}}
7021 \newcommand{\note}[2][Note]{{%
7022 \color{magenta}{\bfseries #1}\emph{#2}}}
7023
7024 \g@addto@macro\UrlBreaks{%
7025 \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
7026 \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
7027 \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
7028 \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
7029 \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
7030 }
7031 \Urlmuskip=0mu plus 0.1mu
7032
7033 \DeclareDocumentCommand{\githubuser}{m}{\href{https://github.com/#1}{@#1}}
7034
7035 \def\thuthesis{\textsc{Thu}\-\textsc{Thesis}}
7036 %</dtx-style>
7037 % \end{macrocode}
7038 % \fi
7039 %
7040 % \Finale
7041 %
7042 \endinput
7043 % \iffalse
7044 % Local Variables:
7045 % mode: doctex
7046 % TeX-master: t
7047 % End:
7048 % \fi