texlive[55485] Master/texmf-dist: thuthesis (8jun20)

commits+karl at tug.org commits+karl at tug.org
Mon Jun 8 23:19:57 CEST 2020


Revision: 55485
          http://tug.org/svn/texlive?view=revision&revision=55485
Author:   karl
Date:     2020-06-08 23:19:57 +0200 (Mon, 08 Jun 2020)
Log Message:
-----------
thuthesis (8jun20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/thuthesis/README.md
    trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-survey.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-translation.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/data/chap01.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/data/resume.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/dtx-style.sty
    trunk/Master/texmf-dist/doc/latex/thuthesis/latexmkrc
    trunk/Master/texmf-dist/doc/latex/thuthesis/main.pdf
    trunk/Master/texmf-dist/doc/latex/thuthesis/main.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/spine.pdf
    trunk/Master/texmf-dist/doc/latex/thuthesis/thusetup.tex
    trunk/Master/texmf-dist/doc/latex/thuthesis/thuthesis.pdf
    trunk/Master/texmf-dist/doc/latex/thuthesis/tsinghua.pdf
    trunk/Master/texmf-dist/source/latex/thuthesis/Makefile
    trunk/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
    trunk/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/README.md	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/README.md	2020-06-08 21:19:57 UTC (rev 55485)
@@ -1,38 +1,59 @@
-[![Actions Status](https://github.com/xueruini/thuthesis/workflows/Test/badge.svg)](https://github.com/xueruini/thuthesis/actions)
-[![Join the chat at https://gitter.im/thuthesis/Lobby](https://badges.gitter.im/thuthesis/Lobby.svg)](https://gitter.im/thuthesis/Lobby)
-[![GitHub downloads](https://img.shields.io/github/downloads/xueruini/thuthesis/total)](https://github.com/xueruini/thuthesis/releases)
-[![GitHub commits](https://img.shields.io/github/commits-since/xueruini/thuthesis/latest)](https://github.com/xueruini/thuthesis/commits/master)
-[![GitHub release](https://img.shields.io/github/v/release/xueruini/thuthesis)](https://github.com/xueruini/thuthesis/releases/latest)
+[![Actions Status](https://github.com/tuna/thuthesis/workflows/Test/badge.svg)](https://github.com/tuna/thuthesis/actions)
+[![GitHub downloads](https://img.shields.io/github/downloads/tuna/thuthesis/total)](https://github.com/tuna/thuthesis/releases)
+[![GitHub commits](https://img.shields.io/github/commits-since/tuna/thuthesis/latest)](https://github.com/tuna/thuthesis/commits/master)
+[![GitHub release](https://img.shields.io/github/v/release/tuna/thuthesis)](https://github.com/tuna/thuthesis/releases/latest)
 [![CTAN](https://img.shields.io/ctan/v/thuthesis)](https://www.ctan.org/pkg/thuthesis)
 
-# What's ThuThesis?
-**ThuThesis** is an abbreviation of **T**sing**h**ua **U**niversity **Thesis** LaTeX Template.
 
-This package establishes a simple and easy-to-use LaTeX template for Tsinghua dissertations, including general undergraduate research papers, masters theses, doctoral dissertations, and postdoctoral reports. An English translation of this README follows the Chinese below.
+# ThuThesis
 
+Scroll down for the English version of README.
 
-# ThuThesis 是什么?
 **ThuThesis** 是 **T**sing**h**ua **U**niversity **Thesis** LaTeX Template 的缩写。
 
 此宏包旨在建立一个简单易用的清华大学学位论文 LaTeX 模板,包括本科综合论文训练、硕士论文、博士论文以及博士后出站报告。
 
-# 文档
-请[下载](https://github.com/xueruini/thuthesis/releases)模板,里面包括具体使用说明以及示例文档:
+**由于模板升级频繁,在开始使用和提问前,请确保您已经认真完整地阅读了使用说明文档和示例代码。**
 
+**由于模板升级频繁,在开始使用和提问前,请确保您已经认真完整地阅读了使用说明文档和示例代码。**
+
+**由于模板升级频繁,在开始使用和提问前,请确保您已经认真完整地阅读了使用说明文档和示例代码。**
+
+## 下载
+
+推荐下载**发布版**模板,里面包括具体使用说明以及示例文档:
+
 * 模板使用说明 (thuthesis.pdf)
 * 示例文档 (main.pdf)
 
-# 下载
-* 发行版:[CTAN](https://www.ctan.org/pkg/thuthesis)
-* 开发版:[GitHub](https://github.com/xueruini/thuthesis)
+开发版中不提供预生成的 `cls` 文件和文档,仅包含源码。其仅供开发者与需要尚未发布的功能的有经验的 TeX 用户使用,不提供任何保证。
 
-# 升级
-## 自动更新
-通过 TeX 发行版工具自动从 [CTAN](https://www.ctan.org/pkg/thuthesis) 更新。
+下载途径:
 
-## 手动更新
-从 [GitHub](https://github.com/xueruini/thuthesis) 下载放入论文目录,执行命令(Windows 用户在文件夹空白处按 `Shift + 鼠标右键`,点击“在此处打开命令行窗口”):
+* 发布版:
+  * [CTAN](https://www.ctan.org/pkg/thuthesis):可能滞后正式发布少许时间。
+  * [GitHub Releases](https://github.com/tuna/thuthesis/releases):最新版的及时发布途径。
+  * [TUNA 镜像站](https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/):GitHub Releases 的镜像。
+* 开发版:[GitHub](https://github.com/tuna/thuthesis)
 
+## 更新日志
+
+每个版本的详细更新日志,请见 [CHANGELOG.md](blob/master/CHANGELOG.md)。使用文档中也包含了这一内容。
+
+## 升级
+### 自动更新
+通过 TeX 发行版工具(如 `tlmgr`)自动从 [CTAN](https://www.ctan.org/pkg/thuthesis) 更新。
+
+### 手动更新
+
+#### 发布版
+
+下载发布版的的 zip 包,使用其中的 `thuthesis.cls` 等文件覆盖原有的即可,无须额外操作。
+
+#### 开发板
+
+从 GitHub clone 项目源码或者下载源码 zip 包,执行命令(Windows 用户在文件夹空白处按 `Shift + 鼠标右键`,点击“在此处打开命令行窗口”):
+
 ```shell
 xetex thuthesis.ins
 ```
@@ -39,23 +60,23 @@
 
 即可得到 `thuthesis.cls` 等模板文件。
 
-# 提问
+## 提问
 按推荐顺序排序:
 
-* 先到 [FAQ](https://github.com/xueruini/thuthesis/wiki/FAQ) 看看常见问题
-* [GitHub Issues](https://github.com/xueruini/thuthesis/issues)
+* 先到 [FAQ](https://github.com/tuna/thuthesis/wiki/FAQ) 看看常见问题
+* [GitHub Issues](https://github.com/tuna/thuthesis/issues)
 
-# Makefile的用法
+## Makefile的用法
 
 ```shell
 make [{all|thesis|spine|doc|clean|cleanall|distclean}]
 ```
 
-## 目标
+### 目标
 * `make thesis`    生成论文 main.pdf;
 * `make spine`     生成书脊 spine.pdf;
 * `make doc`       生成模板使用说明书 thuthesis.pdf;
-* `make all`       生成论文和书籍,相当于 `make thesis && make spine`;
+* `make all`       生成论文和书脊,相当于 `make thesis && make spine`;
 * `make clean`     删除示例文件的中间文件(不含 main.pdf);
 * `make cleanall`  删除示例文件的中间文件和 main.pdf;
 * `make distclean` 删除示例文件和模板的所有中间文件和 PDF。
@@ -62,22 +83,45 @@
 
 ---
 
-# Documentation
-Download and unzip the template. Specific usage documentation and examples can be found in the files below. At present, these documents are <b>only available in Chinese</b>:
-* Template usage (thuthesis.pdf)
+# ThuThesis?
+**ThuThesis** is an abbreviation of **T**sing**h**ua **U**niversity **Thesis** LaTeX Template.
+
+This package establishes a simple and easy-to-use LaTeX template for Tsinghua dissertations, including general undergraduate research papers, masters theses, doctoral dissertations, and postdoctoral reports. An English translation of this README follows the Chinese below.
+
+**This template is subject to frequent changes. Please make sure you have read the usage documentation and example code completely and carefully before using and asking questions.**
+
+## Downloads
+
+**Published versions** are recommended. Specific usage documentation and examples can be found in the archive. At present, these documents are <b>only available in Chinese</b>:
+* Template usage documentation (thuthesis.pdf)
 * Template example (main.pdf)
 
-# Downloads
-* Published version: [CTAN](https://www.ctan.org/pkg/thuthesis)
-* Developer version: [GitHub](https://github.com/xueruini/thuthesis)
+Developer versions contain only source code but no pre-compiled `cls` file and documentations. They are only for the usage of developers and experienced TeX users in need of unpublished features. No warranties are provided.
 
-# Updates
-## Automatic
+* Published versions:
+  * [CTAN](https://www.ctan.org/pkg/thuthesis)
+  * [GitHub Releases](https://github.com/tuna/thuthesis/releases)
+  * [TUNA Mirrors](https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/): mirror of GitHub Releases
+* Developer versions: [GitHub](https://github.com/tuna/thuthesis)
+
+## Changelog
+
+See [CHANGELOG.md](blob/master/CHANGELOG.md) for detailed changes in each release. They are also included in the usage documentation.
+
+## Updates
+### Automatic
 Get the most up-to-date published version with your TeX distribution from [CTAN](https://www.ctan.org/pkg/thuthesis).
 
-## Manual
-Download the package from [GitHub](https://github.com/xueruini/thuthesis) to the root directory of your thesis, then execute the command (Windows users `Shift + right click` white area in the file window and click "Open command line window here" from the popup menu):
+### Manual
 
+#### Published versions
+
+Download the published zip files, extract `thuthesis.cls` and other files (if needed) and override the existing ones in your thesis.
+
+#### Developer versions
+
+Download the source code package and unzip to the root directory of your thesis (or clone this project), then execute the command (Windows users `Shift + right click` white area in the file window and click "Open command line window here" from the popup menu):
+
 ```shell
 xetex thuthesis.ins
 ```
@@ -84,19 +128,19 @@
 
 You'll get `thuthesis.cls` along with other template files.
 
-# Reporting Issues
+## Reporting Issues
 Please follow the procedure below:
 
-* Check the [FAQ](https://github.com/xueruini/thuthesis/wiki/FAQ)
-* [GitHub Issues](https://github.com/xueruini/thuthesis/issues)
+* Check the [FAQ](https://github.com/tuna/thuthesis/wiki/FAQ)
+* [GitHub Issues](https://github.com/tuna/thuthesis/issues)
 
-# Makefile Usage
+## Makefile Usage
 
 ```shell
 make [{all|thesis|spine|doc|clean|cleanall|distclean}]
 ```
 
-## Targets
+### Targets
 * `make thesis`    generate thesis main.pdf;
 * `make spine`     generate book spine for printing spine.pdf;
 * `make doc`       generate template documentation thuthesis.pdf;

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-survey.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-survey.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-survey.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -8,20 +8,24 @@
 
 写出至少 5000 外文印刷字符的调研阅读报告或者书面翻译 1-2 篇(不少于 2 万外文印刷符)。
 
+
+\tableofcontents
+
+
+\section{Single-Objective Programming}
+
 It is impossible to cover in a single chapter every concept of mathematical
-programming.\cite{tex} This chapter introduces only the basic concepts and techniques of
+programming\cite{tex}. This chapter introduces only the basic concepts and techniques of
 mathematical programming such that readers gain an understanding of them
-throughout the book\cite{abrahams99tex,salomon1995advanced}.
+throughout the book.~\cite{abrahams99tex,salomon1995advanced}.
 
-
-\section{Single-Objective Programming}
 The general form of single-objective programming (SOP) is written
 as follows,
 \begin{equation*} % 如果附录中的公式不想让它出现在公式索引中,那就请
                              % 用 equation*
 \left\{\begin{array}{l}
-\max \,\,f(x)\\[0.1 cm]
-\mbox{subject to:} \\ [0.1 cm]
+\max \,\,f(x)\\%[0.1 cm]
+\mbox{subject to:} \\%[0.1 cm]
 \qquad g_j(x)\le 0,\quad j=1,2,\cdots,p
 \end{array}\right.
 \end{equation*}
@@ -52,7 +56,7 @@
 \end{mpdefop}
 
 One of the outstanding contributions to mathematical programming was known as
-the Kuhn-Tucker conditions\ref{eq:ktc}. In order to introduce them, let us give
+the Kuhn-Tucker conditions~\eqref{eq:ktc}. In order to introduce them, let us give
 some definitions. An inequality constraint $g_j(x)\le 0$ is said to be active at
 a point $x^*$ if $g_j(x^*)=0$. A point $x^*$ satisfying $g_j(x^*)\le 0$ is said
 to be regular if the gradient vectors $\nabla g_j(x)$ of all active constraints
@@ -65,14 +69,14 @@
 \begin{equation}
 \label{eq:ktc}
 \left\{\begin{array}{l}
-    \nabla f(x^*)-\sum\limits_{j=1}^p\lambda_j\nabla g_j(x^*)=0\\[0.3cm]
-    \lambda_jg_j(x^*)=0,\quad j=1,2,\cdots,p\\[0.2cm]
+    \nabla f(x^*)-\sum\limits_{j=1}^p\lambda_j\nabla g_j(x^*)=0\\%[0.3cm]
+    \lambda_jg_j(x^*)=0,\quad j=1,2,\cdots,p\\%[0.2cm]
     \lambda_j\ge 0,\quad j=1,2,\cdots,p.
 \end{array}\right.
 \end{equation}
 If all the functions $f(x)$ and $g_j(x),j=1,2,\cdots,p$ are convex and
 differentiable, and the point $x^*$ satisfies the Kuhn-Tucker conditions
-(\ref{eq:ktc}), then it has been proved that the point $x^*$ is a global optimal
+\eqref{eq:ktc}, then it has been proved that the point $x^*$ is a global optimal
 solution of SOP.
 
 \subsection{Linear Programming}
@@ -79,20 +83,19 @@
 \label{sec:lp}
 
 If the functions $f(x),g_j(x),j=1,2,\cdots,p$ are all linear, then SOP is called
-a {\em linear programming}.
+a \emph{linear programming}.
 
 The feasible set of linear is always convex. A point $x$ is called an extreme
 point of convex set $S$ if $x\in S$ and $x$ cannot be expressed as a convex
 combination of two points in $S$. It has been shown that the optimal solution to
 linear programming corresponds to an extreme point of its feasible set provided
-that the feasible set $S$ is bounded. This fact is the basis of the {\em simplex
+that the feasible set $S$ is bounded. This fact is the basis of the \emph{simplex
   algorithm} which was developed by Dantzig as a very efficient method for
 solving linear programming.
 \begin{table}[ht]
 \centering
   \centering
-  \caption*{Table~1\hskip1em This is an example for manually numbered table, which
-    would not appear in the list of tables}
+  \caption{This is an example for table}
   \label{tab:badtabular2}
   \begin{tabular}[c]{|m{1.5cm}|c|c|c|c|c|c|}\hline
     \multicolumn{2}{|c|}{Network Topology} & \# of nodes &
@@ -118,7 +121,7 @@
 \subsection{Nonlinear Programming}
 
 If at least one of the functions $f(x),g_j(x),j=1,2,\cdots,p$ is nonlinear, then
-SOP is called a {\em nonlinear programming}.
+SOP is called a \emph{nonlinear programming}.
 
 A large number of classical optimization methods have been developed to treat
 special-structural nonlinear programming based on the mathematical theory
@@ -126,8 +129,7 @@
 \begin{figure}[h]
   \centering
   \includegraphics{thu-lib-logo.pdf}
-  \caption*{Figure~1\quad This is an example for manually numbered figure,
-    which would not appear in the list of figures}
+  \caption{This is an example for figure.}
   \label{tab:badfigure2}
 \end{figure}
 
@@ -141,8 +143,8 @@
 predecessor. The next point to be added to the sequence is chosen by analyzing
 the behavior of the function at the previous points. This construction continues
 until some termination criterion is met. Methods based upon this strategy are
-called {\em ascent methods}, which can be classified as {\em direct methods},
-{\em gradient methods}, and {\em Hessian methods} according to the information
+called \emph{ascent methods}, which can be classified as \emph{direct methods},
+\emph{gradient methods}, and \emph{Hessian methods} according to the information
 about the behavior of objective function $f$. Direct methods require only that
 the function can be evaluated at each point. Gradient methods require the
 evaluation of first derivatives of $f$. Hessian methods require the evaluation
@@ -152,16 +154,16 @@
 
 \subsection{Integer Programming}
 
-{\em Integer programming} is a special mathematical programming in which all of
+\emph{Integer programming} is a special mathematical programming in which all of
 the variables are assumed to be only integer values. When there are not only
-integer variables but also conventional continuous variables, we call it {\em
+integer variables but also conventional continuous variables, we call it \emph{
   mixed integer programming}. If all the variables are assumed either 0 or 1,
-then the problem is termed a {\em zero-one programming}. Although integer
-programming can be solved by an {\em exhaustive enumeration} theoretically, it
+then the problem is termed a \emph{zero-one programming}. Although integer
+programming can be solved by an \emph{exhaustive enumeration} theoretically, it
 is impractical to solve realistically sized integer programming problems. The
 most successful algorithm so far found to solve integer programming is called
-the {\em branch-and-bound enumeration} developed by Balas (1965) and Dakin
-(1965). The other technique to integer programming is the {\em cutting plane
+the \emph{branch-and-bound enumeration} developed by Balas (1965) and Dakin
+(1965). The other technique to integer programming is the \emph{cutting plane
   method} developed by Gomory (1959).
 
 \hfill\textit{Uncertain Programming\/}\quad(\textsl{BaoDing Liu, 2006.2})

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-translation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-translation.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix-translation.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -6,9 +6,12 @@
 \title{书面翻译题目}
 \maketitle
 
+\tableofcontents
+
+
 \section{单目标规划}
 北冥有鱼,其名为鲲。鲲之大,不知其几千里也。化而为鸟,其名为鹏。鹏之背,不知其几
-千里也。怒而飞,其翼若垂天之云。是鸟也,海运则将徙于南冥。南冥者,天池也。
+千里也。怒而飞,其翼若垂天之云。是鸟也,海运则将徙于南冥。南冥者,天池也。\cite{abrahams99tex}
 \begin{equation}\tag*{(123)}
  p(y|\mathbf{x}) = \frac{p(\mathbf{x},y)}{p(\mathbf{x})}=
 \frac{p(\mathbf{x}|y)p(y)}{p(\mathbf{x})}
@@ -23,7 +26,7 @@
 \begin{table}[ht]
 \centering
   \centering
-  \caption*{表~1\hskip1em 这是手动编号但不出现在索引中的一个表格例子}
+  \caption{这是一个表格例子}
   \label{tab:badtabular3}
   \begin{tabular}[c]{|m{1.5cm}|c|c|c|c|c|c|}\hline
     \multicolumn{2}{|c|}{Network Topology} & \# of nodes &
@@ -59,7 +62,7 @@
 \begin{figure}[h]
   \centering
   \includegraphics{thu-whole-logo.pdf}
-  \caption*{图~1\hskip1em 这是手动编号但不出现索引中的图片的例子}
+  \caption{这是图片的例子}
   \label{tab:badfigure3}
 \end{figure}
 
@@ -77,7 +80,7 @@
 作孝弟,而侥幸于封侯富贵者也。子之罪大极重,疾走归!不然,我将以子肝益昼餔之膳。”
 
 
-\nocite{abrahams99tex,salomon1995advanced}
+% 书面翻译的参考文献
 \bibliographystyle{plainnat}
 \bibliography{ref/appendix}
 
@@ -92,5 +95,11 @@
 %     New York: Springer, 1995.
 % \end{thebibliography}
 
+% 书面翻译对应的原文索引
+\begin{translation-index}
+  \nocite{salomon1995advanced}
+  \bibliographystyle{plainnat}
+  \bibliography{ref/appendix}
+\end{translation-index}
 
 \end{translation}

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/data/appendix.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -1,171 +1,5 @@
 \chapter{单目标规划}
 
-As one of the most widely used techniques in operations
-research, \emph{ mathematical programming} is defined as a means of maximizing a
-quantity known as \emph{bjective function}, subject to a set of constraints
-represented by equations and inequalities. Some known subtopics of mathematical
-programming are linear programming, nonlinear programming, multiobjective
-programming, goal programming, dynamic programming, and multilevel
-programming.
-
-It is impossible to cover in a single chapter every concept of mathematical
-programming. This chapter introduces only the basic concepts and techniques of
-mathematical programming such that readers gain an understanding of them
-throughout the book.
-
-
-\section{Single-Objective Programming}
-The general form of single-objective programming (SOP) is written
-as follows,
-\begin{equation*} % 如果附录中的公式不想让它出现在公式索引中,那就请
-                             % 用 equation*
-\left\{\begin{array}{l}
-\max \,\,f(x)\\[0.1 cm]
-\mbox{subject to:} \\ [0.1 cm]
-\qquad g_j(x)\le 0,\quad j=1,2,\cdots,p
-\end{array}\right.
-\end{equation*}
-which maximizes a real-valued function $f$ of
-$x=(x_1,x_2,\cdots,x_n)$ subject to a set of constraints.
-
-\newcommand\Real{\mathbf{R}}
-\newtheorem{mpdef}{Definition}[chapter]
-\begin{mpdef}
-In SOP, we call $x$ a decision vector, and
-$x_1,x_2,\cdots,x_n$ decision variables. The function
-$f$ is called the objective function. The set
-\begin{equation*}
-S=\left\{x\in\Real^n\bigm|g_j(x)\le 0,\,j=1,2,\cdots,p\right\}
-\end{equation*}
-is called the feasible set. An element $x$ in $S$ is called a
-feasible solution.
-\end{mpdef}
-
-\newtheorem{mpdefop}[mpdef]{Definition}
-\begin{mpdefop}
-A feasible solution $x^*$ is called the optimal
-solution of SOP if and only if
-\begin{equation}
-f(x^*)\ge f(x)
-\end{equation}
-for any feasible solution $x$.
-\end{mpdefop}
-
-One of the outstanding contributions to mathematical programming was known as
-the Kuhn-Tucker conditions\ref{eq:ktc}. In order to introduce them, let us give
-some definitions. An inequality constraint $g_j(x)\le 0$ is said to be active at
-a point $x^*$ if $g_j(x^*)=0$. A point $x^*$ satisfying $g_j(x^*)\le 0$ is said
-to be regular if the gradient vectors $\nabla g_j(x)$ of all active constraints
-are linearly independent.
-
-Let $x^*$ be a regular point of the constraints of SOP and assume that all the
-functions $f(x)$ and $g_j(x),j=1,2,\cdots,p$ are differentiable. If $x^*$ is a
-local optimal solution, then there exist Lagrange multipliers
-$\lambda_j,j=1,2,\cdots,p$ such that the following Kuhn-Tucker conditions hold,
-\begin{equation}
-\label{eq:ktc}
-\left\{\begin{array}{l}
-    \nabla f(x^*)-\sum\limits_{j=1}^p\lambda_j\nabla g_j(x^*)=0\\[0.3cm]
-    \lambda_jg_j(x^*)=0,\quad j=1,2,\cdots,p\\[0.2cm]
-    \lambda_j\ge 0,\quad j=1,2,\cdots,p.
-\end{array}\right.
-\end{equation}
-If all the functions $f(x)$ and $g_j(x),j=1,2,\cdots,p$ are convex and
-differentiable, and the point $x^*$ satisfies the Kuhn-Tucker conditions
-(\ref{eq:ktc}), then it has been proved that the point $x^*$ is a global optimal
-solution of SOP.
-
-\subsection{Linear Programming}
-\label{sec:lp}
-
-If the functions $f(x),g_j(x),j=1,2,\cdots,p$ are all linear, then SOP is called
-a {\em linear programming}.
-
-The feasible set of linear is always convex. A point $x$ is called an extreme
-point of convex set $S$ if $x\in S$ and $x$ cannot be expressed as a convex
-combination of two points in $S$. It has been shown that the optimal solution to
-linear programming corresponds to an extreme point of its feasible set provided
-that the feasible set $S$ is bounded. This fact is the basis of the {\em simplex
-  algorithm} which was developed by Dantzig as a very efficient method for
-solving linear programming.
-\begin{table}[ht]
-\centering
-  \centering
-  \caption*{Table~1\hskip1em This is an example for manually numbered table, which
-    would not appear in the list of tables}
-  \label{tab:badtabular2}
-  \begin{tabular}[c]{|m{1.5cm}|c|c|c|c|c|c|}\hline
-    \multicolumn{2}{|c|}{Network Topology} & \# of nodes &
-    \multicolumn{3}{c|}{\# of clients} & Server \\\hline
-    GT-ITM & Waxman Transit-Stub & 600 &
-    \multirow{2}{2em}{2\%}&
-    \multirow{2}{2em}{10\%}&
-    \multirow{2}{2em}{50\%}&
-    \multirow{2}{1.2in}{Max. Connectivity}\\\cline{1-3}
-    \multicolumn{2}{|c|}{Inet-2.1} & 6000 & & & &\\\hline
-    \multirow{2}{1.5cm}{Xue} & Rui  & Ni &\multicolumn{4}{c|}{\multirow{2}*{\thuthesis}}\\\cline{2-3}
-    & \multicolumn{2}{c|}{ABCDEF} &\multicolumn{4}{c|}{} \\\hline
-\end{tabular}
-\end{table}
-
-Roughly speaking, the simplex algorithm examines only the extreme points of the
-feasible set, rather than all feasible points. At first, the simplex algorithm
-selects an extreme point as the initial point. The successive extreme point is
-selected so as to improve the objective function value. The procedure is
-repeated until no improvement in objective function value can be made. The last
-extreme point is the optimal solution.
-
-\subsection{Nonlinear Programming}
-
-If at least one of the functions $f(x),g_j(x),j=1,2,\cdots,p$ is nonlinear, then
-SOP is called a {\em nonlinear programming}.
-
-A large number of classical optimization methods have been developed to treat
-special-structural nonlinear programming based on the mathematical theory
-concerned with analyzing the structure of problems.
-\begin{figure}[h]
-  \centering
-  \includegraphics{thu-lib-logo.pdf}
-  \caption*{Figure~1\quad This is an example for manually numbered figure,
-    which would not appear in the list of figures}
-  \label{tab:badfigure2}
-\end{figure}
-
-Now we consider a nonlinear programming which is confronted solely with
-maximizing a real-valued function with domain $\Real^n$.  Whether derivatives are
-available or not, the usual strategy is first to select a point in $\Real^n$ which
-is thought to be the most likely place where the maximum exists. If there is no
-information available on which to base such a selection, a point is chosen at
-random. From this first point an attempt is made to construct a sequence of
-points, each of which yields an improved objective function value over its
-predecessor. The next point to be added to the sequence is chosen by analyzing
-the behavior of the function at the previous points. This construction continues
-until some termination criterion is met. Methods based upon this strategy are
-called {\em ascent methods}, which can be classified as {\em direct methods},
-{\em gradient methods}, and {\em Hessian methods} according to the information
-about the behavior of objective function $f$. Direct methods require only that
-the function can be evaluated at each point. Gradient methods require the
-evaluation of first derivatives of $f$. Hessian methods require the evaluation
-of second derivatives. In fact, there is no superior method for all
-problems. The efficiency of a method is very much dependent upon the objective
-function.
-
-\subsection{Integer Programming}
-
-{\em Integer programming} is a special mathematical programming in which all of
-the variables are assumed to be only integer values. When there are not only
-integer variables but also conventional continuous variables, we call it {\em
-  mixed integer programming}. If all the variables are assumed either 0 or 1,
-then the problem is termed a {\em zero-one programming}. Although integer
-programming can be solved by an {\em exhaustive enumeration} theoretically, it
-is impractical to solve realistically sized integer programming problems. The
-most successful algorithm so far found to solve integer programming is called
-the {\em branch-and-bound enumeration} developed by Balas (1965) and Dakin
-(1965). The other technique to integer programming is the {\em cutting plane
-  method} developed by Gomory (1959).
-
-\hfill\textit{Uncertain Programming\/}\quad(\textsl{BaoDing Liu, 2006.2})
-
 \section{单目标规划}
 北冥有鱼,其名为鲲。鲲之大,不知其几千里也。化而为鸟,其名为鹏。鹏之背,不知其几
 千里也。怒而飞,其翼若垂天之云。是鸟也,海运则将徙于南冥。南冥者,天池也。
@@ -183,7 +17,7 @@
 \begin{table}[ht]
 \centering
   \centering
-  \caption*{表~1\hskip1em 这是手动编号但不出现在索引中的一个表格例子}
+  \caption{这是一个表格例子}
   \label{tab:badtabular3}
   \begin{tabular}[c]{|m{1.5cm}|c|c|c|c|c|c|}\hline
     \multicolumn{2}{|c|}{Network Topology} & \# of nodes &
@@ -219,7 +53,7 @@
 \begin{figure}[h]
   \centering
   \includegraphics{thu-whole-logo.pdf}
-  \caption*{图~1\hskip1em 这是手动编号但不出现索引中的图片的例子}
+  \caption{这是图片的例子}
   \label{tab:badfigure3}
 \end{figure}
 

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/data/chap01.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/data/chap01.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/data/chap01.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -43,23 +43,11 @@
   知周乎万物,而道济天下,故不过。旁行而不流,乐天知命,故不忧。安土敦乎仁,故
   能爱。范围天地之化而不过,曲成万物而不遗,通乎昼夜之道而知,故神无方而易无体。}
 
-% 非本科生一般用不到幼圆与隶书字体。需要的同学请查看 ctex 文档。
-{\ifcsname youyuan\endcsname\youyuan\else[无 \cs{youyuan} 字体。]\fi 有天地,然后
-  万物生焉。盈天地之间者,唯万物,故受之以屯;屯者盈也,屯者物之始生也。物生必蒙,
-  故受之以蒙;蒙者蒙也,物之穉也。物穉不可不养也,故受之以需;需者饮食之道也。饮
-  食必有讼,故受之以讼。讼必有众起,故受之以师;师者众也。众必有所比,故受之以比;
-  比者比也。比必有所畜也,故受之以小畜。物畜然后有礼,故受之以履。}
-
 {\heiti 履而泰,然后安,故受之以泰;泰者通也。物不可以终通,故受之以否。物不可以终
   否,故受之以同人。与人同者,物必归焉,故受之以大有。有大者不可以盈,故受之以谦。
   有大而能谦,必豫,故受之以豫。豫必有随,故受之以随。以喜随人者,必有事,故受
   之以蛊;蛊者事也。}
 
-{\ifcsname lishu\endcsname\lishu\else[无 \cs{lishu} 字体。]\fi 有事而后可大,故受
-  之以临;临者大也。物大然后可观,故受之以观。可观而后有所合,故受之以噬嗑;嗑者
-  合也。物不可以苟合而已,故受之以贲;贲者饰也。致饰然后亨,则尽矣,故受之以剥;
-  剥者剥也。物不可以终尽,剥穷上反下,故受之以复。复则不妄矣,故受之以无妄。}
-
 {\songti 有无妄然后可畜,故受之以大畜。物畜然后可养,故受之以颐;颐者养也。不养则不
   可动,故受之以大过。物不可以终过,故受之以坎;坎者陷也。陷必有所丽,故受之以
   离;离者丽也。}
@@ -76,23 +64,28 @@
 配合使用。如果表格比较简单的话可以直接用命令 \cs{hlinewd}\marg{width} 控制。
 \begin{table}[htb]
   \centering
-  \begin{minipage}[t]{0.8\linewidth} % 如果想在表格中使用脚注,minipage是个不错的办法
+  \begin{threeparttable}[b]
   \caption[模板文件]{模板文件。如果表格的标题很长,那么在表格索引中就会很不美
     观,所以要像 chapter 那样在前面用中括号写一个简短的标题。这个标题会出现在索
     引中。}
   \label{tab:template-files}
-    \begin{tabularx}{\linewidth}{lX}
-      \toprule[1.5pt]
-      {\heiti 文件名} & {\heiti 描述} \\\midrule[1pt]
-      thuthesis.ins & \LaTeX{} 安装文件,DocStrip\footnote{表格中的脚注} \\
-      thuthesis.dtx & 所有的一切都在这里面\footnote{再来一个}。\\
+    \begin{tabular}{ll}
+      \toprule
+      {\heiti 文件名} & {\heiti 描述} \\\midrule
+      thuthesis.ins & \LaTeX{} 安装文件,DocStrip。\tnote{1} \\
+      thuthesis.dtx & 所有的一切都在这里面。\tnote{b}\\
       thuthesis.cls & 模板类文件。\\
       thuthesis-numeric.bst    & 参考文献 BibTeX 样式文件。\\
       thuthesis-author-year.bst    & 参考文献 BibTeX 样式文件。\\
       thusetup.tex   & 基本配置和常用的包、命令,减轻主文件的负担。\\
-      \bottomrule[1.5pt]
-    \end{tabularx}
-  \end{minipage}
+      \bottomrule
+    \end{tabular}
+    \begin{tablenotes}
+    \item [1] 表格中的脚注。如果脚注比较长,那么换行后的效果是这样的,需要更多的文字。
+              现在能看到么?
+    \item [b] 再来一个。可以使用不同的 symbol。
+    \end{tablenotes}
+  \end{threeparttable}
 \end{table}
 
 首先来看一个最简单的表格。表 \ref{tab:template-files} 列举了本模板主要文件及其功
@@ -153,9 +146,9 @@
 \caption{第一个并排子表格}
 \label{tab:parallel1}
 \begin{tabular}{p{2cm}p{2cm}}
-\toprule[1.5pt]
-111 & 222 \\\midrule[1pt]
-222 & 333 \\\bottomrule[1.5pt]
+\toprule
+111 & 222 \\\midrule
+222 & 333 \\\bottomrule
 \end{tabular}
 \end{minipage}%
 \begin{minipage}{0.5\textwidth}
@@ -163,9 +156,9 @@
 \caption{第二个并排子表格}
 \label{tab:parallel2}
 \begin{tabular}{p{2cm}p{2cm}}
-\toprule[1.5pt]
-111 & 222 \\\midrule[1pt]
-222 & 333 \\\bottomrule[1.5pt]
+\toprule
+111 & 222 \\\midrule
+222 & 333 \\\bottomrule
 \end{tabular}
 \end{minipage}
 \end{table}
@@ -192,9 +185,9 @@
 \subcaptionbox{第一个子表格}
 {
 \begin{tabular}{p{2cm}p{2cm}}
-\toprule[1.5pt]
-111 & 222 \\\midrule[1pt]
-222 & 333 \\\bottomrule[1.5pt]
+\toprule
+111 & 222 \\\midrule
+222 & 333 \\\bottomrule
 \end{tabular}
 }
 \hskip2cm
@@ -201,9 +194,9 @@
 \subcaptionbox{第二个子表格}
 {
 \begin{tabular}{p{2cm}p{2cm}}
-\toprule[1.5pt]
-111 & 222 \\\midrule[1pt]
-222 & 333 \\\bottomrule[1.5pt]
+\toprule
+111 & 222 \\\midrule
+222 & 333 \\\bottomrule
 \end{tabular}
 }
 \end{table}
@@ -242,20 +235,20 @@
 
 \begin{longtable}[c]{c*{6}{r}}
 \caption{实验数据}\label{tab:performance}\\
-\toprule[1.5pt]
+\toprule
  测试程序 & \multicolumn{1}{c}{正常运行} & \multicolumn{1}{c}{同步} & \multicolumn{1}{c}{检查点} & \multicolumn{1}{c}{卷回恢复}
 & \multicolumn{1}{c}{进程迁移} & \multicolumn{1}{c}{检查点} \\
 & \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{时间 (s)}&
 \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{
-  时间 (s)}&  文件(KB)\\\midrule[1pt]
+  时间 (s)}&  文件(KB)\\\midrule
 \endfirsthead
 \multicolumn{7}{c}{续表~\thetable\hskip1em 实验数据}\\
-\toprule[1.5pt]
+\toprule
  测试程序 & \multicolumn{1}{c}{正常运行} & \multicolumn{1}{c}{同步} & \multicolumn{1}{c}{检查点} & \multicolumn{1}{c}{卷回恢复}
 & \multicolumn{1}{c}{进程迁移} & \multicolumn{1}{c}{检查点} \\
 & \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{时间 (s)}&
 \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{时间 (s)}& \multicolumn{1}{c}{
-  时间 (s)}&  文件(KB)\\\midrule[1pt]
+  时间 (s)}&  文件(KB)\\\midrule
 \endhead
 \hline
 \multicolumn{7}{r}{续下页}
@@ -285,7 +278,7 @@
 EP.B.2 & 495.49 & 0.001 & 0.009 & 0.003 & 0.196 & 2011 \\
 EP.B.4 & 247.69 & 0.002 & 0.012 & 0.004 & 0.122 & 1663 \\
 EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\
-\bottomrule[1.5pt]
+\bottomrule
 \end{longtable}
 
 要想用好论文模板还是得提前学习一些 \TeX/\LaTeX{} 的相关知识,具备一些基本能力,掌
@@ -343,7 +336,7 @@
 \section{定理环境}
 \label{sec:theorem}
 
-给大家演示一下各种和证明有关的环境:
+给大家演示一下各种和证明有关的环境,比如公式~\eqref{eq:eqnxmp}:
 
 \begin{assumption}
 待月西厢下,迎风户半开;隔墙花影动,疑是玉人来。
@@ -358,6 +351,7 @@
 何反起悲伤?(引自《杜十娘怒沉百宝箱》)
 
 \begin{definition}
+\label{def:ziyue}
 子曰:「道千乘之国,敬事而信,节用而爱人,使民以时。」
 \end{definition}
 
@@ -365,15 +359,14 @@
 君应有语,渺万里层云,千山暮雪,只影向谁去?
 
 横汾路,寂寞当年箫鼓,荒烟依旧平楚。招魂楚些何嗟及,山鬼暗谛风雨。天也妒,未信与,莺儿燕子俱黄土。
-千秋万古,为留待骚人,狂歌痛饮,来访雁丘处。
+千秋万古,为留待骚人,狂歌痛饮,来访雁丘处。(参见定义~\ref{def:ziyue})
 
 \begin{proposition}
  曾子曰:「吾日三省吾身 —— 为人谋而不忠乎?与朋友交而不信乎?传不习乎?」
 \end{proposition}
 
-多么凄美的命题啊!其日牛马嘶,新妇入青庐,奄奄黄昏后,寂寂人定初,我命绝今日,
-魂去尸长留,揽裙脱丝履,举身赴清池,府吏闻此事,心知长别离,徘徊庭树下,自挂东南
-枝。
+其日牛马嘶,新妇入青庐,奄奄黄昏后,寂寂人定初,我命绝今日,魂去尸长留,揽裙脱丝履,举身赴清池,
+府吏闻此事,心知长别离,徘徊庭树下,自挂东南枝。
 
 \begin{remark}
 天不言自高,水不言自流。
@@ -430,6 +423,8 @@
 \begin{theorem}\label{the:theorem1}
 犯我强汉者,虽远必诛\hfill —— 陈汤(汉)
 \end{theorem}
+
+下面演示了子公式编号:
 \begin{subequations}
 \begin{align}
 y & = 1 \\
@@ -436,6 +431,7 @@
 y & = 0
 \end{align}
 \end{subequations}
+
 道可道,非常道。名可名,非常名。无名天地之始;有名万物之母。故常无,欲以观其妙;
 常有,欲以观其徼。此两者,同出而异名,同谓之玄。玄之又玄,众妙之门。上善若水。水
 善利万物而不争,处众人之所恶,故几于道。曲则全,枉则直,洼则盈,敝则新,少则多,
@@ -521,17 +517,17 @@
 
 有时候不想要上标,那么可以这样~\inlinecite{shaheshang},这个非常重要。
 
-有时候一些参考文献没有纸质出处,需要标注 URL。缺省情况下,URL 不会在连字符处断行,
-这可能使得用连字符代替空格的网址分行很难看。如果需要,可以将模板类文件中
-\begin{verbatim}
-\RequirePackage{hyperref}
-\end{verbatim}
-一行改为:
-\begin{verbatim}
-\PassOptionsToPackage{hyphens}{url}
-\RequirePackage{hyperref}
-\end{verbatim}
-使得连字符处可以断行。更多设置可以参考 \texttt{url} 宏包文档。
+% 有时候一些参考文献没有纸质出处,需要标注 URL。缺省情况下,URL 不会在连字符处断行,
+% 这可能使得用连字符代替空格的网址分行很难看。如果需要,可以将模板类文件中
+% \begin{verbatim}
+% \RequirePackage{hyperref}
+% \end{verbatim}
+% 一行改为:
+% \begin{verbatim}
+% \PassOptionsToPackage{hyphens}{url}
+% \RequirePackage{hyperref}
+% \end{verbatim}
+% 使得连字符处可以断行。更多设置可以参考 \texttt{url} 宏包文档。
 
 \section{公式}
 \label{sec:equation}

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/data/resume.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/data/resume.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/data/resume.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -25,7 +25,7 @@
 
   % 2. 尚未刊载,但已经接到正式录用函的学术论文(本人为第一作者,或者
   %    导师为第一作者本人是第二作者)。
-  \begin{publications}[before=\publicationskip,after=\publicationskip]
+  \begin{publications}[before*=\publicationskip,after*=\publicationskip]
     \item Yang Y, Ren T L, Zhu Y P, et al. PMUTs for handwriting recognition. In
       press. (已被 Integrated Ferroelectrics 录用. SCI 源刊.)
   \end{publications}

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/dtx-style.sty
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/dtx-style.sty	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/dtx-style.sty	2020-06-08 21:19:57 UTC (rev 55485)
@@ -21,8 +21,18 @@
 %% To produce the documentation run the original source files ending with `.dtx'
 %% through LaTeX.
 %% 
-\RequirePackage{ifxetex}
-\RequireXeTeX
+\newcommand\thu at error[1]{%
+  \ClassError{thuthesis}{#1}{}%
+}
+\@ifl at t@r\fmtversion{2017/04/15}{}{
+  \thu at error{%
+    TeX Live 2017 or later version is required to compile this document%
+  }
+}
+\RequirePackage{iftex}
+\ifXeTeX\else
+  \thu at error{XeLaTeX is required to compile this document}
+\fi
 \ProvidesPackage{dtx-style}
 \RequirePackage{hypdoc}
 \RequirePackage{ifthen}
@@ -42,7 +52,14 @@
 \RequirePackage{enumitem}
 \RequirePackage{etoolbox}
 \RequirePackage{metalogo}
+\RequirePackage[tightLists=false]{markdown}
 
+\markdownSetup{
+  renderers = {
+    link = {\href{#2}{#1}},
+  }
+}
+
 \ifthenelse{\equal{\@nameuse{g__ctex_fontset_tl}}{mac}}{
   \setmainfont{Palatino}
   \setsansfont[Scale=MatchLowercase]{Helvetica}
@@ -182,6 +199,8 @@
 \newcommand{\note}[2][Note]{{%
   \color{magenta}{\bfseries #1}\emph{#2}}}
 
+\DeclareDocumentCommand{\githubuser}{m}{\href{https://github.com/#1}{@#1}}
+
 \def\thuthesis{\textsc{Thu}\-\textsc{Thesis}}
 \endinput
 %%

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/latexmkrc	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/latexmkrc	2020-06-08 21:19:57 UTC (rev 55485)
@@ -2,12 +2,12 @@
 
 $pdf_mode = 5;
 
-$xelatex = "xelatex -file-line-error -halt-on-error -interaction=nonstopmode -no-pdf -synctex=1 %O %S";
+$xelatex = "xelatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -no-pdf -synctex=1 %O %S";
 $xdvipdfmx = "xdvipdfmx -q -E -o %D %O %S";
 
 $bibtex_use = 1.5;
 
-$clean_ext = "hd loe synctex.gz thm xdv";
+$clean_ext = "hd loe ptc synctex.gz thm xdv";
 
 $makeindex = "makeindex -s gind.ist %O -o %D %S";
 add_cus_dep('glo', 'gls', 0, 'glo2gls');

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/main.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/main.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/main.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/main.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -2,7 +2,7 @@
 % !TeX program = xelatex
 % !TeX spellcheck = en_US
 
-\documentclass[degree=master,fontset=windows]{thuthesis}
+\documentclass[degree=master]{thuthesis}
   % 学位 degree:
   %   doctor | master | bachelor | postdoc
   % 学位类型 degree-type:
@@ -20,6 +20,8 @@
 
 % 使用授权的说明
 \copyrightpage
+% 将签字扫描后授权文件 scan-auth.pdf 替换原始页面
+% \copyrightpage[scan-auth.pdf]
 
 \frontmatter
 \input{data/abstract.tex}
@@ -43,7 +45,6 @@
 %% 本科生要求的几个索引。
 % \listoffigures    % 插图索引
 % \listoftables     % 表格索引
-% \listofequations  % 公式索引
 
 % 参考文献
 \bibliographystyle{thuthesis-numeric}      % 顺序编码制
@@ -56,12 +57,14 @@
 
 % 声明
 \statement
+% 将签字扫描后的声明n'g statement.pdf 替换原始页面
+% \copyrightpage[statement.pdf]
 
 % 附录
 \appendix
+\input{data/appendix}
 % \input{data/appendix-survey}       % 本科生:外文资料的调研阅读报告
 % \input{data/appendix-translation}  % 本科生:外文资料的书面翻译
-\input{data/appendix}
 
 % 个人简历
 \input{data/resume}

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/spine.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/thusetup.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/thuthesis/thusetup.tex	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/doc/latex/thuthesis/thusetup.tex	2020-06-08 21:19:57 UTC (rev 55485)
@@ -48,7 +48,7 @@
   %      工程领域名称
   %   3. 其他专业型学位
   %      不填写此项
-  %   4. 本科生不需要填写
+  %   4. 本科生填写专业名称,第二学位论文需标注“(第二学位)”
   %
   discipline  = {计算机科学与技术},
   discipline* = {Computer Science and Technology},
@@ -61,17 +61,17 @@
   % 指导教师
   %   中文姓名和职称之间以英文逗号“,”分开,下同
   %
-  supervisor  = {郑纬民教授},
+  supervisor  = {郑纬民, 教授},
   supervisor* = {Professor Zheng Weimin},
   %
   % 副指导教师
   %
-  associate-supervisor  = {陈文光教授},
+  associate-supervisor  = {陈文光, 教授},
   associate-supervisor* = {Professor Chen Wenguang},
   %
   % 联合指导教师
   %
-  % joint-supervisor  = {某某某教授},
+  % joint-supervisor  = {某某某, 教授},
   % joint-supervisor* = {Professor Mou Moumou},
   %
   % 日期
@@ -103,9 +103,13 @@
 % 跨页表格
 \usepackage{longtable}
 
-% 固定宽度的表格
+% 固定宽度的表格。放在 hyperref 之前的话,tabularx 里的 footnote 显示不出来。
 \usepackage{tabularx}
 
+% 表格加脚注
+\usepackage{threeparttable}
+\pretocmd{\TPTnoteSettings}{\footnotesize}{}{}
+
 % 表格中的反斜线
 \usepackage{diagbox}
 
@@ -121,7 +125,9 @@
 % \usepackage{rotating} % 图形和表格的控制旋转
 
 % 定理类环境宏包
-\usepackage[amsmath,thmmarks,hyperref]{ntheorem}
+\usepackage{amsthm}
+% 也可以使用 ntheorem
+% \usepackage[amsmath,thmmarks,hyperref]{ntheorem}
 
 % 给自定义的宏后面自动加空白
 % \usepackage{xspace}

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/thuthesis.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/thuthesis/tsinghua.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/thuthesis/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/latex/thuthesis/Makefile	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/source/latex/thuthesis/Makefile	2020-06-08 21:19:57 UTC (rev 55485)
@@ -7,7 +7,9 @@
 SOURCES = $(PACKAGE).ins $(PACKAGE).dtx
 CLSFILE = dtx-style.sty $(PACKAGE).cls
 
-LATEXMK = latexmk
+LATEXMK  = latexmk
+SHELL   := /bin/bash
+NPM     ?= npm
 
 # make deletion work on Windows
 ifdef SystemRoot
@@ -62,7 +64,7 @@
 
 clean:
 	$(LATEXMK) -c $(PACKAGE).dtx $(THESIS) $(SPINE)
-	-@$(RM) *~ main-survey.*
+	-@$(RM) *~ main-survey.*  _markdown_thuthesis*
 
 cleanall: clean
 	-@$(RM) $(PACKAGE).pdf $(THESIS).pdf $(SPINE).pdf
@@ -80,4 +82,4 @@
 endif
 
 dist: check all-dev
-	npm run build -- --version=$(version)
+	$(NPM) run build -- --version=$(version)

Modified: trunk/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx	2020-06-08 21:19:57 UTC (rev 55485)
@@ -1,7 +1,8 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2005-2020 by Ruini Xue <xueruini at gmail.com>
+% Copyright (C) 2005-2020 by Tsinghua University TUNA Association <tuna at tsinghua.edu.cn>
 %
+%
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
 % of this license or (at your option) any later version.
@@ -16,7 +17,7 @@
 %
 % \iffalse
 %<*driver>
-\ProvidesFile{thuthesis.dtx}[2020/02/23 6.0.2 Tsinghua University Thesis Template]
+\ProvidesFile{thuthesis.dtx}[2020/06/08 6.1.0 Tsinghua University Thesis Template]
 \documentclass{ltxdoc}
 \usepackage{dtx-style}
 
@@ -56,7 +57,7 @@
 % \IndexPrologue{\section{\indexname}}
 %
 % \title{\bfseries\color{violet}\thuthesis:清华大学学位论文模板}
-% \author{{\fangsong 薛瑞尼}\\[5pt]\texttt{xueruini at gmail.com}}
+% \author{{\fangsong 清华大学 TUNA 协会}\\[5pt]\texttt{tuna at tsinghua.edu.cn}}
 % \date{v\fileversion\ (\filedate)}
 % \maketitle\thispagestyle{empty}
 %
@@ -71,7 +72,7 @@
 % \begin{abstract}
 % \noindent
 % \begin{enumerate}
-% \item 本模板的发布遵守 \LaTeX{} Project Public License,使用前请认真阅读协议内
+% \item 本模板的发布遵守 \href{https://www.latex-project.org/lppl/lppl-1-3c.txt}{\LaTeX{} Project Public License (1.3.c)},使用前请认真阅读协议内
 %   容。
 % \item 本模板为作者根据
 %   清华大学教务处颁发的
@@ -107,7 +108,7 @@
 % 的 \LaTeX{} 论文模板。
 %
 % 本文档将尽量完整的介绍模板的使用方法,如有不清楚之处,或者想提出改进建议,
-% 可以在 \href{https://github.com/xueruini/thuthesis/issues/}{GitHub Issues}
+% 可以在 \href{https://github.com/tuna/thuthesis/issues/}{GitHub Issues}
 % 参与讨论或提问。
 % 有兴趣者都可以参与完善此手册,也非常欢迎对代码的贡献。
 %
@@ -117,18 +118,36 @@
 % 用户如果遇到 bug,或者发现与学校《写作指南》 的要求不一致,可以尝试以下办法:
 % \begin{enumerate}
 %   \item 将模板升级到最新,见第~\ref{sec:upgrade} 节;
-%   \item 阅读 \href{https://github.com/xueruini/thuthesis/wiki/FAQ}{FAQ};
+%   \item 阅读 \href{https://github.com/tuna/thuthesis/wiki/FAQ}{FAQ};
 %   \item 在 GitHub Issues 中按照说明
-%     \href{https://github.com/xueruini/thuthesis/issues/new?template=bug_report.md}{报告 bug}。
+%     \href{https://github.com/tuna/thuthesis/issues/new?template=bug_report.md}{报告 bug}。
 % \end{enumerate}
 %
+% \section{贡献者}
+% \label{sec:contributors}
+%
+% \thuthesis{} 的开发过程中,主要的维护者包括:
+% 
+% \begin{itemize}
+%  \item 薛瑞尼(\githubuser{xueruini}):最早的开发者,2005 年创建 \thuthesis{} 并长期进行维护工作。
+%  \item 赵涛(\githubuser{alick}):2011-2015 年活跃,较早期阶段的开发者。
+%  \item 李泽平(\githubuser{zepinglee}):2016 年至今活跃,为目前主要维护者。
+%  \item 陈晟祺(\githubuser{Harry-Chen}):2020 年至今活跃,主要负责非开发性事宜。
+% \end{itemize}
+%
+% 同时,也要感谢所有在 GitHub 上提出问题与贡献代码的同学、老师们。
+% \thuthesis{} 的持续发展,离不开你们的帮助与支持。
+%
 % \section{安装}
 % \label{sec:installation}
 %
-% \thuthesis{} 已经包含在主要的 \TeX{} 发行版中,但是通常版本较旧,
-% 而且不方便更新。
-% 建议使用 GitHub 上的最新版:
-% \url{https://github.com/xueruini/thuthesis}。
+% \thuthesis{} 已经包含在主要的 \TeX{} 发行版中,但是通常版本较旧,而且不方便更新。
+% 建议从下列途径下载最新版:
+% \begin{description}
+%  \item[GitHub] \url{https://github.com/tuna/thuthesis},从 Release 中下载 zip 文件。
+%  \item[TUNA 镜像站] \url{https://mirrors.tuna.tsinghua.edu.cn/github-release/tuna/thuthesis/},也可在首页选择“获取下载链接——应用软件——\thuthesis{}论文模板”。
+% \end{description}
+% 
 %
 % 模板支持在 TeX Live、MacTeX 和 MiKTeX 平台下进行编译,但要求 2017 年或更新的发行版。
 % 当然,尽可能使用最新的版本可以避免 bug。
@@ -210,21 +229,32 @@
 %   $ latexmk thuthesis.dtx  # 生成说明文档 thuthesis.pdf
 %   $ latexmk -c             # 清理编译生成的辅助文件
 % \end{shell}
-% \texttt{latexmk} 的编译过程是通过 \file{latexmk} 文件来配置的,如果要进一步了解,
-% 可以参考 \pkg{latexmk} 的文档。
+% \texttt{latexmk} 的编译过程是通过 \file{latexmkrc} 文件来配置的,如果要进一步了解,
+% 可以参考 \pkg{latexmk} 文档。
 %
 % \subsubsection{\XeLaTeX}
 % \label{sec:xelatex}
 % 如果用户无法使用以上两种较为方便的编译方法,就只能按照以下复杂的办法手动编译。
+%
+% 首先,更新模板:
 % \begin{shell}
-%   $ xetex thuthesis.ins  # 生成 thuthesis.cls
+%   $ xetex thuthesis.ins         # 生成 thuthesis.cls
+% \end{shell}
+%
+% 然后,生成论文以及书脊:
+% \begin{shell}
 %   $ xelatex main.tex
-%   $ bibtex main.tex      # 生成 bbl 文件
-%   $ xelatex main.tex     # 解决引用
-%   $ xelatex main.tex     # 生成完整的 pdf 文件
+%   $ bibtex main.aux             # 生成 bbl 文件
+%   $ bibtex main-survey.aux      # 本科生的调研报告的参考文献
+%   $ bibtex main-translation.aux # 本科生的外文资料翻译的参考文献
+%   $ bibtex main-index.aux       # 本科生的书面翻译对应的原文索引
+%   $ xelatex main.tex            # 解决引用
+%   $ xelatex main.tex            # 生成论文 PDF
+%
+%   $ xelatex spine.tex           # 生成书脊 PDF
 % \end{shell}
 %
-% 下面的命令用来生成用户手册,
+% 下面的命令用来生成用户手册:
 % \begin{shell}
 %   $ xelatex thuthesis.dtx
 %   $ makeindex -s gind.ist -o thuthesis.ind thuthesis.idx
@@ -286,17 +316,6 @@
 %   \documentclass[degree=master, degree-type=professional]{thuthesis}
 % \end{latex}
 %
-% \DescribeOption{language}
-% 论文全文的主要语言。可选:\option{chinese}(默认),\option{english}。
-%
-% 注意,本科生《写作指南》要求“本科生(含国外来华留学本科生)非外语专业论文统一要求
-% 用中文书写。”研究生《写作指南》要求“外国人来华留学生可以用英文撰写学位论文,但
-% 须采用中文封面”,“除留学生外,学位论文一律须用汉语书写”,用户须提前与导师和院系
-% 的审查教师协商使用何种语言书写论文。
-% \begin{latex}
-%   \documentclass[degree=bachelor, language=english]{thuthesis}
-% \end{latex}
-%
 % \subsection{字体配置}
 % \label{sec:font-config}
 % 模板默认可以自动检测操作系统,并配置改平台上合适的字体,
@@ -339,10 +358,8 @@
 % 允许的选项有 \option{windows}、\option{mac}、\option{fandol},详
 % 见 \pkg{ctex}、\pkg{xeCJK}、\pkg{fontspec} 等宏包的使用说明。
 %
-% \subsection{封面信息}
-% \label{sec:titlepage}
-% 封面信息可以通过统一设置命令 \cs{thusetup} 设置 \emph{key=value} 形式完成;
-% 带 * 号的键通常是对应的英文。
+% \subsection{论文设置}
+% 论文的设置可以通过统一命令 \cs{thusetup} 设置 \emph{key=value} 形式完成。
 %
 % \DescribeMacro{\thusetup}
 % \cs{thusetup} 用法与常见 \emph{key=value} 命令相同,如下:
@@ -361,6 +378,30 @@
 % \note[注意:]{\cs{thusetup} 使用 \pkg{kvsetkeys} 机制,所以配置项之间不能有空行,否则
 % 会报错。}
 %
+% \subsubsection{书写语言}
+% 在导言区设置 \option{language} 会修改论文的主要语言,如章节标题等。
+% 在正文中设置 \option{language} 只修改接下来部分的书写语言,
+% 如标点格式、图表名称,但不影响章节标题等。
+%
+% \begin{latex}
+%   \thusetup{
+%     language = english,
+%   }
+% \end{latex}
+%
+% 论文的一些部分(如英文摘要、本科生的外文调研报告)要求使用特定的语言,
+% 模板已经进行配置,并在这些部分结束后自动恢复为主要语言。
+%
+% 注意,本科生《写作指南》要求“本科生(含国外来华留学本科生)非外语专业论文统一要求
+% 用中文书写。”研究生《写作指南》要求“外国人来华留学生可以用英文撰写学位论文,但
+% 须采用中文封面”,“除留学生外,学位论文一律须用汉语书写”,用户须提前与导师和院系
+% 的审查教师协商使用何种语言书写论文。
+%
+% \subsection{封面信息}
+% \label{sec:titlepage}
+% 封面信息可以通过统一设置命令 \cs{thusetup} 设置 \emph{key=value} 形式完成;
+% 带 * 号的键通常是对应的英文。
+%
 % \subsubsection{论文标题}
 % 中英文标题。可以在标题内部使用换行|\\|。
 % \begin{latex}
@@ -415,7 +456,7 @@
 %   \item 学术型学位:获得一级学科授权的学科填写一级学科名称,其他填写二级学科名称;
 %   \item 工程硕士:工程领域名称;
 %   \item 其他专业型学位:-
-%   \item 本科生:-
+%   \item 本科生:专业名称,第二学位论文需标注“(第二学位)”
 % \end{itemize}
 %
 % \begin{latex}
@@ -454,7 +495,7 @@
 % \end{latex}
 %
 % \myentry{联合导师}
-% 硕士生联合指导教师,博士生联合导师。
+% 硕士生、本科生联合指导教师,博士生联合导师。
 % \begin{latex}
 %   \thusetup{
 %     joint-supervisor  = {联合导师姓名, 教授},
@@ -540,7 +581,7 @@
 % \end{latex}
 %
 % \subsubsection{目录和索引表}
-% 目录、插图、表格和公式等索引命令分别如下,将其插入到期望的位置即可(带*的命令表
+% 目录、插图、表格、公式和算法等索引命令分别如下,将其插入到期望的位置即可(带*的命令表
 % 示对应的索引表不会出现在目录中):
 %
 % \DescribeMacro{\tableofcontents}
@@ -550,6 +591,8 @@
 % \DescribeMacro{\listoftables*}
 % \DescribeMacro{\listofequations}
 % \DescribeMacro{\listofequations*}
+% \DescribeMacro{\listofalgorithms}
+% \DescribeMacro{\listofalgorithms*}
 % \begin{longtable}{ll}
 % \toprule
 %   {\heiti 用途} & {\heiti 命令} \\\midrule
@@ -559,9 +602,24 @@
 % 表格索引 & \cs{listoftables}    \\
 %          & \cs{listoftables*}   \\\midrule
 % 公式索引 & \cs{listofequations} \\
-%          & \cs{listofequations*}\\\bottomrule
+%          & \cs{listofequations*}\\\midrule
+% 算法索引 & \cs{listofalgorithms} \\
+%          & \cs{listofalgorithms*}\\\bottomrule
 % \end{longtable}
 %
+% \DescribeOption{toc-chapter-style}
+% 本科生《写作指南》关于目录章标题要求“目录从第 1 章开始,每章标题用黑体小四号字”,
+% 所以其中的西文和数字默认使用 Arial 字体,跟正文的章标题一致。
+% 但是论文样例\footnote{
+%   \url{http://www.law.tsinghua.edu.cn/publish/law/7024/2012/20120216153516317135347/20120216153516317135347_.html}
+% }的目录章标题的西文和数字却使用了 Times。
+% 如果审查老师这样要求,需要在生成目录前设置
+% \begin{latex}
+%   \thusetup{
+%     toc-chapter-style = times,
+%   }
+% \end{latex}
+%
 % \LaTeX{} 默认支持插图和表格索引,是通过 \cs{caption} 命令完成的,因此它们必须出
 % 现在浮动环境中,否则不被计数。
 %
@@ -569,10 +627,6 @@
 % 个命令不会给表格编号,也就是出来的只有标题文字而没有“表~xx”,“图~xx”,否则
 % 索引里面序号不连续就显得不伦不类,这也是 \LaTeX{} 里星号命令默认的规则。
 %
-% 有这种需求的多是本科同学的英文资料翻译部分,如果你觉得附录中英文原文中的表格和
-% 图片显示成“表”和“图”很不协调的话,一个很好的办法还是用 \cs{caption*},参数
-% 随便自己写,具体用法请参看示例文档。
-%
 % 如果的确想让其编号,但又不想出现在索引中的话,目前模板暂不支持。
 %
 % 公式索引为本模板扩展,模板扩展了 \pkg{amsmath} 几个内部命令,使得公式编号样式和
@@ -818,12 +872,18 @@
 % 本科生《写作指南》要求附录 A 为外文资料的调研阅读报告或书面翻译,二者择一。
 % 调研报告(或书面翻译)的题目和参考文献是独立于论文的,相当一篇独立的小文章,
 % 所以模板相应定义了 \env{survey} 和 \env{translation}。在这两个环境内部可以
-% 像论文正文一样使用标题和参考文献的命令,但不会影响外部:
+% 像论文正文一样使用标题和参考文献的命令,但不会影响外部。
+% 但是需要使用 \hologo{BibTeX} 对 \file{main-survey.aux} 或者
+% \file{main-translation.aux} 进行编译,才能生成参考文献(见 \ref{sec:xelatex} 节)。
 %
+% 同时,阅读报告默认切换书写语言为英语,书面翻译默认切换为中文。
+% 如有需要,可以通过 \cs{thusetup} 的 \option{language} 参数再次更改。
+%
 % \begin{latex}
 %   \begin{survey}
 %     \title{...}
 %     \maketitle
+%     \tableofcontents
 %     ... \cite{...}
 %     \bibliographystyle{...}
 %     \bibliography{...}
@@ -830,14 +890,19 @@
 %   \end{survey}
 % \end{latex}
 %
-% 书面翻译对应的原文索引的实际作用更接近参考文献,所以也用参考文献的机制来生成,
-% 但是在正文中并不引用。
+% “书面翻译对应的原文索引”区别于译文的参考文献,需要使用 \env{translation-index}
+% 环境,另外需要使用 \hologo{BibTeX} 编译 \file{main-index.aux}。
 %
 % \begin{latex}
 %   \begin{translation}
-%     ... \nocite{...}
+%     ... \cite{...}
 %     \bibliographystyle{...}
-%     \bibliography{...}
+%     \bibliography{...}  % 书面翻译的参考文献
+%     \begin{translation-index}
+%       \nocite{...}
+%       \bibliographystyle{...}
+%       \bibliography{...}  % 书面翻译对应的原文索引
+%     \end{translation-index}
 %   \end{translation}
 % \end{latex}
 %
@@ -883,7 +948,7 @@
 %   \end{publications}
 %
 %   % 2. 尚未刊载,但已经接到正式录用函的学术论文
-%   \begin{publications}[before=\publicationskip,after=\publicationskip]
+%   \begin{publications}[before*=\publicationskip,after*=\publicationskip]
 %     \item Yang Y, Ren T L, Zhu Y P, et al. PMUTs for handwriting
 %       recognition. In press. (已被 Integrated Ferroelectrics 录用. SCI 源刊.)
 %   \end{publications}
@@ -919,8 +984,16 @@
 % \label{sec:thanks}
 % 感谢这些年来一直陪伴 \thuthesis{} 成长的新老同学!
 %
-% 欢迎各位到 \href{http://github.com/xueruini/thuthesis/}{\thuthesis{} GitHub 主页}贡献!
+% 欢迎各位到 \href{http://github.com/tuna/thuthesis/}{\thuthesis{} GitHub 主页}贡献!
 %
+%
+% % redefine some commands in markdown package to remove annoying section numbering
+% \renewcommand{\markdownRendererHeadingTwo}[1]{\subsection*{#1}}
+% \renewcommand{\markdownRendererHeadingThree}[1]{\subsubsection*{#1}}
+% % render changelog from markdown
+% \markdownInput{CHANGELOG.md}
+%
+%
 % \StopEventually{\PrintIndex}
 % \clearpage
 %
@@ -928,15 +1001,33 @@
 %
 % \subsection{基本信息}
 %    \begin{macrocode}
-%<cls>\NeedsTeXFormat{LaTeX2e}
+%<cls>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
 %<cls>\ProvidesClass{thuthesis}
-%<cls>[2020/02/23 6.0.2 Tsinghua University Thesis Template]
+%<cls>[2020/06/08 6.1.0 Tsinghua University Thesis Template]
 %    \end{macrocode}
 %
+% 报错
+%    \begin{macrocode}
+\newcommand\thu at error[1]{%
+  \ClassError{thuthesis}{#1}{}%
+}
+%    \end{macrocode}
+%
+% 检查 \LaTeXe{} kernel 版本
+%    \begin{macrocode}
+\@ifl at t@r\fmtversion{2017/04/15}{}{
+  \thu at error{%
+    TeX Live 2017 or later version is required to compile this document%
+  }
+}
+%    \end{macrocode}
+%
 % 检查编译引擎,要求使用 \XeLaTeX。
 %    \begin{macrocode}
-\RequirePackage{ifxetex}
-\RequireXeTeX
+\RequirePackage{iftex}
+\ifXeTeX\else
+  \thu at error{XeLaTeX is required to compile this document}
+\fi
 %    \end{macrocode}
 %
 % \subsection{定义选项}
@@ -946,7 +1037,7 @@
 %<*cls>
 \hyphenation{Thu-Thesis}
 \def\thuthesis{ThuThesis}
-\def\version{6.0.2}
+\def\version{6.1.0}
 \RequirePackage{kvdefinekeys}
 \RequirePackage{kvsetkeys}
 \RequirePackage{kvoptions}
@@ -956,18 +1047,11 @@
   setkeys=\kvsetkeys}
 %    \end{macrocode}
 %
-% 用 \pkg{kvoptions} 的 \emph{key=value} 方式来设置论文类型。
-%    \begin{macrocode}
-\newcommand\thu at error[1]{%
-  \ClassError{thuthesis}{#1}{}%
-}
-%    \end{macrocode}
-%
 % \begin{macro}{\thusetup}
 % 提供一个 \cs{thusetup} 命令支持 \emph{key-value} 的方式来设置。
 %    \begin{macrocode}
-\newcommand\thusetup{%
-  \kvsetkeys{thu}%
+\newcommand\thusetup[1]{%
+  \kvsetkeys{thu}{#1}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -982,7 +1066,6 @@
 %         <choice2>,
 %       },
 %       default = <default>,
-%       code = <code>,
 %     },
 %   }
 % \end{latex}
@@ -1010,9 +1093,6 @@
   \kv at define@key{thu at value}{name}{%
     \@namedef{thu@#1@@name}{##1}%
   }%
-  \kv at define@key{thu at value}{code}{%
-    \@namedef{thu@#1@@code}{##1}%
-  }%
 %    \end{macrocode}
 %
 % 由于在定义接口时,\cs{thu@\meta{key}@@code} 不一定有定义,
@@ -1022,15 +1102,6 @@
 %    \begin{macrocode}
   \@namedef{thu@#1@@check}{}%
   \@namedef{thu@#1@@code}{}%
-  \@namedef{thu@#1@@hook}{%
-    \expandafter\ifx\csname\@currname.\@currext-h@@k\endcsname\relax
-      \@nameuse{thu@#1@@code}%
-    \else
-      \AtEndOfClass{%
-        \@nameuse{thu@#1@@code}%
-      }%
-    \fi
-  }%
 %    \end{macrocode}
 %
 % 保存下 |choices = {}| 定义的内容,在定义 \cs{thu@\meta{name}} 后再执行。
@@ -1084,7 +1155,6 @@
   \expandafter\let\csname thu@\@nameuse{thu@#1@@name}\endcsname\thu@@default
   \expandafter\ifx\csname thu@\@nameuse{thu@#1@@name}\endcsname\@empty\else
     \@nameuse{thu@#1@@check}%
-    \@nameuse{thu@#1@@hook}%
   \fi
 %    \end{macrocode}
 %
@@ -1094,7 +1164,7 @@
   \kv at define@key{thu}{#1}{%
     \@namedef{thu@\@nameuse{thu@#1@@name}}{##1}%
     \@nameuse{thu@#1@@check}%
-    \@nameuse{thu@#1@@hook}%
+    \@nameuse{thu@#1@@code}%
   }%
 }
 %    \end{macrocode}
@@ -1102,22 +1172,12 @@
 % 定义接口向 |key| 添加 |code|:
 %
 %    \begin{macrocode}
-\newcommand\thu at addto[2]{%
+\newcommand\thu at option@hook[2]{%
   \expandafter\g at addto@macro\csname thu@#1@@code\endcsname{#2}%
 }
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\newif\ifthu at degree@graduate
-\newcommand\thu at set@graduate{%
-  \thu at degree@graduatefalse
-  \ifthu at degree@doctor
-    \thu at degree@graduatetrue
-  \fi
-  \ifthu at degree@master
-    \thu at degree@graduatetrue
-  \fi
-}
 \thu at define@key{
   degree = {
     choices = {
@@ -1127,7 +1187,6 @@
       postdoc,
     },
     default = doctor,
-    code = {\thu at set@graduate},
   },
   degree-type = {
     choices = {
@@ -1138,7 +1197,7 @@
   },
 %    \end{macrocode}
 %
-% 论文是否使用英文。
+% 论文的主要语言。
 %    \begin{macrocode}
   language = {
     choices = {
@@ -1146,9 +1205,87 @@
       english,
     },
   },
+%    \end{macrocode}
+%
+% 字体
+%    \begin{macrocode}
+  fontset = {
+    choices = {
+      windows,
+      mac,
+      ubuntu,
+      fandol,
+      none,
+    },
+    default = none,
+  },
+  system = {
+    choices = {
+      mac,
+      unix,
+      windows,
+      auto,
+    },
+    default = auto,
+  },
+  font = {
+    choices = {
+      times,
+      termes,
+      xits,
+      libertinus,
+      lm,
+      auto,
+      none,
+    },
+    default = auto,
+  },
+  cjk-font = {
+    name = cjk at font,
+    choices = {
+      windows,
+      mac,
+      noto,
+      fandol,
+      auto,
+      none,
+    },
+    default = auto,
+  },
+  math-font = {
+    name = math at font,
+    choices = {
+      xits,
+      stix,
+      libertinus,
+      lm,
+      none,
+    },
+    default = xits,
+  },
 }
+\newif\ifthu at degree@graduate
+\newcommand\thu at set@graduate{%
+  \thu at degree@graduatefalse
+  \ifthu at degree@doctor
+    \thu at degree@graduatetrue
+  \fi
+  \ifthu at degree@master
+    \thu at degree@graduatetrue
+  \fi
+}
+\thu at set@graduate
+\thu at option@hook{degree}{%
+  \thu at set@graduate
+}
 %    \end{macrocode}
 %
+% 设置默认 \option{openany}。
+%    \begin{macrocode}
+\DeclareBoolOption[false]{openright}
+\DeclareComplementaryOption{openany}{openright}
+%    \end{macrocode}
+%
 % \option{raggedbottom} 选项(默认打开)
 %    \begin{macrocode}
 \DeclareBoolOption[true]{raggedbottom}
@@ -1164,10 +1301,19 @@
 \ProcessKeyvalOptions*
 %    \end{macrocode}
 %
+% 设置默认 \option{openany}。
+%    \begin{macrocode}
+\ifthu at openright
+  \PassOptionsToClass{openright}{book}
+\else
+  \PassOptionsToClass{openany}{book}
+\fi
+%    \end{macrocode}
+%
 % 使用 \pkg{ctexbook} 类,优于调用 \pkg{ctex} 宏包。
 %    \begin{macrocode}
 \PassOptionsToPackage{quiet}{xeCJK}
-\LoadClass[a4paper,openany,UTF8,zihao=-4,scheme=plain]{ctexbook}
+\LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01]
 %    \end{macrocode}
 %
 %
@@ -1180,6 +1326,24 @@
 \RequirePackage{xparse}
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\RequirePackage{geometry}%
+%    \end{macrocode}
+%
+% 利用 \pkg{fancyhdr} 设置页眉页脚。
+%    \begin{macrocode}
+\RequirePackage{fancyhdr}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\RequirePackage{titletoc}
+%    \end{macrocode}
+%
+% 利用 \pkg{notoccite} 避免目录中引用编号混乱。
+%    \begin{macrocode}
+\RequirePackage{notoccite}
+%    \end{macrocode}
+%
 % \AmSTeX\ 宏包,用来排出更加漂亮的公式。
 %    \begin{macrocode}
 \RequirePackage{amsmath}
@@ -1250,21 +1414,22 @@
 \RequirePackage{url}
 %    \end{macrocode}
 %
-% 设置 url 样式,与上下文一致
+% 对冲突的宏包报错。
 %    \begin{macrocode}
-\urlstyle{same}
-%    \end{macrocode}
-%
-% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。
-%    \begin{macrocode}
-\g at addto@macro\UrlBreaks{%
-  \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
-  \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
-  \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
-  \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
-  \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
+\RequirePackage{filehook}
+\newcommand\thu at package@conflict[2]{
+  \AtBeginOfPackageFile*{#2}{
+    \thu at error{The "#2" package is incompatible with required "#1"}
+  }
 }
-\Urlmuskip=0mu plus 0.1mu
+\thu at package@conflict{unicode-math}{amscd}
+\thu at package@conflict{unicode-math}{amsfonts}
+\thu at package@conflict{unicode-math}{amssymb}
+\thu at package@conflict{unicode-math}{bbm}
+\thu at package@conflict{unicode-math}{bm}
+\thu at package@conflict{unicode-math}{eucal}
+\thu at package@conflict{unicode-math}{eufrak}
+\thu at package@conflict{unicode-math}{mathrsfs}
 %    \end{macrocode}
 %
 %
@@ -1281,10 +1446,10 @@
 % 页眉距边界:1.5 厘米,页脚距边界:1.75 厘米。
 %
 %    \begin{macrocode}
-\RequirePackage{geometry}
 \geometry{
   a4paper, % 210 * 297mm
-  nomarginpar,
+  marginparwidth = 2cm,
+  marginparsep = 0.5cm
 }
 \ifthu at degree@bachelor
   \geometry{
@@ -1306,16 +1471,6 @@
 \fi
 %    \end{macrocode}
 %
-% 利用 \pkg{fancyhdr} 设置页眉页脚。
-%    \begin{macrocode}
-\RequirePackage{fancyhdr}
-%    \end{macrocode}
-%
-% 利用 \pkg{notoccite} 避免目录中引用编号混乱。
-%    \begin{macrocode}
-\RequirePackage{notoccite}
-%    \end{macrocode}
-%
 % \subsection{主文档格式}
 % \label{sec:mainbody}
 %
@@ -1337,18 +1492,18 @@
 % 我们的单面和双面模式与常规的不太一样。
 %    \begin{macrocode}
 \renewcommand\frontmatter{%
-  \if at openright\cleardoublepage\else\clearpage\fi
-  \@mainmatterfalse
+  \cleardoublepage
   \ifthu at degree@bachelor
     \pagestyle{thu at plain}
   \else
     \pagestyle{thu at headings}
   \fi
+  \@mainmatterfalse
   \pagenumbering{Roman}%
   \let\@tabular\thu at tabular
 }
 \renewcommand\mainmatter{%
-  \if at openright\cleardoublepage\else\clearpage\fi
+  \cleardoublepage
   \@mainmattertrue
   \pagenumbering{arabic}
   \ifthu at degree@bachelor\pagestyle{thu at plain}\else\pagestyle{thu at headings}\fi}
@@ -1364,39 +1519,214 @@
 % \label{sec:font}
 % 使用 \pkg{fontspec} 配置字体。
 %    \begin{macrocode}
-\newcommand\thu at fontset{\csname g__ctex_fontset_tl\endcsname}
-\ifthenelse{\equal{\thu at fontset}{fandol}}{
-  \setmainfont[
+\ifthu at fontset@mac
+  \thusetup{
+    font     = times,
+    cjk-font = mac,
+  }
+\else
+  \ifthu at fontset@windows
+    \thusetup{
+      font     = times,
+      cjk-font = windows,
+    }
+  \else
+    \ifthu at fontset@fandol
+      \thusetup{
+        font     = termes,
+        cjk-font = fandol,
+      }
+    \else
+      \ifthu at fontset@ubuntu
+        \thusetup{
+          font     = termes,
+          cjk-font = noto,
+        }
+      \fi
+    \fi
+  \fi
+\fi
+%    \end{macrocode}
+%
+% 检测系统
+%    \begin{macrocode}
+\ifthu at system@auto
+  \IfFileExists{/System/Library/Fonts/Menlo.ttc}{
+    \thusetup{system = mac}
+  }{
+    \IfFileExists{/dev/null}{
+      \IfFileExists{null:}{
+        \thusetup{system = windows}
+      }{
+        \thusetup{system = unix}
+      }
+    }{
+      \thusetup{system = windows}
+    }
+  }
+\fi
+%    \end{macrocode}
+%
+% XITS 字体于 2018-10-03 更改了字体的文件名,所以需要判断。
+% 原文件名为 \file{xits-regular.otf}、\file{xits-math.otf} 等,
+% 后改为 \file{XITS-Regular.otf}、\file{XITSMath-Regular.otf} 等。
+%
+% Libertinus 字体同样。
+%    \begin{macrocode}
+\let\thu at font@family at xits\@empty
+\newcommand\thu at set@xits at names{%
+  \ifx\thu at font@family at xits\@empty
+    \IfFontExistsTF{XITSMath-Regular.otf}{%
+      \gdef\thu at font@family at xits{XITS}%
+      \gdef\thu at font@style at xits@rm{Regular}%
+      \gdef\thu at font@style at xits@bf{Bold}%
+      \gdef\thu at font@style at xits@it{Italic}%
+      \gdef\thu at font@style at xits@bfit{BoldItalic}%
+      \gdef\thu at font@name at xits@math at rm{XITSMath-Regular}%
+      \gdef\thu at font@name at xits@math at bf{XITSMath-Bold}%
+    }{%
+      \gdef\thu at font@family at xits{xits}%
+      \gdef\thu at font@style at xits@rm{regular}%
+      \gdef\thu at font@style at xits@bf{bold}%
+      \gdef\thu at font@style at xits@it{italic}%
+      \gdef\thu at font@style at xits@bfit{bolditalic}%
+      \gdef\thu at font@name at xits@math at rm{xits-math}%
+      \gdef\thu at font@name at xits@math at bf{xits-mathbold}%
+    }%
+  \fi
+}
+\let\thu at font@family at libertinus\@empty
+\newcommand\thu at set@libertinus at names{%
+  \ifx\thu at font@family at libertinus\@empty
+    \IfFontExistsTF{LibertinusSerif-Regular.otf}{%
+      \gdef\thu at font@family at libertinus@serif{LibertinusSerif}%
+      \gdef\thu at font@family at libertinus@sans{LibertinusSans}%
+      \gdef\thu at font@name at libertinus@math{LibertinusMath-Regular}%
+      \gdef\thu at font@style at libertinus@rm{Regular}%
+      \gdef\thu at font@style at libertinus@bf{Bold}%
+      \gdef\thu at font@style at libertinus@it{Italic}%
+      \gdef\thu at font@style at libertinus@bfit{BoldItalic}%
+    }{%
+      \gdef\thu at font@family at libertinus@serif{libertinusserif}%
+      \gdef\thu at font@family at libertinus@sans{libertinussans}%
+      \gdef\thu at font@name at libertinus@math{libertinusmath-regular}%
+      \gdef\thu at font@style at libertinus@rm{regular}%
+      \gdef\thu at font@style at libertinus@bf{bold}%
+      \gdef\thu at font@style at libertinus@it{italic}%
+      \gdef\thu at font@style at libertinus@bfit{bolditalic}%
+    }%
+  \fi
+}
+%    \end{macrocode}
+%
+% 《撰写手册》要求西文字体使用 Times New Roman 和 Arial,
+% 但是在 Linux 下没有这两个字体,所以使用它们的克隆版 TeX Gyre Termes 和
+% TeX Gyre Heros。
+%    \begin{macrocode}
+\ifthu at font@auto
+  \ifthu at system@unix
+    \thusetup{font=termes}
+  \else
+    \thusetup{font=times}
+  \fi
+\fi
+\newcommand\thu at load@font at times{%
+  \setmainfont{Times New Roman}%
+  \setsansfont{Arial}%
+  \ifthu at system@mac
+    \setmonofont{Menlo}[Scale = MatchLowercase]%
+  \else
+    \setmonofont{Courier New}[Scale = MatchLowercase]%
+  \fi
+}
+\newcommand\thu at load@font at termes{%
+  \setmainfont{texgyretermes}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-  ]{texgyretermes}
-  \setsansfont[
+  ]%
+  \thu at load@texgyre at sans@mono
+}
+\newcommand\thu at load@texgyre at sans@mono{%
+  \setsansfont{texgyreheros}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-  ]{texgyreheros}
-  \setmonofont[
+  ]%
+  \setmonofont{texgyrecursor}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-    Scale          = MatchLowercase,
-  ]{texgyrecursor}
-}{
-  \setmainfont{Times New Roman}
-  \setsansfont{Arial}
-  \ifthenelse{\equal{\thu at fontset}{mac}}{
-    \setmonofont[Scale=MatchLowercase]{Menlo}
-  }{
-    \setmonofont[Scale=MatchLowercase]{Courier New}
-  }
+  ]%
 }
+\newcommand\thu at load@font at xits{%
+  \thu at set@xits at names
+  \setmainfont{\thu at font@family at xits}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at xits@rm,
+    BoldFont       = *-\thu at font@style at xits@bf,
+    ItalicFont     = *-\thu at font@style at xits@it,
+    BoldItalicFont = *-\thu at font@style at xits@bfit,
+  ]%
+  \thu at load@texgyre at sans@mono
+}
+\newcommand\thu at load@font at libertinus{%
+  \thu at set@libertinus at names
+  \setmainfont{\thu at font@family at libertinus@serif}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at libertinus@rm,
+    BoldFont       = *-\thu at font@style at libertinus@bf,
+    ItalicFont     = *-\thu at font@style at libertinus@it,
+    BoldItalicFont = *-\thu at font@style at libertinus@bfit,
+  ]%
+  \setsansfont{\thu at font@family at libertinus@sans}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at libertinus@rm,
+    BoldFont       = *-\thu at font@style at libertinus@bf,
+    ItalicFont     = *-\thu at font@style at libertinus@it,
+  ]%
+  \setmonofont{lmmonolt10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+}
+\@namedef{thu at load@font at lm}{%
+  \setmainfont{lmroman10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-italic,
+    BoldItalicFont = *-bolditalic,
+  ]%
+  \setsansfont{lmsans10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+  \setmonofont{lmmonolt10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+}
+\newcommand\thu at load@font{%
+  \@nameuse{thu at load@font@\thu at font}%
+}
+\thu at load@font
+\thu at option@hook{font}{\thu at load@font}
 %    \end{macrocode}
 %
 % 使用 \pkg{unicode-math} 配置数学字体
@@ -1407,59 +1737,177 @@
   nabla      = upright,
   partial    = upright,
 }
-\IfFontExistsTF{XITSMath-Regular.otf}{
-  \setmathfont[
+\newcommand\thu at load@math at font@xits{%
+  \thu at set@xits at names
+  \setmathfont{\thu at font@name at xits@math at rm}[
     Extension    = .otf,
-    BoldFont     = XITSMath-Bold,
+    BoldFont     = \thu at font@name at xits@math at bf,
     StylisticSet = 8,
-  ]{XITSMath-Regular}
-  \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf}
-}{
-  \setmathfont[
+  ]%
+  \setmathfont{\thu at font@name at xits@math at rm}[
     Extension    = .otf,
-    BoldFont     = *bold,
+    StylisticSet = 1,
+    range        = {cal,bfcal},
+  ]%
+}
+\newcommand\thu at load@math at font@stix{%
+  \setmathfont{STIX2Math}[
+    Extension    = .otf,
     StylisticSet = 8,
-  ]{xits-math}
-  \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf}
+  ]%
+  \setmathfont{STIX2Math}[
+    Extension    = .otf,
+    StylisticSet = 1,
+    range        = {cal,bfcal},
+  ]%
 }
+\newcommand\thu at load@math at font@libertinus{%
+  \thu at set@libertinus at names
+  \setmathfont{\thu at font@name at libertinus@math .otf}%
+}
+\newcommand\thu at load@math at font@lm{%
+  \setmathfont{latinmodern-math.otf}%
+}
+\newcommand\thu at load@math at font{%
+  \@nameuse{thu at load@math at font@\thu at math@font}
+}
+\thu at load@math at font
+\thu at option@hook{math-font}{\thu at load@math at font}
 %    \end{macrocode}
 %
-% 在使用 Windows Vista 或之后版本的系统时,\pkg{ctex} 宏包会默认使用微软雅黑字体,
-% 这可能会导致审查不合格。下面设置适合印刷的黑体,同时保持跨平台兼容性。
+% 中文字体
 %    \begin{macrocode}
-\ifthenelse{\equal{\thu at fontset}{windows}}{
+\ifthu at cjk@font at auto
+  \ifthu at system@mac
+    \thusetup{cjk-font = mac}
+  \else
+    \ifthu at system@windows
+      \thusetup{cjk-font = windows}
+    \else
+      \IfFontExistsTF{Noto Serif CJK SC}{
+        \thusetup{cjk-font = noto}
+      }{
+        \thusetup{cjk-font = fandol}
+      }
+    \fi
+  \fi
+\fi
+\newcommand\thu at load@cjk at font@windows{%
   \xeCJKsetup{EmboldenFactor=2}
-  \IfFileExists{C:/bootfont.bin}{
-    \setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi_GB2312]{SimSun}
-    \setCJKfamilyfont{zhkai}[AutoFakeBold]{KaiTi_GB2312}
-  }{
-    \setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi]{SimSun}
-    \setCJKfamilyfont{zhkai}[AutoFakeBold]{KaiTi}
-  }
-  \setCJKsansfont[AutoFakeBold]{SimHei}
-  \setCJKfamilyfont{zhsong}[AutoFakeBold]{SimSun}
-  \setCJKfamilyfont{zhhei}[AutoFakeBold]{SimHei}
-}{}
+  \setCJKmainfont{SimSun}[
+    AutoFakeBold = true,
+    ItalicFont   = KaiTi,
+  ]%
+  \setCJKsansfont{SimHei}[AutoFakeBold]%
+  \setCJKmonofont{FangSong}%
+  \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold]%
+  \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold]%
+  \setCJKfamilyfont{zhkai}{KaiTi}%
+  \setCJKfamilyfont{zhfs}{FangSong}%
+}
+\newcommand\thu at load@cjk at font@mac{%
+  \setCJKmainfont{Songti SC}[
+    UprightFont    = * Light,
+    BoldFont       = * Bold,
+    ItalicFont     = Kaiti SC,
+    BoldItalicFont = Kaiti SC Bold,
+  ]%
+  \setCJKsansfont{Heiti SC}[BoldFont=* Medium]%
+  \setCJKmonofont{STFangsong}
+  \setCJKfamilyfont{zhsong}{Songti SC}[
+    UprightFont = * Light,
+      BoldFont  = * Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{Heiti SC}[
+    UprightFont = * Light,
+    BoldFont    = * Medium,
+  ]%
+  \setCJKfamilyfont{zhfs}{STFangsong}%
+  \setCJKfamilyfont{zhkai}{Kaiti SC}[BoldFont = * Bold]%
+  \setCJKfamilyfont{zhli}{Baoli SC}%
+  \setCJKfamilyfont{zhyuan}{Yuanyi SC}[
+    UprightFont = * Light,
+    BoldFont    = * Bold,
+  ]%
+  \xeCJKsetwidth{‘’“”}{1em}%
+}
 %    \end{macrocode}
 %
-% 类似地,\pkg{ctex} 2.4.14 开始在 macOS 下自动调用苹方黑体,所以必进行调整。
+% 注意 Noto CJK 的 regular 字重名字不带“Regular”。
 %    \begin{macrocode}
-\ifthenelse{\equal{\thu at fontset}{mac}}{
-  \setCJKmainfont[
-         UprightFont = * Light,
-            BoldFont = * Bold,
-          ItalicFont = Kaiti SC,
-      BoldItalicFont = Kaiti SC Bold,
-    ]{Songti SC}
-  \setCJKsansfont[BoldFont=* Medium]{Heiti SC}
-  \setCJKfamilyfont{zhsong}[
-         UprightFont = * Light,
-            BoldFont = * Bold,
-    ]{Songti SC}
-  \setCJKfamilyfont{zhhei}[BoldFont=* Medium]{Heiti SC}
-  \setCJKfamilyfont{zhkai}[BoldFont=* Bold]{Kaiti SC}
-  \xeCJKsetwidth{‘’“”}{1em}
-}{}
+\newcommand\thu at load@cjk at font@noto{%
+  \setCJKmainfont{Noto Serif CJK SC}[
+    UprightFont    = * Light,
+    BoldFont       = * Bold,
+    ItalicFont     = FandolKai-Regular,
+    ItalicFeatures = {Extension = .otf},
+  ]%
+  \setCJKsansfont{Noto Sans CJK SC}[
+    BoldFont    = * Medium,
+  ]%
+  \setCJKmonofont{Noto Sans Mono CJK SC}%
+  \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[
+    UprightFont = * Light,
+    UprightFont = * Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[
+    BoldFont    = * Medium,
+  ]%
+  \setCJKfamilyfont{zhfs}{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhkai}{FandolKai}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+}
+\newcommand\thu at load@cjk at font@fandol{%
+  \setCJKmainfont{FandolSong}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+    ItalicFont  = FandolKai-Regular,
+  ]%
+  \setCJKsansfont{FandolHei}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKmonofont{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhsong}{FandolSong}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{FandolHei}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKfamilyfont{zhfs}{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhkai}{FandolKai}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+}
+\ifthu at cjk@font at none\else
+  \providecommand\songti{\CJKfamily{zhsong}}
+  \providecommand\heiti{\CJKfamily{zhhei}}
+  \providecommand\fangsong{\CJKfamily{zhfs}}
+  \providecommand\kaishu{\CJKfamily{zhkai}}
+\fi
+\newcommand\thu at load@cjk at font{%
+  \@nameuse{thu at load@cjk at font@\thu at cjk@font}%
+}
+\thu at load@cjk at font
+\thu at option@hook{cjk-font}{\thu at load@cjk at font}
 %    \end{macrocode}
 %
 % \begin{macro}{\normalsize}
@@ -1476,7 +1924,7 @@
 %
 % WORD 中的字号对应该关系如下(1bp = 72.27/72 pt):
 % \begin{center}
-% \begin{tabular}{llll}
+% \begin{longtable}{llll}
 % \toprule
 % 初号 & 42bp & 14.82mm & 42.1575pt \\
 % 小初 & 36bp & 12.70mm & 36.135 pt \\
@@ -1494,7 +1942,7 @@
 % 小六 & 6.5bp & 2.29mm & \\
 % 七号 & 5.5bp & 1.94mm & \\
 % 八号 & 5bp & 1.76mm & \\\bottomrule
-% \end{tabular}
+% \end{longtable}
 % \end{center}
 %
 % \begin{macro}{\thu at def@fontsize}
@@ -1571,6 +2019,134 @@
 %
 % \subsubsection{语言设置}
 %
+% 定义 \cs{thu at main@language},当在导言区修改 \option{language} 时,
+% 保存为论文的主要语言;
+% \cs{thu at reset@main at language} 则用于正文中恢复为主要语言。
+%    \begin{macrocode}
+\let\thu at main@language\thu at language
+\thu at option@hook{language}{%
+  \ifx\@begindocumenthook\@undefined
+    \let\thu at main@language\thu at language
+  \fi
+}
+\newcommand\thu at reset@main at language{
+  \thusetup{language = \thu at main@language}
+}
+%    \end{macrocode}
+%
+% 根据语言设置各章节的名称,只有在导言区设置 \option{degree} 和
+% \option{language} 时会修改,而在正文局部切换语言时则不变。
+%    \begin{macrocode}
+\newcommand\thu at set@chapter at names{%
+  \ifthu at language@chinese
+    \ctexset{
+      chapter/name   = {第,章},
+      appendixname   = 附录,
+      contentsname   = 目\hspace{\ccwd}录,
+      listfigurename = 插图索引,
+      listtablename  = 表格索引,
+      bibname        = 参考文献,
+      indexname      = 索引,
+    }%
+    \def\thu at denotation@name{主要符号对照表}%
+    \def\thu at list@algorithm at name{算法索引}%
+    \def\listequationname{公式索引}%
+    \def\thu at acknowledgements@name{致\hspace{\ccwd}谢}%
+    \ifthu at degree@bachelor
+      \def\thu at resume@name{在学期间参加课题的研究成果}%
+    \else
+      \ifthu at degree@postdoc
+        \def\thu at resume@name{个人简历、发表的学术论文与科研成果}%
+      \else
+        \def\thu at resume@name{个人简历、在学期间发表的学术论文与研究成果}%
+      \fi
+    \fi
+  \else
+    \ifthu at language@english
+      \ctexset{
+        chapter/name   = \chaptername\space,
+        appendixname   = Appendix,
+        contentsname   = Contents,
+        listfigurename = List of Figures,
+        listtablename  = List of Tables,
+        bibname        = Bibliography,
+        indexname      = Index,
+      }%
+      \def\thu at denotation@name{Nomenclature}%
+      \def\thu at list@algorithm at name{List of Algorithms}%
+      \def\listequationname{List of Equations}%
+      \def\thu at acknowledgements@name{Acknowledgements}%
+      \ifthu at degree@bachelor
+        \def\thu at resume@name{Research Achievements}%
+      \else
+        \def\thu at resume@name{Resume, Publications and Research Achievements}%
+      \fi
+    \fi
+  \fi
+}
+\thu at set@chapter at names
+\thu at option@hook{degree}{\thu at set@chapter at names}
+\thu at option@hook{language}{%
+  \ifx\@begindocumenthook\@undefined
+    \thu at set@chapter at names
+  \fi
+}
+%    \end{macrocode}
+%
+% 这部分名称在正文中局部地修改语言时会发生变化,比如英文摘要、
+% 本科生附录的阅读报告。
+%    \begin{macrocode}
+\newcommand\thu at set@names{%
+  \ifthu at language@chinese
+    \ctexset{
+      figurename = 图,
+      tablename  = 表,
+    }%
+    \def\thu at algorithm@name{算法}%
+    \def\thu at equation@name{公式}%
+    \def\thu at assumption@name{假设}%
+    \def\thu at definition@name{定义}%
+    \def\thu at proposition@name{命题}%
+    \def\thu at lemma@name{引理}%
+    \def\thu at theorem@name{定理}%
+    \def\thu at axiom@name{公理}%
+    \def\thu at corollary@name{推论}%
+    \def\thu at exercise@name{练习}%
+    \def\thu at example@name{例}%
+    \def\thu at remark@name{注释}%
+    \def\thu at problem@name{问题}%
+    \def\thu at conjecture@name{猜想}%
+    \def\thu at proof@name{证明}%
+    \def\thu at theorem@separator{:}%
+  \else
+    \ifthu at language@english
+      \ctexset{
+        figurename = {Figure},
+        tablename  = {Table},
+      }%
+      \def\thu at algorithm@name{Algorithm}%
+      \def\thu at equation@name{Equation}%
+      \def\thu at assumption@name{Assumption}%
+      \def\thu at definition@name{Definition}%
+      \def\thu at proposition@name{Proposition}%
+      \def\thu at lemma@name{Lemma}%
+      \def\thu at theorem@name{Theorem}%
+      \def\thu at axiom@name{Axiom}%
+      \def\thu at corollary@name{Corollary}%
+      \def\thu at exercise@name{Exercise}%
+      \def\thu at example@name{Example}%
+      \def\thu at remark@name{Remark}%
+      \def\thu at problem@name{Problem}%
+      \def\thu at conjecture@name{Conjecture}%
+      \def\thu at proof@name{Proof}%
+      \def\thu at theorem@separator{: }%
+    \fi
+  \fi
+}
+\thu at set@names
+\thu at option@hook{language}{\thu at set@names}
+%    \end{macrocode}
+%
 % \newcommand\unicodechar[1]{U+#1(\symbol{"#1})}
 % 由于 Unicode 的一些标点符号是中西文混用的:
 % \unicodechar{00B7}、
@@ -1585,95 +2161,27 @@
 % \unicodechar{2E3A},
 % 所以要根据语言设置正确的字体。
 % \footnote{\url{https://github.com/CTeX-org/ctex-kit/issues/389}}
-% 所以要根据语言设置正确的字体。
+% 此外切换语言时,有一部分名称是需要被重新定义的。
 %    \begin{macrocode}
-\newcommand\thu at setchinese{%
-  \xeCJKResetPunctClass
-}
-\newcommand\thu at setenglish{%
-  \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
-  \xeCJKDeclareCharClass{HalfRight}{
-    "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
-  }%
-}
-\newcommand\thu at setdefaultlanguage{%
+\newcommand\thu at set@punctuations{%
   \ifthu at language@chinese
-    \thu at setchinese
+    \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}%
+    \xeCJKDeclareCharClass{FullRight}{
+      "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+    }%
   \else
-    \thu at setenglish
+    \ifthu at language@english
+      \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
+      \xeCJKDeclareCharClass{HalfRight}{
+        "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+      }%
+    \fi
   \fi
 }
+\thu at set@punctuations
+\thu at option@hook{language}{\thu at set@punctuations}
 %    \end{macrocode}
 %
-% 中英文翻译:
-%    \begin{macrocode}
-\ifthu at language@chinese
-  \ctexset{
-    chapter/name   = {第,章},
-    appendixname   = 附录,
-    contentsname   = {目\hspace{\ccwd}录},
-    listfigurename = 插图索引,
-    listtablename  = 表格索引,
-    figurename     = 图,
-    tablename      = 表,
-    bibname        = 参考文献,
-    indexname      = 索引,
-  }
-  \newcommand\thu at denotation@name{主要符号对照表}
-  \newcommand\listequationname{公式索引}
-  \newcommand\equationname{公式}
-  \newcommand\thu at assumption@name{假设}
-  \newcommand\thu at definition@name{定义}
-  \newcommand\thu at proposition@name{命题}
-  \newcommand\thu at lemma@name{引理}
-  \newcommand\thu at theorem@name{定理}
-  \newcommand\thu at axiom@name{公理}
-  \newcommand\thu at corollary@name{推论}
-  \newcommand\thu at exercise@name{练习}
-  \newcommand\thu at example@name{例}
-  \newcommand\thu at remark@name{注释}
-  \newcommand\thu at problem@name{问题}
-  \newcommand\thu at conjecture@name{猜想}
-  \newcommand\thu at proof@name{证明}
-  \newcommand\thu at theorem@separator{:}
-  \newcommand\thu at ack@name{致\hspace{\ccwd}谢}
-  \ifthu at degree@bachelor
-    \newcommand\thu at resume@title{在学期间参加课题的研究成果}
-  \else
-    \ifthu at degree@postdoc
-      \newcommand\thu at resume@title{个人简历、发表的学术论文与科研成果}
-    \else
-      \newcommand\thu at resume@title{个人简历、在学期间发表的学术论文与研究成果}
-    \fi
-  \fi
-\else
-  \newcommand\thu at denotation@name{Nomenclature}
-  \newcommand\listequationname{List of Equations}
-  \newcommand\equationname{Equation}
-  \newcommand\thu at assumption@name{Assumption}
-  \newcommand\thu at definition@name{Definition}
-  \newcommand\thu at proposition@name{Proposition}
-  \newcommand\thu at lemma@name{Lemma}
-  \newcommand\thu at theorem@name{Theorem}
-  \newcommand\thu at axiom@name{Axiom}
-  \newcommand\thu at corollary@name{Corollary}
-  \newcommand\thu at exercise@name{Exercise}
-  \newcommand\thu at example@name{Example}
-  \newcommand\thu at remark@name{Remark}
-  \newcommand\thu at problem@name{Problem}
-  \newcommand\thu at conjecture@name{Conjecture}
-  \newcommand\thu at proof@name{proof}
-  \newcommand\thu at theorem@separator{: }
-  \newcommand\thu at ack@name{Acknowledgements}
-  \ifthu at degree@bachelor
-    \newcommand\thu at resume@title{Research Achievements}
-  \else
-    \newcommand\thu at resume@title{Resume, Publications and Research Achievements}
-  \fi
-\fi
-%    \end{macrocode}
-%
-%
 % \subsubsection{页眉页脚}
 % \label{sec:headerfooter}
 %
@@ -1734,25 +2242,14 @@
 % \begin{macro}{\thu at textcircled}
 % 生成带圈的脚注数字,最多处理到 10。
 %    \begin{macrocode}
-\ifthenelse{\equal{\thu at fontset}{mac}}{
-  \newfontfamily\thu at circlefont{Songti SC Light}
-}{
-  \ifthenelse{\equal{\thu at fontset}{windows}}{
-    \newfontfamily\thu at circlefont{SimSun}
-  }{
-    \IfFontExistsTF{XITS-Regular.otf}{
-      \newfontfamily\thu at circlefont{XITS-Regular.otf}
-    }{
-      \newfontfamily\thu at circlefont{xits-regular.otf}
-    }
-  }
-}
 \def\thu at textcircled#1{%
-  \ifnum\value{#1} >9%
-    \ClassError{thuthesis}%
-      {Too many footnotes in this page.}{Keep footnote less than 10.}%
+  \ifnum\value{#1} >10\relax
+    \thu at error{%
+      Too many footnotes in this page.
+      Keep footnote less than 10%
+    }%
   \fi
-  {\thu at circlefont\symbol{\the\numexpr\value{#1}+"245F\relax}}%
+  {\CJKfamily+{}\symbol{\the\numexpr\value{#1}+"245F\relax}}%
 }
 \renewcommand{\thefootnote}{\thu at textcircled{footnote}}
 \renewcommand{\thempfootnote}{\thu at textcircled{mpfootnote}}
@@ -1776,15 +2273,40 @@
 \apptocmd{\@makefntext}{\let\@makefnmark\thu at makefnmark}{}{}
 %    \end{macrocode}
 %
+% 设置 url 样式,与上下文一致
+%    \begin{macrocode}
+\urlstyle{same}
+%    \end{macrocode}
 %
+% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。
+%    \begin{macrocode}
+\g at addto@macro\UrlBreaks{%
+  \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
+  \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
+  \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
+  \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
+  \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
+}
+\Urlmuskip=0mu plus 0.1mu
+%    \end{macrocode}
+%
+%
 % \subsubsection{数学相关}
 % \label{sec:equation}
 % \begin{macro}{\ldots}
 % 省略号一律居中,所以 \cs{ldots} 不再居于底部。
 %    \begin{macrocode}
-\ifthu at language@chinese
-  \def\mathellipsis{\cdots}
-\fi
+\newcommand\thu at set@math at ellipsis{%
+  \ifthu at language@chinese
+    \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}%
+  \else
+    \ifthu at language@english
+      \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}%
+    \fi
+  \fi
+}
+\thu at set@math at ellipsis
+\thu at option@hook{language}{\thu at set@math at ellipsis}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1845,8 +2367,8 @@
 % \begin{macro}{\boldsymbol}
 % 兼容旧的粗体命令:\pkg{bm} 的 \cs{bm} 和 \pkg{amsmath} 的 \cs{boldsymbol}。
 %    \begin{macrocode}
-\newcommand\bm{\symbf}
-\renewcommand\boldsymbol{\symbf}
+\DeclareRobustCommand\bm[1]{{\symbf{#1}}}
+\DeclareRobustCommand\boldsymbol[1]{{\symbf{#1}}}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1890,9 +2412,9 @@
 \iffalse
 \ifthu at degree@bachelor
   \def\thu at maketag#1{\maketag@@@{%
-    (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)}}
+    (\ignorespaces\text{\thu at equation@name\hskip0.5em}#1\unskip\@@italiccorr)}}
   \def\tagform@#1{\maketag@@@{%
-    (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
+    (\ignorespaces\text{\thu at equation@name\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
 \fi
 \fi
 \def\thu at maketag#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)}}
@@ -1907,9 +2429,9 @@
 % \label{sec:float}
 % 设置浮动对象和文字之间的距离
 %    \begin{macrocode}
-\setlength{\floatsep}{12bp \@plus 2bp \@minus 4bp}
-\setlength{\textfloatsep}{12bp}
-\setlength{\intextsep}{12bp}
+\setlength{\floatsep}{6bp}
+\setlength{\textfloatsep}{6bp}
+\setlength{\intextsep}{6bp}
 \setlength{\@fptop}{0bp \@plus1.0fil}
 \setlength{\@fpsep}{12bp \@plus2.0fil}
 \setlength{\@fpbot}{0bp \@plus1.0fil}
@@ -1924,26 +2446,35 @@
 \renewcommand{\floatpagefraction}{0.60}
 %    \end{macrocode}
 %
-% 定制浮动图形和表格标题样式
+% 定制浮动图形和表格标题样式,以及改变附录中浮动体的编号规则:
 % \begin{itemize}
 %   \item 图表标题字体为 11pt, 这里写作大五号
-%   \item 去掉图表号后面的冒号。图序与图名文字之间空一个汉字符宽度。
+%   \item 去掉图表号后面的冒号,图序与图名文字之间空一个汉字符宽度
+%   \item 本科生附录中的各种浮动体需要编号为类似 A-1 的形式
 %   \item 图:caption 在下,段前空 6 磅,段后空 12 磅
 %   \item 表:caption 在上,段前空 12 磅,段后空 6 磅
 % \end{itemize}
 %    \begin{macrocode}
 \ifthu at degree@bachelor
-  \g at addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
-  \g at addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+  \AtBeginDocument{% delay the check until all packages are loaded
+    \g at addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
+    \g at addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+  }
 \fi
+%    \end{macrocode}
+%
+% 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距,段前空 3 磅,段后空 3 磅。
+%    \begin{macrocode}
 \let\old at tabular\@tabular
 \def\thu at tabular{\dawu[1.5]\old at tabular}
-\DeclareCaptionFont{thu}{\dawu[1.3]}
+\DeclareCaptionFont{thu}{\dawu}
 \DeclareCaptionLabelSeparator{thu}{\hspace{\ccwd}}
 \captionsetup{
+  format         = hang,
   font           = thu,
   labelsep       = thu,
-  skip           = 6bp,
+  aboveskip      = 6bp,
+  belowskip      = 6bp,
   figureposition = bottom,
   tableposition  = top,
 }
@@ -1953,6 +2484,14 @@
 % \renewcommand{\p at subfigure}{:}
 %    \end{macrocode}
 %
+% 研究生和本科生都推荐使用三线表,并且要求表的上、下边线为单直线,线粗为 1.5 磅;
+% 第三条线为单直线,线粗为 1 磅。
+% 这里设置 \pkg{booktabs} 线粗的默认值。
+%    \begin{macrocode}
+\heavyrulewidth=1.5bp
+\lightrulewidth=1bp
+%    \end{macrocode}
+%
 % \begin{macro}{\hlinewd}
 % 简单的表格使用三线表推荐用 \cs{hlinewd}。如果表格比较复杂还是用 \pkg{booktabs} 的命
 % 令好一些。
@@ -1968,11 +2507,11 @@
 % \label{sec:theor}
 %    \begin{macrocode}
 \ifthu at degree@bachelor
-  \newcommand{\cabstractname}{中文摘要}
-  \newcommand{\eabstractname}{ABSTRACT}
+  \newcommand{\thu at abstract@name}{中文摘要}
+  \newcommand{\thu at abstract@name at en}{ABSTRACT}
 \else
-  \newcommand{\cabstractname}{摘\hspace{\ccwd}要}
-  \newcommand{\eabstractname}{Abstract}
+  \newcommand{\thu at abstract@name}{摘\hspace{\ccwd}要}
+  \newcommand{\thu at abstract@name at en}{Abstract}
 \fi
 %    \end{macrocode}
 %
@@ -2027,7 +2566,7 @@
 \newcommand\thu at chapter@titleformat[1]{%
   \ifthu at degree@bachelor #1\else%
     \ifthenelse%
-      {\equal{#1}{\eabstractname}}%
+      {\equal{#1}{\thu at abstract@name at en}}%
       {\bfseries #1}%
       {#1}%
   \fi}
@@ -2084,7 +2623,7 @@
 \newcommand\thu at phantomsection{}
 \NewDocumentCommand\thu at chapter{s o m o}{
   \IfBooleanF{#1}{%
-    \ClassError{thuthesis}{You have to use the star form: \string\thu at chapter*}{}
+    \thu at error{You have to use the star form: \string\thu at chapter*}%
   }%
   \if at openright\cleardoublepage\else\clearpage\fi%
   \IfValueTF{#2}{%
@@ -2124,58 +2663,86 @@
 \setcounter{tocdepth}{2}
 %    \end{macrocode}
 %
-% 每章标题行前空 6 磅,后空 0 磅。章节名中英文用 Arial 字体,页码仍用 Times。
 % \begin{macro}{\tableofcontents}
 % 目录生成命令。
 %    \begin{macrocode}
 \renewcommand\tableofcontents{%
-  \thu at chapter*[]{\contentsname}
-  \ifthu at degree@bachelor\xiaosi[1.667]\else\xiaosi[1.65]\fi\@starttoc{toc}\normalsize}
+  \thu at chapter*[]{\contentsname}%
+  \@starttoc{toc}%
+}
+\thu at define@key{
+  toc-chapter-style = {
+    name = toc at chapter@style,
+    choices = {
+      arial,
+      times,
+    },
+    default = arial,
+  },
+}
+\newcommand\thu at leaders{\titlerule*[4bp]{.}}
+\newcommand\thu at set@toc at format{%
+  \contentsmargin{\z@}%
 %    \end{macrocode}
-% 调整目录样式,允许指定目录字体。
+%
+% 本科生:
+% 目录从第 1 章开始,每章标题用黑体小四号字,行间距为 20pt,
+% 行前空 6pt,行后空 0pt。
+% 其它级节标题用宋体小四字,行间距为 20pt。
+%
+% 注意示例中章标题的字母和数字是衬线体,所以这里用 \cs{heiti}。
+% 示例中的一级和二级节标题分别缩进 1 和 1.5 个汉字符。
 %    \begin{macrocode}
-\def\@pnumwidth{2em}
-\def\@tocrmarg{\@pnumwidth}
-\def\@dotsep{1}
-\renewcommand*\l at chapter[2]{%
-  \ifnum \c at tocdepth >\m at ne
-    \addpenalty{-\@highpenalty}%
-    \ifthu at degree@bachelor\vskip 6bp\else\vskip 4bp\fi \@plus\p@
-    \setlength\@tempdima{4em}%
-    \begingroup
-      \parindent \z@ \rightskip \@pnumwidth
-      \parfillskip -\@pnumwidth
-      \leavevmode
-      \advance\leftskip\@tempdima
-      \hskip -\leftskip
-      \begingroup
-        \ifthu at degree@graduate
+  \ifthu at degree@bachelor
+    \titlecontents{chapter}
+      [\z@]{\addvspace{6bp}
+        \ifthu at toc@chapter at style@arial
           \sffamily
         \else
-          \ifthu at degree@bachelor
-            \heiti
-          \fi
+          \heiti
         \fi
-        #1%
-      \endgroup
-      \leaders\hbox{$\m at th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill%
-      \nobreak #2\par
-      \penalty\@highpenalty
-    \endgroup
-  \fi}
+      }
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\rmfamily\thu at leaders\thecontentspage}%
+    \titlecontents{section}
+      [1\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+    \titlecontents{subsection}
+      [1.5\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
 %    \end{macrocode}
 %
-% 研究生学位论文写作指南中规定:目录中的章标题行居左书写,一级节标题行缩进 1 个
-% 汉字符,二级节标题行缩进 2 个汉字符(但示例文件中为 1.5 个汉字符)。本科生指
-% 南中未作明确规定,示例文件中对于一级和二级节标题分别缩进 1 和 1.5 个汉字符。
+% 研究生:
+% \begin{enumerate}
+%   \item 目录中的章标题行采用黑体小四号字,固定行距 20 磅,段前空 6 磅,
+%     段后 0 磅;其他内容采用宋体小四号字,行距为固定值 20 磅,
+%     段前、段后均为 0 磅。
+%   \item 目录中的章标题行居左书写,一级节标题行缩进 1 个汉字符,
+%     二级节标题行缩进 2 个汉字符。
+% \end{enumerate}
+%
+% 注意示例中章标题的字母和数字是无衬线体,所以用这里用 \cs{sffamily},
+% 但是页码仍然用 \cs{rmfamily}。
 %    \begin{macrocode}
-\patchcmd{\@dottedtocline}{\hb at xt@\@pnumwidth}{\hbox}{}{}
-\renewcommand*\l at section{%
-  \@dottedtocline{1}{\ccwd}{2.1em}}
-\renewcommand*\l at subsection{%
-  \@dottedtocline{2}{\ifthu at degree@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}}
-\renewcommand*\l at subsubsection{%
-  \@dottedtocline{3}{\ifthu at degree@bachelor 2.4em\else 3.5em\fi}{3.8em}}
+  \else
+    \titlecontents{chapter}
+      [\z@]{\addvspace{6bp}\sffamily}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\rmfamily\thu at leaders\thecontentspage}%
+    \titlecontents{section}
+      [1\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+    \titlecontents{subsection}
+      [2\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+  \fi
+}
+\thu at set@toc at format
+\thu at option@hook{degree}{\thu at set@toc at format}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -2533,54 +3100,88 @@
 %    \begin{macrocode}
 \newcommand\thu at titlepage@info{%
   \ifthu at degree@doctor
-    \thu at titlepage@info at doctor
+    \ifthu at degree@type at academic
+      \thu at titlepage@info at doctor@academic
+    \else
+      \thu at titlepage@info at doctor@professional
+    \fi
   \else
-    \thu at titlepage@info at master
+    \ifthu at degree@type at academic
+      \thu at titlepage@info at master@academic
+    \else
+      \ifx\thu at discipline\@empty
+        \thu at titlepage@info at master@other
+      \else
+        \thu at titlepage@info at master@engineer
+      \fi
+    \fi
   \fi
 }
-\newcommand\thu at cover@info at tabular[4]{%
-  \def\thu at cover@item##1##2##3{%
+%    \end{macrocode}
+%
+% 标题页作者信息表
+%    \begin{macrocode}
+\newcommand\thu at titlepage@info at tabular[4]{%
+  \def\thu at info@item##1##2##3{%
     \ifx##3\@empty\else
-      \thu at pad{#2}{\thu at fixed@box{#1}{##1}}%
+      \thu at pad{#1}{\thu at fixed@box{#2}{##1}}%
       \thu at pad{#3}{:}%
       ##2{##3}\\
     \fi
   }%
+  \fangsong\sanhao[1.95]%
   \begin{tabular}{l}%
     #4%
-  \end{tabular}
+  \end{tabular}%
 }
-\newcommand\thu at titlepage@info at doctor{%
-  \fangsong\sanhao[1.95]%
-  \thu at cover@info at tabular{2.8cm}{2.8cm}{0.82cm}{%
-    \thu at cover@item{培养单位}{}{\thu at department}%
-    \ifthu at degree@type at academic
-      \thu at cover@item{学科}{}{\thu at discipline}%
-      \thu at cover@item{研究生}{\thu at name@title}{\thu at author}%
-    \else
-      \thu at cover@item{申请人}{\thu at name@title}{\thu at author}%
-    \fi
-    \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-    \thu at cover@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    \thu at cover@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
+\newcommand\thu at titlepage@info at doctor@academic{%
+  \thu at titlepage@info at tabular{2.8cm}{2.8cm}{0.82cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{学科}{}{\thu at discipline}%
+    \thu at info@item{研究生}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
   }\par
 }
-\newcommand\thu at titlepage@info at master{%
-  \fangsong\sanhao[1.95]%
-  \thu at cover@info at tabular{5.5em}{3.6cm}{0.82cm}{%
-    \thu at cover@item{培养单位}{}{\thu at department}%
-    \ifthu at degree@type at academic
-      \thu at cover@item{学科}{}{\thu at discipline}%
-      \thu at cover@item{研究生}{\thu at name@title}{\thu at author}%
-    \else
-      \thu at cover@item{工程领域}{}{\thu at discipline}%
-      \thu at cover@item{申请人}{\thu at name@title}{\thu at author}%
-    \fi
-    \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-    \thu at cover@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    \thu at cover@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+\newcommand\thu at titlepage@info at doctor@professional{%
+  \thu at titlepage@info at tabular{3.03cm}{5em}{1.52cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
   }\par
 }
+\newcommand\thu at titlepage@info at master@academic{%
+  \thu at titlepage@info at tabular{3.59cm}{5.5em}{0.82cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{学科}{}{\thu at discipline}%
+    \thu at info@item{研究生}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
+\newcommand\thu at titlepage@info at master@engineer{%
+  \thu at titlepage@info at tabular{2.8cm}{2.8cm}{1.34cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{工程领域}{}{\thu at discipline}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
+\newcommand\thu at titlepage@info at master@other{%
+  \thu at titlepage@info at tabular{3.28cm}{5em}{1.52cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
 %    \end{macrocode}
 %
 % 论文成文打印的日期,用三号宋体汉字,字距延伸 0.5bp,
@@ -2708,6 +3309,15 @@
 % \end{macro}
 %
 % \myentry{本科生封面}
+% 本科生封面要求:
+% \begin{itemize}
+%   \item 题目:1 号黑体字,1.2 倍行距。
+%   \item 系别、专业、姓名及指导教师信息部分使用三号仿宋\_GB2312 字。
+%   \item 论文成文打印的日期用阿拉伯数字,采用小四号宋体。
+%   \item 涉密的论文在封面右上角处注明论文密级,采用小四号宋体。
+% \end{itemize}
+%
+% 外文系英语专业要求题目先写中文标题,再写英文标题,字号 26pt,32 磅行距。
 %    \begin{macrocode}
 \newcommand\thu at titlepage@bachelor{%
   \newgeometry{
@@ -2746,25 +3356,34 @@
       \CJKunderline[skip=false, thickness=0.05em, depth=0.12em]{\thu at title}\par
     }\par
     \vskip 2.5cm%
-    \parbox[t][6.0cm][t]{\textwidth}{%
+    \begingroup
       \fangsong\sanhao[2.3]%
       \leftskip=2.5cm%
       \parindent=\z@
-      \def\thu at cover@item##1##2##3{%
+      \def\thu at info@item##1##2##3{%
         \ifx##3\@empty\else
-          \thu at fixed@box{4em}{##1}:##2{##3}\\
+          \thu at fixed@box{%
+            \ifx\thu at joint@supervisor\@empty
+              4em%
+            \else
+              5.5em%
+            \fi
+          }{##1}:##2{##3}\\
         \fi
       }%
       \def\thu at name@title at format##1##2{%
         \thu at stretch{3em}{##1}\quad ##2%
       }
-      \thu at cover@item{系别}{}{\thu at department}%
-      \thu at cover@item{专业}{}{\thu at discipline}%
-      \thu at cover@item{姓名}{\thu at name@title}{\thu at author}%
-      \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-      \thu at cover@item{辅导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    }\par
-    {\xiaosi\thu at format@date{\thu at date@zh at digit}{\thu at date}\par}%
+      \thu at info@item{系别}{}{\thu at department}%
+      \thu at info@item{专业}{}{\thu at discipline}%
+      \thu at info@item{姓名}{\thu at name@title}{\thu at author}%
+      \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+      \thu at info@item{辅导教师}{\thu at name@title}{\thu at associate@supervisor}%
+      \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+      \par
+    \endgroup
+    \vskip 1.5cm%
+    {\CJKfamily+{}\xiaosi\thu at format@date{\thu at date@zh at digit}{\thu at date}\par}%
   \endgroup
   \clearpage
   \restoregeometry
@@ -2876,7 +3495,7 @@
   日\ifthu at degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:}
 \newcommand\copyrightpage[1][]{%
   \ifthu at degree@postdoc\relax\else
-    \ifthu at degree@bachelor\clearpage\else\cleardoublepage\fi%
+    \cleardoublepage
     \def\thu@@tmp{#1}
     \ifx\thu@@tmp\@empty
       \ifthu at degree@bachelor\thu at authorization@mk\else%
@@ -2936,7 +3555,7 @@
 }
 \newcommand\thu at clist@use[2]{%
   \def\thu@@tmp{}%
-  \kv at set@family at handler{thu at clist}{%
+  \def\thu at clist@processor##1{%
     \ifx\thu@@tmp\@empty
       \def\thu@@tmp{#2}%
     \else
@@ -2944,7 +3563,7 @@
     \fi
     ##1%
   }%
-  \kvsetkeys at expandafter{thu at clist}{#1}%
+  \expandafter\comma at parse\expandafter{#1}{\thu at clist@processor}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2968,9 +3587,11 @@
 % 标点符号一律用中文输入状态下的标点符号。
 %    \begin{macrocode}
 \newenvironment{abstract}{%
-  \ifthu at degree@bachelor\clearpage\else\cleardoublepage\fi
-  \thu at setchinese
-  \thu at chapter*[]{\cabstractname} % no tocline
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thusetup{language = chinese}%
+  \thu at chapter*[]{\thu at abstract@name}%  %no tocline
 }{%
 %    \end{macrocode}
 %
@@ -2980,7 +3601,10 @@
   \thu at put@keywords{\textbf{关键词:}}{%
     \thu at clist@use{\thu at keywords}{;}%
   }%
-  \thu at setdefaultlanguage
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at reset@main at language % switch back to main language
 }
 %    \end{macrocode}
 % \end{environment}
@@ -2991,8 +3615,11 @@
 % 摘要内容用小四号 Times New Roman。
 %    \begin{macrocode}
 \newenvironment{abstract*}{%
-  \thu at setenglish
-  \thu at chapter*[]{\eabstractname} % no tocline
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thusetup{language = english}%
+  \thu at chapter*[]{\thu at abstract@name at en}%  no tocline
 }{%
   \ifthu at degree@doctor\vfill\else\vskip12bp\fi
   \thu at put@keywords{%
@@ -3000,7 +3627,10 @@
   }{%
     \thu at clist@use{\thu at keywords@en}{; }%
   }%
-  \thu at setdefaultlanguage
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at reset@main at language % switch back to main language
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3011,6 +3641,9 @@
 % 主要符号对照表。
 %    \begin{macrocode}
 \newenvironment{denotation}[1][2.5cm]{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
   \thu at chapter*[]{\thu at denotation@name} % no tocline
   \vskip-30bp\xiaosi[1.6]\begin{thu at denotation}[labelwidth=#1]
 }{%
@@ -3037,8 +3670,8 @@
 % \begin{environment}{acknowledgements}
 % 支持扫描文件替换。
 %    \begin{macrocode}
-\newcommand\thu at declarename{声\hspace{\ccwd}明}
-\newcommand{\thu at declaretext}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
+\newcommand\thu at statement@name{声\hspace{\ccwd}明}
+\newcommand{\thu at statement@text}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
   ,独立进行研究工作所取得的成果。尽我所知,除文中已经注明引用的内容外,本学位论
   文的研究成果不包含任何他人享有著作权的内容。对本论文所涉及的研究工作做出贡献的
   其他个人和集体,均已在文中以明确方式标明。}
@@ -3049,24 +3682,42 @@
 % 定义致谢与声明环境。
 %    \begin{macrocode}
 \newenvironment{acknowledgements}{%
-  \thu at chapter*{\thu at ack@name}%
-}{}
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at chapter*{\thu at acknowledgements@name}%
+}{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+}
 %    \end{macrocode}
 %
 % 声明部分
 %    \begin{macrocode}
 \newcommand\statement[1][]{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
   \def\thu@@tmp{#1}%
   \ifx\thu@@tmp\@empty
-    \thu at chapter*{\thu at declarename}%
-    \par{\xiaosi\parindent2em\thu at declaretext}\vskip2cm%
-    {\xiaosi\hfill\thu at signature\thu at underline[2.5cm]\relax
+    \thu at chapter*{\thu at statement@name}%
+    \thu at statement@text\par
+    \ifthu at degree@graduate
+      \vskip 2cm%
+    \else
+      \null\par
+    \fi
+    {\hfill\thu at signature\thu at underline[2.5cm]\relax
       \thu at backdate\thu at underline[2.5cm]\relax}%
   \else
     \includepdf[pagecommand={\thispagestyle{thu at empty}%
-      \addcontentsline{toc}{chapter}{\thu at declarename}%
+      \addcontentsline{toc}{chapter}{\thu at statement@name}%
     }]{#1}%
   \fi
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3085,21 +3736,38 @@
 % \begin{macro}{\listoftables*}
 % 定义图表以及公式目录样式。
 %    \begin{macrocode}
-\def\thu at starttoc#1{% #1: float type, prepend type name in \listof*** entry.
-  \let\oldnumberline\numberline
-  \def\numberline##1{\oldnumberline{\csname #1name\endcsname\hskip.4em ##1}}
-  \@starttoc{\csname ext@#1\endcsname}
-  \let\numberline\oldnumberline}
 \def\thu at listof#1{% #1: float type
   \setcounter{tocdepth}{2} % restore tocdepth in case being modified
   \@ifstar
-    {\thu at chapter*[]{\csname list#1name\endcsname}\thu at starttoc{#1}}
-    {\thu at chapter*{\csname list#1name\endcsname}\thu at starttoc{#1}}}
-\renewcommand\listoffigures{\thu at listof{figure}}
-\renewcommand*\l at figure{\ifthu at degree@bachelor\relax\else\addvspace{6bp}\fi\@dottedtocline{1}{0em}{4em}}
-\renewcommand\listoftables{\thu at listof{table}}
-\let\l at table\l at figure
+    {\thu at chapter*[]{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}
+    {\thu at chapter*{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}%
+}
+\renewcommand\listoffigures{%
+  \thu at set@list at label@width{\figurename}%
+  \thu at listof{figure}%
+}
 %    \end{macrocode}
+%
+% 英文的图序“Figure X-X”比中文略宽,所以根据实际内容设置不同宽度。
+%    \begin{macrocode}
+\newlength{\thu at list@label at width}
+\newcommand\thu at set@list at label@width[1]{%
+  \settowidth{\thu at list@label at width}{#1~8.8}%
+  \addtolength{\thu at list@label at width}{1em}%
+}
+\titlecontents{figure}
+  [\thu at list@label at width]{\addvspace{6bp}}
+  {\contentslabel[\figurename~\thecontentslabel]{\thu at list@label at width}}{}
+  {\thu at leaders\thecontentspage}
+\renewcommand\listoftables{%
+  \thu at set@list at label@width{\tablename}%
+  \thu at listof{table}%
+}
+\titlecontents{table}
+  [\thu at list@label at width]{\addvspace{6bp}}
+  {\contentslabel[\tablename~\thecontentslabel]{\thu at list@label at width}}{}
+  {\thu at leaders\thecontentspage}
+%    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
@@ -3127,9 +3795,14 @@
 % \begin{macro}{\listofequations}
 % \begin{macro}{\listofequations*}
 % \LaTeX{} 默认没有公式索引,此处定义自己的 \cs{listofequations}。
+% 公式索引没有名称,所以不设置固定的 label 宽度。
 %    \begin{macrocode}
 \newcommand\listofequations{\thu at listof{equation}}
-\let\l at equation\l at figure
+\titlecontents{equation}
+  [0pt]{\addvspace{6bp}}
+  {\thu at equation@name~\thecontentslabel}{}
+  {\thu at leaders\thecontentspage}
+\contentsuse{equation}{loe}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -3177,11 +3850,9 @@
 \thu at define@key{
   cite-style = {
     name = cite at style,
-    code = {
-      \@nameuse{bibstyle at thuthesis-\thu at cite@style}
-    },
   }
 }
+\thu at option@hook{cite-style}{\@nameuse{bibstyle at thuthesis-\thu at cite@style}}
 %    \end{macrocode}
 %
 % 下面修改 \pkg{natbib} 的引用格式,主要是将页码写在上标位置。
@@ -3247,17 +3918,36 @@
 % 但是从示例来看,目录中只出现附录的 chapter 标题,
 % 不出现附录中的 section 及 subsection 的标题。
 % 部分院系(例如自动化系)的格式审查的老师甚至一致口头如此要求。
-% (\href{https://github.com/xueruini/thuthesis/pull/425}{\#425})
+% (\href{https://github.com/tuna/thuthesis/pull/425}{\#425})
 %    \begin{macrocode}
 \thu at define@key{
   toc-depth = {
     name = toc at depth,
-    code = {\addtocontents{toc}{\protect\setcounter{tocdepth}{\thu at toc@depth}}},
   },
 }
-\g at addto@macro\appendix{\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}}
 %    \end{macrocode}
 %
+% 这里不要使用 \cs{addcontentsline},
+% 避免写入 \pkg{titletoc} 的 (\file{.ptc}) 文件中,
+% 造成 \env{survey} 的子目录中 |tocdepth| 为 0。
+%    \begin{macrocode}
+\thu at option@hook{toc-depth}{%
+  \protected at write\@auxout{}{%
+    \string\ttl at writefile{toc}{%
+      \protect\setcounter{tocdepth}{\thu at toc@depth}%
+    }%
+  }%
+  \addtocontents{lof}{\string\let\string\contentsline\string\ttl at gobblecontents}
+  \addtocontents{lot}{\string\let\string\contentsline\string\ttl at gobblecontents}
+  \addtocontents{loe}{\string\let\string\contentsline\string\ttl at gobblecontents}
+}
+\g at addto@macro\appendix{%
+  \thusetup{
+    toc-depth = 0,
+  }
+}
+%    \end{macrocode}
+%
 % 本科生《写作指南》有独特的要求:附录 A 为外文资料的调研阅读报告或书面翻译,
 % 并且要分别附上独立的参考文献和外文资料的原文索引。
 % 所以这里定义 \env{survey} 和 \env{translation} 专门处理这两种情况,
@@ -3268,9 +3958,15 @@
 %    \begin{macrocode}
 \newenvironment{survey}{%
   \chapter{外文资料的调研阅读报告}%
-  \thu at setenglish
+  \thusetup{language = english}%
   \let\title\thu at appendix@title
   \let\maketitle\thu at appendix@maketitle
+  \thu at set@partial at toc@format
+  \renewcommand\tableofcontents{%
+    \section*{Contents}%
+    \thu at pdfbookmark{1}{Contents}%
+    \printcontents[survey]{l}{1}[2]{}%
+  }%
   \renewcommand\bibname{参考文献}%
   \let\bibsection\thu at appendix@bibsection
   \renewcommand\@bibunitname{main-survey}%
@@ -3277,8 +3973,11 @@
   \let\bibliographystyle\defaultbibliographystyle
   \let\bibliography\thu at appendix@bibliography
   \begin{bibunit}%
+  \startcontents[survey]%
 }{%
+  \stopcontents[survey]%
   \end{bibunit}%
+  \thu at reset@main at language % restore language
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3288,21 +3987,48 @@
 %    \begin{macrocode}
 \newenvironment{translation}{%
   \chapter{外文资料的书面翻译}%
-  \thu at setenglish
+  \thusetup{language = chinese}%
   \let\title\thu at appendix@title
   \let\maketitle\thu at appendix@maketitle
-  \renewcommand\bibname{书面翻译对应的原文索引}%
-  \let\bibsection\thu at appendix@bibsection
+  \thu at set@partial at toc@format
+  \renewcommand\tableofcontents{%
+    \section*{目录}%
+    \thu at pdfbookmark{1}{目录}%
+    \printcontents[translation]{l}{1}[2]{}%
+  }%
+  \def\bibsection{%
+    \begingroup
+      \ctexset{section/numbering=false}%
+      \section{\bibname}%
+    \endgroup
+  }%
   \renewcommand\@bibunitname{main-translation}%
   \let\bibliographystyle\defaultbibliographystyle
   \let\bibliography\thu at appendix@bibliography
   \begin{bibunit}%
+  \startcontents[translation]%
 }{%
+  \stopcontents[translation]%
   \end{bibunit}%
+  \thu at reset@main at language % restore language
 }
 %    \end{macrocode}
 % \end{environment}
 %
+% \begin{environment}{translation}
+% 书面翻译对应的原文索引,区别于译文的参考文献。
+%    \begin{macrocode}
+\newenvironment{translation-index}{%
+  \begin{bibunit}%
+    \renewcommand\@bibunitname{main-index}%
+    \renewcommand\bibname{书面翻译对应的原文索引}%
+    \let\bibsection\thu at appendix@bibsection
+}{%
+  \end{bibunit}%
+}
+%    \end{macrocode}
+% \end{environment}
+%
 % 调研阅读报告需要独立的标题,这里仿照了标准文档类的用法 \cs{title}, \cs{maketitle}。
 %    \begin{macrocode}
 \DeclareRobustCommand\thu at appendix@title[1]{\gdef\thu at appendix@@title{#1}}
@@ -3315,11 +4041,29 @@
 }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\newcommand\thu at set@partial at toc@format{%
+  \titlecontents{section}
+    [\z@]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+  \titlecontents{subsection}
+    [1\ccwd]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+  \titlecontents{subsubsection}
+    [2\ccwd]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+}
+%    \end{macrocode}
+%
 % 调研阅读报告的参考文献(或书面翻译对应的外文资料的原文索引)标题用宋体小四号字,段前 20pt,段后 6pt,行距 20pt。
 %    \begin{macrocode}
 \newcommand\thu at appendix@bibsection{%
   \par
   \vskip 20bp%
+  \thu at pdfbookmark{1}{\bibname}%
   \begingroup
     \centering
     \xiaosi[1.667]\bibname\par
@@ -3335,7 +4079,7 @@
 % \begin{environment}{resume}
 % 个人简历发表文章等。
 %    \begin{macrocode}
-\newenvironment{resume}[1][\thu at resume@title]{%
+\newenvironment{resume}[1][\thu at resume@name]{%
   \thu at chapter*{#1}}{}
 %    \end{macrocode}
 % \end{environment}
@@ -3384,14 +4128,11 @@
 % \subsection{其他宏包的设置}
 %
 % 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。
-%    \begin{macrocode}
-\newcommand\thu at atendpackage{\csname ctex_at_end_package:nn\endcsname}
-%    \end{macrocode}
 %
 % \subsubsection{\pkg{hyperref} 宏包}
 %
 %    \begin{macrocode}
-\thu at atendpackage{hyperref}{
+\AtEndOfPackageFile*{hyperref}{
   \hypersetup{
     linktoc            = all,
     bookmarksdepth     = 2,
@@ -3398,6 +4139,7 @@
     bookmarksnumbered  = true,
     bookmarksopen      = true,
     bookmarksopenlevel = 1,
+    bookmarksdepth     = 3,
     unicode            = true,
     psdextra           = true,
     breaklinks         = true,
@@ -3430,6 +4172,15 @@
   \@ifpackagelater{hyperref}{2019/04/27}{}{%
     \g at addto@macro\psdmapshortnames{\let\mu\textmu}
   }%
+  \ifthu at language@chinese
+    \hypersetup{
+      pdflang = zh-CN,
+    }%
+  \else
+    \hypersetup{
+      pdflang = en-US,
+    }%
+  \fi
   \AtBeginDocument{%
     \ifthu at language@chinese
       \hypersetup{
@@ -3437,7 +4188,6 @@
         pdfauthor   = \thu at author,
         pdfsubject  = \thu at degree@name,
         pdfkeywords = \thu at keywords,
-        pdflang     = zh-CN,
       }%
     \else
       \hypersetup{
@@ -3445,7 +4195,6 @@
         pdfauthor   = \thu at author@en,
         pdfsubject  = \thu at degree@name at en,
         pdfkeywords = \thu at keywords@en,
-        pdflang     = en-US,
       }%
     \fi
     \hypersetup{
@@ -3457,7 +4206,7 @@
 % \subsubsection{\pkg{nomencl} 宏包}
 %
 %    \begin{macrocode}
-\thu at atendpackage{nomencl}{
+\AtEndOfPackageFile*{nomencl}{
   \let\nomname\thu at denotation@name
   \def\thenomenclature{\begin{denotation}[\nom at tempdim]}
   \def\endthenomenclature{\end{denotation}}
@@ -3477,7 +4226,7 @@
 % \subsubsection{\pkg{siunitx} 宏包}
 %
 %    \begin{macrocode}
-\thu at atendpackage{siunitx}{%
+\AtEndOfPackageFile*{siunitx}{%
   \sisetup{
     group-minimum-digits = 4,
     separate-uncertainty = true,
@@ -3501,18 +4250,57 @@
     \fi
   }
   \thu at set@siunitx at language
-  \thu at addto{language}{\thu at set@siunitx at language}
+  \thu at option@hook{language}{\thu at set@siunitx at language}
 }
 %    \end{macrocode}
 %
+% \subsubsection{\pkg{amsthm} 宏包}
+%
+% 定理标题使用黑体,正文使用宋体,冒号隔开。
+%    \begin{macrocode}
+\AtEndOfPackageFile*{amsthm}{%
+  \newtheoremstyle{thu}
+    {\z@}{\z@}
+    {\normalfont}{\z@}
+    {\normalfont\sffamily}{\thu at theorem@separator}
+    {0.5em}{}
+  \theoremstyle{thu}
+  \newtheorem{assumption}{\thu at assumption@name}[chapter]%
+  \newtheorem{definition}{\thu at definition@name}[chapter]%
+  \newtheorem{proposition}{\thu at proposition@name}[chapter]%
+  \newtheorem{lemma}{\thu at lemma@name}[chapter]%
+  \newtheorem{theorem}{\thu at theorem@name}[chapter]%
+  \newtheorem{axiom}{\thu at axiom@name}[chapter]%
+  \newtheorem{corollary}{\thu at corollary@name}[chapter]%
+  \newtheorem{exercise}{\thu at exercise@name}[chapter]%
+  \newtheorem{example}{\thu at example@name}[chapter]%
+  \newtheorem{remark}{\thu at remark@name}[chapter]%
+  \newtheorem{problem}{\thu at problem@name}[chapter]%
+  \newtheorem{conjecture}{\thu at conjecture@name}[chapter]%
+  \renewenvironment{proof}[1][\thu at proof@name]{\par
+    \pushQED{\qed}%
+    % \normalfont \topsep6\p@\@plus6\p@\relax
+    \normalfont \topsep\z@\relax
+    \trivlist
+    \item[\hskip\labelsep
+          \itshape
+      % #1\@addpunct{.}]\ignorespaces
+      \textsf{#1}\@addpunct{\thu at theorem@separator}]\ignorespaces
+  }{%
+    \popQED\endtrivlist\@endpefalse
+  }
+  \renewcommand\qedsymbol{\ensuremath{\QED}}
+}
+%    \end{macrocode}
+%
 % \subsubsection{\pkg{ntheorem} 宏包}
 %
 % 定理标题使用黑体,正文使用宋体,冒号隔开。
 %    \begin{macrocode}
-\thu at atendpackage{ntheorem}{%
+\AtEndOfPackageFile*{ntheorem}{%
   \theorembodyfont{\normalfont}%
   \theoremheaderfont{\normalfont\sffamily}%
-  \theoremsymbol{\ensuremath{\square}}%
+  \theoremsymbol{\ensuremath{\QED}}%
   \newtheorem*{proof}{\thu at proof@name}%
   \theoremstyle{plain}%
   \theoremsymbol{}%
@@ -3532,6 +4320,75 @@
 }
 %    \end{macrocode}
 %
+% \subsubsection{\pkg{algorithm} 宏包}
+%
+% 使 \env{algorithm} 和 \env{listing} 环境的名称随语言设置而改变,
+% 并使其在附录中的编号规则与图、表等一致。
+%
+% \begin{macro}{\listofalgorithm}
+% \begin{macro}{\listofalgorithm*}
+%    \begin{macrocode}
+\PassOptionsToPackage{chapter}{algorithm}
+\AtEndOfPackageFile*{algorithm}{
+  \floatname{algorithm}{\thu at algorithm@name}
+  \g at addto@macro\appendix{\renewcommand*{\thealgorithm}{\thechapter-\arabic{algorithm}}}
+  \renewcommand\listofalgorithms{%
+    \thu at set@list at label@width{\fname at algorithm}%
+    \thu at listof{algorithm}%
+  }
+  \renewcommand\listalgorithmname{\thu at list@algorithm at name}
+  \def\ext at algorithm{loa}
+  \contentsuse{algorithm}{loa}
+  \titlecontents{algorithm}
+    [\thu at list@label at width]{\addvspace{6bp}}
+    {\contentslabel[\fname at algorithm~\thecontentslabel]{\thu at list@label at width}}{}
+    {\thu at leaders\thecontentspage}
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{\pkg{algorithm2e} 宏包}
+%
+%    \begin{macrocode}
+\PassOptionsToPackage{algochapter}{algorithm2e}
+\AtEndOfPackageFile*{algorithm2e}{
+  \renewcommand\algorithmcfname{\thu at algorithm@name}
+  \SetAlgoCaptionLayout{dawu}
+  \SetAlCapSty{relax}
+  \SetAlgoCaptionSeparator{\hspace*{1em}}
+  \SetAlFnt{\dawu}
+  \renewcommand\listofalgorithms{%
+    \thu at set@list at label@width{\algorithmcfname}%
+    \thu at listof{algorithmcf}%
+  }
+  \renewcommand\listalgorithmcfname{\thu at list@algorithm at name}
+  \def\ext at algorithmcf{loa}
+  \contentsuse{algocf}{loa}
+  \titlecontents{algocf}
+    [\thu at list@label at width]{\addvspace{6bp}}
+    {\contentslabel[\algorithmcfname~\thecontentslabel]{\thu at list@label at width}}{}
+    {\thu at leaders\thecontentspage}
+}
+%    \end{macrocode}
+%
+% \subsubsection{\pkg{minted} 宏包}
+%
+%    \begin{macrocode}
+\AtEndOfPackageFile*{minted}{
+  \g at addto@macro\appendix{\renewcommand*{\thelisting}{\thechapter-\arabic{listing}}}%
+  \newcommand\thu at set@listing at language{%
+    \ifthu at language@chinese
+      \floatname{listing}{代码}%
+    \else
+      \floatname{listing}{Listing}%
+    \fi
+  }
+  \thu at set@listing at language
+  \thu at option@hook{language}{\thu at set@listing at language}
+}
+%    \end{macrocode}
+%
 % \subsection{书脊}
 % \label{sec:spine}
 % \begin{macro}{\spine}
@@ -3578,7 +4435,14 @@
 \RequirePackage{enumitem}
 \RequirePackage{etoolbox}
 \RequirePackage{metalogo}
+\RequirePackage[tightLists=false]{markdown}
 
+\markdownSetup{
+  renderers = {
+    link = {\href{#2}{#1}},
+  }
+}
+
 \ifthenelse{\equal{\@nameuse{g__ctex_fontset_tl}}{mac}}{
   \setmainfont{Palatino}
   \setsansfont[Scale=MatchLowercase]{Helvetica}
@@ -3718,6 +4582,8 @@
 \newcommand{\note}[2][Note]{{%
   \color{magenta}{\bfseries #1}\emph{#2}}}
 
+\DeclareDocumentCommand{\githubuser}{m}{\href{https://github.com/#1}{@#1}}
+
 \def\thuthesis{\textsc{Thu}\-\textsc{Thesis}}
 %</dtx-style>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls	2020-06-08 21:19:40 UTC (rev 55484)
+++ trunk/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls	2020-06-08 21:19:57 UTC (rev 55485)
@@ -21,14 +21,24 @@
 %% To produce the documentation run the original source files ending with `.dtx'
 %% through LaTeX.
 %% 
-\NeedsTeXFormat{LaTeX2e}
+\NeedsTeXFormat{LaTeX2e}[2017/04/15]
 \ProvidesClass{thuthesis}
-[2020/02/23 6.0.2 Tsinghua University Thesis Template]
-\RequirePackage{ifxetex}
-\RequireXeTeX
+[2020/06/08 6.1.0 Tsinghua University Thesis Template]
+\newcommand\thu at error[1]{%
+  \ClassError{thuthesis}{#1}{}%
+}
+\@ifl at t@r\fmtversion{2017/04/15}{}{
+  \thu at error{%
+    TeX Live 2017 or later version is required to compile this document%
+  }
+}
+\RequirePackage{iftex}
+\ifXeTeX\else
+  \thu at error{XeLaTeX is required to compile this document}
+\fi
 \hyphenation{Thu-Thesis}
 \def\thuthesis{ThuThesis}
-\def\version{6.0.2}
+\def\version{6.1.0}
 \RequirePackage{kvdefinekeys}
 \RequirePackage{kvsetkeys}
 \RequirePackage{kvoptions}
@@ -36,12 +46,9 @@
   family=thu,
   prefix=thu@,
   setkeys=\kvsetkeys}
-\newcommand\thu at error[1]{%
-  \ClassError{thuthesis}{#1}{}%
+\newcommand\thusetup[1]{%
+  \kvsetkeys{thu}{#1}%
 }
-\newcommand\thusetup{%
-  \kvsetkeys{thu}%
-}
 \newcommand\thu at define@key[1]{%
   \kvsetkeys{thu at key}{#1}%
 }
@@ -52,20 +59,8 @@
   \kv at define@key{thu at value}{name}{%
     \@namedef{thu@#1@@name}{##1}%
   }%
-  \kv at define@key{thu at value}{code}{%
-    \@namedef{thu@#1@@code}{##1}%
-  }%
   \@namedef{thu@#1@@check}{}%
   \@namedef{thu@#1@@code}{}%
-  \@namedef{thu@#1@@hook}{%
-    \expandafter\ifx\csname\@currname.\@currext-h@@k\endcsname\relax
-      \@nameuse{thu@#1@@code}%
-    \else
-      \AtEndOfClass{%
-        \@nameuse{thu@#1@@code}%
-      }%
-    \fi
-  }%
   \kv at define@key{thu at value}{choices}{%
     \def\thu@@choices{##1}%
     \@namedef{thu@#1@@reset}{}%
@@ -97,27 +92,16 @@
   \expandafter\let\csname thu@\@nameuse{thu@#1@@name}\endcsname\thu@@default
   \expandafter\ifx\csname thu@\@nameuse{thu@#1@@name}\endcsname\@empty\else
     \@nameuse{thu@#1@@check}%
-    \@nameuse{thu@#1@@hook}%
   \fi
   \kv at define@key{thu}{#1}{%
     \@namedef{thu@\@nameuse{thu@#1@@name}}{##1}%
     \@nameuse{thu@#1@@check}%
-    \@nameuse{thu@#1@@hook}%
+    \@nameuse{thu@#1@@code}%
   }%
 }
-\newcommand\thu at addto[2]{%
+\newcommand\thu at option@hook[2]{%
   \expandafter\g at addto@macro\csname thu@#1@@code\endcsname{#2}%
 }
-\newif\ifthu at degree@graduate
-\newcommand\thu at set@graduate{%
-  \thu at degree@graduatefalse
-  \ifthu at degree@doctor
-    \thu at degree@graduatetrue
-  \fi
-  \ifthu at degree@master
-    \thu at degree@graduatetrue
-  \fi
-}
 \thu at define@key{
   degree = {
     choices = {
@@ -127,7 +111,6 @@
       postdoc,
     },
     default = doctor,
-    code = {\thu at set@graduate},
   },
   degree-type = {
     choices = {
@@ -142,14 +125,93 @@
       english,
     },
   },
+  fontset = {
+    choices = {
+      windows,
+      mac,
+      ubuntu,
+      fandol,
+      none,
+    },
+    default = none,
+  },
+  system = {
+    choices = {
+      mac,
+      unix,
+      windows,
+      auto,
+    },
+    default = auto,
+  },
+  font = {
+    choices = {
+      times,
+      termes,
+      xits,
+      libertinus,
+      lm,
+      auto,
+      none,
+    },
+    default = auto,
+  },
+  cjk-font = {
+    name = cjk at font,
+    choices = {
+      windows,
+      mac,
+      noto,
+      fandol,
+      auto,
+      none,
+    },
+    default = auto,
+  },
+  math-font = {
+    name = math at font,
+    choices = {
+      xits,
+      stix,
+      libertinus,
+      lm,
+      none,
+    },
+    default = xits,
+  },
 }
+\newif\ifthu at degree@graduate
+\newcommand\thu at set@graduate{%
+  \thu at degree@graduatefalse
+  \ifthu at degree@doctor
+    \thu at degree@graduatetrue
+  \fi
+  \ifthu at degree@master
+    \thu at degree@graduatetrue
+  \fi
+}
+\thu at set@graduate
+\thu at option@hook{degree}{%
+  \thu at set@graduate
+}
+\DeclareBoolOption[false]{openright}
+\DeclareComplementaryOption{openany}{openright}
 \DeclareBoolOption[true]{raggedbottom}
 \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
 \ProcessKeyvalOptions*
+\ifthu at openright
+  \PassOptionsToClass{openright}{book}
+\else
+  \PassOptionsToClass{openany}{book}
+\fi
 \PassOptionsToPackage{quiet}{xeCJK}
-\LoadClass[a4paper,openany,UTF8,zihao=-4,scheme=plain]{ctexbook}
+\LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01]
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
+\RequirePackage{geometry}%
+\RequirePackage{fancyhdr}
+\RequirePackage{titletoc}
+\RequirePackage{notoccite}
 \RequirePackage{amsmath}
 \RequirePackage{unicode-math}
 \RequirePackage{graphicx}
@@ -170,19 +232,24 @@
 \RequirePackage[sort&compress]{natbib}
 \RequirePackage{bibunits}
 \RequirePackage{url}
-\urlstyle{same}
-\g at addto@macro\UrlBreaks{%
-  \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
-  \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
-  \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
-  \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
-  \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
+\RequirePackage{filehook}
+\newcommand\thu at package@conflict[2]{
+  \AtBeginOfPackageFile*{#2}{
+    \thu at error{The "#2" package is incompatible with required "#1"}
+  }
 }
-\Urlmuskip=0mu plus 0.1mu
-\RequirePackage{geometry}
+\thu at package@conflict{unicode-math}{amscd}
+\thu at package@conflict{unicode-math}{amsfonts}
+\thu at package@conflict{unicode-math}{amssymb}
+\thu at package@conflict{unicode-math}{bbm}
+\thu at package@conflict{unicode-math}{bm}
+\thu at package@conflict{unicode-math}{eucal}
+\thu at package@conflict{unicode-math}{eufrak}
+\thu at package@conflict{unicode-math}{mathrsfs}
 \geometry{
   a4paper, % 210 * 297mm
-  nomarginpar,
+  marginparwidth = 2cm,
+  marginparsep = 0.5cm
 }
 \ifthu at degree@bachelor
   \geometry{
@@ -202,25 +269,23 @@
     footskip   = 0.8cm,
   }
 \fi
-\RequirePackage{fancyhdr}
-\RequirePackage{notoccite}
 \let\thu at cleardoublepage\cleardoublepage
 \newcommand{\thu at clearemptydoublepage}{%
   \clearpage{\pagestyle{thu at empty}\thu at cleardoublepage}}
 \let\cleardoublepage\thu at clearemptydoublepage
 \renewcommand\frontmatter{%
-  \if at openright\cleardoublepage\else\clearpage\fi
-  \@mainmatterfalse
+  \cleardoublepage
   \ifthu at degree@bachelor
     \pagestyle{thu at plain}
   \else
     \pagestyle{thu at headings}
   \fi
+  \@mainmatterfalse
   \pagenumbering{Roman}%
   \let\@tabular\thu at tabular
 }
 \renewcommand\mainmatter{%
-  \if at openright\cleardoublepage\else\clearpage\fi
+  \cleardoublepage
   \@mainmattertrue
   \pagenumbering{arabic}
   \ifthu at degree@bachelor\pagestyle{thu at plain}\else\pagestyle{thu at headings}\fi}
@@ -227,39 +292,196 @@
 \renewcommand\backmatter{%
   \if at openright\cleardoublepage\else\clearpage\fi
   \@mainmattertrue}
-\newcommand\thu at fontset{\csname g__ctex_fontset_tl\endcsname}
-\ifthenelse{\equal{\thu at fontset}{fandol}}{
-  \setmainfont[
+\ifthu at fontset@mac
+  \thusetup{
+    font     = times,
+    cjk-font = mac,
+  }
+\else
+  \ifthu at fontset@windows
+    \thusetup{
+      font     = times,
+      cjk-font = windows,
+    }
+  \else
+    \ifthu at fontset@fandol
+      \thusetup{
+        font     = termes,
+        cjk-font = fandol,
+      }
+    \else
+      \ifthu at fontset@ubuntu
+        \thusetup{
+          font     = termes,
+          cjk-font = noto,
+        }
+      \fi
+    \fi
+  \fi
+\fi
+\ifthu at system@auto
+  \IfFileExists{/System/Library/Fonts/Menlo.ttc}{
+    \thusetup{system = mac}
+  }{
+    \IfFileExists{/dev/null}{
+      \IfFileExists{null:}{
+        \thusetup{system = windows}
+      }{
+        \thusetup{system = unix}
+      }
+    }{
+      \thusetup{system = windows}
+    }
+  }
+\fi
+\let\thu at font@family at xits\@empty
+\newcommand\thu at set@xits at names{%
+  \ifx\thu at font@family at xits\@empty
+    \IfFontExistsTF{XITSMath-Regular.otf}{%
+      \gdef\thu at font@family at xits{XITS}%
+      \gdef\thu at font@style at xits@rm{Regular}%
+      \gdef\thu at font@style at xits@bf{Bold}%
+      \gdef\thu at font@style at xits@it{Italic}%
+      \gdef\thu at font@style at xits@bfit{BoldItalic}%
+      \gdef\thu at font@name at xits@math at rm{XITSMath-Regular}%
+      \gdef\thu at font@name at xits@math at bf{XITSMath-Bold}%
+    }{%
+      \gdef\thu at font@family at xits{xits}%
+      \gdef\thu at font@style at xits@rm{regular}%
+      \gdef\thu at font@style at xits@bf{bold}%
+      \gdef\thu at font@style at xits@it{italic}%
+      \gdef\thu at font@style at xits@bfit{bolditalic}%
+      \gdef\thu at font@name at xits@math at rm{xits-math}%
+      \gdef\thu at font@name at xits@math at bf{xits-mathbold}%
+    }%
+  \fi
+}
+\let\thu at font@family at libertinus\@empty
+\newcommand\thu at set@libertinus at names{%
+  \ifx\thu at font@family at libertinus\@empty
+    \IfFontExistsTF{LibertinusSerif-Regular.otf}{%
+      \gdef\thu at font@family at libertinus@serif{LibertinusSerif}%
+      \gdef\thu at font@family at libertinus@sans{LibertinusSans}%
+      \gdef\thu at font@name at libertinus@math{LibertinusMath-Regular}%
+      \gdef\thu at font@style at libertinus@rm{Regular}%
+      \gdef\thu at font@style at libertinus@bf{Bold}%
+      \gdef\thu at font@style at libertinus@it{Italic}%
+      \gdef\thu at font@style at libertinus@bfit{BoldItalic}%
+    }{%
+      \gdef\thu at font@family at libertinus@serif{libertinusserif}%
+      \gdef\thu at font@family at libertinus@sans{libertinussans}%
+      \gdef\thu at font@name at libertinus@math{libertinusmath-regular}%
+      \gdef\thu at font@style at libertinus@rm{regular}%
+      \gdef\thu at font@style at libertinus@bf{bold}%
+      \gdef\thu at font@style at libertinus@it{italic}%
+      \gdef\thu at font@style at libertinus@bfit{bolditalic}%
+    }%
+  \fi
+}
+\ifthu at font@auto
+  \ifthu at system@unix
+    \thusetup{font=termes}
+  \else
+    \thusetup{font=times}
+  \fi
+\fi
+\newcommand\thu at load@font at times{%
+  \setmainfont{Times New Roman}%
+  \setsansfont{Arial}%
+  \ifthu at system@mac
+    \setmonofont{Menlo}[Scale = MatchLowercase]%
+  \else
+    \setmonofont{Courier New}[Scale = MatchLowercase]%
+  \fi
+}
+\newcommand\thu at load@font at termes{%
+  \setmainfont{texgyretermes}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-  ]{texgyretermes}
-  \setsansfont[
+  ]%
+  \thu at load@texgyre at sans@mono
+}
+\newcommand\thu at load@texgyre at sans@mono{%
+  \setsansfont{texgyreheros}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-  ]{texgyreheros}
-  \setmonofont[
+  ]%
+  \setmonofont{texgyrecursor}[
     Extension      = .otf,
     UprightFont    = *-regular,
     BoldFont       = *-bold,
     ItalicFont     = *-italic,
     BoldItalicFont = *-bolditalic,
-    Scale          = MatchLowercase,
-  ]{texgyrecursor}
-}{
-  \setmainfont{Times New Roman}
-  \setsansfont{Arial}
-  \ifthenelse{\equal{\thu at fontset}{mac}}{
-    \setmonofont[Scale=MatchLowercase]{Menlo}
-  }{
-    \setmonofont[Scale=MatchLowercase]{Courier New}
-  }
+  ]%
 }
+\newcommand\thu at load@font at xits{%
+  \thu at set@xits at names
+  \setmainfont{\thu at font@family at xits}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at xits@rm,
+    BoldFont       = *-\thu at font@style at xits@bf,
+    ItalicFont     = *-\thu at font@style at xits@it,
+    BoldItalicFont = *-\thu at font@style at xits@bfit,
+  ]%
+  \thu at load@texgyre at sans@mono
+}
+\newcommand\thu at load@font at libertinus{%
+  \thu at set@libertinus at names
+  \setmainfont{\thu at font@family at libertinus@serif}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at libertinus@rm,
+    BoldFont       = *-\thu at font@style at libertinus@bf,
+    ItalicFont     = *-\thu at font@style at libertinus@it,
+    BoldItalicFont = *-\thu at font@style at libertinus@bfit,
+  ]%
+  \setsansfont{\thu at font@family at libertinus@sans}[
+    Extension      = .otf,
+    UprightFont    = *-\thu at font@style at libertinus@rm,
+    BoldFont       = *-\thu at font@style at libertinus@bf,
+    ItalicFont     = *-\thu at font@style at libertinus@it,
+  ]%
+  \setmonofont{lmmonolt10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+}
+\@namedef{thu at load@font at lm}{%
+  \setmainfont{lmroman10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-italic,
+    BoldItalicFont = *-bolditalic,
+  ]%
+  \setsansfont{lmsans10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+  \setmonofont{lmmonolt10}[
+    Extension      = .otf,
+    UprightFont    = *-regular,
+    BoldFont       = *-bold,
+    ItalicFont     = *-oblique,
+    BoldItalicFont = *-boldoblique,
+  ]%
+}
+\newcommand\thu at load@font{%
+  \@nameuse{thu at load@font@\thu at font}%
+}
+\thu at load@font
+\thu at option@hook{font}{\thu at load@font}
 \unimathsetup{
   math-style = ISO,
   bold-style = ISO,
@@ -266,50 +488,169 @@
   nabla      = upright,
   partial    = upright,
 }
-\IfFontExistsTF{XITSMath-Regular.otf}{
-  \setmathfont[
+\newcommand\thu at load@math at font@xits{%
+  \thu at set@xits at names
+  \setmathfont{\thu at font@name at xits@math at rm}[
     Extension    = .otf,
-    BoldFont     = XITSMath-Bold,
+    BoldFont     = \thu at font@name at xits@math at bf,
     StylisticSet = 8,
-  ]{XITSMath-Regular}
-  \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf}
-}{
-  \setmathfont[
+  ]%
+  \setmathfont{\thu at font@name at xits@math at rm}[
     Extension    = .otf,
-    BoldFont     = *bold,
+    StylisticSet = 1,
+    range        = {cal,bfcal},
+  ]%
+}
+\newcommand\thu at load@math at font@stix{%
+  \setmathfont{STIX2Math}[
+    Extension    = .otf,
     StylisticSet = 8,
-  ]{xits-math}
-  \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf}
+  ]%
+  \setmathfont{STIX2Math}[
+    Extension    = .otf,
+    StylisticSet = 1,
+    range        = {cal,bfcal},
+  ]%
 }
-\ifthenelse{\equal{\thu at fontset}{windows}}{
+\newcommand\thu at load@math at font@libertinus{%
+  \thu at set@libertinus at names
+  \setmathfont{\thu at font@name at libertinus@math .otf}%
+}
+\newcommand\thu at load@math at font@lm{%
+  \setmathfont{latinmodern-math.otf}%
+}
+\newcommand\thu at load@math at font{%
+  \@nameuse{thu at load@math at font@\thu at math@font}
+}
+\thu at load@math at font
+\thu at option@hook{math-font}{\thu at load@math at font}
+\ifthu at cjk@font at auto
+  \ifthu at system@mac
+    \thusetup{cjk-font = mac}
+  \else
+    \ifthu at system@windows
+      \thusetup{cjk-font = windows}
+    \else
+      \IfFontExistsTF{Noto Serif CJK SC}{
+        \thusetup{cjk-font = noto}
+      }{
+        \thusetup{cjk-font = fandol}
+      }
+    \fi
+  \fi
+\fi
+\newcommand\thu at load@cjk at font@windows{%
   \xeCJKsetup{EmboldenFactor=2}
-  \IfFileExists{C:/bootfont.bin}{
-    \setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi_GB2312]{SimSun}
-    \setCJKfamilyfont{zhkai}[AutoFakeBold]{KaiTi_GB2312}
-  }{
-    \setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi]{SimSun}
-    \setCJKfamilyfont{zhkai}[AutoFakeBold]{KaiTi}
-  }
-  \setCJKsansfont[AutoFakeBold]{SimHei}
-  \setCJKfamilyfont{zhsong}[AutoFakeBold]{SimSun}
-  \setCJKfamilyfont{zhhei}[AutoFakeBold]{SimHei}
-}{}
-\ifthenelse{\equal{\thu at fontset}{mac}}{
-  \setCJKmainfont[
-         UprightFont = * Light,
-            BoldFont = * Bold,
-          ItalicFont = Kaiti SC,
-      BoldItalicFont = Kaiti SC Bold,
-    ]{Songti SC}
-  \setCJKsansfont[BoldFont=* Medium]{Heiti SC}
-  \setCJKfamilyfont{zhsong}[
-         UprightFont = * Light,
-            BoldFont = * Bold,
-    ]{Songti SC}
-  \setCJKfamilyfont{zhhei}[BoldFont=* Medium]{Heiti SC}
-  \setCJKfamilyfont{zhkai}[BoldFont=* Bold]{Kaiti SC}
-  \xeCJKsetwidth{‘’“”}{1em}
-}{}
+  \setCJKmainfont{SimSun}[
+    AutoFakeBold = true,
+    ItalicFont   = KaiTi,
+  ]%
+  \setCJKsansfont{SimHei}[AutoFakeBold]%
+  \setCJKmonofont{FangSong}%
+  \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold]%
+  \setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold]%
+  \setCJKfamilyfont{zhkai}{KaiTi}%
+  \setCJKfamilyfont{zhfs}{FangSong}%
+}
+\newcommand\thu at load@cjk at font@mac{%
+  \setCJKmainfont{Songti SC}[
+    UprightFont    = * Light,
+    BoldFont       = * Bold,
+    ItalicFont     = Kaiti SC,
+    BoldItalicFont = Kaiti SC Bold,
+  ]%
+  \setCJKsansfont{Heiti SC}[BoldFont=* Medium]%
+  \setCJKmonofont{STFangsong}
+  \setCJKfamilyfont{zhsong}{Songti SC}[
+    UprightFont = * Light,
+      BoldFont  = * Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{Heiti SC}[
+    UprightFont = * Light,
+    BoldFont    = * Medium,
+  ]%
+  \setCJKfamilyfont{zhfs}{STFangsong}%
+  \setCJKfamilyfont{zhkai}{Kaiti SC}[BoldFont = * Bold]%
+  \setCJKfamilyfont{zhli}{Baoli SC}%
+  \setCJKfamilyfont{zhyuan}{Yuanyi SC}[
+    UprightFont = * Light,
+    BoldFont    = * Bold,
+  ]%
+  \xeCJKsetwidth{‘’“”}{1em}%
+}
+\newcommand\thu at load@cjk at font@noto{%
+  \setCJKmainfont{Noto Serif CJK SC}[
+    UprightFont    = * Light,
+    BoldFont       = * Bold,
+    ItalicFont     = FandolKai-Regular,
+    ItalicFeatures = {Extension = .otf},
+  ]%
+  \setCJKsansfont{Noto Sans CJK SC}[
+    BoldFont    = * Medium,
+  ]%
+  \setCJKmonofont{Noto Sans Mono CJK SC}%
+  \setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[
+    UprightFont = * Light,
+    UprightFont = * Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[
+    BoldFont    = * Medium,
+  ]%
+  \setCJKfamilyfont{zhfs}{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhkai}{FandolKai}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+}
+\newcommand\thu at load@cjk at font@fandol{%
+  \setCJKmainfont{FandolSong}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+    ItalicFont  = FandolKai-Regular,
+  ]%
+  \setCJKsansfont{FandolHei}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKmonofont{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhsong}{FandolSong}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKfamilyfont{zhhei}{FandolHei}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+    BoldFont    = *-Bold,
+  ]%
+  \setCJKfamilyfont{zhfs}{FandolFang}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+  \setCJKfamilyfont{zhkai}{FandolKai}[
+    Extension   = .otf,
+    UprightFont = *-Regular,
+  ]%
+}
+\ifthu at cjk@font at none\else
+  \providecommand\songti{\CJKfamily{zhsong}}
+  \providecommand\heiti{\CJKfamily{zhhei}}
+  \providecommand\fangsong{\CJKfamily{zhfs}}
+  \providecommand\kaishu{\CJKfamily{zhkai}}
+\fi
+\newcommand\thu at load@cjk at font{%
+  \@nameuse{thu at load@cjk at font@\thu at cjk@font}%
+}
+\thu at load@cjk at font
+\thu at option@hook{cjk-font}{\thu at load@cjk at font}
 \renewcommand\normalsize{%
   \@setfontsize\normalsize{12bp}{20bp}%
   \abovedisplayskip=12bp \@plus 2bp \@minus 2bp
@@ -337,86 +678,135 @@
 \thu at def@fontsize{xiaoliu}{6.5bp}
 \thu at def@fontsize{qihao}{5.5bp}
 \thu at def@fontsize{bahao}{5bp}
-\newcommand\thu at setchinese{%
-  \xeCJKResetPunctClass
+\let\thu at main@language\thu at language
+\thu at option@hook{language}{%
+  \ifx\@begindocumenthook\@undefined
+    \let\thu at main@language\thu at language
+  \fi
 }
-\newcommand\thu at setenglish{%
-  \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
-  \xeCJKDeclareCharClass{HalfRight}{
-    "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
-  }%
+\newcommand\thu at reset@main at language{
+  \thusetup{language = \thu at main@language}
 }
-\newcommand\thu at setdefaultlanguage{%
+\newcommand\thu at set@chapter at names{%
   \ifthu at language@chinese
-    \thu at setchinese
+    \ctexset{
+      chapter/name   = {第,章},
+      appendixname   = 附录,
+      contentsname   = 目\hspace{\ccwd}录,
+      listfigurename = 插图索引,
+      listtablename  = 表格索引,
+      bibname        = 参考文献,
+      indexname      = 索引,
+    }%
+    \def\thu at denotation@name{主要符号对照表}%
+    \def\thu at list@algorithm at name{算法索引}%
+    \def\listequationname{公式索引}%
+    \def\thu at acknowledgements@name{致\hspace{\ccwd}谢}%
+    \ifthu at degree@bachelor
+      \def\thu at resume@name{在学期间参加课题的研究成果}%
+    \else
+      \ifthu at degree@postdoc
+        \def\thu at resume@name{个人简历、发表的学术论文与科研成果}%
+      \else
+        \def\thu at resume@name{个人简历、在学期间发表的学术论文与研究成果}%
+      \fi
+    \fi
   \else
-    \thu at setenglish
+    \ifthu at language@english
+      \ctexset{
+        chapter/name   = \chaptername\space,
+        appendixname   = Appendix,
+        contentsname   = Contents,
+        listfigurename = List of Figures,
+        listtablename  = List of Tables,
+        bibname        = Bibliography,
+        indexname      = Index,
+      }%
+      \def\thu at denotation@name{Nomenclature}%
+      \def\thu at list@algorithm at name{List of Algorithms}%
+      \def\listequationname{List of Equations}%
+      \def\thu at acknowledgements@name{Acknowledgements}%
+      \ifthu at degree@bachelor
+        \def\thu at resume@name{Research Achievements}%
+      \else
+        \def\thu at resume@name{Resume, Publications and Research Achievements}%
+      \fi
+    \fi
   \fi
 }
-\ifthu at language@chinese
-  \ctexset{
-    chapter/name   = {第,章},
-    appendixname   = 附录,
-    contentsname   = {目\hspace{\ccwd}录},
-    listfigurename = 插图索引,
-    listtablename  = 表格索引,
-    figurename     = 图,
-    tablename      = 表,
-    bibname        = 参考文献,
-    indexname      = 索引,
-  }
-  \newcommand\thu at denotation@name{主要符号对照表}
-  \newcommand\listequationname{公式索引}
-  \newcommand\equationname{公式}
-  \newcommand\thu at assumption@name{假设}
-  \newcommand\thu at definition@name{定义}
-  \newcommand\thu at proposition@name{命题}
-  \newcommand\thu at lemma@name{引理}
-  \newcommand\thu at theorem@name{定理}
-  \newcommand\thu at axiom@name{公理}
-  \newcommand\thu at corollary@name{推论}
-  \newcommand\thu at exercise@name{练习}
-  \newcommand\thu at example@name{例}
-  \newcommand\thu at remark@name{注释}
-  \newcommand\thu at problem@name{问题}
-  \newcommand\thu at conjecture@name{猜想}
-  \newcommand\thu at proof@name{证明}
-  \newcommand\thu at theorem@separator{:}
-  \newcommand\thu at ack@name{致\hspace{\ccwd}谢}
-  \ifthu at degree@bachelor
-    \newcommand\thu at resume@title{在学期间参加课题的研究成果}
+\thu at set@chapter at names
+\thu at option@hook{degree}{\thu at set@chapter at names}
+\thu at option@hook{language}{%
+  \ifx\@begindocumenthook\@undefined
+    \thu at set@chapter at names
+  \fi
+}
+\newcommand\thu at set@names{%
+  \ifthu at language@chinese
+    \ctexset{
+      figurename = 图,
+      tablename  = 表,
+    }%
+    \def\thu at algorithm@name{算法}%
+    \def\thu at equation@name{公式}%
+    \def\thu at assumption@name{假设}%
+    \def\thu at definition@name{定义}%
+    \def\thu at proposition@name{命题}%
+    \def\thu at lemma@name{引理}%
+    \def\thu at theorem@name{定理}%
+    \def\thu at axiom@name{公理}%
+    \def\thu at corollary@name{推论}%
+    \def\thu at exercise@name{练习}%
+    \def\thu at example@name{例}%
+    \def\thu at remark@name{注释}%
+    \def\thu at problem@name{问题}%
+    \def\thu at conjecture@name{猜想}%
+    \def\thu at proof@name{证明}%
+    \def\thu at theorem@separator{:}%
   \else
-    \ifthu at degree@postdoc
-      \newcommand\thu at resume@title{个人简历、发表的学术论文与科研成果}
-    \else
-      \newcommand\thu at resume@title{个人简历、在学期间发表的学术论文与研究成果}
+    \ifthu at language@english
+      \ctexset{
+        figurename = {Figure},
+        tablename  = {Table},
+      }%
+      \def\thu at algorithm@name{Algorithm}%
+      \def\thu at equation@name{Equation}%
+      \def\thu at assumption@name{Assumption}%
+      \def\thu at definition@name{Definition}%
+      \def\thu at proposition@name{Proposition}%
+      \def\thu at lemma@name{Lemma}%
+      \def\thu at theorem@name{Theorem}%
+      \def\thu at axiom@name{Axiom}%
+      \def\thu at corollary@name{Corollary}%
+      \def\thu at exercise@name{Exercise}%
+      \def\thu at example@name{Example}%
+      \def\thu at remark@name{Remark}%
+      \def\thu at problem@name{Problem}%
+      \def\thu at conjecture@name{Conjecture}%
+      \def\thu at proof@name{Proof}%
+      \def\thu at theorem@separator{: }%
     \fi
   \fi
-\else
-  \newcommand\thu at denotation@name{Nomenclature}
-  \newcommand\listequationname{List of Equations}
-  \newcommand\equationname{Equation}
-  \newcommand\thu at assumption@name{Assumption}
-  \newcommand\thu at definition@name{Definition}
-  \newcommand\thu at proposition@name{Proposition}
-  \newcommand\thu at lemma@name{Lemma}
-  \newcommand\thu at theorem@name{Theorem}
-  \newcommand\thu at axiom@name{Axiom}
-  \newcommand\thu at corollary@name{Corollary}
-  \newcommand\thu at exercise@name{Exercise}
-  \newcommand\thu at example@name{Example}
-  \newcommand\thu at remark@name{Remark}
-  \newcommand\thu at problem@name{Problem}
-  \newcommand\thu at conjecture@name{Conjecture}
-  \newcommand\thu at proof@name{proof}
-  \newcommand\thu at theorem@separator{: }
-  \newcommand\thu at ack@name{Acknowledgements}
-  \ifthu at degree@bachelor
-    \newcommand\thu at resume@title{Research Achievements}
+}
+\thu at set@names
+\thu at option@hook{language}{\thu at set@names}
+\newcommand\thu at set@punctuations{%
+  \ifthu at language@chinese
+    \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}%
+    \xeCJKDeclareCharClass{FullRight}{
+      "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+    }%
   \else
-    \newcommand\thu at resume@title{Resume, Publications and Research Achievements}
+    \ifthu at language@english
+      \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
+      \xeCJKDeclareCharClass{HalfRight}{
+        "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+      }%
+    \fi
   \fi
-\fi
+}
+\thu at set@punctuations
+\thu at option@hook{language}{\thu at set@punctuations}
 \fancypagestyle{thu at empty}{%
   \fancyhf{}
   \renewcommand{\headrulewidth}{0pt}
@@ -438,25 +828,14 @@
   space=auto,
   autoindent=true}
 \setlist{nosep}
-\ifthenelse{\equal{\thu at fontset}{mac}}{
-  \newfontfamily\thu at circlefont{Songti SC Light}
-}{
-  \ifthenelse{\equal{\thu at fontset}{windows}}{
-    \newfontfamily\thu at circlefont{SimSun}
-  }{
-    \IfFontExistsTF{XITS-Regular.otf}{
-      \newfontfamily\thu at circlefont{XITS-Regular.otf}
-    }{
-      \newfontfamily\thu at circlefont{xits-regular.otf}
-    }
-  }
-}
 \def\thu at textcircled#1{%
-  \ifnum\value{#1} >9%
-    \ClassError{thuthesis}%
-      {Too many footnotes in this page.}{Keep footnote less than 10.}%
+  \ifnum\value{#1} >10\relax
+    \thu at error{%
+      Too many footnotes in this page.
+      Keep footnote less than 10%
+    }%
   \fi
-  {\thu at circlefont\symbol{\the\numexpr\value{#1}+"245F\relax}}%
+  {\CJKfamily+{}\symbol{\the\numexpr\value{#1}+"245F\relax}}%
 }
 \renewcommand{\thefootnote}{\thu at textcircled{footnote}}
 \renewcommand{\thempfootnote}{\thu at textcircled{mpfootnote}}
@@ -468,9 +847,26 @@
 \def\thu@@makefnmark{\hbox{{\normalfont\@thefnmark}}}
 \pretocmd{\@makefntext}{\let\@makefnmark\thu@@makefnmark}{}{}
 \apptocmd{\@makefntext}{\let\@makefnmark\thu at makefnmark}{}{}
-\ifthu at language@chinese
-  \def\mathellipsis{\cdots}
-\fi
+\urlstyle{same}
+\g at addto@macro\UrlBreaks{%
+  \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9%
+  \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M
+  \do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z
+  \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m
+  \do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z
+}
+\Urlmuskip=0mu plus 0.1mu
+\newcommand\thu at set@math at ellipsis{%
+  \ifthu at language@chinese
+    \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}%
+  \else
+    \ifthu at language@english
+      \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}%
+    \fi
+  \fi
+}
+\thu at set@math at ellipsis
+\thu at option@hook{language}{\thu at set@math at ellipsis}
 \protected\def\le{\leqslant}
 \protected\def\ge{\geqslant}
 \AtBeginDocument{%
@@ -491,8 +887,8 @@
 \AtBeginDocument{%
   \renewcommand\nabla{\mbfnabla}%
 }
-\newcommand\bm{\symbf}
-\renewcommand\boldsymbol{\symbf}
+\DeclareRobustCommand\bm[1]{{\symbf{#1}}}
+\DeclareRobustCommand\boldsymbol[1]{{\symbf{#1}}}
 \newcommand\square{\mdlgwhtsquare}
 \AtBeginDocument{%
   \renewcommand\checkmark{\ensuremath{✓}}%
@@ -504,17 +900,17 @@
 \iffalse
 \ifthu at degree@bachelor
   \def\thu at maketag#1{\maketag@@@{%
-    (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)}}
+    (\ignorespaces\text{\thu at equation@name\hskip0.5em}#1\unskip\@@italiccorr)}}
   \def\tagform@#1{\maketag@@@{%
-    (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
+    (\ignorespaces\text{\thu at equation@name\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
 \fi
 \fi
 \def\thu at maketag#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)}}
 \def\tagform@#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)\equcaption{#1}}}
 \renewcommand{\eqref}[1]{\textup{(\ref{#1})}}
-\setlength{\floatsep}{12bp \@plus 2bp \@minus 4bp}
-\setlength{\textfloatsep}{12bp}
-\setlength{\intextsep}{12bp}
+\setlength{\floatsep}{6bp}
+\setlength{\textfloatsep}{6bp}
+\setlength{\intextsep}{6bp}
 \setlength{\@fptop}{0bp \@plus1.0fil}
 \setlength{\@fpsep}{12bp \@plus2.0fil}
 \setlength{\@fpbot}{0bp \@plus1.0fil}
@@ -523,17 +919,21 @@
 \renewcommand{\bottomfraction}{0.65}
 \renewcommand{\floatpagefraction}{0.60}
 \ifthu at degree@bachelor
-  \g at addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
-  \g at addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+  \AtBeginDocument{% delay the check until all packages are loaded
+    \g at addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
+    \g at addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+  }
 \fi
 \let\old at tabular\@tabular
 \def\thu at tabular{\dawu[1.5]\old at tabular}
-\DeclareCaptionFont{thu}{\dawu[1.3]}
+\DeclareCaptionFont{thu}{\dawu}
 \DeclareCaptionLabelSeparator{thu}{\hspace{\ccwd}}
 \captionsetup{
+  format         = hang,
   font           = thu,
   labelsep       = thu,
-  skip           = 6bp,
+  aboveskip      = 6bp,
+  belowskip      = 6bp,
   figureposition = bottom,
   tableposition  = top,
 }
@@ -540,15 +940,17 @@
 \captionsetup[sub]{font=thu}
 \renewcommand{\thesubfigure}{(\alph{subfigure})}
 \renewcommand{\thesubtable}{(\alph{subtable})}
+\heavyrulewidth=1.5bp
+\lightrulewidth=1bp
 \def\hlinewd#1{%
   \noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
     \reserved at a\@xhline}
 \ifthu at degree@bachelor
-  \newcommand{\cabstractname}{中文摘要}
-  \newcommand{\eabstractname}{ABSTRACT}
+  \newcommand{\thu at abstract@name}{中文摘要}
+  \newcommand{\thu at abstract@name at en}{ABSTRACT}
 \else
-  \newcommand{\cabstractname}{摘\hspace{\ccwd}要}
-  \newcommand{\eabstractname}{Abstract}
+  \newcommand{\thu at abstract@name}{摘\hspace{\ccwd}要}
+  \newcommand{\thu at abstract@name at en}{Abstract}
 \fi
 \AtBeginDocument{%
   \pagestyle{thu at empty}
@@ -556,7 +958,7 @@
 \newcommand\thu at chapter@titleformat[1]{%
   \ifthu at degree@bachelor #1\else%
     \ifthenelse%
-      {\equal{#1}{\eabstractname}}%
+      {\equal{#1}{\thu at abstract@name at en}}%
       {\bfseries #1}%
       {#1}%
   \fi}
@@ -599,7 +1001,7 @@
 \newcommand\thu at phantomsection{}
 \NewDocumentCommand\thu at chapter{s o m o}{
   \IfBooleanF{#1}{%
-    \ClassError{thuthesis}{You have to use the star form: \string\thu at chapter*}{}
+    \thu at error{You have to use the star form: \string\thu at chapter*}%
   }%
   \if at openright\cleardoublepage\else\clearpage\fi%
   \IfValueTF{#2}{%
@@ -629,44 +1031,58 @@
 \setcounter{secnumdepth}{3}
 \setcounter{tocdepth}{2}
 \renewcommand\tableofcontents{%
-  \thu at chapter*[]{\contentsname}
-  \ifthu at degree@bachelor\xiaosi[1.667]\else\xiaosi[1.65]\fi\@starttoc{toc}\normalsize}
-\def\@pnumwidth{2em}
-\def\@tocrmarg{\@pnumwidth}
-\def\@dotsep{1}
-\renewcommand*\l at chapter[2]{%
-  \ifnum \c at tocdepth >\m at ne
-    \addpenalty{-\@highpenalty}%
-    \ifthu at degree@bachelor\vskip 6bp\else\vskip 4bp\fi \@plus\p@
-    \setlength\@tempdima{4em}%
-    \begingroup
-      \parindent \z@ \rightskip \@pnumwidth
-      \parfillskip -\@pnumwidth
-      \leavevmode
-      \advance\leftskip\@tempdima
-      \hskip -\leftskip
-      \begingroup
-        \ifthu at degree@graduate
+  \thu at chapter*[]{\contentsname}%
+  \@starttoc{toc}%
+}
+\thu at define@key{
+  toc-chapter-style = {
+    name = toc at chapter@style,
+    choices = {
+      arial,
+      times,
+    },
+    default = arial,
+  },
+}
+\newcommand\thu at leaders{\titlerule*[4bp]{.}}
+\newcommand\thu at set@toc at format{%
+  \contentsmargin{\z@}%
+  \ifthu at degree@bachelor
+    \titlecontents{chapter}
+      [\z@]{\addvspace{6bp}
+        \ifthu at toc@chapter at style@arial
           \sffamily
         \else
-          \ifthu at degree@bachelor
-            \heiti
-          \fi
+          \heiti
         \fi
-        #1%
-      \endgroup
-      \leaders\hbox{$\m at th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill%
-      \nobreak #2\par
-      \penalty\@highpenalty
-    \endgroup
-  \fi}
-\patchcmd{\@dottedtocline}{\hb at xt@\@pnumwidth}{\hbox}{}{}
-\renewcommand*\l at section{%
-  \@dottedtocline{1}{\ccwd}{2.1em}}
-\renewcommand*\l at subsection{%
-  \@dottedtocline{2}{\ifthu at degree@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}}
-\renewcommand*\l at subsubsection{%
-  \@dottedtocline{3}{\ifthu at degree@bachelor 2.4em\else 3.5em\fi}{3.8em}}
+      }
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\rmfamily\thu at leaders\thecontentspage}%
+    \titlecontents{section}
+      [1\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+    \titlecontents{subsection}
+      [1.5\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+  \else
+    \titlecontents{chapter}
+      [\z@]{\addvspace{6bp}\sffamily}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\rmfamily\thu at leaders\thecontentspage}%
+    \titlecontents{section}
+      [1\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+    \titlecontents{subsection}
+      [2\ccwd]{}
+      {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+      {\thu at leaders\thecontentspage}%
+  \fi
+}
+\thu at set@toc at format
+\thu at option@hook{degree}{\thu at set@toc at format}
 \thu at define@key{
   secret-level = {
     name = secret at level,
@@ -917,54 +1333,84 @@
 }
 \newcommand\thu at titlepage@info{%
   \ifthu at degree@doctor
-    \thu at titlepage@info at doctor
+    \ifthu at degree@type at academic
+      \thu at titlepage@info at doctor@academic
+    \else
+      \thu at titlepage@info at doctor@professional
+    \fi
   \else
-    \thu at titlepage@info at master
+    \ifthu at degree@type at academic
+      \thu at titlepage@info at master@academic
+    \else
+      \ifx\thu at discipline\@empty
+        \thu at titlepage@info at master@other
+      \else
+        \thu at titlepage@info at master@engineer
+      \fi
+    \fi
   \fi
 }
-\newcommand\thu at cover@info at tabular[4]{%
-  \def\thu at cover@item##1##2##3{%
+\newcommand\thu at titlepage@info at tabular[4]{%
+  \def\thu at info@item##1##2##3{%
     \ifx##3\@empty\else
-      \thu at pad{#2}{\thu at fixed@box{#1}{##1}}%
+      \thu at pad{#1}{\thu at fixed@box{#2}{##1}}%
       \thu at pad{#3}{:}%
       ##2{##3}\\
     \fi
   }%
+  \fangsong\sanhao[1.95]%
   \begin{tabular}{l}%
     #4%
-  \end{tabular}
+  \end{tabular}%
 }
-\newcommand\thu at titlepage@info at doctor{%
-  \fangsong\sanhao[1.95]%
-  \thu at cover@info at tabular{2.8cm}{2.8cm}{0.82cm}{%
-    \thu at cover@item{培养单位}{}{\thu at department}%
-    \ifthu at degree@type at academic
-      \thu at cover@item{学科}{}{\thu at discipline}%
-      \thu at cover@item{研究生}{\thu at name@title}{\thu at author}%
-    \else
-      \thu at cover@item{申请人}{\thu at name@title}{\thu at author}%
-    \fi
-    \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-    \thu at cover@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    \thu at cover@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
+\newcommand\thu at titlepage@info at doctor@academic{%
+  \thu at titlepage@info at tabular{2.8cm}{2.8cm}{0.82cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{学科}{}{\thu at discipline}%
+    \thu at info@item{研究生}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
   }\par
 }
-\newcommand\thu at titlepage@info at master{%
-  \fangsong\sanhao[1.95]%
-  \thu at cover@info at tabular{5.5em}{3.6cm}{0.82cm}{%
-    \thu at cover@item{培养单位}{}{\thu at department}%
-    \ifthu at degree@type at academic
-      \thu at cover@item{学科}{}{\thu at discipline}%
-      \thu at cover@item{研究生}{\thu at name@title}{\thu at author}%
-    \else
-      \thu at cover@item{工程领域}{}{\thu at discipline}%
-      \thu at cover@item{申请人}{\thu at name@title}{\thu at author}%
-    \fi
-    \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-    \thu at cover@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    \thu at cover@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+\newcommand\thu at titlepage@info at doctor@professional{%
+  \thu at titlepage@info at tabular{3.03cm}{5em}{1.52cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合导师}{\thu at name@title}{\thu at joint@supervisor}%
   }\par
 }
+\newcommand\thu at titlepage@info at master@academic{%
+  \thu at titlepage@info at tabular{3.59cm}{5.5em}{0.82cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{学科}{}{\thu at discipline}%
+    \thu at info@item{研究生}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
+\newcommand\thu at titlepage@info at master@engineer{%
+  \thu at titlepage@info at tabular{2.8cm}{2.8cm}{1.34cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{工程领域}{}{\thu at discipline}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
+\newcommand\thu at titlepage@info at master@other{%
+  \thu at titlepage@info at tabular{3.28cm}{5em}{1.52cm}{%
+    \thu at info@item{培养单位}{}{\thu at department}%
+    \thu at info@item{申请人}{\thu at name@title}{\thu at author}%
+    \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+    \thu at info@item{副指导教师}{\thu at name@title}{\thu at associate@supervisor}%
+    \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+  }\par
+}
 \newcommand\thu at titlepage@date{%
   \begingroup
     \def\CJKglue{\hskip 1bp}%
@@ -1115,25 +1561,34 @@
       \CJKunderline[skip=false, thickness=0.05em, depth=0.12em]{\thu at title}\par
     }\par
     \vskip 2.5cm%
-    \parbox[t][6.0cm][t]{\textwidth}{%
+    \begingroup
       \fangsong\sanhao[2.3]%
       \leftskip=2.5cm%
       \parindent=\z@
-      \def\thu at cover@item##1##2##3{%
+      \def\thu at info@item##1##2##3{%
         \ifx##3\@empty\else
-          \thu at fixed@box{4em}{##1}:##2{##3}\\
+          \thu at fixed@box{%
+            \ifx\thu at joint@supervisor\@empty
+              4em%
+            \else
+              5.5em%
+            \fi
+          }{##1}:##2{##3}\\
         \fi
       }%
       \def\thu at name@title at format##1##2{%
         \thu at stretch{3em}{##1}\quad ##2%
       }
-      \thu at cover@item{系别}{}{\thu at department}%
-      \thu at cover@item{专业}{}{\thu at discipline}%
-      \thu at cover@item{姓名}{\thu at name@title}{\thu at author}%
-      \thu at cover@item{指导教师}{\thu at name@title}{\thu at supervisor}%
-      \thu at cover@item{辅导教师}{\thu at name@title}{\thu at associate@supervisor}%
-    }\par
-    {\xiaosi\thu at format@date{\thu at date@zh at digit}{\thu at date}\par}%
+      \thu at info@item{系别}{}{\thu at department}%
+      \thu at info@item{专业}{}{\thu at discipline}%
+      \thu at info@item{姓名}{\thu at name@title}{\thu at author}%
+      \thu at info@item{指导教师}{\thu at name@title}{\thu at supervisor}%
+      \thu at info@item{辅导教师}{\thu at name@title}{\thu at associate@supervisor}%
+      \thu at info@item{联合指导教师}{\thu at name@title}{\thu at joint@supervisor}%
+      \par
+    \endgroup
+    \vskip 1.5cm%
+    {\CJKfamily+{}\xiaosi\thu at format@date{\thu at date@zh at digit}{\thu at date}\par}%
   \endgroup
   \clearpage
   \restoregeometry
@@ -1231,7 +1686,7 @@
   日\ifthu at degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:}
 \newcommand\copyrightpage[1][]{%
   \ifthu at degree@postdoc\relax\else
-    \ifthu at degree@bachelor\clearpage\else\cleardoublepage\fi%
+    \cleardoublepage
     \def\thu@@tmp{#1}
     \ifx\thu@@tmp\@empty
       \ifthu at degree@bachelor\thu at authorization@mk\else%
@@ -1276,7 +1731,7 @@
 }
 \newcommand\thu at clist@use[2]{%
   \def\thu@@tmp{}%
-  \kv at set@family at handler{thu at clist}{%
+  \def\thu at clist@processor##1{%
     \ifx\thu@@tmp\@empty
       \def\thu@@tmp{#2}%
     \else
@@ -1284,7 +1739,7 @@
     \fi
     ##1%
   }%
-  \kvsetkeys at expandafter{thu at clist}{#1}%
+  \expandafter\comma at parse\expandafter{#1}{\thu at clist@processor}%
 }
 \newbox\thu at kw
 \newcommand\thu at put@keywords[2]{%
@@ -1294,19 +1749,27 @@
     \box\thu at kw#2\par
   \endgroup}
 \newenvironment{abstract}{%
-  \ifthu at degree@bachelor\clearpage\else\cleardoublepage\fi
-  \thu at setchinese
-  \thu at chapter*[]{\cabstractname} % no tocline
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thusetup{language = chinese}%
+  \thu at chapter*[]{\thu at abstract@name}%  %no tocline
 }{%
   \ifthu at degree@doctor\vfill\else\vskip12bp\fi
   \thu at put@keywords{\textbf{关键词:}}{%
     \thu at clist@use{\thu at keywords}{;}%
   }%
-  \thu at setdefaultlanguage
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at reset@main at language % switch back to main language
 }
 \newenvironment{abstract*}{%
-  \thu at setenglish
-  \thu at chapter*[]{\eabstractname} % no tocline
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thusetup{language = english}%
+  \thu at chapter*[]{\thu at abstract@name at en}%  no tocline
 }{%
   \ifthu at degree@doctor\vfill\else\vskip12bp\fi
   \thu at put@keywords{%
@@ -1314,9 +1777,15 @@
   }{%
     \thu at clist@use{\thu at keywords@en}{; }%
   }%
-  \thu at setdefaultlanguage
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at reset@main at language % switch back to main language
 }
 \newenvironment{denotation}[1][2.5cm]{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
   \thu at chapter*[]{\thu at denotation@name} % no tocline
   \vskip-30bp\xiaosi[1.6]\begin{thu at denotation}[labelwidth=#1]
 }{%
@@ -1333,8 +1802,8 @@
   labelsep*=0.5cm,
   itemindent=0pt,
 }
-\newcommand\thu at declarename{声\hspace{\ccwd}明}
-\newcommand{\thu at declaretext}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
+\newcommand\thu at statement@name{声\hspace{\ccwd}明}
+\newcommand{\thu at statement@text}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
   ,独立进行研究工作所取得的成果。尽我所知,除文中已经注明引用的内容外,本学位论
   文的研究成果不包含任何他人享有著作权的内容。对本论文所涉及的研究工作做出贡献的
   其他个人和集体,均已在文中以明确方式标明。}
@@ -1341,43 +1810,78 @@
 \newcommand{\thu at signature}{签\hspace{1em}名:}
 \newcommand{\thu at backdate}{日\hspace{1em}期:}
 \newenvironment{acknowledgements}{%
-  \thu at chapter*{\thu at ack@name}%
-}{}
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+  \thu at chapter*{\thu at acknowledgements@name}%
+}{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
+}
 \newcommand\statement[1][]{%
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
   \def\thu@@tmp{#1}%
   \ifx\thu@@tmp\@empty
-    \thu at chapter*{\thu at declarename}%
-    \par{\xiaosi\parindent2em\thu at declaretext}\vskip2cm%
-    {\xiaosi\hfill\thu at signature\thu at underline[2.5cm]\relax
+    \thu at chapter*{\thu at statement@name}%
+    \thu at statement@text\par
+    \ifthu at degree@graduate
+      \vskip 2cm%
+    \else
+      \null\par
+    \fi
+    {\hfill\thu at signature\thu at underline[2.5cm]\relax
       \thu at backdate\thu at underline[2.5cm]\relax}%
   \else
     \includepdf[pagecommand={\thispagestyle{thu at empty}%
-      \addcontentsline{toc}{chapter}{\thu at declarename}%
+      \addcontentsline{toc}{chapter}{\thu at statement@name}%
     }]{#1}%
   \fi
+  \ifthu at degree@bachelor
+    \cleardoublepage
+  \fi
 }
 \let\acknowledgement\acknowledgements
 \let\endacknowledgement\endacknowledgements
-\def\thu at starttoc#1{% #1: float type, prepend type name in \listof*** entry.
-  \let\oldnumberline\numberline
-  \def\numberline##1{\oldnumberline{\csname #1name\endcsname\hskip.4em ##1}}
-  \@starttoc{\csname ext@#1\endcsname}
-  \let\numberline\oldnumberline}
 \def\thu at listof#1{% #1: float type
   \setcounter{tocdepth}{2} % restore tocdepth in case being modified
   \@ifstar
-    {\thu at chapter*[]{\csname list#1name\endcsname}\thu at starttoc{#1}}
-    {\thu at chapter*{\csname list#1name\endcsname}\thu at starttoc{#1}}}
-\renewcommand\listoffigures{\thu at listof{figure}}
-\renewcommand*\l at figure{\ifthu at degree@bachelor\relax\else\addvspace{6bp}\fi\@dottedtocline{1}{0em}{4em}}
-\renewcommand\listoftables{\thu at listof{table}}
-\let\l at table\l at figure
+    {\thu at chapter*[]{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}
+    {\thu at chapter*{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}%
+}
+\renewcommand\listoffigures{%
+  \thu at set@list at label@width{\figurename}%
+  \thu at listof{figure}%
+}
+\newlength{\thu at list@label at width}
+\newcommand\thu at set@list at label@width[1]{%
+  \settowidth{\thu at list@label at width}{#1~8.8}%
+  \addtolength{\thu at list@label at width}{1em}%
+}
+\titlecontents{figure}
+  [\thu at list@label at width]{\addvspace{6bp}}
+  {\contentslabel[\figurename~\thecontentslabel]{\thu at list@label at width}}{}
+  {\thu at leaders\thecontentspage}
+\renewcommand\listoftables{%
+  \thu at set@list at label@width{\tablename}%
+  \thu at listof{table}%
+}
+\titlecontents{table}
+  [\thu at list@label at width]{\addvspace{6bp}}
+  {\contentslabel[\tablename~\thecontentslabel]{\thu at list@label at width}}{}
+  {\thu at leaders\thecontentspage}
 \def\ext at equation{loe}
 \def\equcaption#1{%
   \addcontentsline{\ext at equation}{equation}%
                   {\protect\numberline{#1}}}
 \newcommand\listofequations{\thu at listof{equation}}
-\let\l at equation\l at figure
+\titlecontents{equation}
+  [0pt]{\addvspace{6bp}}
+  {\thu at equation@name~\thecontentslabel}{}
+  {\thu at leaders\thecontentspage}
+\contentsuse{equation}{loe}
 \DeclareRobustCommand\inlinecite{\@inlinecite}
 \def\@inlinecite#1{\begingroup\let\@cite\NAT at citenum\citep{#1}\endgroup}
 \let\onlinecite\inlinecite
@@ -1397,11 +1901,9 @@
 \thu at define@key{
   cite-style = {
     name = cite at style,
-    code = {
-      \@nameuse{bibstyle at thuthesis-\thu at cite@style}
-    },
   }
 }
+\thu at option@hook{cite-style}{\@nameuse{bibstyle at thuthesis-\thu at cite@style}}
 \patchcmd\NAT at citexnum{%
   \@ifnum{\NAT at ctype=\z@}{%
     \if*#2*\else\NAT at cmt#2\fi
@@ -1439,15 +1941,34 @@
 \thu at define@key{
   toc-depth = {
     name = toc at depth,
-    code = {\addtocontents{toc}{\protect\setcounter{tocdepth}{\thu at toc@depth}}},
   },
 }
-\g at addto@macro\appendix{\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}}
+\thu at option@hook{toc-depth}{%
+  \protected at write\@auxout{}{%
+    \string\ttl at writefile{toc}{%
+      \protect\setcounter{tocdepth}{\thu at toc@depth}%
+    }%
+  }%
+  \addtocontents{lof}{\string\let\string\contentsline\string\ttl at gobblecontents}
+  \addtocontents{lot}{\string\let\string\contentsline\string\ttl at gobblecontents}
+  \addtocontents{loe}{\string\let\string\contentsline\string\ttl at gobblecontents}
+}
+\g at addto@macro\appendix{%
+  \thusetup{
+    toc-depth = 0,
+  }
+}
 \newenvironment{survey}{%
   \chapter{外文资料的调研阅读报告}%
-  \thu at setenglish
+  \thusetup{language = english}%
   \let\title\thu at appendix@title
   \let\maketitle\thu at appendix@maketitle
+  \thu at set@partial at toc@format
+  \renewcommand\tableofcontents{%
+    \section*{Contents}%
+    \thu at pdfbookmark{1}{Contents}%
+    \printcontents[survey]{l}{1}[2]{}%
+  }%
   \renewcommand\bibname{参考文献}%
   \let\bibsection\thu at appendix@bibsection
   \renewcommand\@bibunitname{main-survey}%
@@ -1454,23 +1975,47 @@
   \let\bibliographystyle\defaultbibliographystyle
   \let\bibliography\thu at appendix@bibliography
   \begin{bibunit}%
+  \startcontents[survey]%
 }{%
+  \stopcontents[survey]%
   \end{bibunit}%
+  \thu at reset@main at language % restore language
 }
 \newenvironment{translation}{%
   \chapter{外文资料的书面翻译}%
-  \thu at setenglish
+  \thusetup{language = chinese}%
   \let\title\thu at appendix@title
   \let\maketitle\thu at appendix@maketitle
-  \renewcommand\bibname{书面翻译对应的原文索引}%
-  \let\bibsection\thu at appendix@bibsection
+  \thu at set@partial at toc@format
+  \renewcommand\tableofcontents{%
+    \section*{目录}%
+    \thu at pdfbookmark{1}{目录}%
+    \printcontents[translation]{l}{1}[2]{}%
+  }%
+  \def\bibsection{%
+    \begingroup
+      \ctexset{section/numbering=false}%
+      \section{\bibname}%
+    \endgroup
+  }%
   \renewcommand\@bibunitname{main-translation}%
   \let\bibliographystyle\defaultbibliographystyle
   \let\bibliography\thu at appendix@bibliography
   \begin{bibunit}%
+  \startcontents[translation]%
 }{%
+  \stopcontents[translation]%
   \end{bibunit}%
+  \thu at reset@main at language % restore language
 }
+\newenvironment{translation-index}{%
+  \begin{bibunit}%
+    \renewcommand\@bibunitname{main-index}%
+    \renewcommand\bibname{书面翻译对应的原文索引}%
+    \let\bibsection\thu at appendix@bibsection
+}{%
+  \end{bibunit}%
+}
 \DeclareRobustCommand\thu at appendix@title[1]{\gdef\thu at appendix@@title{#1}}
 \newcommand\thu at appendix@maketitle{%
   \par
@@ -1479,9 +2024,24 @@
   \end{center}%
   \par
 }
+\newcommand\thu at set@partial at toc@format{%
+  \titlecontents{section}
+    [\z@]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+  \titlecontents{subsection}
+    [1\ccwd]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+  \titlecontents{subsubsection}
+    [2\ccwd]{}
+    {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+    {\thu at leaders\thecontentspage}%
+}
 \newcommand\thu at appendix@bibsection{%
   \par
   \vskip 20bp%
+  \thu at pdfbookmark{1}{\bibname}%
   \begingroup
     \centering
     \xiaosi[1.667]\bibname\par
@@ -1489,7 +2049,7 @@
   \vskip 6bp%
 }%
 \newcommand\thu at appendix@bibliography[1]{\putbib[#1]}
-\newenvironment{resume}[1][\thu at resume@title]{%
+\newenvironment{resume}[1][\thu at resume@name]{%
   \thu at chapter*{#1}}{}
 \newcommand{\resumeitem}[1]{%
   \vspace{24bp}{\sihao\heiti\centerline{#1}}\par\vspace{6bp}}
@@ -1502,8 +2062,7 @@
 \setlist[achievements]{label=[\arabic*],align=left,nosep,itemsep=8bp,
   leftmargin=10mm,labelsep=!,before=\xiaosi[1.26]}
 \def\publicationskip{\bigskip\bigskip}
-\newcommand\thu at atendpackage{\csname ctex_at_end_package:nn\endcsname}
-\thu at atendpackage{hyperref}{
+\AtEndOfPackageFile*{hyperref}{
   \hypersetup{
     linktoc            = all,
     bookmarksdepth     = 2,
@@ -1510,6 +2069,7 @@
     bookmarksnumbered  = true,
     bookmarksopen      = true,
     bookmarksopenlevel = 1,
+    bookmarksdepth     = 3,
     unicode            = true,
     psdextra           = true,
     breaklinks         = true,
@@ -1533,6 +2093,15 @@
   \@ifpackagelater{hyperref}{2019/04/27}{}{%
     \g at addto@macro\psdmapshortnames{\let\mu\textmu}
   }%
+  \ifthu at language@chinese
+    \hypersetup{
+      pdflang = zh-CN,
+    }%
+  \else
+    \hypersetup{
+      pdflang = en-US,
+    }%
+  \fi
   \AtBeginDocument{%
     \ifthu at language@chinese
       \hypersetup{
@@ -1540,7 +2109,6 @@
         pdfauthor   = \thu at author,
         pdfsubject  = \thu at degree@name,
         pdfkeywords = \thu at keywords,
-        pdflang     = zh-CN,
       }%
     \else
       \hypersetup{
@@ -1548,7 +2116,6 @@
         pdfauthor   = \thu at author@en,
         pdfsubject  = \thu at degree@name at en,
         pdfkeywords = \thu at keywords@en,
-        pdflang     = en-US,
       }%
     \fi
     \hypersetup{
@@ -1555,7 +2122,7 @@
       pdfcreator={\thuthesis-v\version}}
   }%
 }
-\thu at atendpackage{nomencl}{
+\AtEndOfPackageFile*{nomencl}{
   \let\nomname\thu at denotation@name
   \def\thenomenclature{\begin{denotation}[\nom at tempdim]}
   \def\endthenomenclature{\end{denotation}}
@@ -1564,7 +2131,7 @@
   \let\thu at LT@array\LT at array
   \def\LT at array{\dawu[1.5]\thu at LT@array} % set default font size
 }
-\thu at atendpackage{siunitx}{%
+\AtEndOfPackageFile*{siunitx}{%
   \sisetup{
     group-minimum-digits = 4,
     separate-uncertainty = true,
@@ -1588,12 +2155,45 @@
     \fi
   }
   \thu at set@siunitx at language
-  \thu at addto{language}{\thu at set@siunitx at language}
+  \thu at option@hook{language}{\thu at set@siunitx at language}
 }
-\thu at atendpackage{ntheorem}{%
+\AtEndOfPackageFile*{amsthm}{%
+  \newtheoremstyle{thu}
+    {\z@}{\z@}
+    {\normalfont}{\z@}
+    {\normalfont\sffamily}{\thu at theorem@separator}
+    {0.5em}{}
+  \theoremstyle{thu}
+  \newtheorem{assumption}{\thu at assumption@name}[chapter]%
+  \newtheorem{definition}{\thu at definition@name}[chapter]%
+  \newtheorem{proposition}{\thu at proposition@name}[chapter]%
+  \newtheorem{lemma}{\thu at lemma@name}[chapter]%
+  \newtheorem{theorem}{\thu at theorem@name}[chapter]%
+  \newtheorem{axiom}{\thu at axiom@name}[chapter]%
+  \newtheorem{corollary}{\thu at corollary@name}[chapter]%
+  \newtheorem{exercise}{\thu at exercise@name}[chapter]%
+  \newtheorem{example}{\thu at example@name}[chapter]%
+  \newtheorem{remark}{\thu at remark@name}[chapter]%
+  \newtheorem{problem}{\thu at problem@name}[chapter]%
+  \newtheorem{conjecture}{\thu at conjecture@name}[chapter]%
+  \renewenvironment{proof}[1][\thu at proof@name]{\par
+    \pushQED{\qed}%
+    % \normalfont \topsep6\p@\@plus6\p@\relax
+    \normalfont \topsep\z@\relax
+    \trivlist
+    \item[\hskip\labelsep
+          \itshape
+      % #1\@addpunct{.}]\ignorespaces
+      \textsf{#1}\@addpunct{\thu at theorem@separator}]\ignorespaces
+  }{%
+    \popQED\endtrivlist\@endpefalse
+  }
+  \renewcommand\qedsymbol{\ensuremath{\QED}}
+}
+\AtEndOfPackageFile*{ntheorem}{%
   \theorembodyfont{\normalfont}%
   \theoremheaderfont{\normalfont\sffamily}%
-  \theoremsymbol{\ensuremath{\square}}%
+  \theoremsymbol{\ensuremath{\QED}}%
   \newtheorem*{proof}{\thu at proof@name}%
   \theoremstyle{plain}%
   \theoremsymbol{}%
@@ -1611,6 +2211,53 @@
   \newtheorem{problem}{\thu at problem@name}[chapter]%
   \newtheorem{conjecture}{\thu at conjecture@name}[chapter]%
 }
+\PassOptionsToPackage{chapter}{algorithm}
+\AtEndOfPackageFile*{algorithm}{
+  \floatname{algorithm}{\thu at algorithm@name}
+  \g at addto@macro\appendix{\renewcommand*{\thealgorithm}{\thechapter-\arabic{algorithm}}}
+  \renewcommand\listofalgorithms{%
+    \thu at set@list at label@width{\fname at algorithm}%
+    \thu at listof{algorithm}%
+  }
+  \renewcommand\listalgorithmname{\thu at list@algorithm at name}
+  \def\ext at algorithm{loa}
+  \contentsuse{algorithm}{loa}
+  \titlecontents{algorithm}
+    [\thu at list@label at width]{\addvspace{6bp}}
+    {\contentslabel[\fname at algorithm~\thecontentslabel]{\thu at list@label at width}}{}
+    {\thu at leaders\thecontentspage}
+}
+\PassOptionsToPackage{algochapter}{algorithm2e}
+\AtEndOfPackageFile*{algorithm2e}{
+  \renewcommand\algorithmcfname{\thu at algorithm@name}
+  \SetAlgoCaptionLayout{dawu}
+  \SetAlCapSty{relax}
+  \SetAlgoCaptionSeparator{\hspace*{1em}}
+  \SetAlFnt{\dawu}
+  \renewcommand\listofalgorithms{%
+    \thu at set@list at label@width{\algorithmcfname}%
+    \thu at listof{algorithmcf}%
+  }
+  \renewcommand\listalgorithmcfname{\thu at list@algorithm at name}
+  \def\ext at algorithmcf{loa}
+  \contentsuse{algocf}{loa}
+  \titlecontents{algocf}
+    [\thu at list@label at width]{\addvspace{6bp}}
+    {\contentslabel[\algorithmcfname~\thecontentslabel]{\thu at list@label at width}}{}
+    {\thu at leaders\thecontentspage}
+}
+\AtEndOfPackageFile*{minted}{
+  \g at addto@macro\appendix{\renewcommand*{\thelisting}{\thechapter-\arabic{listing}}}%
+  \newcommand\thu at set@listing at language{%
+    \ifthu at language@chinese
+      \floatname{listing}{代码}%
+    \else
+      \floatname{listing}{Listing}%
+    \fi
+  }
+  \thu at set@listing at language
+  \thu at option@hook{language}{\thu at set@listing at language}
+}
 \NewDocumentCommand{\spine}{O{\thu at title} O{\thu at author}}{%
   \newpage\thispagestyle{empty}%
   \fangsong\addCJKfontfeatures*{RawFeature={vertical:}}



More information about the tex-live-commits mailing list.