summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thuthesis
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-09 03:01:30 +0000
committerNorbert Preining <norbert@preining.info>2020-06-09 03:01:30 +0000
commit03edc188c852d76ccf08759e0c334228f5f37c9f (patch)
tree08a3225e256e2bdf837eba0a45bf66b2d476f992 /macros/latex/contrib/thuthesis
parent7e1a772944cf3d35b15db92cf639c702d1acf053 (diff)
CTAN sync 202006090301
Diffstat (limited to 'macros/latex/contrib/thuthesis')
-rw-r--r--macros/latex/contrib/thuthesis/Makefile8
-rw-r--r--macros/latex/contrib/thuthesis/README.md124
-rw-r--r--macros/latex/contrib/thuthesis/data/appendix-survey.tex52
-rw-r--r--macros/latex/contrib/thuthesis/data/appendix-translation.tex17
-rw-r--r--macros/latex/contrib/thuthesis/data/appendix.tex170
-rw-r--r--macros/latex/contrib/thuthesis/data/chap01.tex104
-rw-r--r--macros/latex/contrib/thuthesis/data/resume.tex2
-rw-r--r--macros/latex/contrib/thuthesis/latexmkrc4
-rw-r--r--macros/latex/contrib/thuthesis/main.pdfbin767739 -> 877231 bytes
-rw-r--r--macros/latex/contrib/thuthesis/main.tex9
-rw-r--r--macros/latex/contrib/thuthesis/spine.pdfbin20322 -> 20346 bytes
-rw-r--r--macros/latex/contrib/thuthesis/thusetup.tex18
-rw-r--r--macros/latex/contrib/thuthesis/thuthesis.dtx1748
-rw-r--r--macros/latex/contrib/thuthesis/thuthesis.pdfbin914795 -> 1050296 bytes
-rw-r--r--macros/latex/contrib/thuthesis/tsinghua.pdfbin6715 -> 14186 bytes
15 files changed, 1509 insertions, 747 deletions
diff --git a/macros/latex/contrib/thuthesis/Makefile b/macros/latex/contrib/thuthesis/Makefile
index f3dd43cc77..6e1c352650 100644
--- a/macros/latex/contrib/thuthesis/Makefile
+++ b/macros/latex/contrib/thuthesis/Makefile
@@ -7,7 +7,9 @@ SPINE = spine
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 @@ test:
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 @@ else
endif
dist: check all-dev
- npm run build -- --version=$(version)
+ $(NPM) run build -- --version=$(version)
diff --git a/macros/latex/contrib/thuthesis/README.md b/macros/latex/contrib/thuthesis/README.md
index 3f30682f45..8477c945ac 100644
--- a/macros/latex/contrib/thuthesis/README.md
+++ b/macros/latex/contrib/thuthesis/README.md
@@ -1,37 +1,58 @@
-[![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 用户使用,不提供任何保证。
+
+下载途径:
+
+* 发布版:
+ * [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` 等文件覆盖原有的即可,无须额外操作。
-# 升级
-## 自动更新
-通过 TeX 发行版工具自动从 [CTAN](https://www.ctan.org/pkg/thuthesis) 更新。
+#### 开发板
-## 手动更新
-从 [GitHub](https://github.com/xueruini/thuthesis) 下载放入论文目录,执行命令(Windows 用户在文件夹空白处按 `Shift + 鼠标右键`,点击“在此处打开命令行窗口”):
+从 GitHub clone 项目源码或者下载源码 zip 包,执行命令(Windows 用户在文件夹空白处按 `Shift + 鼠标右键`,点击“在此处打开命令行窗口”):
```shell
xetex thuthesis.ins
@@ -39,44 +60,67 @@ xetex thuthesis.ins
即可得到 `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。
---
-# 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.
+
+* 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)
-# Updates
-## Automatic
+## 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 @@ xetex thuthesis.ins
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;
diff --git a/macros/latex/contrib/thuthesis/data/appendix-survey.tex b/macros/latex/contrib/thuthesis/data/appendix-survey.tex
index 4a753f5211..f97039b45c 100644
--- a/macros/latex/contrib/thuthesis/data/appendix-survey.tex
+++ b/macros/latex/contrib/thuthesis/data/appendix-survey.tex
@@ -8,20 +8,24 @@
写出至少 5000 外文印刷字符的调研阅读报告或者书面翻译 1-2 篇(不少于 2 万外文印刷符)。
-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
-mathematical programming such that readers gain an understanding of them
-throughout the book\cite{abrahams99tex,salomon1995advanced}.
+
+\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
+mathematical programming such that readers gain an understanding of them
+throughout the book.~\cite{abrahams99tex,salomon1995advanced}.
+
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 @@ 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
+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,34 +69,33 @@ $\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]
+ \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}
\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 @@ 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}.
+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 @@ 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}
+ \caption{This is an example for figure.}
\label{tab:badfigure2}
\end{figure}
@@ -141,8 +143,8 @@ 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
+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 @@ function.
\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})
diff --git a/macros/latex/contrib/thuthesis/data/appendix-translation.tex b/macros/latex/contrib/thuthesis/data/appendix-translation.tex
index f085815300..5cc6549083 100644
--- a/macros/latex/contrib/thuthesis/data/appendix-translation.tex
+++ b/macros/latex/contrib/thuthesis/data/appendix-translation.tex
@@ -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}
diff --git a/macros/latex/contrib/thuthesis/data/appendix.tex b/macros/latex/contrib/thuthesis/data/appendix.tex
index 94a4a0595c..38e7548ba7 100644
--- a/macros/latex/contrib/thuthesis/data/appendix.tex
+++ b/macros/latex/contrib/thuthesis/data/appendix.tex
@@ -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 @@ the {\em branch-and-bound enumeration} developed by Balas (1965) and Dakin
\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 @@ the {\em branch-and-bound enumeration} developed by Balas (1965) and Dakin
\begin{figure}[h]
\centering
\includegraphics{thu-whole-logo.pdf}
- \caption*{图~1\hskip1em 这是手动编号但不出现索引中的图片的例子}
+ \caption{这是图片的例子}
\label{tab:badfigure3}
\end{figure}
diff --git a/macros/latex/contrib/thuthesis/data/chap01.tex b/macros/latex/contrib/thuthesis/data/chap01.tex
index e1ab5e19d8..01096ad170 100644
--- a/macros/latex/contrib/thuthesis/data/chap01.tex
+++ b/macros/latex/contrib/thuthesis/data/chap01.tex
@@ -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,18 +185,18 @@
\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
\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.A.8 & 31.06 & 0.004 & 0.017 & 0.005 & 0.073 & 1661 \\
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 @@ EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\
\section{定理环境}
\label{sec:theorem}
-给大家演示一下各种和证明有关的环境:
+给大家演示一下各种和证明有关的环境,比如公式~\eqref{eq:eqnxmp}:
\begin{assumption}
待月西厢下,迎风户半开;隔墙花影动,疑是玉人来。
@@ -358,6 +351,7 @@ EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\
何反起悲伤?(引自《杜十娘怒沉百宝箱》)
\begin{definition}
+\label{def:ziyue}
子曰:「道千乘之国,敬事而信,节用而爱人,使民以时。」
\end{definition}
@@ -365,15 +359,14 @@ EP.B.8 & 126.74 & 0.003 & 0.017 & 0.005 & 0.083 & 1656 \\
君应有语,渺万里层云,千山暮雪,只影向谁去?
横汾路,寂寞当年箫鼓,荒烟依旧平楚。招魂楚些何嗟及,山鬼暗谛风雨。天也妒,未信与,莺儿燕子俱黄土。
-千秋万古,为留待骚人,狂歌痛饮,来访雁丘处。
+千秋万古,为留待骚人,狂歌痛饮,来访雁丘处。(参见定义~\ref{def:ziyue})
\begin{proposition}
曾子曰:「吾日三省吾身 —— 为人谋而不忠乎?与朋友交而不信乎?传不习乎?」
\end{proposition}
-多么凄美的命题啊!其日牛马嘶,新妇入青庐,奄奄黄昏后,寂寂人定初,我命绝今日,
-魂去尸长留,揽裙脱丝履,举身赴清池,府吏闻此事,心知长别离,徘徊庭树下,自挂东南
-枝。
+其日牛马嘶,新妇入青庐,奄奄黄昏后,寂寂人定初,我命绝今日,魂去尸长留,揽裙脱丝履,举身赴清池,
+府吏闻此事,心知长别离,徘徊庭树下,自挂东南枝。
\begin{remark}
天不言自高,水不言自流。
@@ -430,12 +423,15 @@ x&\equiv y+1\pod{m^2}
\begin{theorem}\label{the:theorem1}
犯我强汉者,虽远必诛\hfill —— 陈汤(汉)
\end{theorem}
+
+下面演示了子公式编号:
\begin{subequations}
\begin{align}
y & = 1 \\
y & = 0
\end{align}
\end{subequations}
+
道可道,非常道。名可名,非常名。无名天地之始;有名万物之母。故常无,欲以观其妙;
常有,欲以观其徼。此两者,同出而异名,同谓之玄。玄之又玄,众妙之门。上善若水。水
善利万物而不争,处众人之所恶,故几于道。曲则全,枉则直,洼则盈,敝则新,少则多,
@@ -521,17 +517,17 @@ V_j & = v_j, & \qquad X_j & = x_j,
有时候不想要上标,那么可以这样~\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}
diff --git a/macros/latex/contrib/thuthesis/data/resume.tex b/macros/latex/contrib/thuthesis/data/resume.tex
index 80bd6aa06b..587d9ef628 100644
--- a/macros/latex/contrib/thuthesis/data/resume.tex
+++ b/macros/latex/contrib/thuthesis/data/resume.tex
@@ -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}
diff --git a/macros/latex/contrib/thuthesis/latexmkrc b/macros/latex/contrib/thuthesis/latexmkrc
index 3ba7612943..d5134325de 100644
--- a/macros/latex/contrib/thuthesis/latexmkrc
+++ b/macros/latex/contrib/thuthesis/latexmkrc
@@ -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');
diff --git a/macros/latex/contrib/thuthesis/main.pdf b/macros/latex/contrib/thuthesis/main.pdf
index dd7dc07b26..d4e1a77c4b 100644
--- a/macros/latex/contrib/thuthesis/main.pdf
+++ b/macros/latex/contrib/thuthesis/main.pdf
Binary files differ
diff --git a/macros/latex/contrib/thuthesis/main.tex b/macros/latex/contrib/thuthesis/main.tex
index a84e0b479e..93113b7a6a 100644
--- a/macros/latex/contrib/thuthesis/main.tex
+++ b/macros/latex/contrib/thuthesis/main.tex
@@ -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}
diff --git a/macros/latex/contrib/thuthesis/spine.pdf b/macros/latex/contrib/thuthesis/spine.pdf
index 2c7a051036..f5963cc5a6 100644
--- a/macros/latex/contrib/thuthesis/spine.pdf
+++ b/macros/latex/contrib/thuthesis/spine.pdf
Binary files differ
diff --git a/macros/latex/contrib/thuthesis/thusetup.tex b/macros/latex/contrib/thuthesis/thusetup.tex
index 2571c78f04..7e0e93575b 100644
--- a/macros/latex/contrib/thuthesis/thusetup.tex
+++ b/macros/latex/contrib/thuthesis/thusetup.tex
@@ -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}
diff --git a/macros/latex/contrib/thuthesis/thuthesis.dtx b/macros/latex/contrib/thuthesis/thuthesis.dtx
index 0a40047d0e..aca56237d9 100644
--- a/macros/latex/contrib/thuthesis/thuthesis.dtx
+++ b/macros/latex/contrib/thuthesis/thuthesis.dtx
@@ -1,6 +1,7 @@
% \iffalse meta-comment
%
-% Copyright (C) 2005-2020 by Ruini Xue <xueruini@gmail.com>
+% Copyright (C) 2005-2020 by Tsinghua University TUNA Association <tuna@tsinghua.edu.cn>
+%
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -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@gmail.com}}
+% \author{{\fangsong 清华大学 TUNA 协会}\\[5pt]\texttt{tuna@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
+% \end{shell}
+%
+% 然后,生成论文以及书脊:
% \begin{shell}
-% $ xetex thuthesis.ins # 生成 thuthesis.cls
% $ 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,26 +872,37 @@
% 本科生《写作指南》要求附录 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{...}
% \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,7 +984,15 @@
% \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@error[1]{%
+ \ClassError{thuthesis}{#1}{}%
+}
+% \end{macrocode}
+%
+% 检查 \LaTeXe{} kernel 版本
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2017/04/15}{}{
+ \thu@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@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@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@define@key{thu@value}{name}{%
\@namedef{thu@#1@@name}{##1}%
}%
- \kv@define@key{thu@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@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@addto[2]{%
+\newcommand\thu@option@hook[2]{%
\expandafter\g@addto@macro\csname thu@#1@@code\endcsname{#2}%
}
% \end{macrocode}
%
% \begin{macrocode}
-\newif\ifthu@degree@graduate
-\newcommand\thu@set@graduate{%
- \thu@degree@graduatefalse
- \ifthu@degree@doctor
- \thu@degree@graduatetrue
- \fi
- \ifthu@degree@master
- \thu@degree@graduatetrue
- \fi
-}
\thu@define@key{
degree = {
choices = {
@@ -1127,7 +1187,6 @@
postdoc,
},
default = doctor,
- code = {\thu@set@graduate},
},
degree-type = {
choices = {
@@ -1138,7 +1197,7 @@
},
% \end{macrocode}
%
-% 论文是否使用英文。
+% 论文的主要语言。
% \begin{macrocode}
language = {
choices = {
@@ -1146,7 +1205,85 @@
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@font,
+ choices = {
+ windows,
+ mac,
+ noto,
+ fandol,
+ auto,
+ none,
+ },
+ default = auto,
+ },
+ math-font = {
+ name = math@font,
+ choices = {
+ xits,
+ stix,
+ libertinus,
+ lm,
+ none,
+ },
+ default = xits,
+ },
}
+\newif\ifthu@degree@graduate
+\newcommand\thu@set@graduate{%
+ \thu@degree@graduatefalse
+ \ifthu@degree@doctor
+ \thu@degree@graduatetrue
+ \fi
+ \ifthu@degree@master
+ \thu@degree@graduatetrue
+ \fi
+}
+\thu@set@graduate
+\thu@option@hook{degree}{%
+ \thu@set@graduate
+}
+% \end{macrocode}
+%
+% 设置默认 \option{openany}。
+% \begin{macrocode}
+\DeclareBoolOption[false]{openright}
+\DeclareComplementaryOption{openany}{openright}
% \end{macrocode}
%
% \option{raggedbottom} 选项(默认打开)
@@ -1164,10 +1301,19 @@
\ProcessKeyvalOptions*
% \end{macrocode}
%
+% 设置默认 \option{openany}。
+% \begin{macrocode}
+\ifthu@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@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@package@conflict[2]{
+ \AtBeginOfPackageFile*{#2}{
+ \thu@error{The "#2" package is incompatible with required "#1"}
+ }
}
-\Urlmuskip=0mu plus 0.1mu
+\thu@package@conflict{unicode-math}{amscd}
+\thu@package@conflict{unicode-math}{amsfonts}
+\thu@package@conflict{unicode-math}{amssymb}
+\thu@package@conflict{unicode-math}{bbm}
+\thu@package@conflict{unicode-math}{bm}
+\thu@package@conflict{unicode-math}{eucal}
+\thu@package@conflict{unicode-math}{eufrak}
+\thu@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@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@openright\cleardoublepage\else\clearpage\fi
- \@mainmatterfalse
+ \cleardoublepage
\ifthu@degree@bachelor
\pagestyle{thu@plain}
\else
\pagestyle{thu@headings}
\fi
+ \@mainmatterfalse
\pagenumbering{Roman}%
\let\@tabular\thu@tabular
}
\renewcommand\mainmatter{%
- \if@openright\cleardoublepage\else\clearpage\fi
+ \cleardoublepage
\@mainmattertrue
\pagenumbering{arabic}
\ifthu@degree@bachelor\pagestyle{thu@plain}\else\pagestyle{thu@headings}\fi}
@@ -1364,39 +1519,214 @@
% \label{sec:font}
% 使用 \pkg{fontspec} 配置字体。
% \begin{macrocode}
-\newcommand\thu@fontset{\csname g__ctex_fontset_tl\endcsname}
-\ifthenelse{\equal{\thu@fontset}{fandol}}{
- \setmainfont[
+\ifthu@fontset@mac
+ \thusetup{
+ font = times,
+ cjk-font = mac,
+ }
+\else
+ \ifthu@fontset@windows
+ \thusetup{
+ font = times,
+ cjk-font = windows,
+ }
+ \else
+ \ifthu@fontset@fandol
+ \thusetup{
+ font = termes,
+ cjk-font = fandol,
+ }
+ \else
+ \ifthu@fontset@ubuntu
+ \thusetup{
+ font = termes,
+ cjk-font = noto,
+ }
+ \fi
+ \fi
+ \fi
+\fi
+% \end{macrocode}
+%
+% 检测系统
+% \begin{macrocode}
+\ifthu@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@font@family@xits\@empty
+\newcommand\thu@set@xits@names{%
+ \ifx\thu@font@family@xits\@empty
+ \IfFontExistsTF{XITSMath-Regular.otf}{%
+ \gdef\thu@font@family@xits{XITS}%
+ \gdef\thu@font@style@xits@rm{Regular}%
+ \gdef\thu@font@style@xits@bf{Bold}%
+ \gdef\thu@font@style@xits@it{Italic}%
+ \gdef\thu@font@style@xits@bfit{BoldItalic}%
+ \gdef\thu@font@name@xits@math@rm{XITSMath-Regular}%
+ \gdef\thu@font@name@xits@math@bf{XITSMath-Bold}%
+ }{%
+ \gdef\thu@font@family@xits{xits}%
+ \gdef\thu@font@style@xits@rm{regular}%
+ \gdef\thu@font@style@xits@bf{bold}%
+ \gdef\thu@font@style@xits@it{italic}%
+ \gdef\thu@font@style@xits@bfit{bolditalic}%
+ \gdef\thu@font@name@xits@math@rm{xits-math}%
+ \gdef\thu@font@name@xits@math@bf{xits-mathbold}%
+ }%
+ \fi
+}
+\let\thu@font@family@libertinus\@empty
+\newcommand\thu@set@libertinus@names{%
+ \ifx\thu@font@family@libertinus\@empty
+ \IfFontExistsTF{LibertinusSerif-Regular.otf}{%
+ \gdef\thu@font@family@libertinus@serif{LibertinusSerif}%
+ \gdef\thu@font@family@libertinus@sans{LibertinusSans}%
+ \gdef\thu@font@name@libertinus@math{LibertinusMath-Regular}%
+ \gdef\thu@font@style@libertinus@rm{Regular}%
+ \gdef\thu@font@style@libertinus@bf{Bold}%
+ \gdef\thu@font@style@libertinus@it{Italic}%
+ \gdef\thu@font@style@libertinus@bfit{BoldItalic}%
+ }{%
+ \gdef\thu@font@family@libertinus@serif{libertinusserif}%
+ \gdef\thu@font@family@libertinus@sans{libertinussans}%
+ \gdef\thu@font@name@libertinus@math{libertinusmath-regular}%
+ \gdef\thu@font@style@libertinus@rm{regular}%
+ \gdef\thu@font@style@libertinus@bf{bold}%
+ \gdef\thu@font@style@libertinus@it{italic}%
+ \gdef\thu@font@style@libertinus@bfit{bolditalic}%
+ }%
+ \fi
+}
+% \end{macrocode}
+%
+% 《撰写手册》要求西文字体使用 Times New Roman 和 Arial,
+% 但是在 Linux 下没有这两个字体,所以使用它们的克隆版 TeX Gyre Termes 和
+% TeX Gyre Heros。
+% \begin{macrocode}
+\ifthu@font@auto
+ \ifthu@system@unix
+ \thusetup{font=termes}
+ \else
+ \thusetup{font=times}
+ \fi
+\fi
+\newcommand\thu@load@font@times{%
+ \setmainfont{Times New Roman}%
+ \setsansfont{Arial}%
+ \ifthu@system@mac
+ \setmonofont{Menlo}[Scale = MatchLowercase]%
+ \else
+ \setmonofont{Courier New}[Scale = MatchLowercase]%
+ \fi
+}
+\newcommand\thu@load@font@termes{%
+ \setmainfont{texgyretermes}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
- ]{texgyretermes}
- \setsansfont[
+ ]%
+ \thu@load@texgyre@sans@mono
+}
+\newcommand\thu@load@texgyre@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@fontset}{mac}}{
- \setmonofont[Scale=MatchLowercase]{Menlo}
- }{
- \setmonofont[Scale=MatchLowercase]{Courier New}
- }
+ ]%
+}
+\newcommand\thu@load@font@xits{%
+ \thu@set@xits@names
+ \setmainfont{\thu@font@family@xits}[
+ Extension = .otf,
+ UprightFont = *-\thu@font@style@xits@rm,
+ BoldFont = *-\thu@font@style@xits@bf,
+ ItalicFont = *-\thu@font@style@xits@it,
+ BoldItalicFont = *-\thu@font@style@xits@bfit,
+ ]%
+ \thu@load@texgyre@sans@mono
}
+\newcommand\thu@load@font@libertinus{%
+ \thu@set@libertinus@names
+ \setmainfont{\thu@font@family@libertinus@serif}[
+ Extension = .otf,
+ UprightFont = *-\thu@font@style@libertinus@rm,
+ BoldFont = *-\thu@font@style@libertinus@bf,
+ ItalicFont = *-\thu@font@style@libertinus@it,
+ BoldItalicFont = *-\thu@font@style@libertinus@bfit,
+ ]%
+ \setsansfont{\thu@font@family@libertinus@sans}[
+ Extension = .otf,
+ UprightFont = *-\thu@font@style@libertinus@rm,
+ BoldFont = *-\thu@font@style@libertinus@bf,
+ ItalicFont = *-\thu@font@style@libertinus@it,
+ ]%
+ \setmonofont{lmmonolt10}[
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-oblique,
+ BoldItalicFont = *-boldoblique,
+ ]%
+}
+\@namedef{thu@load@font@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@load@font{%
+ \@nameuse{thu@load@font@\thu@font}%
+}
+\thu@load@font
+\thu@option@hook{font}{\thu@load@font}
% \end{macrocode}
%
% 使用 \pkg{unicode-math} 配置数学字体
@@ -1407,59 +1737,177 @@
nabla = upright,
partial = upright,
}
-\IfFontExistsTF{XITSMath-Regular.otf}{
- \setmathfont[
+\newcommand\thu@load@math@font@xits{%
+ \thu@set@xits@names
+ \setmathfont{\thu@font@name@xits@math@rm}[
Extension = .otf,
- BoldFont = XITSMath-Bold,
+ BoldFont = \thu@font@name@xits@math@bf,
StylisticSet = 8,
- ]{XITSMath-Regular}
- \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf}
-}{
- \setmathfont[
+ ]%
+ \setmathfont{\thu@font@name@xits@math@rm}[
+ Extension = .otf,
+ StylisticSet = 1,
+ range = {cal,bfcal},
+ ]%
+}
+\newcommand\thu@load@math@font@stix{%
+ \setmathfont{STIX2Math}[
Extension = .otf,
- BoldFont = *bold,
StylisticSet = 8,
- ]{xits-math}
- \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf}
+ ]%
+ \setmathfont{STIX2Math}[
+ Extension = .otf,
+ StylisticSet = 1,
+ range = {cal,bfcal},
+ ]%
+}
+\newcommand\thu@load@math@font@libertinus{%
+ \thu@set@libertinus@names
+ \setmathfont{\thu@font@name@libertinus@math .otf}%
+}
+\newcommand\thu@load@math@font@lm{%
+ \setmathfont{latinmodern-math.otf}%
}
+\newcommand\thu@load@math@font{%
+ \@nameuse{thu@load@math@font@\thu@math@font}
+}
+\thu@load@math@font
+\thu@option@hook{math-font}{\thu@load@math@font}
% \end{macrocode}
%
-% 在使用 Windows Vista 或之后版本的系统时,\pkg{ctex} 宏包会默认使用微软雅黑字体,
-% 这可能会导致审查不合格。下面设置适合印刷的黑体,同时保持跨平台兼容性。
+% 中文字体
% \begin{macrocode}
-\ifthenelse{\equal{\thu@fontset}{windows}}{
+\ifthu@cjk@font@auto
+ \ifthu@system@mac
+ \thusetup{cjk-font = mac}
+ \else
+ \ifthu@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@load@cjk@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}
-}{}
-% \end{macrocode}
-%
-% 类似地,\pkg{ctex} 2.4.14 开始在 macOS 下自动调用苹方黑体,所以必进行调整。
-% \begin{macrocode}
-\ifthenelse{\equal{\thu@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@load@cjk@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}
+%
+% 注意 Noto CJK 的 regular 字重名字不带“Regular”。
+% \begin{macrocode}
+\newcommand\thu@load@cjk@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@load@cjk@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@cjk@font@none\else
+ \providecommand\songti{\CJKfamily{zhsong}}
+ \providecommand\heiti{\CJKfamily{zhhei}}
+ \providecommand\fangsong{\CJKfamily{zhfs}}
+ \providecommand\kaishu{\CJKfamily{zhkai}}
+\fi
+\newcommand\thu@load@cjk@font{%
+ \@nameuse{thu@load@cjk@font@\thu@cjk@font}%
+}
+\thu@load@cjk@font
+\thu@option@hook{cjk-font}{\thu@load@cjk@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@def@fontsize}
@@ -1571,6 +2019,134 @@
%
% \subsubsection{语言设置}
%
+% 定义 \cs{thu@main@language},当在导言区修改 \option{language} 时,
+% 保存为论文的主要语言;
+% \cs{thu@reset@main@language} 则用于正文中恢复为主要语言。
+% \begin{macrocode}
+\let\thu@main@language\thu@language
+\thu@option@hook{language}{%
+ \ifx\@begindocumenthook\@undefined
+ \let\thu@main@language\thu@language
+ \fi
+}
+\newcommand\thu@reset@main@language{
+ \thusetup{language = \thu@main@language}
+}
+% \end{macrocode}
+%
+% 根据语言设置各章节的名称,只有在导言区设置 \option{degree} 和
+% \option{language} 时会修改,而在正文局部切换语言时则不变。
+% \begin{macrocode}
+\newcommand\thu@set@chapter@names{%
+ \ifthu@language@chinese
+ \ctexset{
+ chapter/name = {第,章},
+ appendixname = 附录,
+ contentsname = 目\hspace{\ccwd}录,
+ listfigurename = 插图索引,
+ listtablename = 表格索引,
+ bibname = 参考文献,
+ indexname = 索引,
+ }%
+ \def\thu@denotation@name{主要符号对照表}%
+ \def\thu@list@algorithm@name{算法索引}%
+ \def\listequationname{公式索引}%
+ \def\thu@acknowledgements@name{致\hspace{\ccwd}谢}%
+ \ifthu@degree@bachelor
+ \def\thu@resume@name{在学期间参加课题的研究成果}%
+ \else
+ \ifthu@degree@postdoc
+ \def\thu@resume@name{个人简历、发表的学术论文与科研成果}%
+ \else
+ \def\thu@resume@name{个人简历、在学期间发表的学术论文与研究成果}%
+ \fi
+ \fi
+ \else
+ \ifthu@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@denotation@name{Nomenclature}%
+ \def\thu@list@algorithm@name{List of Algorithms}%
+ \def\listequationname{List of Equations}%
+ \def\thu@acknowledgements@name{Acknowledgements}%
+ \ifthu@degree@bachelor
+ \def\thu@resume@name{Research Achievements}%
+ \else
+ \def\thu@resume@name{Resume, Publications and Research Achievements}%
+ \fi
+ \fi
+ \fi
+}
+\thu@set@chapter@names
+\thu@option@hook{degree}{\thu@set@chapter@names}
+\thu@option@hook{language}{%
+ \ifx\@begindocumenthook\@undefined
+ \thu@set@chapter@names
+ \fi
+}
+% \end{macrocode}
+%
+% 这部分名称在正文中局部地修改语言时会发生变化,比如英文摘要、
+% 本科生附录的阅读报告。
+% \begin{macrocode}
+\newcommand\thu@set@names{%
+ \ifthu@language@chinese
+ \ctexset{
+ figurename = 图,
+ tablename = 表,
+ }%
+ \def\thu@algorithm@name{算法}%
+ \def\thu@equation@name{公式}%
+ \def\thu@assumption@name{假设}%
+ \def\thu@definition@name{定义}%
+ \def\thu@proposition@name{命题}%
+ \def\thu@lemma@name{引理}%
+ \def\thu@theorem@name{定理}%
+ \def\thu@axiom@name{公理}%
+ \def\thu@corollary@name{推论}%
+ \def\thu@exercise@name{练习}%
+ \def\thu@example@name{例}%
+ \def\thu@remark@name{注释}%
+ \def\thu@problem@name{问题}%
+ \def\thu@conjecture@name{猜想}%
+ \def\thu@proof@name{证明}%
+ \def\thu@theorem@separator{:}%
+ \else
+ \ifthu@language@english
+ \ctexset{
+ figurename = {Figure},
+ tablename = {Table},
+ }%
+ \def\thu@algorithm@name{Algorithm}%
+ \def\thu@equation@name{Equation}%
+ \def\thu@assumption@name{Assumption}%
+ \def\thu@definition@name{Definition}%
+ \def\thu@proposition@name{Proposition}%
+ \def\thu@lemma@name{Lemma}%
+ \def\thu@theorem@name{Theorem}%
+ \def\thu@axiom@name{Axiom}%
+ \def\thu@corollary@name{Corollary}%
+ \def\thu@exercise@name{Exercise}%
+ \def\thu@example@name{Example}%
+ \def\thu@remark@name{Remark}%
+ \def\thu@problem@name{Problem}%
+ \def\thu@conjecture@name{Conjecture}%
+ \def\thu@proof@name{Proof}%
+ \def\thu@theorem@separator{: }%
+ \fi
+ \fi
+}
+\thu@set@names
+\thu@option@hook{language}{\thu@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@setchinese{%
- \xeCJKResetPunctClass
-}
-\newcommand\thu@setenglish{%
- \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
- \xeCJKDeclareCharClass{HalfRight}{
- "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
- }%
-}
-\newcommand\thu@setdefaultlanguage{%
+\newcommand\thu@set@punctuations{%
\ifthu@language@chinese
- \thu@setchinese
- \else
- \thu@setenglish
- \fi
-}
-% \end{macrocode}
-%
-% 中英文翻译:
-% \begin{macrocode}
-\ifthu@language@chinese
- \ctexset{
- chapter/name = {第,章},
- appendixname = 附录,
- contentsname = {目\hspace{\ccwd}录},
- listfigurename = 插图索引,
- listtablename = 表格索引,
- figurename = 图,
- tablename = 表,
- bibname = 参考文献,
- indexname = 索引,
- }
- \newcommand\thu@denotation@name{主要符号对照表}
- \newcommand\listequationname{公式索引}
- \newcommand\equationname{公式}
- \newcommand\thu@assumption@name{假设}
- \newcommand\thu@definition@name{定义}
- \newcommand\thu@proposition@name{命题}
- \newcommand\thu@lemma@name{引理}
- \newcommand\thu@theorem@name{定理}
- \newcommand\thu@axiom@name{公理}
- \newcommand\thu@corollary@name{推论}
- \newcommand\thu@exercise@name{练习}
- \newcommand\thu@example@name{例}
- \newcommand\thu@remark@name{注释}
- \newcommand\thu@problem@name{问题}
- \newcommand\thu@conjecture@name{猜想}
- \newcommand\thu@proof@name{证明}
- \newcommand\thu@theorem@separator{:}
- \newcommand\thu@ack@name{致\hspace{\ccwd}谢}
- \ifthu@degree@bachelor
- \newcommand\thu@resume@title{在学期间参加课题的研究成果}
+ \xeCJKDeclareCharClass{FullLeft}{"2018, "201C}%
+ \xeCJKDeclareCharClass{FullRight}{
+ "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+ }%
\else
- \ifthu@degree@postdoc
- \newcommand\thu@resume@title{个人简历、发表的学术论文与科研成果}
- \else
- \newcommand\thu@resume@title{个人简历、在学期间发表的学术论文与研究成果}
+ \ifthu@language@english
+ \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
+ \xeCJKDeclareCharClass{HalfRight}{
+ "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
+ }%
\fi
\fi
-\else
- \newcommand\thu@denotation@name{Nomenclature}
- \newcommand\listequationname{List of Equations}
- \newcommand\equationname{Equation}
- \newcommand\thu@assumption@name{Assumption}
- \newcommand\thu@definition@name{Definition}
- \newcommand\thu@proposition@name{Proposition}
- \newcommand\thu@lemma@name{Lemma}
- \newcommand\thu@theorem@name{Theorem}
- \newcommand\thu@axiom@name{Axiom}
- \newcommand\thu@corollary@name{Corollary}
- \newcommand\thu@exercise@name{Exercise}
- \newcommand\thu@example@name{Example}
- \newcommand\thu@remark@name{Remark}
- \newcommand\thu@problem@name{Problem}
- \newcommand\thu@conjecture@name{Conjecture}
- \newcommand\thu@proof@name{proof}
- \newcommand\thu@theorem@separator{: }
- \newcommand\thu@ack@name{Acknowledgements}
- \ifthu@degree@bachelor
- \newcommand\thu@resume@title{Research Achievements}
- \else
- \newcommand\thu@resume@title{Resume, Publications and Research Achievements}
- \fi
-\fi
+}
+\thu@set@punctuations
+\thu@option@hook{language}{\thu@set@punctuations}
% \end{macrocode}
%
-%
% \subsubsection{页眉页脚}
% \label{sec:headerfooter}
%
@@ -1734,25 +2242,14 @@
% \begin{macro}{\thu@textcircled}
% 生成带圈的脚注数字,最多处理到 10。
% \begin{macrocode}
-\ifthenelse{\equal{\thu@fontset}{mac}}{
- \newfontfamily\thu@circlefont{Songti SC Light}
-}{
- \ifthenelse{\equal{\thu@fontset}{windows}}{
- \newfontfamily\thu@circlefont{SimSun}
- }{
- \IfFontExistsTF{XITS-Regular.otf}{
- \newfontfamily\thu@circlefont{XITS-Regular.otf}
- }{
- \newfontfamily\thu@circlefont{xits-regular.otf}
- }
- }
-}
\def\thu@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@error{%
+ Too many footnotes in this page.
+ Keep footnote less than 10%
+ }%
\fi
- {\thu@circlefont\symbol{\the\numexpr\value{#1}+"245F\relax}}%
+ {\CJKfamily+{}\symbol{\the\numexpr\value{#1}+"245F\relax}}%
}
\renewcommand{\thefootnote}{\thu@textcircled{footnote}}
\renewcommand{\thempfootnote}{\thu@textcircled{mpfootnote}}
@@ -1776,15 +2273,40 @@
\apptocmd{\@makefntext}{\let\@makefnmark\thu@makefnmark}{}{}
% \end{macrocode}
%
+% 设置 url 样式,与上下文一致
+% \begin{macrocode}
+\urlstyle{same}
+% \end{macrocode}
+%
+% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。
+% \begin{macrocode}
+\g@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@language@chinese
- \def\mathellipsis{\cdots}
-\fi
+\newcommand\thu@set@math@ellipsis{%
+ \ifthu@language@chinese
+ \DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}%
+ \else
+ \ifthu@language@english
+ \DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}%
+ \fi
+ \fi
+}
+\thu@set@math@ellipsis
+\thu@option@hook{language}{\thu@set@math@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@degree@bachelor
\def\thu@maketag#1{\maketag@@@{%
- (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)}}
+ (\ignorespaces\text{\thu@equation@name\hskip0.5em}#1\unskip\@@italiccorr)}}
\def\tagform@#1{\maketag@@@{%
- (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
+ (\ignorespaces\text{\thu@equation@name\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}}
\fi
\fi
\def\thu@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@degree@bachelor
- \g@addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
- \g@addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+ \AtBeginDocument{% delay the check until all packages are loaded
+ \g@addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
+ \g@addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}}
+ }
\fi
+% \end{macrocode}
+%
+% 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距,段前空 3 磅,段后空 3 磅。
+% \begin{macrocode}
\let\old@tabular\@tabular
\def\thu@tabular{\dawu[1.5]\old@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@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@degree@bachelor
- \newcommand{\cabstractname}{中文摘要}
- \newcommand{\eabstractname}{ABSTRACT}
+ \newcommand{\thu@abstract@name}{中文摘要}
+ \newcommand{\thu@abstract@name@en}{ABSTRACT}
\else
- \newcommand{\cabstractname}{摘\hspace{\ccwd}要}
- \newcommand{\eabstractname}{Abstract}
+ \newcommand{\thu@abstract@name}{摘\hspace{\ccwd}要}
+ \newcommand{\thu@abstract@name@en}{Abstract}
\fi
% \end{macrocode}
%
@@ -2027,7 +2566,7 @@
\newcommand\thu@chapter@titleformat[1]{%
\ifthu@degree@bachelor #1\else%
\ifthenelse%
- {\equal{#1}{\eabstractname}}%
+ {\equal{#1}{\thu@abstract@name@en}}%
{\bfseries #1}%
{#1}%
\fi}
@@ -2084,7 +2623,7 @@
\newcommand\thu@phantomsection{}
\NewDocumentCommand\thu@chapter{s o m o}{
\IfBooleanF{#1}{%
- \ClassError{thuthesis}{You have to use the star form: \string\thu@chapter*}{}
+ \thu@error{You have to use the star form: \string\thu@chapter*}%
}%
\if@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@chapter*[]{\contentsname}
- \ifthu@degree@bachelor\xiaosi[1.667]\else\xiaosi[1.65]\fi\@starttoc{toc}\normalsize}
-% \end{macrocode}
-% 调整目录样式,允许指定目录字体。
-% \begin{macrocode}
-\def\@pnumwidth{2em}
-\def\@tocrmarg{\@pnumwidth}
-\def\@dotsep{1}
-\renewcommand*\l@chapter[2]{%
- \ifnum \c@tocdepth >\m@ne
- \addpenalty{-\@highpenalty}%
- \ifthu@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@degree@graduate
+ \thu@chapter*[]{\contentsname}%
+ \@starttoc{toc}%
+}
+\thu@define@key{
+ toc-chapter-style = {
+ name = toc@chapter@style,
+ choices = {
+ arial,
+ times,
+ },
+ default = arial,
+ },
+}
+\newcommand\thu@leaders{\titlerule*[4bp]{.}}
+\newcommand\thu@set@toc@format{%
+ \contentsmargin{\z@}%
+% \end{macrocode}
+%
+% 本科生:
+% 目录从第 1 章开始,每章标题用黑体小四号字,行间距为 20pt,
+% 行前空 6pt,行后空 0pt。
+% 其它级节标题用宋体小四字,行间距为 20pt。
+%
+% 注意示例中章标题的字母和数字是衬线体,所以这里用 \cs{heiti}。
+% 示例中的一级和二级节标题分别缩进 1 和 1.5 个汉字符。
+% \begin{macrocode}
+ \ifthu@degree@bachelor
+ \titlecontents{chapter}
+ [\z@]{\addvspace{6bp}
+ \ifthu@toc@chapter@style@arial
\sffamily
\else
- \ifthu@degree@bachelor
- \heiti
- \fi
+ \heiti
\fi
- #1%
- \endgroup
- \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill%
- \nobreak #2\par
- \penalty\@highpenalty
- \endgroup
- \fi}
-% \end{macrocode}
+ }
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\rmfamily\thu@leaders\thecontentspage}%
+ \titlecontents{section}
+ [1\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+ \titlecontents{subsection}
+ [1.5\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+% \end{macrocode}
+%
+% 研究生:
+% \begin{enumerate}
+% \item 目录中的章标题行采用黑体小四号字,固定行距 20 磅,段前空 6 磅,
+% 段后 0 磅;其他内容采用宋体小四号字,行距为固定值 20 磅,
+% 段前、段后均为 0 磅。
+% \item 目录中的章标题行居左书写,一级节标题行缩进 1 个汉字符,
+% 二级节标题行缩进 2 个汉字符。
+% \end{enumerate}
%
-% 研究生学位论文写作指南中规定:目录中的章标题行居左书写,一级节标题行缩进 1 个
-% 汉字符,二级节标题行缩进 2 个汉字符(但示例文件中为 1.5 个汉字符)。本科生指
-% 南中未作明确规定,示例文件中对于一级和二级节标题分别缩进 1 和 1.5 个汉字符。
+% 注意示例中章标题的字母和数字是无衬线体,所以用这里用 \cs{sffamily},
+% 但是页码仍然用 \cs{rmfamily}。
% \begin{macrocode}
-\patchcmd{\@dottedtocline}{\hb@xt@\@pnumwidth}{\hbox}{}{}
-\renewcommand*\l@section{%
- \@dottedtocline{1}{\ccwd}{2.1em}}
-\renewcommand*\l@subsection{%
- \@dottedtocline{2}{\ifthu@degree@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}}
-\renewcommand*\l@subsubsection{%
- \@dottedtocline{3}{\ifthu@degree@bachelor 2.4em\else 3.5em\fi}{3.8em}}
+ \else
+ \titlecontents{chapter}
+ [\z@]{\addvspace{6bp}\sffamily}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\rmfamily\thu@leaders\thecontentspage}%
+ \titlecontents{section}
+ [1\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+ \titlecontents{subsection}
+ [2\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+ \fi
+}
+\thu@set@toc@format
+\thu@option@hook{degree}{\thu@set@toc@format}
% \end{macrocode}
% \end{macro}
%
@@ -2533,52 +3100,86 @@
% \begin{macrocode}
\newcommand\thu@titlepage@info{%
\ifthu@degree@doctor
- \thu@titlepage@info@doctor
+ \ifthu@degree@type@academic
+ \thu@titlepage@info@doctor@academic
+ \else
+ \thu@titlepage@info@doctor@professional
+ \fi
\else
- \thu@titlepage@info@master
+ \ifthu@degree@type@academic
+ \thu@titlepage@info@master@academic
+ \else
+ \ifx\thu@discipline\@empty
+ \thu@titlepage@info@master@other
+ \else
+ \thu@titlepage@info@master@engineer
+ \fi
+ \fi
\fi
}
-\newcommand\thu@cover@info@tabular[4]{%
- \def\thu@cover@item##1##2##3{%
+% \end{macrocode}
+%
+% 标题页作者信息表
+% \begin{macrocode}
+\newcommand\thu@titlepage@info@tabular[4]{%
+ \def\thu@info@item##1##2##3{%
\ifx##3\@empty\else
- \thu@pad{#2}{\thu@fixed@box{#1}{##1}}%
+ \thu@pad{#1}{\thu@fixed@box{#2}{##1}}%
\thu@pad{#3}{:}%
##2{##3}\\
\fi
}%
+ \fangsong\sanhao[1.95]%
\begin{tabular}{l}%
#4%
- \end{tabular}
+ \end{tabular}%
}
-\newcommand\thu@titlepage@info@doctor{%
- \fangsong\sanhao[1.95]%
- \thu@cover@info@tabular{2.8cm}{2.8cm}{0.82cm}{%
- \thu@cover@item{培养单位}{}{\thu@department}%
- \ifthu@degree@type@academic
- \thu@cover@item{学科}{}{\thu@discipline}%
- \thu@cover@item{研究生}{\thu@name@title}{\thu@author}%
- \else
- \thu@cover@item{申请人}{\thu@name@title}{\thu@author}%
- \fi
- \thu@cover@item{指导教师}{\thu@name@title}{\thu@supervisor}%
- \thu@cover@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
- \thu@cover@item{联合导师}{\thu@name@title}{\thu@joint@supervisor}%
+\newcommand\thu@titlepage@info@doctor@academic{%
+ \thu@titlepage@info@tabular{2.8cm}{2.8cm}{0.82cm}{%
+ \thu@info@item{培养单位}{}{\thu@department}%
+ \thu@info@item{学科}{}{\thu@discipline}%
+ \thu@info@item{研究生}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合导师}{\thu@name@title}{\thu@joint@supervisor}%
}\par
}
-\newcommand\thu@titlepage@info@master{%
- \fangsong\sanhao[1.95]%
- \thu@cover@info@tabular{5.5em}{3.6cm}{0.82cm}{%
- \thu@cover@item{培养单位}{}{\thu@department}%
- \ifthu@degree@type@academic
- \thu@cover@item{学科}{}{\thu@discipline}%
- \thu@cover@item{研究生}{\thu@name@title}{\thu@author}%
- \else
- \thu@cover@item{工程领域}{}{\thu@discipline}%
- \thu@cover@item{申请人}{\thu@name@title}{\thu@author}%
- \fi
- \thu@cover@item{指导教师}{\thu@name@title}{\thu@supervisor}%
- \thu@cover@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
- \thu@cover@item{联合指导教师}{\thu@name@title}{\thu@joint@supervisor}%
+\newcommand\thu@titlepage@info@doctor@professional{%
+ \thu@titlepage@info@tabular{3.03cm}{5em}{1.52cm}{%
+ \thu@info@item{培养单位}{}{\thu@department}%
+ \thu@info@item{申请人}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合导师}{\thu@name@title}{\thu@joint@supervisor}%
+ }\par
+}
+\newcommand\thu@titlepage@info@master@academic{%
+ \thu@titlepage@info@tabular{3.59cm}{5.5em}{0.82cm}{%
+ \thu@info@item{培养单位}{}{\thu@department}%
+ \thu@info@item{学科}{}{\thu@discipline}%
+ \thu@info@item{研究生}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合指导教师}{\thu@name@title}{\thu@joint@supervisor}%
+ }\par
+}
+\newcommand\thu@titlepage@info@master@engineer{%
+ \thu@titlepage@info@tabular{2.8cm}{2.8cm}{1.34cm}{%
+ \thu@info@item{培养单位}{}{\thu@department}%
+ \thu@info@item{工程领域}{}{\thu@discipline}%
+ \thu@info@item{申请人}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合指导教师}{\thu@name@title}{\thu@joint@supervisor}%
+ }\par
+}
+\newcommand\thu@titlepage@info@master@other{%
+ \thu@titlepage@info@tabular{3.28cm}{5em}{1.52cm}{%
+ \thu@info@item{培养单位}{}{\thu@department}%
+ \thu@info@item{申请人}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{副指导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合指导教师}{\thu@name@title}{\thu@joint@supervisor}%
}\par
}
% \end{macrocode}
@@ -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@titlepage@bachelor{%
\newgeometry{
@@ -2746,25 +3356,34 @@
\CJKunderline[skip=false, thickness=0.05em, depth=0.12em]{\thu@title}\par
}\par
\vskip 2.5cm%
- \parbox[t][6.0cm][t]{\textwidth}{%
+ \begingroup
\fangsong\sanhao[2.3]%
\leftskip=2.5cm%
\parindent=\z@
- \def\thu@cover@item##1##2##3{%
+ \def\thu@info@item##1##2##3{%
\ifx##3\@empty\else
- \thu@fixed@box{4em}{##1}:##2{##3}\\
+ \thu@fixed@box{%
+ \ifx\thu@joint@supervisor\@empty
+ 4em%
+ \else
+ 5.5em%
+ \fi
+ }{##1}:##2{##3}\\
\fi
}%
\def\thu@name@title@format##1##2{%
\thu@stretch{3em}{##1}\quad ##2%
}
- \thu@cover@item{系别}{}{\thu@department}%
- \thu@cover@item{专业}{}{\thu@discipline}%
- \thu@cover@item{姓名}{\thu@name@title}{\thu@author}%
- \thu@cover@item{指导教师}{\thu@name@title}{\thu@supervisor}%
- \thu@cover@item{辅导教师}{\thu@name@title}{\thu@associate@supervisor}%
- }\par
- {\xiaosi\thu@format@date{\thu@date@zh@digit}{\thu@date}\par}%
+ \thu@info@item{系别}{}{\thu@department}%
+ \thu@info@item{专业}{}{\thu@discipline}%
+ \thu@info@item{姓名}{\thu@name@title}{\thu@author}%
+ \thu@info@item{指导教师}{\thu@name@title}{\thu@supervisor}%
+ \thu@info@item{辅导教师}{\thu@name@title}{\thu@associate@supervisor}%
+ \thu@info@item{联合指导教师}{\thu@name@title}{\thu@joint@supervisor}%
+ \par
+ \endgroup
+ \vskip 1.5cm%
+ {\CJKfamily+{}\xiaosi\thu@format@date{\thu@date@zh@digit}{\thu@date}\par}%
\endgroup
\clearpage
\restoregeometry
@@ -2876,7 +3495,7 @@
日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:}
\newcommand\copyrightpage[1][]{%
\ifthu@degree@postdoc\relax\else
- \ifthu@degree@bachelor\clearpage\else\cleardoublepage\fi%
+ \cleardoublepage
\def\thu@@tmp{#1}
\ifx\thu@@tmp\@empty
\ifthu@degree@bachelor\thu@authorization@mk\else%
@@ -2936,7 +3555,7 @@
}
\newcommand\thu@clist@use[2]{%
\def\thu@@tmp{}%
- \kv@set@family@handler{thu@clist}{%
+ \def\thu@clist@processor##1{%
\ifx\thu@@tmp\@empty
\def\thu@@tmp{#2}%
\else
@@ -2944,7 +3563,7 @@
\fi
##1%
}%
- \kvsetkeys@expandafter{thu@clist}{#1}%
+ \expandafter\comma@parse\expandafter{#1}{\thu@clist@processor}%
}
% \end{macrocode}
% \end{macro}
@@ -2968,9 +3587,11 @@
% 标点符号一律用中文输入状态下的标点符号。
% \begin{macrocode}
\newenvironment{abstract}{%
- \ifthu@degree@bachelor\clearpage\else\cleardoublepage\fi
- \thu@setchinese
- \thu@chapter*[]{\cabstractname} % no tocline
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+ \thusetup{language = chinese}%
+ \thu@chapter*[]{\thu@abstract@name}% %no tocline
}{%
% \end{macrocode}
%
@@ -2980,7 +3601,10 @@
\thu@put@keywords{\textbf{关键词:}}{%
\thu@clist@use{\thu@keywords}{;}%
}%
- \thu@setdefaultlanguage
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+ \thu@reset@main@language % switch back to main language
}
% \end{macrocode}
% \end{environment}
@@ -2991,8 +3615,11 @@
% 摘要内容用小四号 Times New Roman。
% \begin{macrocode}
\newenvironment{abstract*}{%
- \thu@setenglish
- \thu@chapter*[]{\eabstractname} % no tocline
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+ \thusetup{language = english}%
+ \thu@chapter*[]{\thu@abstract@name@en}% no tocline
}{%
\ifthu@degree@doctor\vfill\else\vskip12bp\fi
\thu@put@keywords{%
@@ -3000,7 +3627,10 @@
}{%
\thu@clist@use{\thu@keywords@en}{; }%
}%
- \thu@setdefaultlanguage
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+ \thu@reset@main@language % switch back to main language
}
% \end{macrocode}
% \end{environment}
@@ -3011,6 +3641,9 @@
% 主要符号对照表。
% \begin{macrocode}
\newenvironment{denotation}[1][2.5cm]{%
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
\thu@chapter*[]{\thu@denotation@name} % no tocline
\vskip-30bp\xiaosi[1.6]\begin{thu@denotation}[labelwidth=#1]
}{%
@@ -3037,8 +3670,8 @@
% \begin{environment}{acknowledgements}
% 支持扫描文件替换。
% \begin{macrocode}
-\newcommand\thu@declarename{声\hspace{\ccwd}明}
-\newcommand{\thu@declaretext}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
+\newcommand\thu@statement@name{声\hspace{\ccwd}明}
+\newcommand{\thu@statement@text}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
,独立进行研究工作所取得的成果。尽我所知,除文中已经注明引用的内容外,本学位论
文的研究成果不包含任何他人享有著作权的内容。对本论文所涉及的研究工作做出贡献的
其他个人和集体,均已在文中以明确方式标明。}
@@ -3049,24 +3682,42 @@
% 定义致谢与声明环境。
% \begin{macrocode}
\newenvironment{acknowledgements}{%
- \thu@chapter*{\thu@ack@name}%
-}{}
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+ \thu@chapter*{\thu@acknowledgements@name}%
+}{%
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
+}
% \end{macrocode}
%
% 声明部分
% \begin{macrocode}
\newcommand\statement[1][]{%
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
\def\thu@@tmp{#1}%
\ifx\thu@@tmp\@empty
- \thu@chapter*{\thu@declarename}%
- \par{\xiaosi\parindent2em\thu@declaretext}\vskip2cm%
- {\xiaosi\hfill\thu@signature\thu@underline[2.5cm]\relax
+ \thu@chapter*{\thu@statement@name}%
+ \thu@statement@text\par
+ \ifthu@degree@graduate
+ \vskip 2cm%
+ \else
+ \null\par
+ \fi
+ {\hfill\thu@signature\thu@underline[2.5cm]\relax
\thu@backdate\thu@underline[2.5cm]\relax}%
\else
\includepdf[pagecommand={\thispagestyle{thu@empty}%
- \addcontentsline{toc}{chapter}{\thu@declarename}%
+ \addcontentsline{toc}{chapter}{\thu@statement@name}%
}]{#1}%
\fi
+ \ifthu@degree@bachelor
+ \cleardoublepage
+ \fi
}
% \end{macrocode}
% \end{environment}
@@ -3085,20 +3736,37 @@
% \begin{macro}{\listoftables*}
% 定义图表以及公式目录样式。
% \begin{macrocode}
-\def\thu@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@listof#1{% #1: float type
\setcounter{tocdepth}{2} % restore tocdepth in case being modified
\@ifstar
- {\thu@chapter*[]{\csname list#1name\endcsname}\thu@starttoc{#1}}
- {\thu@chapter*{\csname list#1name\endcsname}\thu@starttoc{#1}}}
-\renewcommand\listoffigures{\thu@listof{figure}}
-\renewcommand*\l@figure{\ifthu@degree@bachelor\relax\else\addvspace{6bp}\fi\@dottedtocline{1}{0em}{4em}}
-\renewcommand\listoftables{\thu@listof{table}}
-\let\l@table\l@figure
+ {\thu@chapter*[]{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}
+ {\thu@chapter*{\csname list#1name\endcsname}\@starttoc{\csname ext@#1\endcsname}}%
+}
+\renewcommand\listoffigures{%
+ \thu@set@list@label@width{\figurename}%
+ \thu@listof{figure}%
+}
+% \end{macrocode}
+%
+% 英文的图序“Figure X-X”比中文略宽,所以根据实际内容设置不同宽度。
+% \begin{macrocode}
+\newlength{\thu@list@label@width}
+\newcommand\thu@set@list@label@width[1]{%
+ \settowidth{\thu@list@label@width}{#1~8.8}%
+ \addtolength{\thu@list@label@width}{1em}%
+}
+\titlecontents{figure}
+ [\thu@list@label@width]{\addvspace{6bp}}
+ {\contentslabel[\figurename~\thecontentslabel]{\thu@list@label@width}}{}
+ {\thu@leaders\thecontentspage}
+\renewcommand\listoftables{%
+ \thu@set@list@label@width{\tablename}%
+ \thu@listof{table}%
+}
+\titlecontents{table}
+ [\thu@list@label@width]{\addvspace{6bp}}
+ {\contentslabel[\tablename~\thecontentslabel]{\thu@list@label@width}}{}
+ {\thu@leaders\thecontentspage}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3127,9 +3795,14 @@
% \begin{macro}{\listofequations}
% \begin{macro}{\listofequations*}
% \LaTeX{} 默认没有公式索引,此处定义自己的 \cs{listofequations}。
+% 公式索引没有名称,所以不设置固定的 label 宽度。
% \begin{macrocode}
\newcommand\listofequations{\thu@listof{equation}}
-\let\l@equation\l@figure
+\titlecontents{equation}
+ [0pt]{\addvspace{6bp}}
+ {\thu@equation@name~\thecontentslabel}{}
+ {\thu@leaders\thecontentspage}
+\contentsuse{equation}{loe}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -3177,11 +3850,9 @@
\thu@define@key{
cite-style = {
name = cite@style,
- code = {
- \@nameuse{bibstyle@thuthesis-\thu@cite@style}
- },
}
}
+\thu@option@hook{cite-style}{\@nameuse{bibstyle@thuthesis-\thu@cite@style}}
% \end{macrocode}
%
% 下面修改 \pkg{natbib} 的引用格式,主要是将页码写在上标位置。
@@ -3247,15 +3918,34 @@
% 但是从示例来看,目录中只出现附录的 chapter 标题,
% 不出现附录中的 section 及 subsection 的标题。
% 部分院系(例如自动化系)的格式审查的老师甚至一致口头如此要求。
-% (\href{https://github.com/xueruini/thuthesis/pull/425}{\#425})
+% (\href{https://github.com/tuna/thuthesis/pull/425}{\#425})
% \begin{macrocode}
\thu@define@key{
toc-depth = {
name = toc@depth,
- code = {\addtocontents{toc}{\protect\setcounter{tocdepth}{\thu@toc@depth}}},
},
}
-\g@addto@macro\appendix{\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}}
+% \end{macrocode}
+%
+% 这里不要使用 \cs{addcontentsline},
+% 避免写入 \pkg{titletoc} 的 (\file{.ptc}) 文件中,
+% 造成 \env{survey} 的子目录中 |tocdepth| 为 0。
+% \begin{macrocode}
+\thu@option@hook{toc-depth}{%
+ \protected@write\@auxout{}{%
+ \string\ttl@writefile{toc}{%
+ \protect\setcounter{tocdepth}{\thu@toc@depth}%
+ }%
+ }%
+ \addtocontents{lof}{\string\let\string\contentsline\string\ttl@gobblecontents}
+ \addtocontents{lot}{\string\let\string\contentsline\string\ttl@gobblecontents}
+ \addtocontents{loe}{\string\let\string\contentsline\string\ttl@gobblecontents}
+}
+\g@addto@macro\appendix{%
+ \thusetup{
+ toc-depth = 0,
+ }
+}
% \end{macrocode}
%
% 本科生《写作指南》有独特的要求:附录 A 为外文资料的调研阅读报告或书面翻译,
@@ -3268,17 +3958,26 @@
% \begin{macrocode}
\newenvironment{survey}{%
\chapter{外文资料的调研阅读报告}%
- \thu@setenglish
+ \thusetup{language = english}%
\let\title\thu@appendix@title
\let\maketitle\thu@appendix@maketitle
+ \thu@set@partial@toc@format
+ \renewcommand\tableofcontents{%
+ \section*{Contents}%
+ \thu@pdfbookmark{1}{Contents}%
+ \printcontents[survey]{l}{1}[2]{}%
+ }%
\renewcommand\bibname{参考文献}%
\let\bibsection\thu@appendix@bibsection
\renewcommand\@bibunitname{main-survey}%
\let\bibliographystyle\defaultbibliographystyle
\let\bibliography\thu@appendix@bibliography
\begin{bibunit}%
+ \startcontents[survey]%
}{%
+ \stopcontents[survey]%
\end{bibunit}%
+ \thu@reset@main@language % restore language
}
% \end{macrocode}
% \end{environment}
@@ -3288,15 +3987,42 @@
% \begin{macrocode}
\newenvironment{translation}{%
\chapter{外文资料的书面翻译}%
- \thu@setenglish
+ \thusetup{language = chinese}%
\let\title\thu@appendix@title
\let\maketitle\thu@appendix@maketitle
- \renewcommand\bibname{书面翻译对应的原文索引}%
- \let\bibsection\thu@appendix@bibsection
+ \thu@set@partial@toc@format
+ \renewcommand\tableofcontents{%
+ \section*{目录}%
+ \thu@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@appendix@bibliography
\begin{bibunit}%
+ \startcontents[translation]%
+}{%
+ \stopcontents[translation]%
+ \end{bibunit}%
+ \thu@reset@main@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@appendix@bibsection
}{%
\end{bibunit}%
}
@@ -3315,11 +4041,29 @@
}
% \end{macrocode}
%
+% \begin{macrocode}
+\newcommand\thu@set@partial@toc@format{%
+ \titlecontents{section}
+ [\z@]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+ \titlecontents{subsection}
+ [1\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+ \titlecontents{subsubsection}
+ [2\ccwd]{}
+ {\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
+ {\thu@leaders\thecontentspage}%
+}
+% \end{macrocode}
+%
% 调研阅读报告的参考文献(或书面翻译对应的外文资料的原文索引)标题用宋体小四号字,段前 20pt,段后 6pt,行距 20pt。
% \begin{macrocode}
\newcommand\thu@appendix@bibsection{%
\par
\vskip 20bp%
+ \thu@pdfbookmark{1}{\bibname}%
\begingroup
\centering
\xiaosi[1.667]\bibname\par
@@ -3335,7 +4079,7 @@
% \begin{environment}{resume}
% 个人简历发表文章等。
% \begin{macrocode}
-\newenvironment{resume}[1][\thu@resume@title]{%
+\newenvironment{resume}[1][\thu@resume@name]{%
\thu@chapter*{#1}}{}
% \end{macrocode}
% \end{environment}
@@ -3384,20 +4128,18 @@
% \subsection{其他宏包的设置}
%
% 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。
-% \begin{macrocode}
-\newcommand\thu@atendpackage{\csname ctex_at_end_package:nn\endcsname}
-% \end{macrocode}
%
% \subsubsection{\pkg{hyperref} 宏包}
%
% \begin{macrocode}
-\thu@atendpackage{hyperref}{
+\AtEndOfPackageFile*{hyperref}{
\hypersetup{
linktoc = all,
bookmarksdepth = 2,
bookmarksnumbered = true,
bookmarksopen = true,
bookmarksopenlevel = 1,
+ bookmarksdepth = 3,
unicode = true,
psdextra = true,
breaklinks = true,
@@ -3430,6 +4172,15 @@
\@ifpackagelater{hyperref}{2019/04/27}{}{%
\g@addto@macro\psdmapshortnames{\let\mu\textmu}
}%
+ \ifthu@language@chinese
+ \hypersetup{
+ pdflang = zh-CN,
+ }%
+ \else
+ \hypersetup{
+ pdflang = en-US,
+ }%
+ \fi
\AtBeginDocument{%
\ifthu@language@chinese
\hypersetup{
@@ -3437,7 +4188,6 @@
pdfauthor = \thu@author,
pdfsubject = \thu@degree@name,
pdfkeywords = \thu@keywords,
- pdflang = zh-CN,
}%
\else
\hypersetup{
@@ -3445,7 +4195,6 @@
pdfauthor = \thu@author@en,
pdfsubject = \thu@degree@name@en,
pdfkeywords = \thu@keywords@en,
- pdflang = en-US,
}%
\fi
\hypersetup{
@@ -3457,7 +4206,7 @@
% \subsubsection{\pkg{nomencl} 宏包}
%
% \begin{macrocode}
-\thu@atendpackage{nomencl}{
+\AtEndOfPackageFile*{nomencl}{
\let\nomname\thu@denotation@name
\def\thenomenclature{\begin{denotation}[\nom@tempdim]}
\def\endthenomenclature{\end{denotation}}
@@ -3477,7 +4226,7 @@
% \subsubsection{\pkg{siunitx} 宏包}
%
% \begin{macrocode}
-\thu@atendpackage{siunitx}{%
+\AtEndOfPackageFile*{siunitx}{%
\sisetup{
group-minimum-digits = 4,
separate-uncertainty = true,
@@ -3501,7 +4250,46 @@
\fi
}
\thu@set@siunitx@language
- \thu@addto{language}{\thu@set@siunitx@language}
+ \thu@option@hook{language}{\thu@set@siunitx@language}
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{amsthm} 宏包}
+%
+% 定理标题使用黑体,正文使用宋体,冒号隔开。
+% \begin{macrocode}
+\AtEndOfPackageFile*{amsthm}{%
+ \newtheoremstyle{thu}
+ {\z@}{\z@}
+ {\normalfont}{\z@}
+ {\normalfont\sffamily}{\thu@theorem@separator}
+ {0.5em}{}
+ \theoremstyle{thu}
+ \newtheorem{assumption}{\thu@assumption@name}[chapter]%
+ \newtheorem{definition}{\thu@definition@name}[chapter]%
+ \newtheorem{proposition}{\thu@proposition@name}[chapter]%
+ \newtheorem{lemma}{\thu@lemma@name}[chapter]%
+ \newtheorem{theorem}{\thu@theorem@name}[chapter]%
+ \newtheorem{axiom}{\thu@axiom@name}[chapter]%
+ \newtheorem{corollary}{\thu@corollary@name}[chapter]%
+ \newtheorem{exercise}{\thu@exercise@name}[chapter]%
+ \newtheorem{example}{\thu@example@name}[chapter]%
+ \newtheorem{remark}{\thu@remark@name}[chapter]%
+ \newtheorem{problem}{\thu@problem@name}[chapter]%
+ \newtheorem{conjecture}{\thu@conjecture@name}[chapter]%
+ \renewenvironment{proof}[1][\thu@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@theorem@separator}]\ignorespaces
+ }{%
+ \popQED\endtrivlist\@endpefalse
+ }
+ \renewcommand\qedsymbol{\ensuremath{\QED}}
}
% \end{macrocode}
%
@@ -3509,10 +4297,10 @@
%
% 定理标题使用黑体,正文使用宋体,冒号隔开。
% \begin{macrocode}
-\thu@atendpackage{ntheorem}{%
+\AtEndOfPackageFile*{ntheorem}{%
\theorembodyfont{\normalfont}%
\theoremheaderfont{\normalfont\sffamily}%
- \theoremsymbol{\ensuremath{\square}}%
+ \theoremsymbol{\ensuremath{\QED}}%
\newtheorem*{proof}{\thu@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@algorithm@name}
+ \g@addto@macro\appendix{\renewcommand*{\thealgorithm}{\thechapter-\arabic{algorithm}}}
+ \renewcommand\listofalgorithms{%
+ \thu@set@list@label@width{\fname@algorithm}%
+ \thu@listof{algorithm}%
+ }
+ \renewcommand\listalgorithmname{\thu@list@algorithm@name}
+ \def\ext@algorithm{loa}
+ \contentsuse{algorithm}{loa}
+ \titlecontents{algorithm}
+ [\thu@list@label@width]{\addvspace{6bp}}
+ {\contentslabel[\fname@algorithm~\thecontentslabel]{\thu@list@label@width}}{}
+ {\thu@leaders\thecontentspage}
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{\pkg{algorithm2e} 宏包}
+%
+% \begin{macrocode}
+\PassOptionsToPackage{algochapter}{algorithm2e}
+\AtEndOfPackageFile*{algorithm2e}{
+ \renewcommand\algorithmcfname{\thu@algorithm@name}
+ \SetAlgoCaptionLayout{dawu}
+ \SetAlCapSty{relax}
+ \SetAlgoCaptionSeparator{\hspace*{1em}}
+ \SetAlFnt{\dawu}
+ \renewcommand\listofalgorithms{%
+ \thu@set@list@label@width{\algorithmcfname}%
+ \thu@listof{algorithmcf}%
+ }
+ \renewcommand\listalgorithmcfname{\thu@list@algorithm@name}
+ \def\ext@algorithmcf{loa}
+ \contentsuse{algocf}{loa}
+ \titlecontents{algocf}
+ [\thu@list@label@width]{\addvspace{6bp}}
+ {\contentslabel[\algorithmcfname~\thecontentslabel]{\thu@list@label@width}}{}
+ {\thu@leaders\thecontentspage}
+}
+% \end{macrocode}
+%
+% \subsubsection{\pkg{minted} 宏包}
+%
+% \begin{macrocode}
+\AtEndOfPackageFile*{minted}{
+ \g@addto@macro\appendix{\renewcommand*{\thelisting}{\thechapter-\arabic{listing}}}%
+ \newcommand\thu@set@listing@language{%
+ \ifthu@language@chinese
+ \floatname{listing}{代码}%
+ \else
+ \floatname{listing}{Listing}%
+ \fi
+ }
+ \thu@set@listing@language
+ \thu@option@hook{language}{\thu@set@listing@language}
+}
+% \end{macrocode}
+%
% \subsection{书脊}
% \label{sec:spine}
% \begin{macro}{\spine}
@@ -3578,6 +4435,13 @@
\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}
@@ -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}
diff --git a/macros/latex/contrib/thuthesis/thuthesis.pdf b/macros/latex/contrib/thuthesis/thuthesis.pdf
index 61143ff60d..6c74015fc5 100644
--- a/macros/latex/contrib/thuthesis/thuthesis.pdf
+++ b/macros/latex/contrib/thuthesis/thuthesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/thuthesis/tsinghua.pdf b/macros/latex/contrib/thuthesis/tsinghua.pdf
index 69c8521bae..ac5b358259 100644
--- a/macros/latex/contrib/thuthesis/tsinghua.pdf
+++ b/macros/latex/contrib/thuthesis/tsinghua.pdf
Binary files differ