diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/thuthesis |
Initial commit
Diffstat (limited to 'macros/latex/contrib/thuthesis')
30 files changed, 11169 insertions, 0 deletions
diff --git a/macros/latex/contrib/thuthesis/Makefile b/macros/latex/contrib/thuthesis/Makefile new file mode 100644 index 0000000000..95f4036008 --- /dev/null +++ b/macros/latex/contrib/thuthesis/Makefile @@ -0,0 +1,82 @@ +# Makefile for ThuThesis + +# Set opts for latexmk if you use it +LATEXMKOPTS = -xelatex -file-line-error -halt-on-error -interaction=nonstopmode +# Basename of thesis +THESISMAIN = main +# Basename of shuji +SHUJIMAIN = shuji + +PACKAGE=thuthesis +SOURCES=$(PACKAGE).ins $(PACKAGE).dtx +THESISCONTENTS=$(THESISMAIN).tex data/*.tex $(FIGURES) +# NOTE: update this to reflect your local file types. +FIGURES=$(wildcard figures/*.pdf) +BIBFILE=ref/*.bib +BSTFILE=*.bst +SHUJICONTENTS=$(SHUJIMAIN).tex +CLSFILES=dtx-style.sty $(PACKAGE).cls + +# make deletion work on Windows +ifdef SystemRoot + RM = del /Q + OPEN = start +else + RM = rm -f + OPEN = open +endif + +.PHONY: all clean distclean dist thesis viewthesis shuji viewshuji doc viewdoc cls check FORCE_MAKE + +all: doc thesis shuji + +cls: $(CLSFILES) + +$(CLSFILES): $(SOURCES) + xetex $(PACKAGE).ins + +viewdoc: doc + $(OPEN) $(PACKAGE).pdf + +doc: $(PACKAGE).pdf + +viewthesis: thesis + $(OPEN) $(THESISMAIN).pdf + +thesis: $(THESISMAIN).pdf + +viewshuji: shuji + $(OPEN) $(SHUJIMAIN).pdf + +shuji: $(SHUJIMAIN).pdf + +$(PACKAGE).pdf: $(CLSFILES) $(THESISMAIN).tex FORCE_MAKE + latexmk $(LATEXMKOPTS) $(PACKAGE).dtx + +$(THESISMAIN).pdf: $(CLSFILES) $(BSTFILE) FORCE_MAKE + latexmk $(LATEXMKOPTS) $(THESISMAIN) + +$(SHUJIMAIN).pdf: $(CLSFILES) FORCE_MAKE + latexmk $(LATEXMKOPTS) $(SHUJIMAIN) + +clean: + latexmk -c $(PACKAGE).dtx $(THESISMAIN) $(SHUJIMAIN) + -@$(RM) *~ + +cleanall: clean + -@$(RM) $(PACKAGE).pdf $(THESISMAIN).pdf $(SHUJIMAIN).pdf + +distclean: cleanall + -@$(RM) $(CLSFILES) + -@$(RM) -r dist + +check: FORCE_MAKE +ifeq ($(version),) + @echo "Error: version missing: \"make [check|dist] version=X.Y.Z\""; exit 1 +else + @[[ $(shell grep -E -c '$(version) Tsinghua University Thesis Template|\\def\\version\{$(version)\}' thuthesis.dtx) -eq 3 ]] || (echo "update version in thuthesis.dtx before release"; exit 1) + @[[ $(shell grep -E -c '"version": "$(version)"' package.json) -eq 1 ]] || (echo "update version in package.json before release"; exit 1) +endif + +dist: check all + npm run build -- --version=$(version) diff --git a/macros/latex/contrib/thuthesis/README.md b/macros/latex/contrib/thuthesis/README.md new file mode 100644 index 0000000000..ff9a88378d --- /dev/null +++ b/macros/latex/contrib/thuthesis/README.md @@ -0,0 +1,104 @@ +[![Build Status](https://travis-ci.org/xueruini/thuthesis.svg?branch=master)](https://travis-ci.org/xueruini/thuthesis) +[![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.svg)](https://github.com/xueruini/thuthesis/releases) +[![GitHub release](https://img.shields.io/github/release/xueruini/thuthesis/all.svg)](https://github.com/xueruini/thuthesis/releases/latest) +[![GitHub commits](https://img.shields.io/github/commits-since/xueruini/thuthesis/latest.svg)](https://github.com/xueruini/thuthesis/commits/master) + +# What's ThuThesis? +ThuThesis is an abbreviation of <b>T</b>sing<b>h</b>ua <b>U</b>niversity <b>Thesis</b> LaTeX Template. + +This package establishes a simple and easy-to-use LaTeX template for Tsinghua dissertations, including general undergraduate research papers, masters theses, doctoral theses, doctoral dissertations, and post-doc reports. Additional support for other formats (what else is there?) will be added continuously. An English translation of this README follows the Chinese below. + +# ThuThesis是什么? +ThuThesis为 <b>T</b>sing<b>h</b>ua <b>U</b>niversity <b>Thesis</b> LaTeX Template之缩写。 + +此宏包旨在建立一个简单易用的清华大学学位论文LaTeX模板,包括本科综合论文训练、硕士论文、博士论文、博士哲学论文以及博士后出站报告。现在支持本科、硕士、博士论文、博士后出站报告格式,对其它格式(还有么?)的支持会陆续加入。 + +# 文档 +请[下载](https://github.com/xueruini/thuthesis/releases)模板,里面包括具体使用说明以及示例文档: + +* 模板使用说明 (thuthesis.pdf) +* 示例文档 (main.pdf) + +# 下载 +* 发行版:[CTAN](http://www.ctan.org/pkg/thuthesis) +* 开发版:[GitHub](https://github.com/xueruini/thuthesis) + +# 升级 +## 自动更新 +通过 TeX 发行版工具自动从 [CTAN](http://www.ctan.org/pkg/thuthesis) 更新。 + +## 手动更新 +从 [GitHub](https://github.com/xueruini/thuthesis) 下载放入论文目录,执行命令(Windows 用户在文件夹空白处按`Shift+鼠标右键`,点击“在此处打开命令行窗口”): + + xetex thuthesis.ins + +即可得到 `thuthesis.cls` 等模板文件。 + +# 提问 +按推荐顺序排序: + +* 先到 [FAQ](https://github.com/xueruini/thuthesis/wiki/FAQ) 看看常见问题 +* [Github Issues](http://github.com/xueruini/thuthesis/issues) +* [TeX@newsmth](http://www.newsmth.net/nForum/#!board/TeX) +* [ThuThesis@Google Groups](http://groups.google.com/group/thuthesis) + +# Makefile的用法 + +```shell +make [{all|thesis|shuji|doc|clean|cleanall|distclean}] +``` + +## 目标 +* `make all` 等于 `make thesis && make shuji && make doc`; +* `make cls` 生成模板文件; +* `make thesis` 生成论文 main.pdf; +* `make shuji` 生成书脊 shuji.pdf; +* `make doc` 生成使用说明书 thuthesis.pdf; +* `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) +* Template example (main.pdf) + +# Downloads +* Published version: [CTAN](http://www.ctan.org/pkg/thuthesis) +* Developer version: [GitHub](https://github.com/xueruini/thuthesis) + +# Updates +## Automatic +Get the most up-to-date published version of the TeX tools from [CTAN](http://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"): + + xetex thuthesis.ins + +You'll get `thuthesis.cls` along with other template files. + +# Reporting Issues +Please follow the procedure below: + +* Check the [FAQ](https://github.com/xueruini/thuthesis/wiki/FAQ) +* [Github Issues](http://github.com/xueruini/thuthesis/issues) +* [TeX@newsmth](http://www.newsmth.net/nForum/#!board/TeX) +* [ThuThesis@Google Groups](http://groups.google.com/group/thuthesis) + +# Makefile Usage + +```shell +make [{all|thesis|shuji|doc|clean|cleanall|distclean}] +``` + +## Targets +* `make all` same as `make thesis && make shuji && make doc`; +* `make cls` generate template file; +* `make thesis` generate thesis main.pdf; +* `make shuji` generate book spine for printing shuji.pdf; +* `make doc` generate documentation thuthesis.pdf; +* `make clean` delete all examples' files (excluding main.pdf); +* `make cleanall` delete all examples' files and main.pdf; +* `make distclean` delete all examples' and templates' files and PDFs. diff --git a/macros/latex/contrib/thuthesis/data/ack.tex b/macros/latex/contrib/thuthesis/data/ack.tex new file mode 100644 index 0000000000..bdab98fb98 --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/ack.tex @@ -0,0 +1,12 @@ +% 如果使用声明扫描页,将可选参数指定为扫描后的 PDF 文件名,例如: +% \begin{acknowledgement}[scan-statement.pdf] +\begin{acknowledgement} + 衷心感谢导师 xxx 教授和物理系 xxx 副教授对本人的精心指导。他们的言传身教将使 + 我终生受益。 + + 在美国麻省理工学院化学系进行九个月的合作研究期间,承蒙 xxx 教授热心指导与帮助,不 + 胜感激。感谢 xx 实验室主任 xx 教授,以及实验室全体老师和同学们的热情帮助和支 + 持!本课题承蒙国家自然科学基金资助,特此致谢。 + + 感谢 \LaTeX 和 \thuthesis\cite{thuthesis},帮我节省了不少时间。 +\end{acknowledgement} diff --git a/macros/latex/contrib/thuthesis/data/appendix01.tex b/macros/latex/contrib/thuthesis/data/appendix01.tex new file mode 100644 index 0000000000..f34536ed5b --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/appendix01.tex @@ -0,0 +1,263 @@ +\chapter{外文资料原文} +\label{cha:engorg} + +\title{The title of the English paper} + +\textbf{Abstract:} 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$^{[1]}$. + +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$^{[2,3]}$. + + +\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*{References} +\noindent{\itshape NOTE: These references are only for demonstration. They are + not real citations in the original text.} + +\begin{translationbib} +\item Donald E. Knuth. The \TeX book. Addison-Wesley, 1984. ISBN: 0-201-13448-9 +\item Paul W. Abrahams, Karl Berry and Kathryn A. Hargreaves. \TeX\ for the + Impatient. Addison-Wesley, 1990. ISBN: 0-201-51375-7 +\item David Salomon. The advanced \TeX book. New York : Springer, 1995. ISBN:0-387-94556-3 +\end{translationbib} + +\chapter{外文资料的调研阅读报告或书面翻译} + +\title{英文资料的中文标题} + +{\heiti 摘要:} 本章为外文资料翻译内容。如果有摘要可以直接写上来,这部分好像没有 +明确的规定。 + +\section{单目标规划} +北冥有鱼,其名为鲲。鲲之大,不知其几千里也。化而为鸟,其名为鹏。鹏之背,不知其几 +千里也。怒而飞,其翼若垂天之云。是鸟也,海运则将徙于南冥。南冥者,天池也。 +\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})} +\end{equation} + +吾生也有涯,而知也无涯。以有涯随无涯,殆已!已而为知者,殆而已矣!为善无近名,为 +恶无近刑,缘督以为经,可以保身,可以全生,可以养亲,可以尽年。 + +\subsection{线性规划} +庖丁为文惠君解牛,手之所触,肩之所倚,足之所履,膝之所倚,砉然响然,奏刀騞然,莫 +不中音,合于桑林之舞,乃中经首之会。 +\begin{table}[ht] +\centering + \centering + \caption*{表~1\hskip1em 这是手动编号但不出现在索引中的一个表格例子} + \label{tab:badtabular3} + \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} + +文惠君曰:“嘻,善哉!技盖至此乎?”庖丁释刀对曰:“臣之所好者道也,进乎技矣。始臣之 +解牛之时,所见无非全牛者;三年之后,未尝见全牛也;方今之时,臣以神遇而不以目视, +官知止而神欲行。依乎天理,批大郤,导大窾,因其固然。技经肯綮之未尝,而况大坬乎! +良庖岁更刀,割也;族庖月更刀,折也;今臣之刀十九年矣,所解数千牛矣,而刀刃若新发 +于硎。彼节者有间而刀刃者无厚,以无厚入有间,恢恢乎其于游刃必有余地矣。是以十九年 +而刀刃若新发于硎。虽然,每至于族,吾见其难为,怵然为戒,视为止,行为迟,动刀甚微, +謋然已解,如土委地。提刀而立,为之而四顾,为之踌躇满志,善刀而藏之。” + +文惠君曰:“善哉!吾闻庖丁之言,得养生焉。” + + +\subsection{非线性规划} +孔子与柳下季为友,柳下季之弟名曰盗跖。盗跖从卒九千人,横行天下,侵暴诸侯。穴室枢 +户,驱人牛马,取人妇女。贪得忘亲,不顾父母兄弟,不祭先祖。所过之邑,大国守城,小 +国入保,万民苦之。孔子谓柳下季曰:“夫为人父者,必能诏其子;为人兄者,必能教其弟。 +若父不能诏其子,兄不能教其弟,则无贵父子兄弟之亲矣。今先生,世之才士也,弟为盗 +跖,为天下害,而弗能教也,丘窃为先生羞之。丘请为先生往说之。” +\begin{figure}[h] + \centering + \includegraphics{thu-whole-logo.pdf} + \caption*{图~1\hskip1em 这是手动编号但不出现索引中的图片的例子} + \label{tab:badfigure3} +\end{figure} + +柳下季曰:“先生言为人父者必能诏其子,为人兄者必能教其弟,若子不听父之诏,弟不受 +兄之教,虽今先生之辩,将奈之何哉?且跖之为人也,心如涌泉,意如飘风,强足以距敌, +辩足以饰非。顺其心则喜,逆其心则怒,易辱人以言。先生必无往。” + +孔子不听,颜回为驭,子贡为右,往见盗跖。 + +\subsection{整数规划} +盗跖乃方休卒徒大山之阳,脍人肝而餔之。孔子下车而前,见谒者曰:“鲁人孔丘,闻将军 +高义,敬再拜谒者。”谒者入通。盗跖闻之大怒,目如明星,发上指冠,曰:“此夫鲁国之 +巧伪人孔丘非邪?为我告之:尔作言造语,妄称文、武,冠枝木之冠,带死牛之胁,多辞缪 +说,不耕而食,不织而衣,摇唇鼓舌,擅生是非,以迷天下之主,使天下学士不反其本,妄 +作孝弟,而侥幸于封侯富贵者也。子之罪大极重,疾走归!不然,我将以子肝益昼餔之膳。” + + +\chapter{其它附录} +前面两个附录主要是给本科生做例子。其它附录的内容可以放到这里,当然如果你愿意,可 +以把这部分也放到独立的文件中,然后将其 \cs{input} 到主文件中。 diff --git a/macros/latex/contrib/thuthesis/data/chap01.tex b/macros/latex/contrib/thuthesis/data/chap01.tex new file mode 100644 index 0000000000..7277f2fb25 --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/chap01.tex @@ -0,0 +1,579 @@ +\chapter{带 English 的标题} +\label{cha:intro} + +这是 \thuthesis\cite{thuthesis} 的示例文档,基本上覆盖了模板中所有格式的设置。建 +议大家在使用模板之前,除了阅读《\thuthesis{} 用户手册》,这个示例文档也最好能看一 +看。 + +小老鼠偷吃热凉粉;短长虫环绕矮高粱\footnote{韩愈(768-824),字退之,河南河阳( + 今河南孟县)人,自称郡望昌黎,世称韩昌黎。幼孤贫刻苦好学,德宗贞元八年进士。曾 + 任监察御史,因上疏请免关中赋役,贬为阳山县令。后随宰相裴度平定淮西迁刑部侍郎, + 又因上表谏迎佛骨,贬潮州刺史。做过吏部侍郎,死谥文公,故世称韩吏部、韩文公。是 + 唐代古文运动领袖,与柳宗元合称韩柳。诗力求险怪新奇,雄浑重气势。}。 + + +\section{封面相关} +封面的例子请参看 \texttt{cover.tex}。主要符号表参看 \texttt{denotation.tex},附录和 +个人简历分别参看 \texttt{appendix01.tex} 和 \texttt{resume.tex}。里面的命令都很直 +观,一看即会\footnote{你说还是看不懂?怎么会呢?}。 + +\section{字体命令} +\label{sec:first} + +苏轼(1037-1101),北宋文学家、书画家。字子瞻,号东坡居士,眉州眉山(今属四川)人 +。苏洵子。嘉佑进士。神宗时曾任祠部员外郎,因反对王安石新法而求外职,任杭州通判, +知密州、徐州、湖州。后以作诗“谤讪朝廷”罪贬黄州。哲宗时任翰林学士,曾出知杭州、 +颖州等,官至礼部尚书。后又贬谪惠州、儋州。北还后第二年病死常州。南宋时追谥文忠。 +与父洵弟辙,合称“三苏”。在政治上属于旧党,但也有改革弊政的要求。其文汪洋恣肆, +明白畅达,为“唐宋八大家”之一。 其诗清新豪健,善用夸张比喻,在艺术表现方面独具 +风格。少数诗篇也能反映民间疾苦,指责统治者的奢侈骄纵。词开豪放一派,对后代很有影 +响。《念奴娇·赤壁怀古》、《水调歌头·丙辰中秋》传诵甚广。 + +{\kaishu 坡仙擅长行书、楷书,取法李邕、徐浩、颜真卿、杨凝式,而能自创新意。用笔丰腴 + 跌宕,有天真烂漫之趣。与蔡襄、黄庭坚、米芾并称“宋四家”。能画竹,学文同,也喜 + 作枯木怪石。论画主张“神似”,认为“论画以形似,见与儿童邻”;高度评价“诗中有 + 画,画中有诗”的艺术造诣。诗文有《东坡七集》等。存世书迹有《答谢民师论文帖》、 + 《祭黄几道文》、《前赤壁赋》、《黄州寒食诗帖》等。 画迹有《枯木怪石图》、《 + 竹石图》等。} + +{\fangsong 易与天地准,故能弥纶天地之道。仰以观於天文,俯以察於地理,是故知幽明之故。原 + 始反终,故知死生之说。精气为物,游魂为变,是故知鬼神之情状。与天地相似,故不违。 + 知周乎万物,而道济天下,故不过。旁行而不流,乐天知命,故不忧。安土敦乎仁,故 + 能爱。范围天地之化而不过,曲成万物而不遗,通乎昼夜之道而知,故神无方而易无体。} + +% 非本科生一般用不到幼圆与隶书字体。需要的同学请查看 ctex 文档。 +{\ifcsname youyuan\endcsname\youyuan\else[无 \cs{youyuan} 字体。]\fi 有天地,然后 + 万物生焉。盈天地之间者,唯万物,故受之以屯;屯者盈也,屯者物之始生也。物生必蒙, + 故受之以蒙;蒙者蒙也,物之穉也。物穉不可不养也,故受之以需;需者饮食之道也。饮 + 食必有讼,故受之以讼。讼必有众起,故受之以师;师者众也。众必有所比,故受之以比; + 比者比也。比必有所畜也,故受之以小畜。物畜然后有礼,故受之以履。} + +{\heiti 履而泰,然后安,故受之以泰;泰者通也。物不可以终通,故受之以否。物不可以终 + 否,故受之以同人。与人同者,物必归焉,故受之以大有。有大者不可以盈,故受之以谦。 + 有大而能谦,必豫,故受之以豫。豫必有随,故受之以随。以喜随人者,必有事,故受 + 之以蛊;蛊者事也。} + +{\ifcsname lishu\endcsname\lishu\else[无 \cs{lishu} 字体。]\fi 有事而后可大,故受 + 之以临;临者大也。物大然后可观,故受之以观。可观而后有所合,故受之以噬嗑;嗑者 + 合也。物不可以苟合而已,故受之以贲;贲者饰也。致饰然后亨,则尽矣,故受之以剥; + 剥者剥也。物不可以终尽,剥穷上反下,故受之以复。复则不妄矣,故受之以无妄。} + +{\songti 有无妄然后可畜,故受之以大畜。物畜然后可养,故受之以颐;颐者养也。不养则不 + 可动,故受之以大过。物不可以终过,故受之以坎;坎者陷也。陷必有所丽,故受之以 + 离;离者丽也。} + +\section{表格样本} +\label{chap1:sample:table} + +\subsection{基本表格} +\label{sec:basictable} + +模板中关于表格的宏包有三个:\pkg{booktabs}、\pkg{array} 和 \pkg{longtabular},命 +令有一个 \cs{hlinewd}。三线表可以用 \pkg{booktabs} 提供 +的 \cs{toprule}、\cs{midrule} 和 \cs{bottomrule}。它们与 \pkg{longtable} 能很好的 +配合使用。如果表格比较简单的话可以直接用命令 \cs{hlinewd}\marg{width} 控制。 +\begin{table}[htb] + \centering + \begin{minipage}[t]{0.8\linewidth} % 如果想在表格中使用脚注,minipage是个不错的办法 + \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{再来一个}。\\ + thuthesis.cls & 模板类文件。\\ + thuthesis-numeric.bst & 参考文献 Bib\TeX\ 样式文件。\\ + thuthesis-author-year.bst & 参考文献 Bib\TeX\ 样式文件。\\ + thuthesis.sty & 常用的包和命令写在这里,减轻主文件的负担。\\ + \bottomrule[1.5pt] + \end{tabularx} + \end{minipage} +\end{table} + +首先来看一个最简单的表格。表 \ref{tab:template-files} 列举了本模板主要文件及其功 +能。请大家注意三线表中各条线对应的命令。这个例子还展示了如何在表格中正确使用脚注。 +由于 \LaTeX{} 本身不支持在表格中使用 \cs{footnote},所以我们不得不将表格放在 +小页中,而且最好将表格的宽度设置为小页的宽度,这样脚注看起来才更美观。 + +\subsection{复杂表格} +\label{sec:complicatedtable} + +我们经常会在表格下方标注数据来源,或者对表格里面的条目进行解释。前面的脚注是一种 +不错的方法,如果不喜欢脚注,可以在表格后面写注释,比如表~\ref{tab:tabexamp1}。 +\begin{table}[htbp] + \centering + \caption{复杂表格示例 1。这个引用 \cite{tex} 不会导致编号混乱。} + \label{tab:tabexamp1} + \begin{minipage}[t]{0.8\textwidth} + \begin{tabularx}{\linewidth}{|l|X|X|X|X|} + \hline + \multirow{2}*{\diagbox[width=5em]{x}{y}} & \multicolumn{2}{c|}{First Half} & \multicolumn{2}{c|}{Second Half}\\\cline{2-5} + & 1st Qtr &2nd Qtr&3rd Qtr&4th Qtr \\ \hline + East$^{*}$ & 20.4& 27.4& 90& 20.4 \\ + West$^{**}$ & 30.6 & 38.6 & 34.6 & 31.6 \\ \hline + \end{tabularx}\\[2pt] + \footnotesize 注:数据来源《\thuthesis{} 使用手册》。\\ + *:东部\\ + **:西部 + \end{minipage} +\end{table} + +此外,表~\ref{tab:tabexamp1} 同时还演示了另外两个功能:1)通过 \pkg{tabularx} 的 + \texttt{|X|} 扩展实现表格自动放大;2)通过命令 \cs{diagbox} 在表头部分 +插入反斜线。 + +为了使我们的例子更接近实际情况,我会在必要的时候插入一些“无关”文字,以免太多图 +表同时出现,导致排版效果不太理想。第一个出场的当然是我的最爱:风流潇洒、骏马绝尘、 +健笔凌云的{\heiti 李太白}了。 + +李白,字太白,陇西成纪人。凉武昭王暠九世孙。或曰山东人,或曰蜀人。白少有逸才,志 +气宏放,飘然有超世之心。初隐岷山,益州长史苏颋见而异之,曰:“是子天才英特,可比 +相如。”天宝初,至长安,往见贺知章。知章见其文,叹曰:“子谪仙人也。”言于明皇, +召见金銮殿,奏颂一篇。帝赐食,亲为调羹,有诏供奉翰林。白犹与酒徒饮于市,帝坐沉香 +亭子,意有所感,欲得白为乐章,召入,而白已醉。左右以水颒面,稍解,援笔成文,婉丽 +精切。帝爱其才,数宴见。白常侍帝,醉,使高力士脱靴。力士素贵,耻之,摘其诗以激杨 +贵妃。帝欲官白,妃辄沮止。白自知不为亲近所容,恳求还山。帝赐金放还。乃浪迹江湖, +终日沉饮。永王璘都督江陵,辟为僚佐。璘谋乱,兵败,白坐长流夜郎,会赦得还。族人阳 +冰为当涂令,白往依之。代宗立,以左拾遗召,而白已卒。文宗时,诏以白歌诗、裴旻剑舞、 +张旭草书为三绝云。集三十卷。今编诗二十五卷。\hfill —— 《全唐诗》诗人小传 + +浮动体的并排放置一般有两种情况:1)二者没有关系,为两个独立的浮动体;2)二者隶属 +于同一个浮动体。对表格来说并排表格既可以像图~\ref{tab:parallel1}、 +图~\ref{tab:parallel2} 使用小页环境,也可以如图~\ref{tab:subtable} 使用子表格来做。 +图的例子参见第~\ref{sec:multifig} 节。 + +\begin{table}[htbp] +\noindent\begin{minipage}{0.5\textwidth} +\centering +\caption{第一个并排子表格} +\label{tab:parallel1} +\begin{tabular}{p{2cm}p{2cm}} +\toprule[1.5pt] +111 & 222 \\\midrule[1pt] +222 & 333 \\\bottomrule[1.5pt] +\end{tabular} +\end{minipage}% +\begin{minipage}{0.5\textwidth} +\centering +\caption{第二个并排子表格} +\label{tab:parallel2} +\begin{tabular}{p{2cm}p{2cm}} +\toprule[1.5pt] +111 & 222 \\\midrule[1pt] +222 & 333 \\\bottomrule[1.5pt] +\end{tabular} +\end{minipage} +\end{table} + +然后就是忧国忧民,诗家楷模杜工部了。杜甫,字子美,其先襄阳人,曾祖依艺为巩令,因 +居巩。甫天宝初应进士,不第。后献《三大礼赋》,明皇奇之,召试文章,授京兆府兵曹参 +军。安禄山陷京师,肃宗即位灵武,甫自贼中遁赴行在,拜左拾遗。以论救房琯,出为华州 +司功参军。关辅饥乱,寓居同州同谷县,身自负薪采梠,餔糒不给。久之,召补京兆府功曹, +道阻不赴。严武镇成都,奏为参谋、检校工部员外郎,赐绯。武与甫世旧,待遇甚厚。乃于 +成都浣花里种竹植树,枕江结庐,纵酒啸歌其中。武卒,甫无所依,乃之东蜀就高適。既至 +而適卒。是岁,蜀帅相攻杀,蜀大扰。甫携家避乱荆楚,扁舟下峡,未维舟而江陵亦乱。乃 +溯沿湘流,游衡山,寓居耒阳。卒年五十九。元和中,归葬偃师首阳山,元稹志其墓。天宝 +间,甫与李白齐名,时称李杜。然元稹之言曰:“李白壮浪纵恣,摆去拘束,诚亦差肩子美 +矣。至若铺陈终始,排比声韵,大或千言,次犹数百,词气豪迈,而风调清深,属对律切, +而脱弃凡近,则李尚不能历其藩翰,况堂奥乎。”白居易亦云:“杜诗贯穿古今, 尽工尽 +善,殆过于李。”元、白之论如此。盖其出处劳佚,喜乐悲愤,好贤恶恶,一见之于诗。而 +又以忠君忧国、伤时念乱为本旨。读其诗可以知其世,故当时谓之“诗史”。旧集诗文共六 +十卷,今编诗十九卷。 + +\begin{table}[htbp] +\centering +\caption{并排子表格} +\label{tab:subtable} +\subcaptionbox{第一个子表格} +{ +\begin{tabular}{p{2cm}p{2cm}} +\toprule[1.5pt] +111 & 222 \\\midrule[1pt] +222 & 333 \\\bottomrule[1.5pt] +\end{tabular} +} +\hskip2cm +\subcaptionbox{第二个子表格} +{ +\begin{tabular}{p{2cm}p{2cm}} +\toprule[1.5pt] +111 & 222 \\\midrule[1pt] +222 & 333 \\\bottomrule[1.5pt] +\end{tabular} +} +\end{table} + +不可否认 \LaTeX{} 的表格功能没有想象中的那么强大,不过只要足够认真,足够细致, +同样可以排出来非常复杂非常漂亮的表格。请参看表~\ref{tab:tabexamp2}。 +\begin{table}[htbp] + \centering\dawu[1.3] + \caption{复杂表格示例 2} + \label{tab:tabexamp2} + \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}{1.5em}{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} + +最后就是清新飘逸、文约意赅、空谷绝响的王大侠了。王维,字摩诘,河东人。工书画,与 +弟缙俱有俊才。开元九年,进士擢第,调太乐丞。坐累为济州司仓参军,历右拾遗、监察御 +史、左补阙、库部郎中,拜吏部郎中。天宝末,为给事中。安禄山陷两都,维为贼所得,服 +药阳喑,拘于菩提寺。禄山宴凝碧池,维潜赋诗悲悼,闻于行在。贼平,陷贼官三等定罪, +特原之,责授太子中允,迁中庶子、中书舍人。复拜给事中,转尚书右丞。维以诗名盛于开 +元、天宝间,宁薛诸王驸马豪贵之门,无不拂席迎之。得宋之问辋川别墅,山水绝胜,与道 +友裴迪,浮舟往来,弹琴赋诗,啸咏终日。笃于奉佛,晚年长斋禅诵。一日,忽索笔作书 +数纸,别弟缙及平生亲故,舍笔而卒。赠秘书监。宝应中,代宗问缙:“朕常于诸王坐闻维 +乐章,今存几何?”缙集诗六卷,文四卷,表上之。敕答云,卿伯氏位列先朝,名高希代。 +抗行周雅,长揖楚辞。诗家者流,时论归美。克成编录,叹息良深。殷璠谓维诗词秀调雅, +意新理惬。在泉成珠,著壁成绘。苏轼亦云:“维诗中有画,画中有诗也。”今编诗四卷。 + +\begin{longtable}[c]{c*{6}{r}} +\caption{实验数据}\label{tab:performance}\\ +\toprule[1.5pt] + 测试程序 & \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] +\endfirsthead +\multicolumn{7}{c}{续表~\thetable\hskip1em 实验数据}\\ +\toprule[1.5pt] + 测试程序 & \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] +\endhead +\hline +\multicolumn{7}{r}{续下页} +\endfoot +\endlastfoot +CG.A.2 & 23.05 & 0.002 & 0.116 & 0.035 & 0.589 & 32491 \\ +CG.A.4 & 15.06 & 0.003 & 0.067 & 0.021 & 0.351 & 18211 \\ +CG.A.8 & 13.38 & 0.004 & 0.072 & 0.023 & 0.210 & 9890 \\ +CG.B.2 & 867.45 & 0.002 & 0.864 & 0.232 & 3.256 & 228562 \\ +CG.B.4 & 501.61 & 0.003 & 0.438 & 0.136 & 2.075 & 123862 \\ +CG.B.8 & 384.65 & 0.004 & 0.457 & 0.108 & 1.235 & 63777 \\ +MG.A.2 & 112.27 & 0.002 & 0.846 & 0.237 & 3.930 & 236473 \\ +MG.A.4 & 59.84 & 0.003 & 0.442 & 0.128 & 2.070 & 123875 \\ +MG.A.8 & 31.38 & 0.003 & 0.476 & 0.114 & 1.041 & 60627 \\ +MG.B.2 & 526.28 & 0.002 & 0.821 & 0.238 & 4.176 & 236635 \\ +MG.B.4 & 280.11 & 0.003 & 0.432 & 0.130 & 1.706 & 123793 \\ +MG.B.8 & 148.29 & 0.003 & 0.442 & 0.116 & 0.893 & 60600 \\ +LU.A.2 & 2116.54 & 0.002 & 0.110 & 0.030 & 0.532 & 28754 \\ +LU.A.4 & 1102.50 & 0.002 & 0.069 & 0.017 & 0.255 & 14915 \\ +LU.A.8 & 574.47 & 0.003 & 0.067 & 0.016 & 0.192 & 8655 \\ +LU.B.2 & 9712.87 & 0.002 & 0.357 & 0.104 & 1.734 & 101975 \\ +LU.B.4 & 4757.80 & 0.003 & 0.190 & 0.056 & 0.808 & 53522 \\ +LU.B.8 & 2444.05 & 0.004 & 0.222 & 0.057 & 0.548 & 30134 \\ +EP.A.2 & 123.81 & 0.002 & 0.010 & 0.003 & 0.074 & 1834 \\ +EP.A.4 & 61.92 & 0.003 & 0.011 & 0.004 & 0.073 & 1743 \\ +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] +\end{longtable} + +要想用好论文模板还是得提前学习一些 \TeX/\LaTeX{}的相关知识,具备一些基本能力,掌 +握一些常见技巧,否则一旦遇到问题还真是比较麻烦。我们见过很多这样的同学,一直以来 +都是使用 Word 等字处理工具,以为 \LaTeX{}模板的用法也应该类似,所以就沿袭同样的思 +路来对待这种所见非所得的排版工具,结果被折腾的焦头烂额,疲惫不堪。 + +如果您要排版的表格长度超过一页,那么推荐使用 \pkg{longtable} 或者 \pkg{supertabular} +宏包,模板对 \pkg{longtable} 进行了相应的设置,所以用起来可能简单一些。 +表~\ref{tab:performance} 就是 \pkg{longtable} 的示例。 + +\subsection{其它} +\label{sec:tableother} +如果不想让某个表格或者图片出现在索引里面,请使用命令 \cs{caption*}。 +这个命令不会给表格编号,也就是出来的只有标题文字而没有“表~XX”,“图~XX”,否则 +索引里面序号不连续就显得不伦不类,这也是 \LaTeX{} 里星号命令默认的规则。 + +有这种需求的多是本科同学的英文资料翻译部分,如果觉得附录中英文原文中的表格和图 +片显示成“表”和“图”不协调的话,一个很好的办法就是用 \cs{caption*},参数 +随便自己写,比如不守规矩的表~1.111 和图~1.111 能满足这种特殊需要(可以参看附录部 +分)。 +\begin{table}[ht] + \begin{minipage}{0.4\linewidth} + \centering + \caption*{表~1.111\quad 这是一个手动编号,不出现在索引中的表格。} + \label{tab:badtabular} + \framebox(150,50)[c]{\thuthesis} + \end{minipage}% + \hfill% + \begin{minipage}{0.4\linewidth} + \centering + \caption*{Figure~1.111\quad 这是一个手动编号,不出现在索引中的图。} + \label{tab:badfigure} + \framebox(150,50)[c]{薛瑞尼} + \end{minipage} +\end{table} + +如果的确想让它编号,但又不想让它出现在索引中的话,目前模板上不支持。 + +最后,虽然大家不一定会独立使用小页,但是关于小页中的脚注还是有必要提一下。请看下 +面的例子。 + +\begin{minipage}[t]{\linewidth-2\parindent} + 柳宗元,字子厚(773-819),河东(今永济县)人\footnote{山西永济水饺。},是唐代 + 杰出的文学家,哲学家,同时也是一位政治改革家。与韩愈共同倡导唐代古文运动,并称 + 韩柳\footnote{唐宋八大家之首二位。}。 +\end{minipage} + +唐朝安史之乱后,宦官专权,藩镇割据,土地兼并日渐严重,社会生产破坏严重,民不聊生。柳宗 +元对这种社会现实极为不满,他积极参加了王叔文领导的“永济革新”,并成为这一 +运动的中坚人物。他们革除弊政,打击权奸,触犯了宦官和官僚贵族利益,在他们的联合反 +扑下,改革失败了,柳宗元被贬为永州司马。 + +\section{定理环境} +\label{sec:theorem} + +给大家演示一下各种和证明有关的环境: + +\begin{assumption} +待月西厢下,迎风户半开;隔墙花影动,疑是玉人来。 +\begin{align} + \label{eq:eqnxmp} + c & = a^2 - b^2 \\ + & = (a+b)(a-b) +\end{align} +\end{assumption} + +千辛万苦,历尽艰难,得有今日。然相从数千里,未曾哀戚。今将渡江,方图百年欢笑,如 +何反起悲伤?(引自《杜十娘怒沉百宝箱》) + +\begin{definition} +子曰:「道千乘之国,敬事而信,节用而爱人,使民以时。」 +\end{definition} + +千古第一定义!问世间、情为何物,只教生死相许?天南地北双飞客,老翅几回寒暑。欢乐趣,离别苦,就中更有痴儿女。 +君应有语,渺万里层云,千山暮雪,只影向谁去? + +横汾路,寂寞当年箫鼓,荒烟依旧平楚。招魂楚些何嗟及,山鬼暗谛风雨。天也妒,未信与,莺儿燕子俱黄土。 +千秋万古,为留待骚人,狂歌痛饮,来访雁丘处。 + +\begin{proposition} + 曾子曰:「吾日三省吾身 —— 为人谋而不忠乎?与朋友交而不信乎?传不习乎?」 +\end{proposition} + +多么凄美的命题啊!其日牛马嘶,新妇入青庐,奄奄黄昏后,寂寂人定初,我命绝今日, +魂去尸长留,揽裙脱丝履,举身赴清池,府吏闻此事,心知长别离,徘徊庭树下,自挂东南 +枝。 + +\begin{remark} +天不言自高,水不言自流。 +\begin{gather*} +\begin{split} +\varphi(x,z) +&=z-\gamma_{10}x-\gamma_{mn}x^mz^n\\ +&=z-Mr^{-1}x-Mr^{-(m+n)}x^mz^n +\end{split}\\[6pt] +\begin{align} \zeta^0&=(\xi^0)^2,\\ +\zeta^1 &=\xi^0\xi^1,\\ +\zeta^2 &=(\xi^1)^2, +\end{align} +\end{gather*} +\end{remark} + +天尊地卑,乾坤定矣。卑高以陈,贵贱位矣。 动静有常,刚柔断矣。方以类聚,物以群分, +吉凶生矣。在天成象,在地成形,变化见矣。鼓之以雷霆,润之以风雨,日月运行,一寒一 +暑,乾道成男,坤道成女。乾知大始,坤作成物。乾以易知,坤以简能。易则易知,简则易 +从。易知则有亲,易从则有功。有亲则可久,有功则可大。可久则贤人之德,可大则贤人之 +业。易简,而天下矣之理矣;天下之理得,而成位乎其中矣。 + +\begin{axiom} +两点间直线段距离最短。 +\begin{align} +x&\equiv y+1\pmod{m^2}\\ +x&\equiv y+1\mod{m^2}\\ +x&\equiv y+1\pod{m^2} +\end{align} +\end{axiom} + +《彖曰》:大哉乾元,万物资始,乃统天。云行雨施,品物流形。大明始终,六位时成,时 +乘六龙以御天。乾道变化,各正性命,保合大和,乃利贞。首出庶物,万国咸宁。 + +《象曰》:天行健,君子以自强不息。潜龙勿用,阳在下也。见龙再田,德施普也。终日乾 +乾,反复道也。或跃在渊,进无咎也。飞龙在天,大人造也。亢龙有悔,盈不可久也。用九, +天德不可为首也。 + +\newcommand\dif{\mathop{}\!\mathrm{d}} +\begin{lemma} +《猫和老鼠》是我最爱看的动画片。 +\begin{multline*}%\tag*{[a]} % 这个不出现在索引中 +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\dif x\biggr\}\dif y \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\dif y +\end{multline*} +\end{lemma} + +行行重行行,与君生别离。相去万余里,各在天一涯。道路阻且长,会面安可知。胡马依北 +风,越鸟巢南枝。相去日已远,衣带日已缓。浮云蔽白日,游子不顾返。思君令人老,岁月 +忽已晚。 弃捐勿复道,努力加餐饭。 + +\begin{theorem}\label{the:theorem1} +犯我强汉者,虽远必诛\hfill —— 陈汤(汉) +\end{theorem} +\begin{subequations} +\begin{align} +y & = 1 \\ +y & = 0 +\end{align} +\end{subequations} +道可道,非常道。名可名,非常名。无名天地之始;有名万物之母。故常无,欲以观其妙; +常有,欲以观其徼。此两者,同出而异名,同谓之玄。玄之又玄,众妙之门。上善若水。水 +善利万物而不争,处众人之所恶,故几于道。曲则全,枉则直,洼则盈,敝则新,少则多, +多则惑。人法地,地法天,天法道,道法自然。知人者智,自知者明。胜人者有力,自胜 +者强。知足者富。强行者有志。不失其所者久。死而不亡者寿。 + +\begin{proof} +燕赵古称多感慨悲歌之士。董生举进士,连不得志于有司,怀抱利器,郁郁适兹土,吾 +知其必有合也。董生勉乎哉? + +夫以子之不遇时,苟慕义强仁者,皆爱惜焉,矧燕、赵之士出乎其性者哉!然吾尝闻 +风俗与化移易,吾恶知其今不异于古所云邪?聊以吾子之行卜之也。董生勉乎哉? + +吾因子有所感矣。为我吊望诸君之墓,而观于其市,复有昔时屠狗者乎?为我谢 +曰:“明天子在上,可以出而仕矣!” \hfill —— 韩愈《送董邵南序》 +\end{proof} + +\begin{corollary} + 四川话配音的《猫和老鼠》是世界上最好看最好听最有趣的动画片。 +\begin{alignat}{3} +V_i & =v_i - q_i v_j, & \qquad X_i & = x_i - q_i x_j, + & \qquad U_i & = u_i, + \qquad \text{for $i\ne j$;}\label{eq:B}\\ +V_j & = v_j, & \qquad X_j & = x_j, + & \qquad U_j & u_j + \sum_{i\ne j} q_i u_i. +\end{alignat} +\end{corollary} + +迢迢牵牛星,皎皎河汉女。 +纤纤擢素手,札札弄机杼。 +终日不成章,泣涕零如雨。 +河汉清且浅,相去复几许。 +盈盈一水间,脉脉不得语。 + +\begin{example} + 大家来看这个例子。 +\begin{equation} + \label{ktc} + \begin{cases} + \nabla f(\bm{x}^*) - \sum_{j=1}^p \lambda_j \nabla g_j(\bm{x}^*) + = 0 \\[0.3cm] + \lambda_j g_j(\bm{x}^*) = 0, \quad j = 1, 2, \dots, p \\[0.2cm] + \lambda_j \ge 0, \quad j = 1, 2, \dots, p. + \end{cases} +\end{equation} +\end{example} + +\begin{exercise} + 请列出 Andrew S. Tanenbaum 和 W. Richard Stevens 的所有著作。 +\end{exercise} + +\begin{conjecture} \textit{Poincare Conjecture} If in a closed three-dimensional + space, any closed curves can shrink to a point continuously, this space can be + deformed to a sphere. +\end{conjecture} + +\begin{problem} + 回答还是不回答,是个问题。 +\end{problem} + +如何引用定理~\ref{the:theorem1} 呢?加上 \cs{label} 使用 \cs{ref} 即可。妾发 +初覆额,折花门前剧。郎骑竹马来,绕床弄青梅。同居长干里,两小无嫌猜。 十四为君妇, +羞颜未尝开。低头向暗壁,千唤不一回。十五始展眉,愿同尘与灰。常存抱柱信,岂上望夫 +台。 十六君远行,瞿塘滟滪堆。五月不可触,猿声天上哀。门前迟行迹,一一生绿苔。苔深 +不能扫,落叶秋风早。八月蝴蝶来,双飞西园草。感此伤妾心,坐愁红颜老。 + +\section{参考文献} +\label{sec:bib} +当然参考文献可以直接写 \cs{bibitem},虽然费点功夫,但是好控制,各种格式可以自己随意改 +写。 + +本模板推荐使用 BIB\TeX,分别提供数字引用(\texttt{thuthesis-numeric.bst})和作 +者年份引用(\texttt{thuthesis-author-year.bst})样式,基本符合学校的参考文献格式 +(如专利等引用未加详细测试)。看看这个例子,关于书的~\cite{tex, companion, + ColdSources},还有这些~\cite{Krasnogor2004e, clzs, zjsw},关于杂志 +的~\cite{ELIDRISSI94, MELLINGER96, SHELL02},硕士论文~\cite{zhubajie, + metamori2004},博士论文~\cite{shaheshang, FistSystem01},标准文 +件~\cite{IEEE-1363},会议论文~\cite{DPMG,kocher99},技术报告~\cite{NPB2},电子文 +献~\cite{chuban2001,oclc2000}。 +若使用著者-出版年制,中文参考文献~\cite{cnarticle}应增加 +\texttt{key=\{pinyin\}} 字段,以便正确进行排序~\cite{cnproceed}。 +另外,如果对参考文献有不如意的地方,请手动修改 \texttt{bbl} 文件。 + +有时候不想要上标,那么可以这样~\inlinecite{shaheshang},这个非常重要。 + +有时候一些参考文献没有纸质出处,需要标注 URL。缺省情况下,URL 不会在连字符处断行, +这可能使得用连字符代替空格的网址分行很难看。如果需要,可以将模板类文件中 +\begin{verbatim} +\RequirePackage{hyperref} +\end{verbatim} +一行改为: +\begin{verbatim} +\PassOptionsToPackage{hyphens}{url} +\RequirePackage{hyperref} +\end{verbatim} +使得连字符处可以断行。更多设置可以参考 \texttt{url} 宏包文档。 + +\section{公式} +\label{sec:equation} +\renewcommand\vec{\symbf} +\newcommand\mat{\symbf} +贝叶斯公式如式~(\ref{equ:chap1:bayes}),其中 $p(y|\vec{x})$ 为后验; +$p(\vec{x})$ 为先验;分母 $p(\vec{x})$ 为归一化因子。 +\begin{equation} +\label{equ:chap1:bayes} +p(y|\vec{x}) = \frac{p(\vec{x},y)}{p(\vec{x})}= +\frac{p(\vec{x}|y)p(y)}{p(\vec{x})} +\end{equation} + +论文里面公式越多,\TeX{} 就越 happy。再看一个 \pkg{amsmath} 的例子: +\newcommand{\envert}[1]{\left\lvert#1\right\rvert} +\begin{equation}\label{detK2} +\det\mat{K}(t=1,t_1,\dots,t_n)=\sum_{I\in\vec{n}}(-1)^{\envert{I}} +\prod_{i\in I}t_i\prod_{j\in I}(D_j+\lambda_jt_j)\det\vec{A} +^{(\lambda)}(\overline{I}|\overline{I})=0. +\end{equation} + +前面定理示例部分列举了很多公式环境,可以说把常见的情况都覆盖了,大家在写公式的时 +候一定要好好看 \pkg{amsmath} 的文档,并参考模板中的用法: +\begin{multline*}%\tag{[b]} % 这个出现在索引中的 +\int_a^b\biggl\{\int_a^b[f(x)^2g(y)^2+f(y)^2g(x)^2] + -2f(x)g(x)f(y)g(y)\dif x\biggr\}\dif y \\ + =\int_a^b\biggl\{g(y)^2\int_a^bf^2+f(y)^2 + \int_a^b g^2-2f(y)g(y)\int_a^b fg\biggr\}\dif y +\end{multline*} + +其实还可以看看这个多级规划: +\begin{equation} + \label{bilevel} + \begin{cases} + \max_{\bm{x}} F(\bm{x}, y_1^*, y_2^*, \dots, y_m^*) \\ + \text{subject to:} \\ + \qquad G(\bm{x}) \le 0 \\ + \qquad (y_1^*, y_2^*, \dots, y_m^*) \text{ solves problems } + (i = 1, 2, \dots, m) \\ + \qquad + \begin{cases} + \max_{\bm{x}} f_i(\bm{x}, y_1, y_2, \dots, y_m) \\ + \text{subject to:} \\ + \qquad g_i(\bm{x}, y_1, y_2, \dots, y_m) \le 0. + \end{cases} + \end{cases} +\end{equation} +这些跟规划相关的公式都来自于刘宝碇老师《不确定规划》的课件。 diff --git a/macros/latex/contrib/thuthesis/data/chap02.tex b/macros/latex/contrib/thuthesis/data/chap02.tex new file mode 100644 index 0000000000..e7604f525c --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/chap02.tex @@ -0,0 +1,124 @@ +\chapter{中华人民共和国} +\label{cha:china} + +\section{其它例子} +\label{sec:other} + +在第~\ref{cha:intro} 章中我们学习了贝叶斯公式~(\ref{equ:chap1:bayes}),这里我们复 +习一下: +\begin{equation} +\label{equ:chap2:bayes} +p(y|\vec{x}) = \frac{p(\vec{x},y)}{p(\vec{x})}= +\frac{p(\vec{x}|y)p(y)}{p(\vec{x})} +\end{equation} + +\subsection{绘图} +\label{sec:draw} + +本模板不再预先装载任何绘图包(如 \pkg{pstricks,pgf} 等),完全由用户来决定。 +个人觉得 \pkg{pgf} 不错,不依赖于 Postscript。此外还有很多针对 \LaTeX{} 的 + GUI 作图工具,如 XFig(jFig), WinFig, Tpx, Ipe, Dia, Inkscape, LaTeXPiX, +jPicEdt, jaxdraw 等等。 + +\subsection{插图} +\label{sec:graphs} + +强烈推荐《\LaTeXe\ 插图指南》!关于子图形的使用细节请参看 \pkg{subcaption} 宏包的说明文档。 + +\subsubsection{一个图形} +\label{sec:onefig} +一般图形都是处在浮动环境中。之所以称为浮动是指最终排版效果图形的位置不一定与源文 +件中的位置对应\footnote{This is not a bug, but a feature of \LaTeX!},这也是刚使 +用 \LaTeX{} 同学可能遇到的问题。如果要强制固定浮动图形的位置,请使用 \pkg{float} 宏包, +它提供了 \texttt{[H]} 参数,比如图~\ref{fig:xfig1}。 +\begin{figure}[H] % use float package if you want it here + \centering + \includegraphics{thu-whole-logo.pdf} + \caption{利用 Xfig 制图} + \label{fig:xfig1} +\end{figure} + +大学之道,在明明德,在亲民,在止于至善。知止而后有定;定而后能静;静而后能安;安 +而后能虑;虑而后能得。物有本末,事有终始。知所先后,则近道矣。古之欲明明德于天 +下者,先治其国;欲治其国者,先齐其家;欲齐其家者,先修其身;欲修其身者,先正其心; +欲正其心者,先诚其意;欲诚其意者,先致其知;致知在格物。物格而后知至;知至而后 +意诚;意诚而后心正;心正而后身 修;身修而后家齐;家齐而后国治;国治而后天下 +平。自天子以至于庶人,壹是皆以修身为本。其本乱而未治者 否矣。其所厚者薄,而其所 +薄者厚,未之有也! + +\hfill —— 《大学》 + + +\subsubsection{多个图形} +\label{sec:multifig} + +如果多个图形相互独立,并不共用一个图形计数器,那么 +用 \texttt{minipage} 或者\texttt{parbox} 就可以。否则,请参看 +图~\ref{fig:big1-subcaptionbox},它包含两个小图,分别是图~\ref{fig:subfig1}和 +图~\ref{fig:subfig2}。推荐使用 \cs{subcaptionbox},因为可以像 +图~\ref{fig:big1-subcaptionbox} 那样对齐子图的标题,也可以使用 \pkg{subcaption} +宏包的 \cs{subcaption}(放在 minipage中,用法同\cs{caption})或 +是 \pkg{subfigure} 、\pkg{subtable}环境,像图~\ref{fig:big1-subfigure},不要再 +用 \cs{subfloat}、\cs{subfigure} 和 \cs{subtable}。 + +\begin{figure}[h] + \centering% + \subcaptionbox{第一个小图形\label{fig:subfig1}}[3cm] %标题的长度,超过则会换行,如下一个小图。 + {\includegraphics[height=3cm]{thu-fig-logo.pdf}}% + \hspace{4em}% + \subcaptionbox{第二个小图形,注意这个图略矮些。如果标题很长的话,它会自动换行\label{fig:subfig2}} + {\includegraphics[height=2cm]{thu-text-logo.pdf}} + \caption{包含子图形的大图形(subcaptionbox示例)} + \label{fig:big1-subcaptionbox} +\end{figure} +\begin{figure}[h] + \centering% + \begin{subfigure}{3cm} + \includegraphics[height=3cm]{thu-fig-logo.pdf} + \caption{第一个小图形} + \end{subfigure}% + \hspace{4em}% + \begin{subfigure}{0.5\textwidth} + \includegraphics[height=2cm]{thu-text-logo.pdf} + \caption{第二个小图形,注意这个图略矮些。subfigure中同一行的子图在顶端对齐。} + \end{subfigure} + \caption{包含子图形的大图形(subfigure示例)} + \label{fig:big1-subfigure} +\end{figure} + +古之学者必有师。师者,所以传道受业解惑也。人非生而知之者,孰能无惑?惑而不从师, +其为惑也,终不解矣。生乎吾前,其闻道也固先乎吾,吾从而师之;生乎吾後,其闻道也亦 +先乎吾,吾从而师之。吾师道也,夫庸知其年之先後生於吾乎!是故无贵无贱无长无少,道 +之所存,师之所存也。 + +嗟乎!师道之不传也久矣,欲人之无惑也难矣。古之圣人,其出人也远矣,犹且从师而问焉; +今之众人,其下圣人也亦远矣,而耻学於师。是故圣益圣,愚益愚。圣人之所以为圣,愚 +人之所以为愚,其皆出於此乎?爱其子,择师而教之,於其身也,则耻师焉,惑焉。彼童子 +之师,授之书而习其句读者,非吾所谓传其道、解其惑者也。句读之不知,惑之不解,或师 +焉,或不焉,小学而大遗,吾未见其明也。巫医、乐师、百工之人不耻相师, 士大夫之族 +曰“师”曰“弟子”之云者,则群聚而笑之。问之,则曰:彼与彼年相若也,道相似也,位 +卑则足羞,官盛则近谀。呜呼!师道之不复,可知矣。巫医、乐师、百工之人。吾子不齿, +今其智乃反不能及,其可怪也欤!圣人无常师。孔子师郯子、苌子、师襄、老聃。郯子之徒, +其贤不及孔子。孔子曰:“三人行,必有我师。”是故弟子不必不如师,师不必贤於弟子。 +闻道有先後,术业有专攻,如是而已。 + +如果要把编号的两个图形并排,那么小页就非常有用了: +\begin{figure} +\begin{minipage}{0.48\textwidth} + \centering + \includegraphics[height=2cm]{thu-whole-logo.pdf} + \caption{并排第一个图} + \label{fig:parallel1} +\end{minipage}\hfill +\begin{minipage}{0.48\textwidth} + \centering + \includegraphics[height=2cm]{thu-whole-logo.pdf} + \caption{并排第二个图} + \label{fig:parallel2} +\end{minipage} +\end{figure} + +李氏子蟠,年十七,好古文、六艺,经传皆通习之,不拘於时,学於余。余嘉其能行古 +道,作师说以贻之。 + +\hfill —— 韩愈(唐) diff --git a/macros/latex/contrib/thuthesis/data/cover.tex b/macros/latex/contrib/thuthesis/data/cover.tex new file mode 100644 index 0000000000..8aae6b8443 --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/cover.tex @@ -0,0 +1,118 @@ +\thusetup{ + %****************************** + % 注意: + % 1. 配置里面不要出现空行 + % 2. 不需要的配置信息可以删除 + %****************************** + % + %===== + % 秘级 + %===== + secretlevel={秘密}, + secretyear={10}, + % + %========= + % 中文信息 + %========= + ctitle={清华大学学位论文 \LaTeX\ 模板\\使用示例文档 v\version}, + cdegree={工学硕士}, + cdepartment={计算机科学与技术系}, + cmajor={计算机科学与技术}, + cauthor={薛瑞尼}, + csupervisor={郑纬民教授}, + cassosupervisor={陈文光教授}, % 副指导老师 + ccosupervisor={某某某教授}, % 联合指导老师 + % 日期自动使用当前时间,若需指定按如下方式修改: + % cdate={超新星纪元}, + % + % 博士后专有部分 + catalognumber = {分类号}, % 可以留空 + udc = {UDC}, % 可以留空 + id = {编号}, % 可以留空: id={}, + cfirstdiscipline = {计算机科学与技术}, % 流动站(一级学科)名称 + cseconddiscipline = {系统结构}, % 专 业(二级学科)名称 + postdoctordate = {2009 年 7 月——2011 年 7 月}, % 工作完成日期 + postdocstartdate = {2009 年 7 月 1 日}, % 研究工作起始时间 + postdocenddate = {2011 年 7 月 1 日}, % 研究工作期满时间 + % + %========= + % 英文信息 + %========= + etitle={An Introduction to \LaTeX{} Thesis Template of Tsinghua University v\version}, + % 这块比较复杂,需要分情况讨论: + % 1. 学术型硕士 + % edegree:必须为Master of Arts或Master of Science(注意大小写) + % “哲学、文学、历史学、法学、教育学、艺术学门类,公共管理学科 + % 填写Master of Arts,其它填写Master of Science” + % emajor:“获得一级学科授权的学科填写一级学科名称,其它填写二级学科名称” + % 2. 专业型硕士 + % edegree:“填写专业学位英文名称全称” + % emajor:“工程硕士填写工程领域,其它专业学位不填写此项” + % 3. 学术型博士 + % edegree:Doctor of Philosophy(注意大小写) + % emajor:“获得一级学科授权的学科填写一级学科名称,其它填写二级学科名称” + % 4. 专业型博士 + % edegree:“填写专业学位英文名称全称” + % emajor:不填写此项 + edegree={Doctor of Engineering}, + emajor={Computer Science and Technology}, + eauthor={Xue Ruini}, + esupervisor={Professor Zheng Weimin}, + eassosupervisor={Chen Wenguang}, + % 日期自动生成,若需指定按如下方式修改: + % edate={December, 2005} + % + % 关键词用“英文逗号”分割 + ckeywords={TeX, LaTeX, CJK, 模板, 论文}, + ekeywords={TeX, LaTeX, CJK, template, thesis} +} + +% 定义中英文摘要和关键字 +\begin{cabstract} + 论文的摘要是对论文研究内容和成果的高度概括。摘要应对论文所研究的问题及其研究目 + 的进行描述,对研究方法和过程进行简单介绍,对研究成果和所得结论进行概括。摘要应 + 具有独立性和自明性,其内容应包含与论文全文同等量的主要信息。使读者即使不阅读全 + 文,通过摘要就能了解论文的总体内容和主要成果。 + + 论文摘要的书写应力求精确、简明。切忌写成对论文书写内容进行提要的形式,尤其要避 + 免“第 1 章……;第 2 章……;……”这种或类似的陈述方式。 + + 本文介绍清华大学论文模板 \thuthesis{} 的使用方法。本模板符合学校的本科、硕士、 + 博士论文格式要求。 + + 本文的创新点主要有: + \begin{itemize} + \item 用例子来解释模板的使用方法; + \item 用废话来填充无关紧要的部分; + \item 一边学习摸索一边编写新代码。 + \end{itemize} + + 关键词是为了文献标引工作、用以表示全文主要内容信息的单词或术语。关键词不超过 5 + 个,每个关键词中间用分号分隔。(模板作者注:关键词分隔符不用考虑,模板会自动处 + 理。英文关键词同理。) +\end{cabstract} + +% 如果习惯关键字跟在摘要文字后面,可以用直接命令来设置,如下: +% \ckeywords{\TeX, \LaTeX, CJK, 模板, 论文} + +\begin{eabstract} + An abstract of a dissertation is a summary and extraction of research work + and contributions. Included in an abstract should be description of research + topic and research objective, brief introduction to methodology and research + process, and summarization of conclusion and contributions of the + research. An abstract should be characterized by independence and clarity and + carry identical information with the dissertation. It should be such that the + general idea and major contributions of the dissertation are conveyed without + reading the dissertation. + + An abstract should be concise and to the point. It is a misunderstanding to + make an abstract an outline of the dissertation and words ``the first + chapter'', ``the second chapter'' and the like should be avoided in the + abstract. + + Key words are terms used in a dissertation for indexing, reflecting core + information of the dissertation. An abstract may contain a maximum of 5 key + words, with semi-colons used in between to separate one another. +\end{eabstract} + +% \ekeywords{\TeX, \LaTeX, CJK, template, thesis} diff --git a/macros/latex/contrib/thuthesis/data/denotation.tex b/macros/latex/contrib/thuthesis/data/denotation.tex new file mode 100644 index 0000000000..46d4172d85 --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/denotation.tex @@ -0,0 +1,57 @@ +\begin{denotation}[3cm] +\item[HPC] 高性能计算 (High Performance Computing) +\item[cluster] 集群 +\item[Itanium] 安腾 +\item[SMP] 对称多处理 +\item[API] 应用程序编程接口 +\item[PI] 聚酰亚胺 +\item[MPI] 聚酰亚胺模型化合物,N-苯基邻苯酰亚胺 +\item[PBI] 聚苯并咪唑 +\item[MPBI] 聚苯并咪唑模型化合物,N-苯基苯并咪唑 +\item[PY] 聚吡咙 +\item[PMDA-BDA] 均苯四酸二酐与联苯四胺合成的聚吡咙薄膜 +\item[$\Delta G$] 活化自由能 (Activation Free Energy) +\item[$\chi$] 传输系数 (Transmission Coefficient) +\item[$E$] 能量 +\item[$m$] 质量 +\item[$c$] 光速 +\item[$P$] 概率 +\item[$T$] 时间 +\item[$v$] 速度 +\item[劝学] 君子曰:学不可以已。青,取之于蓝,而青于蓝;冰,水为之,而寒于水。木 + 直中绳。輮以为轮,其曲中规。虽有槁暴,不复挺者,輮使之然也。故木受绳则直,金就 + 砺则利,君子博学而日参省乎己,则知明而行无过矣。吾尝终日而思矣,不如须臾之所学 + 也;吾尝跂而望矣,不如登高之博见也。登高而招,臂非加长也,而见者远;顺风而呼, + 声非加疾也,而闻者彰。假舆马者,非利足也,而致千里;假舟楫者,非能水也,而绝江 + 河,君子生非异也,善假于物也。积土成山,风雨兴焉;积水成渊,蛟龙生焉;积善成德, + 而神明自得,圣心备焉。故不积跬步,无以至千里;不积小流,无以成江海。骐骥一跃, + 不能十步;驽马十驾,功在不舍。锲而舍之,朽木不折;锲而不舍,金石可镂。蚓无爪牙 + 之利,筋骨之强,上食埃土,下饮黄泉,用心一也。蟹六跪而二螯,非蛇鳝之穴无可寄托 + 者,用心躁也。—— 荀况 +\end{denotation} + + + +% % 也可以使用 nomencl 宏包: + +% \printnomenclature[3cm] + +% \nomenclature{HPC}{高性能计算 (High Performance Computing)} +% \nomenclature{cluster}{集群} +% \nomenclature{Itanium}{安腾} +% \nomenclature{SMP}{对称多处理} +% \nomenclature{API}{应用程序编程接口} +% \nomenclature{PI}{聚酰亚胺} +% \nomenclature{MPI}{聚酰亚胺模型化合物,N-苯基邻苯酰亚胺} +% \nomenclature{PBI}{聚苯并咪唑} +% \nomenclature{MPBI}{聚苯并咪唑模型化合物,N-苯基苯并咪唑} +% \nomenclature{PY}{聚吡咙} +% \nomenclature{PMDA-BDA}{均苯四酸二酐与联苯四胺合成的聚吡咙薄膜} +% \nomenclature{$\Delta G$}{活化自由能 (Activation Free Energy)} +% \nomenclature{$\chi$}{传输系数 (Transmission Coefficient)} +% \nomenclature{$E$}{能量} +% \nomenclature{$m$}{质量} +% \nomenclature{$c$}{光速} +% \nomenclature{$P$}{概率} +% \nomenclature{$T$}{时间} +% \nomenclature{$v$}{速度} diff --git a/macros/latex/contrib/thuthesis/data/resume.tex b/macros/latex/contrib/thuthesis/data/resume.tex new file mode 100644 index 0000000000..890bd51305 --- /dev/null +++ b/macros/latex/contrib/thuthesis/data/resume.tex @@ -0,0 +1,51 @@ +\begin{resume} + + \resumeitem{个人简历} + + xxxx 年 xx 月 xx 日出生于 xx 省 xx 县。 + + xxxx 年 9 月考入 xx 大学 xx 系 xx 专业,xxxx 年 7 月本科毕业并获得 xx 学士学位。 + + xxxx 年 9 月免试进入 xx 大学 xx 系攻读 xx 学位至今。 + + \researchitem{发表的学术论文} % 发表的和录用的合在一起 + + % 1. 已经刊载的学术论文(本人是第一作者,或者导师为第一作者本人是第二作者) + \begin{publications} + \item Yang Y, Ren T L, Zhang L T, et al. Miniature microphone with silicon- + based ferroelectric thin films. Integrated Ferroelectrics, 2003, + 52:229-235. (SCI 收录, 检索号:758FZ.) + \item 杨轶, 张宁欣, 任天令, 等. 硅基铁电微声学器件中薄膜残余应力的研究. 中国机 + 械工程, 2005, 16(14):1289-1291. (EI 收录, 检索号:0534931 2907.) + \item 杨轶, 张宁欣, 任天令, 等. 集成铁电器件中的关键工艺研究. 仪器仪表学报, + 2003, 24(S4):192-193. (EI 源刊.) + \end{publications} + + % 2. 尚未刊载,但已经接到正式录用函的学术论文(本人为第一作者,或者 + % 导师为第一作者本人是第二作者)。 + \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} + + % 3. 其他学术论文。可列出除上述两种情况以外的其他学术论文,但必须是 + % 已经刊载或者收到正式录用函的论文。 + \begin{publications} + \item Wu X M, Yang Y, Cai J, et al. Measurements of ferroelectric MEMS + microphones. Integrated Ferroelectrics, 2005, 69:417-429. (SCI 收录, 检索号 + :896KM) + \item 贾泽, 杨轶, 陈兢, 等. 用于压电和电容微麦克风的体硅腐蚀相关研究. 压电与声 + 光, 2006, 28(1):117-119. (EI 收录, 检索号:06129773469) + \item 伍晓明, 杨轶, 张宁欣, 等. 基于MEMS技术的集成铁电硅微麦克风. 中国集成电路, + 2003, 53:59-61. + \end{publications} + + \researchitem{研究成果} % 有就写,没有就删除 + \begin{achievements} + \item 任天令, 杨轶, 朱一平, 等. 硅基铁电微声学传感器畴极化区域控制和电极连接的 + 方法: 中国, CN1602118A. (中国专利公开号) + \item Ren T L, Yang Y, Zhu Y P, et al. Piezoelectric micro acoustic sensor + based on ferroelectric materials: USA, No.11/215, 102. (美国发明专利申请号) + \end{achievements} + +\end{resume} diff --git a/macros/latex/contrib/thuthesis/figures/scan-auth.pdf b/macros/latex/contrib/thuthesis/figures/scan-auth.pdf Binary files differnew file mode 100644 index 0000000000..9d5c5a5665 --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/scan-auth.pdf diff --git a/macros/latex/contrib/thuthesis/figures/scan-record.pdf b/macros/latex/contrib/thuthesis/figures/scan-record.pdf Binary files differnew file mode 100644 index 0000000000..db0dcef7b2 --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/scan-record.pdf diff --git a/macros/latex/contrib/thuthesis/figures/scan-statement.pdf b/macros/latex/contrib/thuthesis/figures/scan-statement.pdf Binary files differnew file mode 100644 index 0000000000..8b4933afad --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/scan-statement.pdf diff --git a/macros/latex/contrib/thuthesis/figures/thu-fig-logo.pdf b/macros/latex/contrib/thuthesis/figures/thu-fig-logo.pdf Binary files differnew file mode 100644 index 0000000000..594a342957 --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/thu-fig-logo.pdf diff --git a/macros/latex/contrib/thuthesis/figures/thu-lib-logo.pdf b/macros/latex/contrib/thuthesis/figures/thu-lib-logo.pdf Binary files differnew file mode 100644 index 0000000000..996961e825 --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/thu-lib-logo.pdf diff --git a/macros/latex/contrib/thuthesis/figures/thu-text-logo.pdf b/macros/latex/contrib/thuthesis/figures/thu-text-logo.pdf Binary files differnew file mode 100644 index 0000000000..7f20baf74b --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/thu-text-logo.pdf diff --git a/macros/latex/contrib/thuthesis/figures/thu-whole-logo.pdf b/macros/latex/contrib/thuthesis/figures/thu-whole-logo.pdf Binary files differnew file mode 100644 index 0000000000..1107b0d3ae --- /dev/null +++ b/macros/latex/contrib/thuthesis/figures/thu-whole-logo.pdf diff --git a/macros/latex/contrib/thuthesis/latexmkrc b/macros/latex/contrib/thuthesis/latexmkrc new file mode 100644 index 0000000000..d9969694c2 --- /dev/null +++ b/macros/latex/contrib/thuthesis/latexmkrc @@ -0,0 +1,14 @@ +# vim: set ft=perl: +$xdvipdfmx="xdvipdfmx -q -E -o %D %O %S"; +$clean_ext = 'thm bbl hd loe synctex.gz xdv'; +$makeindex = 'makeindex -s gind.ist %O -o %D %S'; +add_cus_dep('glo', 'gls', 0, 'makeglo2gls'); +sub makeglo2gls { + system("makeindex -s gglo.ist -o \"$_[0].gls\" \"$_[0].glo\""); +} +push @generated_exts, "glo", "gls"; +add_cus_dep('nlo', 'nls', 0, 'nlo2nls'); +sub nlo2nls { + system("makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\""); +} +push @generated_exts, "nlo", "nls"; diff --git a/macros/latex/contrib/thuthesis/main.pdf b/macros/latex/contrib/thuthesis/main.pdf Binary files differnew file mode 100644 index 0000000000..35f10b2a08 --- /dev/null +++ b/macros/latex/contrib/thuthesis/main.pdf diff --git a/macros/latex/contrib/thuthesis/main.tex b/macros/latex/contrib/thuthesis/main.tex new file mode 100644 index 0000000000..f0acc491aa --- /dev/null +++ b/macros/latex/contrib/thuthesis/main.tex @@ -0,0 +1,76 @@ +\documentclass[degree=master,tocarialchapter]{thuthesis} +% 选项 +% degree=[bachelor|master|doctor|postdoctor], % 必选,学位类型 +% language=[chinese|english], % 可选(默认:chinese),论文的主要语言 +% secret, % 可选(默认:关闭),是否有密级 +% tocarialchapter, % 可选(默认:关闭),章目录中使用黑体(这项表示同时打开下面两项) +% tocarialchapterentry, % 可选(默认:关闭),单独控制章标题在目录中使用黑体 +% tocarialchapterpage, % 可选(默认:关闭),单独控制章页码在目录中使用黑体 + +% 所有其它可能用到的包都统一放到这里了,可以根据自己的实际添加或者删除。 +\usepackage{thuthesis} + +% 定义所有的图片文件在 figures 子目录下 +\graphicspath{{figures/}} + +% 可以在这里修改配置文件中的定义。导言区可以使用中文。 +% \def\myname{薛瑞尼} + +\begin{document} + +%%% 封面部分 +\frontmatter +\input{data/cover} +% 如果使用授权说明扫描页,将可选参数中指定为扫描得到的 PDF 文件名,例如: +% \makecover[scan-auth.pdf] +\makecover + +%% 目录 +\tableofcontents + +%% 符号对照表 +\input{data/denotation} + + +%%% 正文部分 +\mainmatter +\input{data/chap01} +\input{data/chap02} + + +%%% 其它部分 +\backmatter + +%% 本科生要这几个索引,研究生不要。选择性留下。 +% 插图索引 +\listoffigures +% 表格索引 +\listoftables +% 公式索引 +\listofequations + + +%% 参考文献 +% 注意:至少需要引用一篇参考文献,否则下面两行可能引起编译错误。 +% 如果不需要参考文献,请将下面两行删除或注释掉。 +\bibliographystyle{thuthesis-numeric} % 顺序编码制 +% \bibliographystyle{thuthesis-author-year} % 著者-出版年制 +% \bibliographystyle{thuthesis-bachelor} % 本科生参考文献的著录格式 +\bibliography{ref/refs} + + +%% 致谢 +\input{data/ack} + +%% 附录 +\begin{appendix} +\input{data/appendix01} +\end{appendix} + +%% 个人简历 +\input{data/resume} + +%% 本科生进行格式审查是需要下面这个表格,答辩可能不需要。选择性留下。 +% 综合论文训练记录表 +\includepdf[pages=-]{scan-record.pdf} +\end{document} diff --git a/macros/latex/contrib/thuthesis/ref/refs.bib b/macros/latex/contrib/thuthesis/ref/refs.bib new file mode 100644 index 0000000000..4832dbb425 --- /dev/null +++ b/macros/latex/contrib/thuthesis/ref/refs.bib @@ -0,0 +1,223 @@ +@book{IEEE-1363, + author = {{IEEE Std 1363-2000}}, + title = {{IEEE} Standard Specifications for Public-Key Cryptography}, + address = {New York}, + publisher = {IEEE}, + year = 2000 +} + +@inproceedings{kocher99, + author = {C. Kocher and J. Jaffe and B. Jun}, + title = {Differential Power Analysis}, + editor = {M. Wiener}, + booktitle = {Advances in Cryptology ({CRYPTO}~'99)}, + series = {Lecture Notes in Computer Science}, + volume = 1666, + pages = {388-397}, + publisher = {Springer-Verlag}, + address = {Germany}, + month = {August}, + year = 1999 +} + +@incollection{Krasnogor2004e, + author = {N. Krasnogor}, + title = {Towards robust memetic algorithms}, + booktitle = {Recent Advances in Memetic Algorithms}, + publisher = {Springer Berlin Heidelberg}, + year = 2004, + pages = {185-207}, + editor = {W.E. Hart and N. Krasnogor and J.E. Smith}, + volume = 166, + series = {Studies in Fuzziness and Soft Computing}, + address = {New York}, +} + +@incollection{zjsw, + author = {班固}, + title = {苏武传}, + booktitle = {传记散文英华}, + publisher = {湖北人民出版社}, + year = 1998, + pages = {65-69}, + editor = {郑在瀛 and 汪超宏 and 周文复}, + volume = 2, + series = {新古文观止丛书}, + address = {武汉}, +} + +@inbook{clzs, + author = {阎真}, + title = {沧浪之水}, + chapter = {大人物还是讲人情的}, + pages = {185-207}, + publisher = {人民文学出版社}, + address = {北京}, + year = 2001, +} + +@book{tex, + author = "Donald E. Knuth", + title = "The {\TeX} Book", + publisher = "Addison-Wesley Publishing Company", + address = "Reading, MA", + year = 1989, + edition = "15th", +} + +@book{companion, + author = "Michel Goosens and Frank Mittelbach and Alexander Samarin", + title = "The {\LaTeX} Companion", + publisher = "Addison-Wesley Publishing Company", + address = "Reading, MA", + PAGES = "112--125", + year = 1994, +} + +@article{ELIDRISSI94, + author = "{Chafik El Idrissi}, M. and {Roney}, A. and {Frigon}, C. and + {Larzilli{\`e}re}, M.", + title = "Measurements of total kinetic-energy released to the {$N=2$} + dissociation limit of {H}$_2$ --- evidence of the dissociation + of very high vibrational {R}ydberg states of {H}$_2$ by + doubly-excited states", + journal = "Chemical Physics Letters", + pages = "260-266", + volume = 224, + number = 10, + year = 1994, +} + +@article{MELLINGER96, + author = "Mellinger, A. and Vidal, C. R. and Jungen, Ch.", + title = "Laser reduced fluorescence study of the carbon-monoxide nd + triplet {R}ydberg series-experimental results and multichannel + quantum-defect analysis", + journal = "J. Chem. Phys.", + pages = "8913-8921", + volume = 104, + number = 5, + year = 1996, +} + +@article{SHELL02, + author = "Michael Shell", + title = "How to Use the {IEEEtran \LaTeX} Class", + journal = "Journal of {\LaTeX} Class Files", + year = 2002, + volume = 12, + number = 4, + pages = "100--120" +} + +@TechReport{NPB2, + title = {The {NAS} Parallel Benchmarks 2.0}, + author = {Alex Woo and David Bailey and Maurice Yarrow and Wijngaart + Wijngaart and Tim Harris and William Saphir}, + year = 1995, + month = dec # "~05", + institution = "The Pennsylvania State University CiteSeer Archives", + url = "http://www.nasa.org/" +} + +@inproceedings{DPMG, + author = {Kim, Sangbum and Woo, Namyoon and Yeom, Heon Y. and Park, + Taesoon and Park, Hyoungwoo}, + title = {Design and {I}mplementation of {D}ynamic {P}rocess + {M}anagement for {G}rid-enabled {MPICH}}, + booktitle = {the 10th European PVM/MPI Users' Group Conference}, + editor = {Jack Dongarra and Domenico Laforenza and Salvatore Orlando}, + publisher = {Springer-Verlag}, + year = 2003, + address = {Venice, Italy}, + month = sep, +} + +@inproceedings{cnproceed, + author = {王重阳 and 黄药师 and 欧阳峰 and 洪七公 and 段皇帝}, + publisher = {金大庸}, + title = {武林高手从入门到精通}, + booktitle = {第~$N$~次华山论剑}, + year = 2006, + address = {西安, 中国}, + month = sep, +} + +@article{cnarticle, + author = "贾宝玉 and 林黛玉 and 薛宝钗 and 贾探春", + title = "论刘姥姥食量大如牛之现实意义", + journal = "红楼梦杂谈", + pages = "260--266", + volume = 224, + year = 1800, +} + +@mastersthesis{zhubajie, + author = {猪八戒}, + title = {论流体食物的持久保存}, + school = {广寒宫大学}, + year = 2005, + address = {北京}, +} + +@phdthesis{shaheshang, + author = {沙和尚}, + title = {论流沙河的综合治理}, + school = {清华大学}, + year = 2005, + address = {北京}, +} + +@mastersthesis{metamori2004, + author = {Ashwin Raju Jeyakumar}, + title = {Metamori: A library for Incremental File Checkpointing}, + school = {Virgina Tech}, + year = 2004, + month = jun # "~21", + address = {Blacksburg}, +} + +@phdthesis{FistSystem01, + author = "Erez Zadok", + title = "{FiST: A System for Stackable File System Code Generation}", + year = 2001, + month = "May", + school = "Computer Science Department, Columbia University", + address = "USA" +} + +@inbook{ColdSources, + author = {P. Gr{\"o}ning and L. Nilsson and P. Ruffieux and R. + Clergereaux and O. Gr{\"o}ning}, + title = {Encyclopedia of Nanoscience and Nanotechnology}, + pages = {547--579}, + publisher = {American Scientific Publishers}, + year = 2004, + volume = 1, + address = {USA}, +} + +@online{chuban2001, + author = {萧钰}, + title = {出版业信息化迈入快车道}, + date = {2001-12-19}, + urldate = {2002-04-15}, + url = {http://www.creader.com/news/200112190019.htm}, +} + +@online{oclc2000, + author = {{Online Computer Library Center, Inc.}}, + title = {History of {OCLC}}, + year = 2000, + urldate = {2000-01-08}, + url = {http://www.oclc.org/about/history/default.htm}, +} + + +@online{thuthesis, + author = {薛瑞尼}, + title = {ThuThesis: 清华大学学位论文模板}, + urldate = {2019-04-27}, + url = {https://github.com/xueruini/thuthesis}, + year = 2017, +} diff --git a/macros/latex/contrib/thuthesis/shuji.pdf b/macros/latex/contrib/thuthesis/shuji.pdf Binary files differnew file mode 100644 index 0000000000..0c61d58ba9 --- /dev/null +++ b/macros/latex/contrib/thuthesis/shuji.pdf diff --git a/macros/latex/contrib/thuthesis/shuji.tex b/macros/latex/contrib/thuthesis/shuji.tex new file mode 100644 index 0000000000..5467371b80 --- /dev/null +++ b/macros/latex/contrib/thuthesis/shuji.tex @@ -0,0 +1,20 @@ +\documentclass[degree=master]{thuthesis} + +\begin{document} +\thusetup{ + cauthor={薛瑞尼}, + ctitle={没有英文的中文标题} +} + +\shuji % 使用默认标题和默认作者 + +\shuji[使用默认作者的标题] + +\shuji[同时修改标题和作者的标题][尼瑞薛] + +\ifxetex + \shuji[清华大学学位 \raisebox{-5pt}{\LaTeX} 论文模板 \raisebox{-5pt}{v\version} 样例] +\else + \shuji[清华大学学位 \raisebox{8pt}{\LaTeX} 论文模板 \raisebox{8pt}{v\version} 样例] +\fi +\end{document} diff --git a/macros/latex/contrib/thuthesis/thuthesis-author-year.bst b/macros/latex/contrib/thuthesis/thuthesis-author-year.bst new file mode 100644 index 0000000000..350d534aa6 --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis-author-year.bst @@ -0,0 +1,2057 @@ +%% +%% This is file `versions/thu/thuthesis-author-year.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `thu,2005,authoryear') +%% ------------------------------------------------------------------- +%% GB/T 7714-2015 BibTeX Style +%% https://github.com/CTeX-org/gbt7714-bibtex-style +%% Version: 2019/03/21 v1.1.1 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016-2019 by Zeping Lee <zepinglee AT gmail.com> +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% ------------------------------------------------------------------- +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + slash.for.extraction + in.booktitle + italic.jounal + bold.journal.volume + show.missing.address.publisher + show.url + show.doi + show.note + lang.zh.order + lang.ja.order + lang.en.order + lang.ru.order + lang.other.order +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #0 'uppercase.name := + #3 'max.num.authors := + #0 'period.between.author.year := + #1 'period.between.author.year := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #1 'slash.for.extraction := + #0 'in.booktitle := + #0 'italic.jounal := + #0 'bold.journal.volume := + #1 'show.missing.address.publisher := + #1 'show.url := + #1 'show.doi := + #0 'show.doi := + #0 'show.note := + #1 'lang.zh.order := + #2 'lang.ja.order := + #3 'lang.en.order := + #4 'lang.ru.order := + #5 'lang.other.order := +} + +ENTRY + { address + author + booktitle + date + doi + edition + editor + howpublished + institution + journal + key + language + mark + medium + note + number + organization + pages + publisher + school + series + title + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic entry.numbered } + { label extra.label sort.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.et.al} +{ bbl.et.al } + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\ " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { slash.for.extraction + { after.slash 'output.state := } + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {italicize} +{ duplicate$ empty$ + { pop$ "" } + { "\textit{" swap$ * "}" * } + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + nameptr max.num.authors > + { bbl.et.al + #1 'namesleft := + } + { t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ + } + if$ + nameptr #1 > + { ", " swap$ * * } + 'skip$ + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + bbl.anonymous + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + 's := + s text.length$ 'charptr := + { charptr #0 > } + { s charptr #1 substring$ "]" = + { #0 'charptr := } + { charptr #1 - 'charptr := } + if$ + } + while$ + charptr #0 > + { "{" s * "}" * } + { s } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + in.booktitle + { duplicate$ empty$ not entry.lang lang.en = and + { "In: " swap$ * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.journal} +{ journal + italic.jounal entry.lang lang.en = and + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." *} + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address + format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\penalty0 (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.dash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.before.dash * ")" * } + 'skip$ + if$ + year contains.dash + { "--" * + year extract.after.dash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.dash empty$ not + { year extract.after.dash * } + { year extract.before.dash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + bbl.anonymous + } + if$ + } + if$ + output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {article} +{ output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.journal "journal" output.check + format.journal.volume output + format.journal.number "" output.after + format.journal.pages "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.editdate "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ journal empty$ not + 'article + { booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { book } + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ lang.zh entry.lang = + { "硕士学位论文" } + { "D" } + if$ + set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} +{ lang.zh entry.lang = + { "博士学位论文" } + { "D" } + if$ + set.entry.mark + monograph +} + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$} + { t #1 "{ll}{ff}" format.name$} + if$ + s num.names$ #1 > + { bbl.space * citation.et.al * } + 'skip$ + if$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +FUNCTION {sort.language.label} +{ entry.lang lang.zh = + { lang.zh.order } + { entry.lang lang.ja = + { lang.ja.order } + { entry.lang lang.en = + { lang.en.order } + { entry.lang lang.ru = + { lang.ru.order } + { lang.other.order } + if$ + } + if$ + } + if$ + } + if$ + int.to.chr$ +} + +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { + s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := + nameptr #1 > + { + " " * + namesleft #1 = t "others" = and + { "zzzzz" * } + { numnames #2 > nameptr #2 = and + { "zz" * year field.or.null * " " * } + 'skip$ + if$ + t sortify * + } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +FUNCTION {anonymous.sort} +{ entry.lang lang.zh = + { "yi4 ming2" } + { "anon" } + if$ +} + +FUNCTION {warn.empty.key} +{ entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {author.sort} +{ key empty$ + { warn.empty.key + author empty$ + { anonymous.sort } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {author.editor.sort} +{ key empty$ + { warn.empty.key + author empty$ + { editor empty$ + { anonymous.sort } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {author.organization.sort} +{ key empty$ + { warn.empty.key + author empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {editor.organization.sort} +{ key empty$ + { warn.empty.key + editor empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + calc.label + label sortify + " " + * + sort.language.label + type$ "book" = + type$ "inbook" = + or + 'author.editor.sort + { type$ "collection" = + type$ "proceedings" = + or + 'editor.organization.sort + 'author.sort + if$ + } + if$ + * + " " + * + year field.or.null sortify + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra } + +INTEGERS { longest.label.width last.extra.num number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := + #0 'number.label := +} + +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label + duplicate$ empty$ + 'skip$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ +} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/macros/latex/contrib/thuthesis/thuthesis-bachelor.bst b/macros/latex/contrib/thuthesis/thuthesis-bachelor.bst new file mode 100644 index 0000000000..1063c962b1 --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis-bachelor.bst @@ -0,0 +1,1866 @@ +%% +%% This is file `versions/thu/thuthesis-bachelor.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2015,numerical') +%% ------------------------------------------------------------------- +%% GB/T 7714-2015 BibTeX Style +%% https://github.com/CTeX-org/gbt7714-bibtex-style +%% Version: 2019/03/21 v1.1.1 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016-2019 by Zeping Lee <zepinglee AT gmail.com> +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% ------------------------------------------------------------------- +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + slash.for.extraction + in.booktitle + italic.jounal + bold.journal.volume + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #3 'max.num.authors := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #1 'slash.for.extraction := + #0 'in.booktitle := + #0 'italic.jounal := + #0 'bold.journal.volume := + #1 'show.missing.address.publisher := + #1 'show.url := + #1 'show.doi := + #0 'show.note := +} + +ENTRY + { address + author + booktitle + date + doi + edition + editor + howpublished + institution + journal + key + language + mark + medium + note + number + organization + pages + publisher + school + series + title + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic entry.numbered } + { label extra.label sort.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.et.al} +{ bbl.et.al } + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { slash.for.extraction + { after.slash 'output.state := } + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {italicize} +{ duplicate$ empty$ + { pop$ "" } + { "\textit{" swap$ * "}" * } + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + nameptr max.num.authors > + { bbl.et.al + #1 'namesleft := + } + { t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ + } + if$ + nameptr #1 > + { ", " swap$ * * } + 'skip$ + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + "" + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + 's := + s text.length$ 'charptr := + { charptr #0 > } + { s charptr #1 substring$ "]" = + { #0 'charptr := } + { charptr #1 - 'charptr := } + if$ + } + while$ + charptr #0 > + { "{" s * "}" * } + { s } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + in.booktitle + { duplicate$ empty$ not entry.lang lang.en = and + { "In: " swap$ * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.journal} +{ journal + italic.jounal entry.lang lang.en = and + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." *} + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address + format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\penalty0 (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.dash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.before.dash * ")" * } + 'skip$ + if$ + year contains.dash + { "--" * + year extract.after.dash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.dash empty$ not + { year extract.after.dash * } + { year extract.before.dash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {article} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.journal "journal" output.check + format.date "year" output.check + format.journal.volume output + format.journal.number "" output.after + format.journal.pages "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem + format.authors output + author format.key output + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + date empty$ + { format.date output } + 'skip$ + if$ + format.pages bbl.colon output.after + format.editdate "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ journal empty$ not + 'article + { booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { book } + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$} + { t #1 "{ll}{ff}" format.name$} + if$ + s num.names$ #1 > + { bbl.space * citation.et.al * } + 'skip$ + if$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num :=} + +FUNCTION {int.to.fix} +{ "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra } + +INTEGERS { longest.label.width last.extra.num number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := + #0 'number.label := +} + +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label + duplicate$ empty$ + 'skip$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ +} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/macros/latex/contrib/thuthesis/thuthesis-numeric.bst b/macros/latex/contrib/thuthesis/thuthesis-numeric.bst new file mode 100644 index 0000000000..17f186e6de --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis-numeric.bst @@ -0,0 +1,1879 @@ +%% +%% This is file `versions/thu/thuthesis-numeric.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `thu,2005,numerical') +%% ------------------------------------------------------------------- +%% GB/T 7714-2015 BibTeX Style +%% https://github.com/CTeX-org/gbt7714-bibtex-style +%% Version: 2019/03/21 v1.1.1 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016-2019 by Zeping Lee <zepinglee AT gmail.com> +%% ------------------------------------------------------------------- +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% ------------------------------------------------------------------- +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + slash.for.extraction + in.booktitle + italic.jounal + bold.journal.volume + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #0 'uppercase.name := + #3 'max.num.authors := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #1 'slash.for.extraction := + #0 'in.booktitle := + #0 'italic.jounal := + #0 'bold.journal.volume := + #1 'show.missing.address.publisher := + #1 'show.url := + #1 'show.doi := + #0 'show.doi := + #0 'show.note := +} + +ENTRY + { address + author + booktitle + date + doi + edition + editor + howpublished + institution + journal + key + language + mark + medium + note + number + organization + pages + publisher + school + series + title + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic entry.numbered } + { label extra.label sort.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ entry.lang lang.zh = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} + +FUNCTION {bbl.et.al} +{ entry.lang lang.zh = + { "等" } + { entry.lang lang.ja = + { "他" } + { entry.lang lang.ru = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {citation.et.al} +{ bbl.et.al } + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\ " } + +FUNCTION {bbl.slash} { "//\allowbreak " } + +FUNCTION {bbl.sine.loco} +{ entry.lang lang.zh = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ entry.lang lang.zh = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ entry.lang lang.zh = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ + newline$ + } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { slash.for.extraction + { after.slash 'output.state := } + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {italicize} +{ duplicate$ empty$ + { pop$ "" } + { "\textit{" swap$ * "}" * } + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + nameptr max.num.authors > + { bbl.et.al + #1 'namesleft := + } + { t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ + } + if$ + nameptr #1 > + { ", " swap$ * * } + 'skip$ + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ + "" + } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + entry.lang lang.zh = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + 's := + s text.length$ 'charptr := + { charptr #0 > } + { s charptr #1 substring$ "]" = + { #0 'charptr := } + { charptr #1 - 'charptr := } + if$ + } + while$ + charptr #0 > + { "{" s * "}" * } + { s } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.number} +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + { number } + if$ + } + { "" } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + } + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ + } + { format.title.vol.num } + if$ + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + entry.numbered not s empty$ not and + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { format.booktitle.vol.num } + if$ + in.booktitle + { duplicate$ empty$ not entry.lang lang.en = and + { "In: " swap$ * } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.journal} +{ journal + italic.jounal entry.lang lang.en = and + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { entry.lang lang.zh = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." *} + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address + format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\penalty0 (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.dash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.before.dash * ")" * } + 'skip$ + if$ + year contains.dash + { "--" * + year extract.after.dash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.dash empty$ not + { year extract.after.dash * } + { year extract.before.dash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "empty author and editor in " cite$ * warning$ + "" + } + if$ + } + if$ + output + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {article} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.journal "journal" output.check + format.date "year" output.check + format.journal.volume output + format.journal.number "" output.after + format.journal.pages "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem + format.authors output + author format.key output + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + date empty$ + { format.date output } + 'skip$ + if$ + format.pages bbl.colon output.after + format.editdate "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ journal empty$ not + 'article + { booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { book } + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ lang.zh entry.lang = + { "硕士学位论文" } + { "D" } + if$ + set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} +{ lang.zh entry.lang = + { "博士学位论文" } + { "D" } + if$ + set.entry.mark + monograph +} + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$} + { t #1 "{ll}{ff}" format.name$} + if$ + s num.names$ #1 > + { bbl.space * citation.et.al * } + 'skip$ + if$ +} + +FUNCTION {author.key.label} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.editor.key.label} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + 'key + if$ + } + { editor format.lab.names } + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num :=} + +FUNCTION {int.to.fix} +{ "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + +FUNCTION {presort} +{ set.entry.lang + set.entry.numbered + show.url show.doi check.electronic + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra } + +INTEGERS { longest.label.width last.extra.num number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := + #0 'number.label := +} + +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label + duplicate$ empty$ + 'skip$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ +} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/macros/latex/contrib/thuthesis/thuthesis.dtx b/macros/latex/contrib/thuthesis/thuthesis.dtx new file mode 100644 index 0000000000..fbabf09833 --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis.dtx @@ -0,0 +1,3527 @@ +% \iffalse meta-comment +% +% Copyright (C) 2005-2019 by Ruini Xue <xueruini@gmail.com> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{thuthesis.dtx}[2019/04/27 5.5.2 Tsinghua University Thesis Template] +\documentclass{ltxdoc} +\usepackage{dtx-style} + +\EnableCrossrefs +\CodelineIndex +\RecordChanges + +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +% \DoNotIndex{\newenvironment,\@bsphack,\@empty,\@esphack,\sfcode} +% \DoNotIndex{\addtocounter,\label,\let,\linewidth,\newcounter} +% \DoNotIndex{\noindent,\normalfont,\par,\parskip,\phantomsection} +% \DoNotIndex{\providecommand,\ProvidesPackage,\refstepcounter} +% \DoNotIndex{\RequirePackage,\setcounter,\setlength,\string,\strut} +% \DoNotIndex{\textbackslash,\texttt,\ttfamily,\usepackage} +% \DoNotIndex{\begin,\end,\begingroup,\endgroup,\par,\\} +% \DoNotIndex{\if,\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi} +% \DoNotIndex{\let,\def,\xdef,\edef,\newcommand,\renewcommand} +% \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect} +% \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize} +% \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny} +% \DoNotIndex{\normalfont,\bfseries,\slshape,\sffamily,\interlinepenalty} +% \DoNotIndex{\textbf,\textit,\textsf,\textsc} +% \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad} +% \DoNotIndex{\centering,\raggedright,\ref} +% \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize} +% \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne} +% \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument} +% +% \GetFileInfo{\jobname.dtx} +% +% \changes{v1.0}{2005/07/06}{Please refer to ``Bao--Pan'' version.} +% \changes{v1.1}{2005/11/03}{Initial version, migrate from the old ``Bao--Pan'' +% version. Make the template a class instead of package.} +% \changes{v1.2}{2005/11/04}{Remove \pkg{fancyref}; Remove \pkg{ucite} and implement +% \cs{onlinecite}; use package \pkg{arial} or \pkg{helvet} selectively.} +% \changes{v1.3}{2005/11/14}{Replace \pkg{subfigure} with \pkg{subfig}, replace \pkg{caption2} +% with \pkg{caption}, add details about using figure are in the example.} +% \changes{v1.4rc1}{2005/11/20}{I do not know why \cs{thu@authorizationaddon} does not work +% now for v1.3, while it's fine in v1.2. Temporarily, I remove the directive +% :(. There might be better solution. Other changes: add \option{config} option to +% subfig to be compatible with subfigure. add \pkg{courier} package for tt font.} +% \changes{v1.4}{2005/12/05}{Fix the problem of \textbf{chinese}, which is +% because both CJK and everysel redefine the \cs{selectfont}. So, a not so good +% workaround is to merge them up. Add \file{shuji.tex} example. Add \cs{pozhehao} command.} +% \changes{v2.1}{2006/02/27}{Add support to bachelor thesis.} +% \changes{v2.1}{2006/03/01}{Remove \pkg{fancyhdr} and \pkg{geometry}.} +% \changes{v2.1}{2006/03/01}{Redefine footnote marks.} +% \changes{v2.1}{2006/03/01}{Replace \file{thubib.bst} with \file{chinesebst.bst}.} +% \changes{v2.1}{2006/03/02}{Merge the modification of \pkg{ntheorem}.} +% \changes{v2.1}{2006/03/02}{Remove \pkg{footmisc} and refine the document.} +% \changes{v2.1}{2006/03/03}{Work very hard on the document.} +% \changes{v2.1}{2006/03/03}{Add \cs{checklab} code to reduce ``unresolved labels'' warning} +% \changes{v2.2}{2006/03/26}{Adjust margins. How bad it is to simulate MS WORD!.} +% \changes{v2.2}{2006/03/26}{Add bachelor training overview details supporting.} +% \changes{v2.2}{2006/03/26}{CJK support in preamble.} +% \changes{v2.2}{2006/03/26}{Adjust hyperref to avoid boxes around links.} +% \changes{v2.3}{2006/04/07}{Fix a great bug: \cs{PassOptionsToClass} and \cs{LoadClass} +% rather than \cs{PassOptionToPackage} and \cs{LoadPackage}.} +% \changes{v2.3}{2006/04/07}{Reorganize the codes in cover, make the pagestyle more readable.} +% \changes{v2.3}{2006/04/07}{Add gbk2uni into the document.} +% \changes{v2.3}{2006/04/07}{Support \option{openright} and openany.} +% \changes{v2.3}{2006/04/09}{Adjust \cs{hypersetup} to remove color and box.} +% \changes{v2.3}{2006/04/09}{Adjust margins again.} +% \changes{v2.3}{2006/04/09}{Adjust references formats.} +% \changes{v2.3}{2006/04/09}{Redefine frontmatter and mainmatter to fit our case.} +% \changes{v2.3}{2006/04/09}{Add assumption environment.} +% \changes{v2.3}{2006/04/09}{Change the brace in the cover.} +% \changes{v2.4}{2006/04/14}{Fill more pdf info. with \cs{hypersetup}.} +% \changes{v2.4}{2006/04/14}{自动隐藏密级为内部时后面的五角星。} +% \changes{v2.4}{2006/04/14}{增加“注释 (Remark)”环境。} +% \changes{v2.4}{2006/04/14}{压缩 item 之间的距离。} +% \changes{v2.4}{2006/04/14}{\file{thubib.bst} 文献标题取消自动小写。} +% \changes{v2.4}{2006/04/14}{中文参考文献取消 In: Proceedings。} +% \changes{v2.4}{2006/04/14}{英文文参考文献调整 In: editor, Proceedings。} +% \changes{v2.4}{2006/04/14}{参考文献为学位论文时,加方括号,作者后面为实心点。} +% \changes{v2.4}{2006/04/14}{中文参考文献作者超过三个加等。} +% \changes{v2.4}{2006/04/14}{中文参考文献需要在 bib 中指定 |lang="chinese"|。} +% \changes{v2.4}{2006/04/14}{学位论文不在需要 type 字段。} +% \changes{v2.4}{2006/04/14}{为摘要等条目增加书签。} +% \changes{v2.4}{2006/04/14}{章节的编号用黑体,也就是自动打开 \option{arialtitle} 选项。} +% \changes{v2.4.1}{2006/04/17}{2.4 忘了把关键词的 tabular 改成 thu@tabular。} +% \changes{v2.4.1}{2006/04/17}{参考文献最后一个作者前是逗号而不是 and。} +% \changes{v2.4.2}{2006/04/18}{去掉参考文献第二个作者后面烦人的逗号。} +% \changes{v2.5}{2006/05/19}{对本科论文进行大幅度的重写,因为教务处修改了格式要求。} +% \changes{v2.5}{2006/05/19}{重新整理代码,使其布局更易读。} +% \changes{v2.5.1}{2006/05/24}{如果选项设置了 dvips,但是用 PDF\LaTeX\ 编译,报错。} +% \changes{v2.5.1}{2006/05/24}{根据教务处的新要求调整附录部分。} +% \changes{v2.5.1}{2006/05/25}{参考文献中杂志文章如果没有卷号,那么页码直接跟在 +% 年份后面,并用句点分割。在 \file{thubib.bst} 中增加 output.year 函数。} +% \changes{v2.6}{2006/06/09}{增加 dvipdfm 选项。} +% \changes{v2.6.1}{2006/06/16}{取消 \file{thubib.bst} 中 inbook 类 volume 后的页 +% 码。} +% \changes{v2.6.2}{2006/06/18}{改正 groupmembers 的拼写错误。} +% \changes{v3.0}{2007/05/12}{不用专门为本科论文生成“\textbf{提交}”版本了。} +% \changes{v3.0}{2007/05/12}{没有了综合论文训练页面,很多本科论文专用命令就消失了。} +% \changes{v4.4}{2008/05/12}{修复网址断字。} +% \changes{v4.5}{2008/01/03}{加入 \XeTeX\ 支持,需要 \pkg{xeCJK}。} +% \changes{v4.5}{2008/01/04}{彻底转向 UTF-8,并支持 \XeLaTeX。} +% \changes{v4.5}{2009/01/03}{增加 xetex, pdftex 选项。} +% \changes{v4.6}{2011/04/27}{增加博士后文档部分。} +% \changes{v4.6}{2011/10/22}{使用手册更新。} +% \changes{v4.7}{2012/06/12}{去掉 \pkg{hypernat} 依赖,\pkg{hyperref} 和 \pkg{natbib} 可以很好配合了。} +% \changes{v4.8}{2013/03/02}{no need to load \pkg{indentfirst} directly since we use \pkg{ctex}.} +% \changes{v4.8}{2013/03/02}{内部调用 \pkg{ctex} 宏包,自动检测编译引擎。} +% \changes{v4.8}{2013/03/04}{dvips method is deprecated. We ask their users to load it manually.} +% \changes{v4.8}{2013/03/09}{reset baselinestretch after ctex's change.} +% \changes{v4.8}{2014/11/25}{好几年累积的一些更新,最重要的是切换到 \CTeX。} +% \changes{v5.4.2}{2017/12/16}{删除 \cs{pozhehao}。} +% \changes{v5.4.4}{2018/04/22}{删除 \option{arialtitle},所有论文格式都一样。} +% +% \def\indexname{索引} +% \def\glossaryname{修改记录} +% \IndexPrologue{\section{\indexname}} +% \GlossaryPrologue{\section{\glossaryname}} +% +% \title{\bfseries\color{violet}\thuthesis:清华大学学位论文模板} +% \author{{\fangsong 薛瑞尼}\\[5pt]\texttt{xueruini@gmail.com}} +% \date{v\fileversion\ (\filedate)} +% \maketitle\thispagestyle{empty} +% +% +% \begin{abstract}\noindent +% 此宏包旨在建立一个简单易用的清华大学学位论文模板,包括本科综合论文训练、硕士 +% 论文、博士论文以及博士后出站报告。 +% \end{abstract} +% +% \vskip2cm +% \def\abstractname{免责声明} +% \begin{abstract} +% \noindent +% \begin{enumerate} +% \item 本模板的发布遵守 \LaTeX\ Project Public License,使用前请认真阅读协议内 +% 容。 +% \item 本模板为作者根据清华大学教务处颁发的《综合论文训练写作指南》, +% 清华大学研究生院颁发的 +% \href{http://yjsy.cic.tsinghua.edu.cn/docinfo/board/boarddetail.jsp?columnId=001050603&parentColumnId=0010506&itemSeq=5365}{《研究生学位论文写作指南》}, +% 清华大学 +% \href{http://postdoctor.tsinghua.edu.cn/info/czxz/1283}{% +% 《编写“清华大学博士后研究报告”参考意见》} +% 编写而成,旨在供清华大学毕业生撰写学位论文使用。 +% \item 清华大学教务处和研究生院只提供毕业论文写作指南,不提供官方模板,也不会授 +% 权第三方模板为官方模板,所以此模板仅为写作指南的参考实现,不保证格式审查老师 +% 不提意见。任何由于使用本模板而引起的论文格式审查问题均与本模板作者无关。 +% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵 +% 守 \LaTeX\ Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与 +% 本模板作者无关。 +% \end{enumerate} +% \end{abstract} +% +% +% \clearpage +% \pagestyle{fancy} +% \begin{multicols}{2}[ +% \setlength{\columnseprule}{.4pt} +% \setlength{\columnsep}{18pt}] +% \tableofcontents +% \end{multicols} +% \clearpage +% +% \section{模板介绍} +% \thuthesis\ (\textbf{T}sing\textbf{h}ua \textbf{U}niversity \LaTeX\ +% \textbf{Thesis} Template) 是为了帮助清华大学毕业生撰写毕业论文而编写 +% 的 \LaTeX\ 论文模板。 +% +% 本文档将尽量完整的介绍模板的使用方法,如有不清楚之处可以参考示例文档或者根据 +% 第~\ref{sec:howtoask} 节说明提问,有兴趣者都可以参与完善此手册,也非常欢迎对代 +% 码的贡献。 +% +% \note[注意:]{模板的作用在于减少论文写作过程中格式调整的时间。前提是遵守模板的 +% 用法,否则即便用了 \thuthesis\ 也难以保证输出的论文符合学校规范。} +% +% +% \section{安装} +% \label{sec:installation} +% +% \thuthesis\ 已经包含在主要的 \TeX\ 发行版中,一般不需要安装,可以利用发行版自 +% 带更新工具自动更新。阅读文档可以使用以下命令: +% \begin{shell} +% $ texdoc thuthesis +% \end{shell} +% +% 如果要使用开发版,需自己下载,\thuthesis\ 相关链接: +% \begin{itemize} +% \item 主页:\href{https://github.com/xueruini/thuthesis}{GitHub} +% \item 下载:\href{http://www.ctan.org/pkg/thuthesis}{CTAN} +% \end{itemize} +% +% \subsection{模板的组成} +% 下表列出了 \thuthesis\ 的主要文件及其功能介绍: +% +% \begin{longtable}{l|p{8cm}} +% \toprule +% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule +% \endfirsthead +% \midrule +% {\heiti 文件(夹)} & {\heiti 功能描述}\\\midrule +% \endhead +% \endfoot +% \endlastfoot +% thuthesis.ins & \textsc{DocStrip} 驱动文件(开发用) \\ +% thuthesis.dtx & \textsc{DocStrip} 源文件(开发用)\\\midrule +% thuthesis.cls & 模板类文件\\ +% thuthesis-numeric.bst & 参考文献样式文件\\ +% thuthesis-author-year.bst & 参考文献样式文件\\ +% tsinghua.pdf & 校名 logo,系统无隶书字体时使用 \\\midrule +% main.tex & 示例文档主文件\\ +% shuji.tex & 书脊示例文档\\ +% ref/ & 示例文档参考文献目录\\ +% data/ & 示例文档章节具体内容\\ +% figures/ & 示例文档图片路径\\ +% thuthesis.sty & 为示例文档加载其它宏包\\\midrule +% Makefile & Makefile\\ +% latexmkrc & latexmk 配置文件 \\ +% README.md & Readme\\ +% \textbf{thuthesis.pdf} & 用户手册(本文档)\\\bottomrule +% \end{longtable} +% +% 几点说明: +% \begin{itemize} +% \item \file{thuthesis.cls} 可由 \file{thuthesis.ins} +% 和 \file{thuthesis.dtx} 生成,但为了降低新手用户的使用难度,故 +% 将 \file{thuthesis.cls} 文件一起发布。 +% \item 使用前阅读文档:\file{thuthesis.pdf}。 +% \end{itemize} +% +% \subsection{生成模板} +% \label{sec:generate-cls} +% \note[提示:]{若使用 \TeX 发行版自带的 \thuthesis\ 或 Github 上发布的版本,可忽 +% 略此节,直接阅读第~\ref{sec:generate-thesis} 节。若下载 CTAN 包或者 Github 开发 +% 代码,请阅读本节了解生成模板文件的步骤。} +% +% 模板解压缩后生成文件夹 \file{thuthesis-vX.Y.Z}\footnote{\texttt{vX.Y.Z} 为版本 +% 号。},其中包括:模板源文件(\file{thuthesis.ins} 和 \file{thuthesis.dtx}),参 +% 考文献样式 \file{thuthesis-numeric.bst} 和 \file{thuthesis-author-year.bst},示例文档 +% (\file{main.tex},\file{shuji.tex},\file{thuthesis.sty}\footnote{可能用到的包 +% 以及一些命令定义都放在这里,以免 \file{thuthesis.cls} 过分臃 +% 肿。},\file{data/} 和 \file{figures/} 和 \file{ref/})。在使用之前需要先生成模 +% 板文件和配置文件(具体命令细节请参考 \file{README.md} 和 \file{Makefile}): +% +% \begin{shell} +% $ cd thuthesis-vX.Y.Z +% # 生成 thuthesis.cls +% $ xetex thuthesis.ins +% +% # 下面的命令用来生成用户手册,可以不执行 +% $ xelatex thuthesis.dtx +% $ makeindex -s gind.ist -o thuthesis.ind thuthesis.idx +% $ makeindex -s gglo.ist -o thuthesis.gls thuthesis.glo +% $ xelatex thuthesis.dtx +% $ xelatex thuthesis.dtx % 生成说明文档 thuthesis.pdf +% \end{shell} +% +% \subsection{生成论文} +% \label{sec:generate-thesis} +% 本节介绍几种常见的生成论文的方法。用户可根据自己的情况选择。 +% +% \subsubsection{\XeLaTeX} +% \label{sec:xelatex} +% 很多用户对 \LaTeX\ 命令执行的次数不太清楚。一个基本的原则是多次运行 \LaTeX\ 命 +% 令直至不再出现警告。下面给出生成示例文档的详细过程(\texttt{\#} 开头的行为注 +% 释),首先来看推荐的 \texttt{xelatex} 方式: +% \begin{shell} +% # 1. 发现里面的引用关系,文件后缀 .tex 可以省略 +% $ xelatex main +% +% # 2. 编译参考文件源文件,生成 bbl 文件 +% $ bibtex main +% +% # 3. 下面解决引用 +% $ xelatex main +% $ xelatex main # 此时生成完整的 pdf 文件 +% \end{shell} +% +% \subsubsection{latexmk} +% \label{sec:latexmk} +% \texttt{latexmk} 命令支持全自动生成 \LaTeX\ 编写的文档,并且支持使用不同的工具 +% 链来进行生成,它会自动运行多次工具直到交叉引用都被解决。下面给出了一个用 +% \texttt{latexmk} 调用 \texttt{xelatex} 生成最终文档的示例: +% \begin{shell} +% # 一句话就够了! +% $ latexmk -xelatex main +% \end{shell} +% +% \subsubsection{make} +% \label{sec:make} +% \note[提示:]{若要使用 \texttt{make} 编译,需自行下载模板。因为 \TeX\ 发行版中 +% 的 \file{Makefile} 不在当前目录。} +% +% 上面的方法虽然不复杂,但是每次都输入还是非常罗嗦,所以 \thuthesis\ 提供了一 +% 个 \file{Makefile}: +% +% \begin{shell} +% $ make clean +% $ make cls # 生成 thuthesis.cls +% $ make doc # 生成说明文档 thuthesis.pdf +% $ make thesis # 生成示例文档 main.pdf +% $ make shuji # 生成书脊 shuji.pdf +% \end{shell} +% +% \thuthesis\ 的 \file{Makefile} 默认用 \texttt{latexmk} 调用\texttt{xelatex} 编 +% 译。如有需要可修 +% 改 \file{Makefile} 开头的参数或通过命令行传递参数(请参看 \file{README.md}), +% 进一步还可以修改 \file{latexmkrc} 进行定制。 +% +% \subsection{升级} +% \label{sec:updgrade} +% \thuthesis\ 升级非常简单,可以通过 \TeX\ 发行版的包管理工具自动更新发行版,也可 +% 以下载最新的开发版, +% 将 \file{thuthesis.ins},\file{thuthesis.dtx},\file{tsinghua.pdf}, +% \file{thuthesis-author-year.bst} 和 \file{thuthesis-numeric.bst} 拷贝至工作目录覆盖相应 +% 的文件,然后运行: +% \begin{shell} +% $ xetex thuthesis.ins +% \end{shell} +% +% 生成新的类文件和配置文件即可。也可以直接拷 +% 贝 \file{thuthesis.cls},免去上面命令的执行。 +% +% +% \section{使用说明} +% \label{sec:usage} +% 本手册假定用户已经能处理一般的 \LaTeX\ 文档,并对 \BibTeX\ 有一定了解。如果 +% 从来没有接触过 \TeX\ 和 \LaTeX,建议先学习相关的基础知识。 +% +% \subsection{关于提问} +% \label{sec:howtoask} +% 按照优先级推荐提问的位置如下: +% +% \begin{itemize} +% \item \href{http://github.com/xueruini/thuthesis/issues}{Github Issues} +% \item \href{http://www.newsmth.net/nForum/#!board/TeX}{Tex@newsmth} +% \item \href{http://groups.google.com/group/thuthesis}{ThuThesis@Google Groups} +% \end{itemize} +% +% \subsection{示例文件} +% \label{sec:userguide} +% +% 模板核心文件 +% 有:\file{thuthesis.cls},\file{thuthesis-numeric.bst}, +% \file{thuthesis-author-year.bst} 和 \file{tsinghua.pdf}, +% 但如果没有示例文档会很难下手,所以推荐从模板自带的示例文档入手,其中包括了论文 +% 写作用到的所有命令及其使用方法,只需要用自己的内容进行相应替换就可以。对于不清 +% 楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自于示例文档, +% 具体内容可以参考模板附带的 \file{main.tex} 和 \file{data/}。 +% +% \lstinputlisting[style=lstStyleLaTeX]{main.tex} +% +% \subsection{论文选项} +% \label{sec:option} +% +% \DescribeOption{degree} +% 选择论文类型,当前支 +% 持:\option{bachelor},\option{master},\option{doctor},\option{postdoctor}。 +% 为必选项。 +% \begin{latex} +% % 博士论文 +% \documentclass[degree=doctor]{thuthesis} +% +% % 硕士论文 +% \documentclass[degree=master]{thuthesis} +% \end{latex} +% +% \DescribeOption{language} +% 论文的主要语言(默认:中文)。可选:\option{chinese},\option{english}。 +% +% \DescribeOption{secret} +% 涉秘论文开关(默认:关闭)。第 \ref{sec:setup-secret} 节两个配置分别用来指定保 +% 密级别和时限。若不设置,则二者取默认值,分别为“\textbf{秘密}”和当前年份。 +% \begin{latex} +% \documentclass[secret]{thuthesis} % 打开保密 +% \documentclass[secret=false]{thuthesis} % 关闭保密 +% +% \thusetup{ +% secretlevel=公开, +% secretyear=10 +% } +% \end{latex} +% +% \DescribeOption{openany} +% \DescribeOption{openright} +% 正规出版物的章节出现在奇数页,也就是右手边的页面,这就是 \option{openright},也 +% 是 \thuthesis\ 的默认选项。在这种情况下,如果前一章的最后一页也是奇数,那么模板 +% 会自动生成一个纯粹的空白页,很多人不是很习惯这种方式,而且学校的格式似乎更倾向 +% 于页面连续,那就是通常所说的 \option{openany}\footnote{目前所有论文都 +% 是 \option{openany}。}。这两个选项不用设置,\thuthesis\ 会根据当前论文类型自动选 +% 择。 +% +% \DescribeOption{tocarialchapter} +% 章目录项(内容和页码)是否用 \textsf{Arial} 字体。如果想分别控制内容和页码的字体, +% 用下面两个开关。 +% +% \DescribeOption{tocarialchapterentry} +% 章目录项内容中的英文和数字是否用 \textsf{Arial} 字体。中文强制黑体,为了协调这个选 +% 项应该默认打开,不过从目前的反馈来看各学院的标准不一致。 +% +% \DescribeOption{tocarialchapterpage} +% 章目录项页码是否用 \textsf{Arial} 字体。 +% +% \subsection{引用方式} +% \label{sec:citestyle} +% 模板支持两种引用方式,分别为理工科常用的“数字式 [1]”和文科常用 +% 的“作者-年份 (Zhang, 2008)”。使用者可通过 \cs{bibliographystyle} 来选择: +% \begin{latex} +% % 数字式 +% \bibliographystyle{thuthesis-numeric} +% +% % 作者-年份 +% \bibliographystyle{thuthesis-author-year} +% \end{latex} +% +% \DescribeMacro{\inlinecite} +% 学校要求的参考文献引用有两种模式:(1)上标模式。比如``同样的工作有很 +% 多$^{[1,2]}$\ldots''。(2)正文模式。比如``文[3] 中详细说明了\ldots''。其中上标 +% 模式使用远比正文模式频繁,所以为了符合使用习惯,上标模式仍然用常规 +% 的 \cs{cite}\marg{key},而 \cs{inlinecite}\marg{key} 则用来生成正文模式。 +% +% 关于参考文献表推荐使用 \BibTeX,默认情况下可以自动识别文献语言, +% 并自动处理文献类型和载体类型标识,也可以手动指定,如: +% \begin{latex} +% @misc{citekey, +% language = {japanese}, +% mark = {Z}, +% medium = {DK}, +% ... +% \end{latex} +% 可选的语言有 english, chinese, japanese, russian。 +% +% 注意如果不需要引用参考文献,请删除 \file{main.tex} 中 \cs{bibliography} 开头的两行, +% 以避免可能的编译错误。 +% +% 国标规定参考文献表采用著者-出版年制组织时,各篇文献首先按文种集中, +% 然后按著者字顺和出版年排列; +% 中文文献可以按著者汉语拼音字顺排列,也可以按著者的笔画笔顺排列。 +% 然而由于 \BibTeX{} 功能的局限性,无法自动获取著者姓名的拼音或笔画笔顺, +% 所以\emph{必须}在 bib 数据库中的 key 域手动录入著者姓名的拼音,如: +% \begin{latex} +% @book{capital, +% author = {马克思 and 恩格斯}, +% key = {ma3 ke4 si1 en1 ge2 si1}, +% ... +% \end{latex} +% +% \BibTeX{} 对自定义样式的支持比较有限, +% 所以用户只能通过修改 \file{bst} 文件来修改文献列表的格式。 +% 本宏包提供了一些接口供用户更方便地修改, +% 在 \file{bst} 文件开始处的 |load.config| 函数中, +% 有一组配置参数用来控制样式。 +% 若变量被设为 |#1| 则表示该项被启用,设为 |#0| 则不启用。 +% 默认的值是严格遵循学校规定的配置。 +% +% +% \subsection{中文字体} +% \label{sec:chinese-fonts} +% +% \subsubsection{字体配置} +% \label{sec:font-config} +% 模板默认使用 \CTeX\ 的字体配置。关于中文字体安装、配置的所有问题不在本模板讨论 +% 范围。 +% +% \subsubsection{字体命令} +% \label{sec:fontcmds} +% \myentry{字体} +% \DescribeMacro{\songti} +% \DescribeMacro{\fangsong} +% \DescribeMacro{\heiti} +% \DescribeMacro{\kaishu} +% 用来切换宋体、仿宋、黑体、楷体四种基本字体。 +% +% \begin{latex} +% {\songti 乾:元,亨,利贞} +% {\fangsong 初九,潜龙勿用} +% {\heiti 九二,见龙在田,利见大人} +% {\kaishu 九三,君子终日乾乾,夕惕若,厉,无咎} +% \end{latex} +% +% \myentry{字号} +% \DescribeMacro{\chuhao} +% \DescribeMacro{\xiaochu} +% \DescribeMacro{\yihao} +% \DescribeMacro{\xiaoyi} +% \DescribeMacro{\bahao} +% 定义字体大小,分别为: +% +% \begin{center} +% \begin{tabular}{llllll} +% \toprule +% \cs{chuhao} & \cs{xiaochu} & \cs{yihao} & \cs{xiaoyi} & \cs{erhao} & \cs{xiaoer}\\ +% \cs{sanhao} & \cs{xiaosan} & \cs{sihao} & \cs{banxiaosi} & \cs{xiaosi} & \cs{dawu}\\ +% \cs{wuhao} & \cs{xiaowu} & \cs{liuhao} & \cs{xiaoliu} & \cs{qihao} & \cs{bahao}\\\bottomrule +% \end{tabular} +% \end{center} +% +% 使用方法为:\cs{command}\oarg{num},其中 command 为字号命令,num 为行距。比 +% 如 \cs{xiaosi}[1.5] 表示选择小四字体,行距 1.5 倍。写作指南要求表格中的字体 +% 是 \cs{dawu},模板已经设置好了。 +% +% \begin{latex} +% {\erhao 二号} +% {\sanhao[1.5] 三号} +% {\sihao 四号} +% {\qihao[2] 七号} +% \end{latex} +% +% 也可以使用 \CTeX\ 定义的 \cs{zihao}\marg{num} 来切换字号,具体用法参看其文 +% 档。 +% +% \subsection{封面信息} +% \label{sec:titlepage} +% 封面信息提供两种配置方法:一是通过统一设置命 +% 令 \cs{thusetup} 通过\emph{key=value} 形式完成;二是每个信息利用命令独立设置, +% 其中命令的名字跟 \emph{key} 相同。两种方式可以交叉使用,并按顺序执行(即后来的设置会覆 +% 盖前面的)。以 \texttt{c} 开头的命令跟中文相关,\texttt{e} 开头则为对应的英文。 +% +% \DescribeMacro{\thusetup} +% \cs{thusetup} 用法与常见 \emph{key=value} 命令相同,如下: +% \begin{latex} +% \thusetup{ +% key1 = value1, +% key2 = {a value, with comma}, +% } +% % 可以多次调用 +% \thusetup{ +% key3 = value3, +% key1 = value11, % 覆盖 value1 +% } +% \end{latex} +% +% \note[注意:]{\cs{thusetup} 使用 \pkg{kvoptions} 机制,所以配置项之间不能有空行,否则 +% 会报错。} +% +% 大多数命令的使用方法都是: \cs{command}\marg{arg},例外者将具体指出。这些命令都 +% 在示例文档的 \file{data/cover.tex} 中。 +% +% \subsubsection{密级} +% \label{sec:setup-secret} +% 定义秘密级别和年限,需要打开论文的 \option{secret} 选项。 +% \begin{latex} +% \thusetup{ +% secretyear = 10, +% secretlevel = {内部}, +% } +% \end{latex} +% +% \subsubsection{博士后专用参数} +% 只见过,没用过,不知道具体是什么意思。 +% \begin{latex} +% \thusetup{ +% catalognumber = {分类号}, +% udc = {udc}, +% id = {id}, +% } +% \end{latex} +% +% \subsubsection{论文标题} +% 中英文标题。可以在标题内部使用换行|\\|。 +% \begin{latex} +% \thusetup{ +% ctitle = {论文中文题目}, +% etitle = {Thesis English Title}, +% } +% \end{latex} +% +% \subsubsection{作者姓名} +% 作者姓名。 +% \begin{latex} +% \thusetup{ +% cauthor = {中文姓名}, +% eauthor = {Name in Pinyin}, +% } +% \end{latex} +% +% \subsubsection{申请学位名称} +% \label{sec:degree} +% 学位和专业的设置比想象的要复杂一些: +% +% \begin{longtable}{p{2cm}p{8cm}p{4cm}} +% \toprule +% 学位类型 & edegree & emajor \\\midrule +% 学术型硕士 +% & 必须为“Master of Art”或“Master of Science”(注意大 +% 小写),其中 “哲学、文学、历史学、法学、教育学、艺术学门类,公共 +% 管理学科填写“Master of Arts”,其它填写“Master of Science”。 +% & “获得一级学科授权的学科填写一级学科名称,其它填写二级学 +% 科名称”。\\\midrule +% 专业型硕士 +% & 专业学位英文名称全称 & % 工程硕士填写工程领域,其它专业学位不填写此项。\\\midrule +% 学术型博士 & Doctor of Philosophy(注意大小写) +% & 获得一级学科授权的学科填写一级学科名称,其它填写二级学科名称。\\\midrule +% 专业型博士 & 专业学位英文名称全称 & 不填写此项。\\\bottomrule +% \end{longtable} +% +% \begin{latex} +% \thusetup{ +% cdegree = {您要申请什么学位}, +% edegree = {Degree in English}, +% } +% \end{latex} +% +% \subsubsection{院系名称} +% 院系名称。 +% \begin{latex} +% \thusetup{ +% cdepartment = {系名全称}, +% edepartment = {Deparment of CS}, +% } +% \end{latex} +% +% \subsubsection{专业名称} +% 参见第 \ref{sec:degree} 节。 +% \begin{latex} +% \thusetup{ +% cmajor = {专业名称}, +% emajor = {Major in English}, +% } +% \end{latex} +% +% 博士后专用。 +% \begin{latex} +% \thusetup{ +% cfirstdiscipline = {流动站(一级学科)名称}, +% cseconddiscipline = {专业(二级学科)名称}, +% } +% \end{latex} +% +% \subsubsection{导师} +% \myentry{导师} +% 直接导师。 +% \begin{latex} +% \thusetup{ +% csupervisor = {导师~教授}, +% esupervisor = {Supervisor}, +% } +% \end{latex} +% +% \myentry{副导师} +% 本科生的辅导教师,硕士的副指导教师。 +% \begin{latex} +% \thusetup{ +% cassosupervisor = {副导师~副教授}, +% eassosupervisor = {2nd Boss}, +% } +% \end{latex} +% +% \myentry{联合导师} +% 硕士生联合指导教师,博士生联合导师。 +% \begin{latex} +% \thusetup{ +% ccosupervisor = {联合导师~教授}, +% ecosupervisor = {3rd Boss}, +% } +% \end{latex} +% +% \subsubsection{成文日期} +% 默认为当前时间,也可以自己指定。 +% \begin{latex} +% \thusetup{ +% cdate = {中文日期}, +% edate = {English Date}, +% postdoctordate = {2009 年 7 月——2011 年 7 月}, % 博士后工作完成日期 +% postdocstartdate = {2009 年 7 月 1 日}, % 博士后研究工作起始时间 +% postdocenddate = {2011 年 7 月 1 日}, % 博士后研究工作期满时间 +% } +% \end{latex} +% +% \subsubsection{摘要} +% \myentry{摘要正文} +% \DescribeEnv{cabstract} +% \DescribeEnv{eabstract} +% \note[说明:]{摘要正文只能用环境命令的形式,不支持 \cs{thusetup}。} +% +% \begin{latex} +% \begin{cabstract} +% 摘要请写在这里... +% \end{cabstract} +% +% \begin{eabstract} +% Here comes the abstract in English... +% \end{eabstract} +% \end{latex} +% +% \myentry{关键词} +% 关键词用英文逗号分割写入相应的命令中,模板会解析各关键词并生成符合不同论文格式 +% 要求的关键词格式。 +% \begin{latex} +% \thusetup{ +% ckeywords = {关键词 1, 关键词 2}, +% ekeywords = {keyword 1, keyword 2}, +% } +% \end{latex} +% +% \myentry{生成封面} +% \DescribeMacro{\makecover} +% 生成封面,包括首页,授权,摘要等。用法:\cs{makecover}\oarg{file}。如果使用授权 +% 说明扫描页,将可选参数中指定为扫描得到的 PDF 文件名,例如: +% \begin{latex} +% % 直接生成封面 +% \makecover +% +% % 将签字扫描后授权文件 scan-auth.pdf 替换原始页面 +% \makecover[scan-auth.pdf] +% \end{latex} +% +% \subsubsection{符号对照表} +% \DescribeEnv{denotation} +% 主要符号表环境,跟 \env{description} 类似,使用方法参见示例文件。带一个可选参数, +% 用来指定符号列的宽度(默认为 2.5cm)。 +% \begin{latex} +% \begin{denotation} +% \item[E] 能量 +% \item[m] 质量 +% \item[c] 光速 +% \end{denotation} +% \end{latex} +% +% 如果默认符号列的宽度不满意,可以通过参数来调整: +% \begin{latex} +% \begin{denotation}[1.5cm] % 设置为 1.5cm +% \item[E] 能量 +% \item[m] 质量 +% \item[c] 光速 +% \end{denotation} +% \end{latex} +% +% 另外一种方法是调用 \pkg{nomencl} 宏包,需要在导言区设置: +% \begin{latex} +% \usepackage{nomencl} +% \makenomenclature +% \end{latex} +% 然后在正文中任意位置使用 \cs{nomenclature} 声明需要添加到主要符号表的符号: +% \begin{latex} +% \nomenclature{$m$}{The mass of one angel} +% \end{latex} +% 最后使用 \cs{printnomenclature} 命令生成符号表。 +% 更详细的使用方法参见 \pkg{nomencl} 宏包的文档。 +% +% \subsection{目录和索引表} +% 目录、插图、表格和公式等索引命令分别如下,将其插入到期望的位置即可(带星号的命令表 +% 示对应的索引表不会出现在目录中): +% +% \DescribeMacro{\tableofcontents} +% \DescribeMacro{\listoffigures} +% \DescribeMacro{\listoffigures*} +% \DescribeMacro{\listoftables} +% \DescribeMacro{\listoftables*} +% \DescribeMacro{\listofequations} +% \DescribeMacro{\listofequations*} +% \begin{longtable}{ll} +% \toprule +% {\heiti 用途} & {\heiti 命令} \\\midrule +% 目录 & \cs{tableofcontents} \\\midrule +% 插图索引 & \cs{listoffigures} \\ +% & \cs{listoffigures*} \\\midrule +% 表格索引 & \cs{listoftables} \\ +% & \cs{listoftables*} \\\midrule +% 公式索引 & \cs{listofequations} \\ +% & \cs{listofequations*}\\\bottomrule +% \end{longtable} +% +% \LaTeX\ 默认支持插图和表格索引,是通过 \cs{caption} 命令完成的,因此它们必须出 +% 现在浮动环境中,否则不被计数。 +% +% 如果不想让某个表格或者图片出现在索引里面,那么请使用命令 \cs{caption*},这 +% 个命令不会给表格编号,也就是出来的只有标题文字而没有``表~xx'',``图~xx'',否则 +% 索引里面序号不连续就显得不伦不类,这也是 \LaTeX\ 里星号命令默认的规则。 +% +% 有这种需求的多是本科同学的英文资料翻译部分,如果你觉得附录中英文原文中的表格和 +% 图片显示成``表''和``图''很不协调的话,一个很好的办法还是用 \cs{caption*},参数 +% 随便自己写,具体用法请参看示例文档。 +% +% 如果的确想让其编号,但又不想出现在索引中的话,目前模板暂不支持。 +% +% 公式索引为本模板扩展,模板扩展了 \pkg{amsmath} 几个内部命令,使得公式编号样式和 +% 自动索引功能非常方便。一般来说,你用到的所有数学环境编号都没问题了,这个可以参 +% 看示例文档。如果你有个非常特殊的数学环境需要加入公式索引,那么请使 +% 用 \cs{equcaption}\marg{编号}。此命令表示 equation caption,带一个参数,即显示 +% 在索引中的编号。因为公式与图表不同,我们很少给一个公式附加一个标题,之所以起这 +% 么个名字是因为图表就是通过 \cs{caption} 加入索引的,\cs{equcaption} 完全就是为 +% 了生成公式列表,不产生什么标题。 +% +% 使用方法如下。假如有一个非 equation 数学环境 \texttt{mymath},只要在其中写一 +% 句 \cs{equcaption} 就可以将它加入公式列表。 +% \begin{latex} +% \begin{mymath} +% \label{eq:emc2}\equcaption{\ref{eq:emc2}} +% E=mc^2 +% \end{mymath} +% \end{latex} +% +% \texttt{mymath} 中公式的编号需要自己来做。 +% +% 同图表一样,附录中的公式有时候也不希望它跟全文统一编号,而且不希望它出现在公式 +% 索引中,目前的解决办法就是利用 \cs{tag*}\marg{公式编号} 来解决。用法很简单,此 +% 处不再罗嗦,实例请参看示例文档附录 A 的前两个公式。 +% +% \subsection{封底部分} +% +% \subsubsection{致谢声明} +% \DescribeEnv{acknowledgement} +% 把致谢做成一个环境更好一些,直接往里面写感谢的话就可以啦。 +% \begin{latex} +% \begin{acknowledgement} +% … +% 还要特别感谢 \thuthesis\ 节省了论文排版时间! +% \end{acknowledgement} +% \end{latex} +% +% 本科论文在此处还有一节“声明”,提交版本时需要替换为签字扫描文件,同样我们也提供: +% 如果使用声明扫描页,将可选参数指定为扫描后的 PDF 文件名,例如: +% \begin{latex} +% \begin{acknowledgement}[scan-statement.pdf] +% 加了扫描文件后,这里面的文字就没用了。 +% +% 还要特别感谢计算机系薛瑞尼同学在论文格式和 \LaTeX\ 编译等方面给我的很多帮助! +% \end{acknowledgement} +% \end{latex} +% +% \subsubsection{附录} +% \DescribeEnv{appendix} +% 所有的附录都插到这里来。因为附录会更改默认的 chapter 属性,而后面的{\heiti 个人简 +% 历}又需要恢复,所以实现为环境可以保证全局的属性不受影响。 +% \begin{latex} +% \begin{appendix} +% \input{data/appendix01} +% \input{data/appendix02} +% \end{appendix} +% \end{latex} +% +% \DescribeMacro{\title} +% 附录里主要是本科的外文资料以及翻译,在这种情况下,\cs{chapter} 的标题是固定的 +% (即“外文资料的调研阅读报告或书面翻译”),所以用 \cs{title}\marg{标题} 开排版外 +% 文资料以及翻译的标题。这个命令只能在附录环境下使用。 +% +% \DescribeEnv{translationbib} +% 本环境用来描述外文资料中的参考文献,例子: +% \begin{latex} +% \begin{translationbib} +% \item Donald E. Knuth. The \TeX book. Addison-Wesley, 1984. ISBN: 0-201-13448-9 +% \item Paul W. Abrahams, Karl Berry and Kathryn A. Hargreaves. \TeX\ for the +% Impatient. Addison-Wesley, 1990. ISBN: 0-201-51375-7 +% \item David Salomon. The advanced \TeX book. New York : Springer, 1995. ISBN:0-387-94556-3 +% \end{translationbib} +% \end{latex} +% +% \subsubsection{简历} +% \DescribeEnv{resume} +% 开启个人简历章节,包括个人简历,发表文章,研究成果列表等。每个子项目请 +% 用以下对应命令开启:\cs{xxxitem}\marg{subtitle}。 +% +% \DescribeMacro{\resumeitem} +% 个人简历,用法:\cs{resumeitem}\{个人简历\}。简历内容部分没有格式要求,正常段 +% 落排版。 +% +% \DescribeMacro{\researchitem} +% 发表学术论文,用法:\cs{researchitem}\marg{类别},包括“学术论文”和“研究成果”两 +% 个类别。分别用 \env{publications} 和 \env{achievements} 罗列。 +% +% \DescribeEnv{publications} +% \DescribeMacro{\publicationskip} +% 用 \env{publications} 环境进行罗列发表的论文。按照学校要求,在学期间发表的学术 +% 论文分以下三部分按顺序分别列出,每部分之间空 1 行,序号可连续排列: +% \begin{enumerate} +% \item 已经刊载的学术论文(本人是第一作者,或者导师为第一作者本人是第二作者) +% \item 尚未刊载,但已经接到正式录用函的学术论文(本人为第一作者,或者导师为第一 +% 作者本人是第二作者)。 +% \item 其他学术论文。可列出除上述两种情况以外的其他学术论文,但必须是已经刊载或 +% 者收到正式录用函的论文。 +% \end{enumerate} +% +% \env{publications} 环境支持每一部分分别编写,逻辑上更清楚,为了在环境之间支持 +% 空行,需要利用 \cs{publicationskip} 控制。示例: +% \begin{latex} +% \researchitem{发表的学术论文} +% +% % 1. 已经刊载的学术论文 +% \begin{publications} +% \item Yang Y, Ren T L, Zhang L T, et al. Miniature microphone with silicon- +% based ferroelectric thin films. Integrated Ferroelectrics, 2003, +% 52:229-235. (SCI 收录, 检索号:758FZ.) +% \item 杨轶, 张宁欣, 任天令, 等. 硅基铁电微声学器件中薄膜残余应力的研究. 中国机 +% 械工程, 2005, 16(14):1289-1291. (EI 收录, 检索号:0534931 2907.) +% \item 杨轶, 张宁欣, 任天令, 等. 集成铁电器件中的关键工艺研究. 仪器仪表学报, +% 2003, 24(S4):192-193. (EI 源刊.) +% \end{publications} +% +% % 2. 尚未刊载,但已经接到正式录用函的学术论文 +% \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} +% +% % 3. 其他学术论文。 +% \begin{publications} +% \item Wu X M, Yang Y, Cai J, et al. Measurements of ferroelectric MEMS +% microphones. Integrated Ferroelectrics, 2005, 69:417-429. (SCI 收录, 检索号 +% :896KM) +% \item 贾泽, 杨轶, 陈兢, 等. 用于压电和电容微麦克风的体硅腐蚀相关研究. 压电与声 +% 光, 2006, 28(1):117-119. (EI 收录, 检索号:06129773469) +% \item 伍晓明, 杨轶, 张宁欣, 等. 基于MEMS技术的集成铁电硅微麦克风. 中国集成电路, +% 2003, 53:59-61. +% \end{publications} +% \end{latex} +% +% \DescribeEnv{achievements} +% 研究成果用 \cs{researchitem}\{研究成果\} 开启,随后用 \env{achievements} 环 +% 境罗列。 +% +% 具体用法请参看示例文档 \file{data/resume.tex}。 +% +% \subsection{书脊} +% \DescribeMacro{\shuji} +% 生成装订的书脊,为竖排格式,命令格式:\cs{shuji}\oarg{标题}\oarg{作者}。默认参 +% 数为论文中文题目和中文作者。如果中文题目中没有英文字母,那么直接调用此命令即可。 +% 否则,就要像例子里面那样做一些微调(参看模板自带的 \file{shuji.tex})。下面是一 +% 个例子: +% \begin{latex} +% \documentclass[degree=master]{thuthesis} +% +% \begin{document} +% \thuset{ +% ctitle={论文中文题目}, +% cauthor={中文姓名}} +% +% \shuji % 使用默认标题和默认作者 +% +% \shuji[使用默认作者的标题] +% +% \shuji[同时修改标题和作者的标题][尼瑞薛] +% +% % 如果标题中有英文,那可以参考如下方法进行微调: +% \shuji[清华大学 \raisebox{-5pt}{\LaTeX} 论文模板 \raisebox{-5pt}{v\version} 样例] +% \end{document} +% \end{latex} +% +% \subsection{自定义} +% \label{sec:othercmd} +% +% \subsubsection{数学环境} +% \label{sec:math} +% \thuthesis\ 定义了常用的数学环境: +% +% \begin{center} +% \begin{tabular}{*{7}{l}}\toprule +% axiom & theorem & definition & proposition & lemma & conjecture &\\ +% 公理 & 定理 & 定义 & 命题 & 引理 & 猜想 &\\\midrule +% proof & corollary & example & exercise & assumption & remark & problem \\ +% 证明 & 推论 & 例子& 练习 & 假设 & 注释 & 问题\\\bottomrule +% \end{tabular} +% \end{center} +% +% 比如: +% \begin{latex} +% \begin{definition} +% 道千乘之国,敬事而信,节用而爱人,使民以时。 +% \end{definition} +% \end{latex} +% 产生(自动编号): +% \medskip +% +% \noindent\framebox[\linewidth][l]{{\heiti 定义~1.1~~~} % {道千乘之国,敬事而信,节用而爱人,使民以时。}} +% +% \smallskip +% 列举出来的数学环境毕竟是有限的,如果想用\emph{胡说}这样的数学环境,那么可以定义: +% \begin{latex} +% \newtheorem{nonsense}{胡说}[chapter] +% \end{latex} +% +% 然后这样使用: +% \begin{latex} +% \begin{nonsense} +% 契丹武士要来中原夺武林秘笈。—— 慕容博 +% \end{nonsense} +% \end{latex} +% 产生(自动编号): +% +% \medskip +% \noindent\framebox[\linewidth][l]{{\heiti 胡说~1.1~~~} % {契丹武士要来中原夺武林秘笈。—— 慕容博}} +% +% \subsubsection{列表环境} +% \DescribeEnv{itemize} +% \DescribeEnv{enumerate} +% \DescribeEnv{description} +% 为了适合中文习惯,模板将这三个常用的列表环境用 \pkg{enumitem} 进行了纵向间距压 +% 缩。一方面清除了多余空间,另一方面用户可以自己指定列表环境的样式(如标签符号, +% 缩进等)。细节请参看 \pkg{enumitem} 文档,此处不再赘述。 +% +% \section{致谢} +% \label{sec:thanks} +% 感谢这些年来一直陪伴 \thuthesis\ 成长的新老同学! +% +% 欢迎各位到 \href{http://github.com/xueruini/thuthesis/}{\thuthesis\ Github 主页}贡献! +% +% \StopEventually{\PrintChanges\PrintIndex} +% \clearpage +% +% \section{实现细节} +% +% \subsection{基本信息} +% \begin{macrocode} +%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<cls>\ProvidesClass{thuthesis} +%<cls>[2019/04/27 5.5.2 Tsinghua University Thesis Template] +% \end{macrocode} +% +% 检查编译引擎,要求使用 XeLaTeX。 +% \begin{macrocode} +\RequirePackage{ifxetex} +\ifxetex\else + \ClassError{thuthesis}{You should use XeLaTeX}{} + \end{document} +\fi +% \end{macrocode} +% +% \subsection{定义选项} +% \label{sec:defoption} +% 定义论文类型以及是否涉密 +% \changes{v2.4}{2006/04/14}{添加模板名称命令。} +% \changes{v2.5}{2006/05/19}{增加本科论文的提交选项 submit。} +% \changes{v2.5.1}{2006/05/24}{如果没有设置格式选项,报错。} +% \changes{v2.5.1}{2006/05/26}{submit 只能由本科用。} +% \changes{v2.5.3}{2006/06/03}{submit 选项的一个笔误。} +% \changes{v3.0}{2007/05/12}{删除 submit 选项。} +% \changes{v4.6}{2011/04/26}{增加 postdoctor 选项。} +% \changes{v4.8}{2014/11/25}{v4.7曾经想发布,但是一直没有做,于是就被跳过了,算是造一个段子吧。} +% \changes{v4.8.1}{2014/12/09}{按照 CTAN 的要求整理一下文件。} +% \begin{macrocode} +%<*cls> +\hyphenation{Thu-Thesis} +\def\thuthesis{ThuThesis} +\def\version{5.5.2} +\RequirePackage{kvoptions} +\SetupKeyvalOptions{ + family=thu, + prefix=thu@, + setkeys=\kvsetkeys} +% \end{macrocode} +% +% 用 \pkg{kvoptions} 的 \texttt{key=value} 方式来设置论文类型。 +% \changes{v5.0.0}{2015/12/13}{使用 \pkg{kvoptions} 简化选项 type。} +% \changes{v5.4.2}{2017/12/18}{使用 degree 取代 type 选项。} +% \begin{macrocode} +\DeclareStringOption[doctor]{degree}[doctor] +% \end{macrocode} +% +% 论文是使用英文。 +% \changes{v5.5.0}{2018/12/09}{增加选项使用英文模板。} +% \begin{macrocode} +\DeclareStringOption[chinese]{language}[chinese] +% \end{macrocode} +% +% 论文是否保密。 +% \begin{macrocode} +\DeclareBoolOption{secret} +% \end{macrocode} +% +% 章目录中的英文是否用 Arial 字体(默认关闭),可以分别控制内容和页码部分。 +% \begin{macrocode} +\DeclareBoolOption{tocarialchapter} +\DeclareBoolOption{tocarialchapterentry} +\DeclareBoolOption{tocarialchapterpage} +% \end{macrocode} +% +% +% \option{raggedbottom} 选项(默认打开) +% \changes{v4.8}{2013/03/05}{增加 noraggedbottom 选项。} +% \changes{v5.0.0}{2015/12/13}{norggedbottom 选项修改为 raggedbottom。} +% \begin{macrocode} +\DeclareBoolOption[true]{raggedbottom} +% \end{macrocode} +% +% 将选项传递给 \pkg{ctexbook}。 +% \begin{macrocode} +\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}} +% \end{macrocode} +% +% \changes{v2.5.1}{2006/05/24}{研究生院目录要 times,而教务处要 arial。} +% \changes{v2.5.1}{2006/05/26}{本科 openright,研究生 openany。} +% \changes{v3.1}{2007/10/09}{本科的目录又不要 arial 字体了。} +% \changes{v4.8}{2013/05/29}{添加 nocap 选项,恢复默认标题样式,模板会进一步定制。} +% 解析用户传递过来的选项,并加载 \pkg{ctexbook}。 +% \begin{macrocode} +\ProcessKeyvalOptions* +\newcommand\thu@validate@key[1]{% + \@ifundefined{thu@\csname thu@#1\endcsname true}{% + \ClassError{thuthesis}{Invalid value '\csname thu@#1\endcsname'}{}% + }{% + \csname thu@\csname thu@#1\endcsname true\endcsname + }% +} +\newif\ifthu@bachelor +\newif\ifthu@master +\newif\ifthu@doctor +\newif\ifthu@postdoctor +\thu@validate@key{degree} +\newif\ifthu@chinese +\newif\ifthu@english +\thu@validate@key{language} +% \end{macrocode} +% +% \changes{v5.3.1}{2016/03/20}{使用 \CTeX\ 默认中文字体配置,支持不同引擎。} +% 使用 \pkg{ctexbook} 类,优于调用 \pkg{ctex} 宏包。 +% \begin{macrocode} +\PassOptionsToPackage{quiet}{xeCJK} +\LoadClass[a4paper,openany,UTF8,zihao=-4,scheme=plain]{ctexbook} +% \end{macrocode} +% +% +% \subsection{装载宏包} +% \label{sec:loadpackage} +% +% 引用的宏包和相应的定义。 +% \begin{macrocode} +\RequirePackage{etoolbox} +\RequirePackage{xparse} +% \end{macrocode} +% +% \AmSTeX\ 宏包,用来排出更加漂亮的公式。 +% \changes{v4.8}{2013/03/02}{no need to load amssymb since we use txfonts.} +% \begin{macrocode} +\RequirePackage{amsmath} +% \end{macrocode} +% +% 使用 \pkg{unicode-math} 处理数学字体。 +% \changes{v3.1}{2007/06/16}{replace \pkg{mathptmx} with \pkg{txfonts}.} +% \changes{v5.2.1}{2016/01/14}{使用 \pkg{newtx} 替换 \pkg{txfonts}。} +% \changes{v5.2.2}{2016/02/01}{不希望 \pkg{newtx} 修改 \cs{@makefnmark}。 } +% \changes{v5.5.0}{2018/07/07}{使用 \pkg{unicode-math} 处理数学字体。} +% \begin{macrocode} +\RequirePackage{unicode-math} +% \end{macrocode} +% +% 图形支持宏包。 +% \begin{macrocode} +\RequirePackage{graphicx} +% \end{macrocode} +% +% 并排图形。\pkg{subfigure}、\pkg{subfig} 已经不再推荐,用新的 \pkg{subcaption}。 +% 浮动图形和表格标题样式。\pkg{caption2} 已经不推荐使用,采用新的 \pkg{caption}。 +% \begin{macrocode} +\RequirePackage[labelformat=simple]{subcaption} +% \end{macrocode} +% +% \pkg{pdfpages} 宏包便于我们插入扫描后的授权页和声明页 PDF 文档。 +% \begin{macrocode} +\RequirePackage{pdfpages} +\includepdfset{fitpaper=true} +% \end{macrocode} +% +% 更好的列表环境。 +% \changes{v2.6.2}{2006/06/18}{去掉 \pkg{paralist} 的 \option{newitem} 和 +% \option{newenum} 选项,因为默认是打开的。} +% \changes{v2.6.4}{2006/10/23}{增加 \option{neverdecrease} 选项。} +% \changes{v5.0.0}{2012/12/13}{删除 \pkg{paralist} 选项。} +% \changes{v5.2.2}{2016/01/31}{利用 \pkg{environ} 的 \cs{Collect@Body}。} +% \begin{macrocode} +\RequirePackage[shortlabels]{enumitem} +\RequirePackage{environ} +% \end{macrocode} +% +% 禁止 \LaTeX 自动调整多余的页面底部空白,并保持脚注仍然在底部。 +% 脚注按页编号。 +% \begin{macrocode} +\ifthu@raggedbottom + \RequirePackage[bottom,perpage,hang]{footmisc} + \raggedbottom +\else + \RequirePackage[perpage,hang]{footmisc} +\fi +% \end{macrocode} +% +% 利用 \pkg{CJKfntef} 实现汉字的下划线和盒子内两段对齐,并可以避免 +% \cs{makebox}\oarg{width}\oarg{s} 可能产生的 underful boxes。 +% \begin{macrocode} +\RequirePackage{CJKfntef} +% \end{macrocode} +% +% \changes{v4.8}{2013/05/28}{在 CJK 模式下用 \pkg{CJKspace} 保留中英文间空格。} +% \changes{v5.0.0}{2015/04/17}{固定字体设置,同时改善与 \pkg{ctex} 兼容性。} +% \changes{v5.2.1}{2016/01/14}{使用 \pkg{newtx} 字体。} +% \changes{v5.3.1}{2016/03/20}{\pkg{ctex} 默认加载 \pkg{CJKspace}。} +% \changes{v5.3.1}{2016/03/20}{几乎没人主动安装 Arial 字体。} +% +% 定理类环境宏包,其中 \pkg{amsmath} 选项用来兼容 \AmSTeX\ 的宏包 +% \begin{macrocode} +\RequirePackage[amsmath,thmmarks,hyperref]{ntheorem} +% \end{macrocode} +% +% 表格控制 +% \changes{v2.6}{2006/06/09}{增加 \pkg{longtable}。} +% \begin{macrocode} +\RequirePackage{array} +\RequirePackage{longtable} +% \end{macrocode} +% +% 使用三线表:\cs{toprule},\cs{midrule},\cs{bottomrule}。 +% \begin{macrocode} +\RequirePackage{booktabs} +% \end{macrocode} +% +% 参考文献引用宏包。 +% \begin{macrocode} +\RequirePackage[sort&compress]{natbib} +% \end{macrocode} +% +% 删除默认模板(\file{book.cls})在章之间引入的垂直间隔。要放在 \pkg{hyperref} +% 之前。 +% \begin{macrocode} +% \end{macrocode} +% 生成有书签的 pdf 及其开关,请结合 gbk2uni 避免书签乱码。 +% \changes{v2.6}{2006/06/09}{去除 hyperref 选项,等待全局传递。} +% \changes{v5.2.2}{2016/01/25}{目录中标题和页码都是链接。} +% \begin{macrocode} +\RequirePackage{hyperref} +\hypersetup{ + linktoc = all, + bookmarksnumbered = true, + bookmarksopen = true, + bookmarksopenlevel = 1, + breaklinks = true, + plainpages = false, + hidelinks, +} +\pdfstringdefDisableCommands{ + \let\\\@empty + \let\hspace\@gobble +} +% \end{macrocode} +% +% 设置 url 样式,与上下文一致 +% \begin{macrocode} +\urlstyle{same} +% \end{macrocode} +% +% 使用 \pkg{xurl} 的方法,增加 URL 可断行的位置。 +% \begin{macrocode} +\def\UrlBreaks{% + \do\/% + \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% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:% + \do\*\do\-\do\~\do\'\do\"\do\-} +\Urlmuskip=0mu plus 0.1mu +% \end{macrocode} +% +% +% \subsection{页面设置} +% \label{sec:layout} +% 本来这部分应该是最容易设置的,但根据格式规定出来的结果跟学校的 WORD 样例相差很 +% 大,所以只能微调。 +% \changes{v2.4}{2006/04/14}{把页面尺寸写入 dvi,避免有的用户通 +% 过 dvips 不指定页面类型而得到古怪的结果。} +% \changes{v4.5.2}{2010/09/19}{研究生页面边距由 3.2cm 改为 3cm。} +% \changes{v4.7}{2012/05/29}{修改本科生页脚间距与样例基本一致。} +% \changes{v5.0.0}{2015/03/10}{不再将页面尺寸写入 dvi,因为已不支持 dvips, +% 而该方案会使得在使用 tikzexternalize 时外部 PDF 图片 BBox 不对。} +% \changes{v5.0.0}{2015/12/14}{用 \pkg{geometry} 简化设置。} +% \begin{macrocode} +\RequirePackage{geometry} +\geometry{ + a4paper, % 210 * 297mm + hcentering, + ignoreall, + nomarginpar} +\ifthu@bachelor + \geometry{ + left=32mm, + headheight=5mm, + headsep=5mm, + textheight=227mm, + bottom=32mm, + footskip=12mm} +\else + \geometry{ + left=30mm, + headheight=5mm, + headsep=5mm, + textheight=237mm, + bottom=29mm, + footskip=6mm} +\fi +% \end{macrocode} +% +% 利用 \pkg{fancyhdr} 设置页眉页脚。 +% \begin{macrocode} +\RequirePackage{fancyhdr} +% \end{macrocode} +% +% 利用 \pkg{notoccite} 避免目录中引用编号混乱。 +% \changes{v5.4.4}{2018/04/13}{让目录中的引用不影响正文中引用序号。} +% \begin{macrocode} +\RequirePackage{notoccite} +% \end{macrocode} +% +% \subsection{主文档格式} +% \label{sec:mainbody} +% +% \subsubsection{Three matters} +% \begin{macro}{\cleardoublepage} +% 对于 \textsl{openright} 选项,必须保证章首页右开,且如果前章末页无内容须 +% 清空其页眉页脚。 +% \begin{macrocode} +\let\thu@cleardoublepage\cleardoublepage +\newcommand{\thu@clearemptydoublepage}{% + \clearpage{\pagestyle{thu@empty}\thu@cleardoublepage}} +\let\cleardoublepage\thu@clearemptydoublepage +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frontmatter} +% \begin{macro}{\mainmatter} +% \begin{macro}{\backmatter} +% 我们的单面和双面模式与常规的不太一样。 +% \changes{v2.5.1}{2006/05/23}{本科正文之后页码即用罗马数字,研究生不变。} +% \changes{v2.5.3}{2006/06/03}{第一章永远右开。} +% \changes{v4.4}{2008/05/30}{本科正文后的页码延续前面的阿拉伯数字,不再用罗马数 +% 字。} +% \changes{v4.4}{2008/05/30}{本科取消了所有页眉。} +% \begin{macrocode} +\renewcommand\frontmatter{% + \if@openright\cleardoublepage\else\clearpage\fi + \@mainmatterfalse + \pagenumbering{Alph} + \pagestyle{thu@empty}} +\renewcommand\mainmatter{% + \if@openright\cleardoublepage\else\clearpage\fi + \@mainmattertrue + \pagenumbering{arabic} + \ifthu@bachelor\pagestyle{thu@plain}\else\pagestyle{thu@headings}\fi} +\renewcommand\backmatter{% + \if@openright\cleardoublepage\else\clearpage\fi + \@mainmattertrue} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{字体} +% \label{sec:font} +% 使用 \pkg{fontspec} 配置字体。 +% \begin{macrocode} +\newcommand\thu@fontset{\csname g__ctex_fontset_tl\endcsname} +\ifthenelse{\equal{\thu@fontset}{fandol}}{ + \setmainfont[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]{texgyretermes} + \setsansfont[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic, + ]{texgyreheros} + \setmonofont[ + 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} + } +} +% \end{macrocode} +% +% 使用 \pkg{unicode-math} 配置数学字体 +% \changes{v5.5.2}{2019/04/21}{使用 XITS 数学字体。} +% \begin{macrocode} +\unimathsetup{ + math-style = ISO, + bold-style = ISO, + nabla = upright, + partial = upright, +} +\IfFontExistsTF{XITSMath-Regular.otf}{ + \setmathfont[ + Extension = .otf, + BoldFont = XITSMath-Bold, + StylisticSet = 8, + ]{XITSMath-Regular} + \setmathfont[range={cal,bfcal},StylisticSet=1]{XITSMath-Regular.otf} +}{ + \setmathfont[ + Extension = .otf, + BoldFont = *bold, + StylisticSet = 8, + ]{xits-math} + \setmathfont[range={cal,bfcal},StylisticSet=1]{xits-math.otf} +} +% \end{macrocode} +% +% 在使用 Windows Vista 或之后版本的系统时,\pkg{ctex} 宏包会默认使用微软雅黑字体, +% 这可能会导致审查不合格。下面设置适合印刷的黑体,同时保持跨平台兼容性。 +% \changes{v5.5.0}{2019/01/06}{Windows 的中文字体开启伪粗。} +% \begin{macrocode} +\ifthenelse{\equal{\thu@fontset}{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} +}{} +% \end{macrocode} +% +% \begin{macro}{\normalsize} +% 正文小四号 (12bp) 字,行距为固定值 20 bp。 +% \changes{v5.4.5}{2018/05/17}{调整公式和正文间距。} +% \begin{macrocode} +\renewcommand\normalsize{% + \@setfontsize\normalsize{12bp}{20bp}% + \abovedisplayskip=12bp \@plus 2bp \@minus 2bp + \abovedisplayshortskip=12bp \@plus 2bp \@minus 2bp + \belowdisplayskip=\abovedisplayskip + \belowdisplayshortskip=\abovedisplayshortskip} +% \end{macrocode} +% \end{macro} +% +% WORD 中的字号对应该关系如下(1bp = 72.27/72 pt): +% \begin{center} +% \begin{tabular}{llll} +% \toprule +% 初号 & 42bp & 14.82mm & 42.1575pt \\ +% 小初 & 36bp & 12.70mm & 36.135 pt \\ +% 一号 & 26bp & 9.17mm & 26.0975pt \\ +% 小一 & 24bp & 8.47mm & 24.09pt \\ +% 二号 & 22bp & 7.76mm & 22.0825pt \\ +% 小二 & 18bp & 6.35mm & 18.0675pt \\ +% 三号 & 16bp & 5.64mm & 16.06pt \\ +% 小三 & 15bp & 5.29mm & 15.05625pt \\ +% 四号 & 14bp & 4.94mm & 14.0525pt \\ +% 小四 & 12bp & 4.23mm & 12.045pt \\ +% 五号 & 10.5bp & 3.70mm & 10.59375pt \\ +% 小五 & 9bp & 3.18mm & 9.03375pt \\ +% 六号 & 7.5bp & 2.56mm & \\ +% 小六 & 6.5bp & 2.29mm & \\ +% 七号 & 5.5bp & 1.94mm & \\ +% 八号 & 5bp & 1.76mm & \\\bottomrule +% \end{tabular} +% \end{center} +% +% \begin{macro}{\thu@def@fontsize} +% \changes{v2.6.2}{2006/06/18}{引入此命令重新定义字号。} +% 根据习惯定义字号。用法: +% +% \cs{thu@def@fontsize}\marg{字号名称}\marg{磅数} +% +% 避免了字号选择和行距的紧耦合。所有字号定义时为单倍行距,并提供选项指定行距倍数。 +% \changes{v5.2.3}{2016/02/13}{改写字体定义命令。} +% \begin{macrocode} +\def\thu@def@fontsize#1#2{% + \expandafter\newcommand\csname #1\endcsname[1][1.3]{% + \fontsize{#2}{##1\dimexpr #2}\selectfont}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\chuhao} +% \begin{macro}{\xiaochu} +% \begin{macro}{\yihao} +% \begin{macro}{\xiaoyi} +% \begin{macro}{\erhao} +% \begin{macro}{\xiaoer} +% \begin{macro}{\sanhao} +% \begin{macro}{\xiaosan} +% \begin{macro}{\sihao} +% \begin{macro}{\banxiaosi} +% \begin{macro}{\xiaosi} +% \begin{macro}{\dawu} +% \begin{macro}{\wuhao} +% \begin{macro}{\xiaowu} +% \begin{macro}{\liuhao} +% \begin{macro}{\xiaoliu} +% \begin{macro}{\qihao} +% \begin{macro}{\bahao} +% 一组字号定义。TODO:用 \cs{zihao} 替代。 +% \begin{macrocode} +\thu@def@fontsize{chuhao}{42bp} +\thu@def@fontsize{xiaochu}{36bp} +\thu@def@fontsize{yihao}{26bp} +\thu@def@fontsize{xiaoyi}{24bp} +\thu@def@fontsize{erhao}{22bp} +\thu@def@fontsize{xiaoer}{18bp} +\thu@def@fontsize{sanhao}{16bp} +\thu@def@fontsize{xiaosan}{15bp} +\thu@def@fontsize{sihao}{14bp} +\thu@def@fontsize{banxiaosi}{13bp} +\thu@def@fontsize{xiaosi}{12bp} +\thu@def@fontsize{dawu}{11bp} +\thu@def@fontsize{wuhao}{10.5bp} +\thu@def@fontsize{xiaowu}{9bp} +\thu@def@fontsize{liuhao}{7.5bp} +\thu@def@fontsize{xiaoliu}{6.5bp} +\thu@def@fontsize{qihao}{5.5bp} +\thu@def@fontsize{bahao}{5bp} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{语言设置} +% +% \newcommand\unicodechar[1]{U+#1(\symbol{"#1})} +% 由于 Unicode 的一些标点符号是中西文混用的: +% \unicodechar{00B7}、 +% \unicodechar{2013}、 +% \unicodechar{2014}、 +% \unicodechar{2018}、 +% \unicodechar{2019}、 +% \unicodechar{201C}、 +% \unicodechar{201D}、 +% \unicodechar{2025}、 +% \unicodechar{2026}、 +% \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{% + \ifthu@chinese + \thu@setchinese + \else + \thu@setenglish + \fi +} +% \end{macrocode} +% +% 中英文翻译: +% \begin{macrocode} +\ifthu@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@bachelor + \newcommand\thu@resume@title{在学期间参加课题的研究成果} + \else + \ifthu@postdoctor + \newcommand\thu@resume@title{个人简历、发表的学术论文与科研成果} + \else + \newcommand\thu@resume@title{个人简历、在学期间发表的学术论文与研究成果} + \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{Acknowledgments} + \ifthu@bachelor + \newcommand\thu@resume@title{Research Achievements} + \else + \ifthu@postdoctor + \newcommand\thu@resume@title{% + Resume, Publications and Research Achievements% + } + \else + \newcommand\thu@resume@title{% + Resume, Publications and Research Achievements% + } + \fi + \fi +\fi +% \end{macrocode} +% +% +% \subsubsection{页眉页脚} +% \label{sec:headerfooter} +% +% 定义页眉和页脚。 +% \begin{macro}{\ps@thu@empty} +% \begin{macro}{\ps@thu@plain} +% \begin{macro}{\ps@thu@headings} +% \changes{v2.0}{2005/12/18}{以前的太乱了,重新整理过清晰多了。} +% \changes{v2.1}{2006/03/01}{彻底放弃 fancyhdr,定义自己的样式。} +% \changes{v2.5}{2006/05/13}{本科的奇偶页眉不同。} +% \changes{v2.5}{2006/05/20}{增加 empty 页面样式。} +% \changes{v4.7}{2012/05/29}{本科页码用小五号字。} +% \changes{v5.0.0}{2015/12/20}{利用 \pkg{fancyhdr} 设置页眉页脚。} +% 定义三种页眉页脚格式: +% \begin{itemize} +% \item \texttt{thu@empty}:页眉页脚都没有 +% \item \texttt{thu@plain}:只显示页脚的页码。\cs{chapter} 自动调用 +% \cs{thispagestyle\{thu@plain\}}。 +% \item \texttt{thu@headings}:页眉页脚同时显示 +% \end{itemize} +% \begin{macrocode} +\fancypagestyle{thu@empty}{% + \fancyhf{} + \renewcommand{\headrulewidth}{0pt} + \renewcommand{\footrulewidth}{0pt}} +\fancypagestyle{thu@plain}{% + \fancyhead{} + \fancyfoot[C]{\xiaowu\thepage} + \renewcommand{\headrulewidth}{0pt} + \renewcommand{\footrulewidth}{0pt}} +\fancypagestyle{thu@headings}{% + \fancyhead{} + \fancyhead[C]{\wuhao\normalfont\leftmark} + \fancyfoot{} + \fancyfoot[C]{\wuhao\thepage} + \renewcommand{\headrulewidth}{0.4pt} + \renewcommand{\footrulewidth}{0pt}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsubsection{段落} +% \label{sec:paragraph} +% +% 全文首行缩进 2 字符,标点符号用全角 +% \begin{macrocode} +\ctexset{% + punct=quanjiao, + space=auto, + autoindent=true} +% \end{macrocode} +% +% 利用 \pkg{enumitem} 命令调整默认列表环境间的距离,以符合中文习惯。 +% \changes{v2.5.2}{2006/06/01}{更改默认列表距离。} +% \begin{macrocode} +\setlist{nosep} +% \end{macrocode} +% +% +% \subsubsection{脚注} +% \label{sec:footnote} +% 脚注符合中文习惯,数字带圈。 +% \changes{v2.1}{2006/03/01}{让脚注它悬挂起来,而且中文中用上标,脚注中用正体。} +% \changes{v2.5}{2006/05/13}{修正 minipage 中的脚注。} +% \begin{macro}{\thu@textcircled} +% \changes{v2.5.1}{2006/05/21}{脚注编号使用 \cs{textcircled} 命令,每页允许至多 99 个。} +% \changes{v5.2.2}{2016/02/01}{脚注编号每页允许至多 9 个。} +% \changes{v5.5.0}{2018/12/10}{去掉 \option{pifootnote} 选项。} +% \changes{v5.5.1}{2019/04/16}{修复 minipage 中 footnote 编号问题。} +% 生成带圈的脚注数字,最多处理到 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.}% + \fi + {\thu@circlefont\symbol{\the\numexpr\value{#1}+"245F\relax}}% +} +\renewcommand{\thefootnote}{\thu@textcircled{footnote}} +\renewcommand{\thempfootnote}{\thu@textcircled{mpfootnote}} +% \end{macrocode} +% \end{macro} +% +% 定义脚注分割线,字号(宋体小五),以及悬挂缩进(1.5字符)。 +% \begin{macrocode} +\def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@} +\let\thu@footnotesize\footnotesize +\renewcommand\footnotesize{\thu@footnotesize\xiaowu[1.5]} +\footnotemargin1.5em\relax +% \end{macrocode} +% +% \cs{@makefnmark} 默认是上标样式,而在脚注部分要求为正文大小。利用\cs{patchcmd} +% 动态调整 \cs{@makefnmark} 的定义。 +% \changes{v2.6}{2006/06/09}{脚注改成 1.5 倍行距,漂亮。} +% \changes{v5.2.2}{2016/02/01}{基于 \pkg{footmisc} 来设置不同位置 footnote +% marker 样式。} +% \begin{macrocode} +\let\thu@makefnmark\@makefnmark +\def\thu@@makefnmark{\hbox{{\normalfont\@thefnmark}}} +\pretocmd{\@makefntext}{\let\@makefnmark\thu@@makefnmark}{}{} +\apptocmd{\@makefntext}{\let\@makefnmark\thu@makefnmark}{}{} +% \end{macrocode} +% +% +% \subsubsection{数学相关} +% \label{sec:equation} +% \begin{macro}{\ldots} +% 省略号一律居中,所以 \cs{ldots} 不再居于底部。 +% \begin{macrocode} +\ifthu@chinese + \def\mathellipsis{\cdots} +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\le} +% \begin{macro}{\ge} +% \begin{macro}{\leq} +% \begin{macro}{\geq} +% 小于等于号要使用倾斜的形式。 +% \begin{macrocode} +\protected\def\le{\leqslant} +\protected\def\ge{\geqslant} +\AtBeginDocument{% + \renewcommand\leq{\leqslant}% + \renewcommand\geq{\geqslant}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int} +% 积分号 \cs{int} 使用正体,并且上下限默认置于积分号上下两侧。 +% \begin{macrocode} +\removenolimits{% + \int\iint\iiint\iiiint\oint\oiint\oiiint + \intclockwise\varointclockwise\ointctrclockwise\sumint + \intbar\intBar\fint\cirfnint\awint\rppolint + \scpolint\npolint\pointint\sqint\intlarhk\intx + \intcap\intcup\upint\lowint +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Re} +% \begin{macro}{\Im} +% 实部、虚部操作符使用罗马体 $\mathrm{Re}$、$\mathrm{Im}$ 而不是 fraktur 体 +% $\Re$、$\Im$。 +% \begin{macrocode} +\AtBeginDocument{% + \renewcommand{\Re}{\operatorname{Re}}% + \renewcommand{\Im}{\operatorname{Im}}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\nabla} +% \cs{nabla} 使用粗正体。 +% \begin{macrocode} +\AtBeginDocument{% + \renewcommand\nabla{\mbfnabla}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\bm} +% \begin{macro}{\boldsymbol} +% 兼容旧的粗体命令:\pkg{bm} 的 \cs{bm} 和 \pkg{amsmath} 的 \cs{boldsymbol}。 +% \begin{macrocode} +\newcommand\bm{\symbf} +\renewcommand\boldsymbol{\symbf} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\square} +% 兼容 \pkg{amssymb} 中的命令。 +% \begin{macrocode} +\newcommand\square{\mdlgwhtsquare} +% \end{macrocode} +% \end{macro} +% +% 允许太长的公式断行、分页等。 +% \begin{macrocode} +\allowdisplaybreaks[4] +\renewcommand\theequation{\ifnum \c@chapter>\z@ \thechapter-\fi\@arabic\c@equation} +% \end{macrocode} +% +% 公式距前后文的距离由 4 个参数控制,参见 \cs{normalsize} 的定义。 +% +% \changes{v2.5.1}{2006/05/24}{本科公式编号前添加\textbf{公式}二字。需要修 \pkg{amsmath} 极其深的一个命令。} +% \changes{v2.5.1}{2006/05/24}{教务处居然要本科论文公式全文编号!} +% \changes{v2.5.2}{2006/05/29}{上一个版本忘了把研究生的公式编号排除。} +% \changes{v3.0}{2007/05/12}{本科公式又要取消全文统一编号了。} +% 本科的公式编号要求很诡异,不得不修改 \pkg{amsmath} 中很深的一个命令 \cs{tagform@}。 +% \changes{v2.6.2}{2006/06/19}{根据不同论文格式显示不同公式编号,并自动加入索引。} +% \changes{v4.2}{2008/01/23}{\cs{eqref} 加括号。} +% 同时为了让 \pkg{amsmath} 的 \cs{tag*} 命令得到正确的格式,我们必须修改这些代 +% 码。\cs{make@df@tag} 是定义 \cs{tag*} 和 \cs{tag} 内部命令的。 +% \cs{make@df@tag@@} 处理 \cs{tag*},我们就改它! +% \begin{latex} +% \def\make@df@tag{\@ifstar\make@df@tag@@\make@df@tag@@@} +% \def\make@df@tag@@#1{% +% \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}} +% \end{latex} +% \changes{v4.4}{2008/05/30}{本科论文终于去掉了\textbf{公式}二字。} +% \changes{v4.4.4}{2008/06/12}{修复了一个从 v4.3 升级到 v4.4 过程中的丢失公式索引的 bug,原修改代码保留备忘。} +% \changes{v5.2.3}{2016/02/13}{安全注释本科公式部分。} +% \begin{macrocode} +\def\make@df@tag{\@ifstar\thu@make@df@tag@@\make@df@tag@@@} +\def\thu@make@df@tag@@#1{\gdef\df@tag{\thu@maketag{#1}\def\@currentlabel{#1}}} +\iffalse +\ifthu@bachelor + \def\thu@maketag#1{\maketag@@@{% + (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)}} + \def\tagform@#1{\maketag@@@{% + (\ignorespaces\text{\equationname\hskip0.5em}#1\unskip\@@italiccorr)\equcaption{#1}}} +\fi +\fi +\def\thu@maketag#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)}} +\def\tagform@#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)\equcaption{#1}}} +% \end{macrocode} +% 修改 \cs{tagform} 会影响 \cs{eqref}。 +% \begin{macrocode} +\renewcommand{\eqref}[1]{\textup{(\ref{#1})}} +% \end{macrocode} +% +% 定理标题使用黑体,正文使用宋体,冒号隔开。 +% \changes{v2.6.2}{2006/06/17}{增加问题和猜想两个数学环境。} +% \changes{v4.2}{2008/03/07}{调整证明环境的编号和结尾的方块。} +% \changes{v5.0.0}{2015/04/18}{修正定理字样为黑体 (\#104)。} +% \changes{v5.3.2}{2017/05/01}{定理环境格式设置(环境标题和环境正文字体设置)统一放置到 .cfg 文件中。} +% \changes{v5.5.0}{2019/01/08}{移除 cfg 文件。} +% \begin{macrocode} +\theorembodyfont{\normalfont} +\theoremheaderfont{\normalfont\sffamily} +\theoremsymbol{\ensuremath{\square}} +\newtheorem*{proof}{\thu@proof@name} +\theoremstyle{plain} +\theoremsymbol{} +\theoremseparator{\thu@theorem@separator} +\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] +% \end{macrocode} +% +% \subsubsection{浮动对象以及表格} +% \label{sec:float} +% 设置浮动对象和文字之间的距离 +% \changes{v2.6}{2006/06/09}{增加 \cs{floatsep},\cs{@fptop},\cs{@fpsep} 和 \cs{@fpbot}。} +% \changes{v5.5.0}{2019/03/15}{修正图表标题与文字之间的距离。} +% \begin{macrocode} +\setlength{\floatsep}{12bp \@plus 2bp \@minus 4bp} +\setlength{\textfloatsep}{12bp} +\setlength{\intextsep}{12bp} +\setlength{\@fptop}{0bp \@plus1.0fil} +\setlength{\@fpsep}{12bp \@plus2.0fil} +\setlength{\@fpbot}{0bp \@plus1.0fil} +% \end{macrocode} +% +% 下面这组命令使浮动对象的缺省值稍微宽松一点,从而防止幅度对象占据过多的文本页面, +% 也可以防止在很大空白的浮动页上放置很小的图形。 +% \begin{macrocode} +\renewcommand{\textfraction}{0.15} +\renewcommand{\topfraction}{0.85} +\renewcommand{\bottomfraction}{0.65} +\renewcommand{\floatpagefraction}{0.60} +% \end{macrocode} +% +% 定制浮动图形和表格标题样式 +% \begin{itemize} +% \item 图表标题字体为 11pt, 这里写作大五号 +% \item 去掉图表号后面的冒号。图序与图名文字之间空一个汉字符宽度。 +% \item 图:caption 在下,段前空 6 磅,段后空 12 磅 +% \item 表:caption 在上,段前空 12 磅,段后空 6 磅 +% \end{itemize} +% \changes{v2.4}{2006/04/14}{表格内容为 11 磅。} +% \changes{v2.4}{2006/04/14}{图表标题左对齐,取消原先漂亮的 hang 模式。} +% \changes{v2.5}{2006/05/13}{标题上下间距重调,以前没有考虑 \cs{intextsep} 的影响。} +% \changes{v2.5.1}{2006/05/23}{增加 \pkg{subfigure} 和 \pkg{subtable} 的 caption 配置。} +% \changes{v2.5.1}{2006/05/24}{重新定义表格默认字体。} +% \changes{v2.5.3}{2006/06/07}{不管 caption 出现在什么位置,\cs{aboveskip} 总是出现在标题和浮动体之间的距离。} +% \changes{v4.3}{2008/03/11}{子图引用时加括号。} +% \changes{v5.0.0}{2015/06/27}{本科附录图表编号用-不用.(如图A-1,表A-2)。} +% \begin{macrocode} +\ifthu@bachelor + \g@addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}} + \g@addto@macro\appendix{\renewcommand*{\thetable}{\thechapter-\arabic{table}}} +\fi +\let\old@tabular\@tabular +\def\thu@tabular{\dawu[1.5]\old@tabular} +\DeclareCaptionFont{thu}{\dawu[1.3]} +\DeclareCaptionLabelSeparator{thu}{\hspace{\ccwd}} +\captionsetup{ + font = thu, + labelsep = thu, + skip = 6bp, + figureposition = bottom, + tableposition = top, +} +\captionsetup[sub]{font=thu} +\renewcommand{\thesubfigure}{(\alph{subfigure})} +\renewcommand{\thesubtable}{(\alph{subtable})} +% \renewcommand{\p@subfigure}{:} +% \end{macrocode} +% 我们采用 \pkg{longtable} 来处理跨页的表格。同样我们需要设置其默认字体为五号。 +% \changes{v2.5.3}{2006/06/08}{增加对 \pkg{longtable} 的处理。} +% \changes{v4.5.1}{2009/01/06}{太好了,不用处理 \pkg{longtable} 的 \cs{caption} +% 了。} +% \begin{macrocode} +\let\thu@LT@array\LT@array +\def\LT@array{\dawu[1.5]\thu@LT@array} % set default font size +% \end{macrocode} +% +% \begin{macro}{\hlinewd} +% 简单的表格使用三线表推荐用 \cs{hlinewd}。如果表格比较复杂还是用 \pkg{booktabs} 的命 +% 令好一些。 +% \begin{macrocode} +\def\hlinewd#1{% + \noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet + \reserved@a\@xhline} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{章节标题} +% \label{sec:theor} +% \changes{v2.5}{2006/05/19}{增加索引名称定义。} +% \begin{macrocode} +\ifthu@bachelor + \newcommand{\cabstractname}{中文摘要} + \newcommand{\eabstractname}{ABSTRACT} +\else + \newcommand{\cabstractname}{摘\hspace{\ccwd}要} + \newcommand{\eabstractname}{Abstract} +\fi +\let\CJK@todaysave=\today +\def\CJK@todaysmall@short{\the\year 年 \the\month 月} +\def\CJK@todaysmall{\the\year 年 \the\month 月 \the\day 日} +\def\CJK@todaybig@short{\zhdigits{\the\year}年\zhnumber{\the\month}月} +\def\CJK@todaybig{\zhdigits{\the\year}年\zhnumber{\the\month}月\zhnumber{\the\day}日} +\def\CJK@today{\CJK@todaysmall} +\renewcommand\today{\CJK@today} +\newcommand\CJKtoday[1][1]{% + \ifcase#1\def\CJK@today{\CJK@todaysave} + \or\def\CJK@today{\CJK@todaysmall} + \or\def\CJK@today{\CJK@todaybig} + \fi} +% \end{macrocode} +% +% \pkg{fancyhdr} 定义页眉页脚很方便,但是有一个非常隐蔽的坑。通过 \pkg{fancyhdr} +% 定义的样式在第一次被调用时会修改 \cs{chaptermark},这会导致页眉信息错误(多余 +% 章号并且英文大写)。这是因为在原始的 \file{book.cls} 中定义如下(大意): +% \begin{latex} +% \newcommand\chaptername{Chapter} +% \newcommand\@chapapp{\chaptername} +% \def\chaptermark#1{ +% \markboth{\MakeUppercase{\@chapapp\ \thechapter}}{}} +% \end{latex} +% 很显然这个 \cs{\@chapapp} 不适合中文,因此我们使用\cs{CTEXthechapter}( +% 如,“第 x 章”),同时会将 \cs{MakeUppercase} 去掉。也就是说我们会做如下动作: +% \begin{latex} +% \renewcommand{\chaptermark}[1]{\@mkboth{\CTEXthechapter\hskip\ccwd#1}{}} +% \end{latex} +% 但,\pkg{fancyhdr} 不知何故在 \cs{ps@fancy} 中对 \cs{chaptermark} 进行重定义 +% (其实一模一样),而这个 \cs{ps@fancy} 会在 \cs{fancypagestyle} 中使用,如下: +% \begin{latex} +% \newcommand{\fancypagestyle}[2]{% +% \@namedef{ps@#1}{\let\fancy@gbl\relax#2\relax\ps@fancy}} +% \end{latex} +% 这样的话,\cs{ps@fancy} 会在 \pkg{fancyhdr} 定义的任何样式首次样被激活时调用,从 +% 而覆盖我们的 \cs{chaptermark} 定义(后续样式再激活不会重复覆盖)。所以我们采用如下 +% 方法解决: +% \begin{macrocode} +\AtBeginDocument{% + \pagestyle{thu@empty} + \renewcommand{\chaptermark}[1]{\@mkboth{\CTEXthechapter\hskip\ccwd#1}{}}} +% \end{macrocode} +% +% 各级标题格式设置。 +% \changes{v5.0.0}{2012/12/23}{用 \cs{ctexset} 来设置,替换复杂的 \cs{@startsection}。} +% \begin{description} +% \item[chapter] 章序号与章名之间空一个汉字符 黑体三号字,居中书写,单倍行距,段 +% 前空 24 磅,段后空 18 磅。本科要求:段前段后间距 30/20 pt,行距 20pt。但正文 +% 章节 30pt 的话和样例效果不一致。 +% +% \changes{v2.5}{2006/05/13}{取消 \pkg{titlesec} 宏包,用基本 \LaTeX\ 命令格式化标题。} +% \changes{v2.5.1}{2006/05/23}{让 \cs{chapter*} 自动 \cs{markboth}。} +% \changes{v3.1}{2006/06/16}{英文摘要标题要搞特殊化。} +% \changes{v5.0.0}{2015/04/17}{修正章节间距问题(\#57)} +% +% \item[section] 一级节标题,例如:\fbox{2.1 实验装置与实验方法}。节标题序号与标 +% 题名之间空一个汉字符(下同)。采用黑体四号(14pt)字居左书写,行距为固定 +% 值 20 磅,段前空 24 磅,段后空 6 磅。本科:25/12 pt,行距 18pt。 +% +% \changes{v4.4}{2008/06/04}{调整段前距为 -20bp 而不是原来的 -24bp。} +% +% \item[subsection] 二级节标题,例如:\fbox{2.1.1 实验装置}。采用黑体 13pt 字居左 +% 书写,行距为固定值 20 磅,段前空 12 磅,段后空 6 磅。本科:中文黑体 12pt 字, +% 英文 13pt 字,段间距 12/6 pt,行距 15pt。 +% +% \changes{v4.4}{2008/06/04}{修改本科生模板的二级节标题为小四而不是半小四。} +% \changes{v4.4}{2008/06/04}{调整段前距为 -12bp 而不是原来的 -16bp。} +% +% \item[subsubsection] 三级节标题,例如:\fbox{2.1.2.1 归纳法}。采用黑体小四号 +% (12pt)字居左书写,行距为固定值 20 磅,段前空 12 磅,段后空 6 磅。 +% +% \changes{v4.4}{2008/06/04}{调整段前距为 -12bp 而不是原来的 -16bp。} +% \end{description} +% \begin{macrocode} +\newcommand\thu@chapter@titleformat[1]{% + \ifthu@bachelor #1\else% + \ifthenelse% + {\equal{#1}{\eabstractname}}% + {\bfseries #1}% + {#1}% + \fi} +\ctexset{% + chapter={ + afterindent=true, + pagestyle={\ifthu@bachelor thu@plain\else thu@headings\fi}, + beforeskip={\ifthu@bachelor 15bp\else 9bp\fi}, + aftername=\hskip\ccwd, + afterskip={\ifthu@bachelor 20bp\else 24bp\fi}, + format={\centering\sffamily\ifthu@bachelor\xiaosan[1.333]\else\sanhao[1]\fi}, + nameformat=\relax, + numberformat=\relax, + titleformat=\thu@chapter@titleformat, + lofskip=0pt, + lotskip=0pt, + }, + section={ + afterindent=true, + beforeskip={\ifthu@bachelor 25bp\else 24bp\fi\@plus 1ex \@minus .2ex}, + afterskip={\ifthu@bachelor 12bp\else 6bp\fi \@plus .2ex}, + format={\sffamily\ifthu@bachelor\sihao[1.286]\else\sihao[1.429]\fi}, + }, + subsection={ + afterindent=true, + beforeskip={\ifthu@bachelor 12bp\else 16bp\fi\@plus 1ex \@minus .2ex}, + afterskip={6bp \@plus .2ex}, + format={\sffamily\ifthu@bachelor\xiaosi[1.25]\else\banxiaosi[1.538]\fi}, + numberformat={\sffamily\ifthu@bachelor\banxiaosi[1.154]\else\banxiaosi[1.538]\fi}, + }, + subsubsection={ + afterindent=true, + beforeskip={\ifthu@bachelor 12bp\else 16bp\fi\@plus 1ex \@minus .2ex}, + afterskip={6bp \@plus .2ex}, + format={\sffamily\ifthu@bachelor\xiaosi[1.25]\else\xiaosi[1.667]\fi}, + }, + paragraph/afterindent=true, + subparagraph/afterindent=true} +% \end{macrocode} +% +% \begin{macro}{\thu@chapter*} +% \changes{v2.5.2}{2006/05/29}{定义自己的 \cs{thu@chapter*}。} +% 默认的 \cs{chapter*} 很难同时满足研究生院和本科生的论文要求。本科论文要求所有的 +% 章都出现在目录里,比如摘要、Abstract、主要符号表等,所以可以简单的扩展默 +% 认\cs{chapter*} 实现这个目的。但是研究生又不要这些出现在目录中,而且致谢和声明 +% 部分的章名、页眉和目录都不同,所以定义一个灵活的 \cs{thu@chapter*} 专门处理这些 +% 要求。 +% +% \cs{thu@chapter*}\oarg{tocline}\marg{title}\oarg{header}: tocline 是出现在目录 +% 中的条目,如果为空则此 chapter 不出现在目录中,如果省略表示目录出现 title; +% title 是章标题;header 是页眉出现的标题,如果忽略则取 title。通过这个宏我才真 +% 正体会到 \TeX\ macro 的力量! +% \begin{macrocode} +\newcounter{thu@bookmark} +\NewDocumentCommand\thu@chapter{s o m o}{ + \IfBooleanF{#1}{% + \ClassError{thuthesis}{You have to use the star form: \string\thu@chapter*}{} + }% + \if@openright\cleardoublepage\else\clearpage\fi\phantomsection% + \IfValueTF{#2}{% + \ifthenelse{\equal{#2}{}}{% + \addtocounter{thu@bookmark}\@ne + \pdfbookmark[0]{#3}{thuchapter.\thethu@bookmark} + }{% + \addcontentsline{toc}{chapter}{#3} + } + }{% + \addcontentsline{toc}{chapter}{#3} + }% + \ifthu@bachelor \ctexset{chapter/beforeskip=25bp} \fi + \chapter*{#3}% + \ifthu@bachelor \ctexset{chapter/beforeskip=15bp} \fi + \IfValueTF{#4}{% + \ifthenelse{\equal{#4}{}} + {\@mkboth{}{}} + {\@mkboth{#4}{#4}} + }{% + \@mkboth{#3}{#3} + } +} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{目录} +% \label{sec:toc} +% 最多 4 层,即: x.x.x.x,对应的命令和层序号分别是: +% \cs{chapter}(0), \cs{section}(1), \cs{subsection}(2), \cs{subsubsection}(3)。 +% \changes{v3.1}{2007/10/09}{博士论文目录只出现到第 3 级标题即可。} +% \changes{v5.0.0}{2015/05/21}{硕士博士论文目录只出现到第 3 级标题即可。其他未明确要求。} +% \begin{macrocode} +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{2} +% \end{macrocode} +% +% 每章标题行前空 6 磅,后空 0 磅。章节名中英文用 Arial 字体,页码仍用 Times。 +% \begin{macro}{\tableofcontents} +% \changes{v2.0}{2005/12/18}{附录的目录项需要调整一下。以及公式编号方式等等。} +% \changes{v2.5}{2006/05/13}{取消 \pkg{titletoc} 宏包,用 \cs{dottedtocline} 调整 +% 目录。} +% \changes{v2.5.1}{2006/05/23}{减小目录项中的导引小点跟页码之间的留白。} +% \changes{v2.5.2}{2006/05/29}{用 \cs{thu@chapter*} 改写目录命令。} +% \changes{v3.0}{2007/05/12}{缩小目录中标题与页码之间\textbf{点}之间的距离。} +% \changes{v4.0}{2007/11/08}{本科研究生目录字号行距都不同。} +% \changes{v4.4}{2008/06/04}{本科生目录字号改回\cs{xiaosi}\oarg{1.8}。} +% \changes{v4.4}{2008/06/04}{本科生目录缩进要求不同。} +% \changes{v4.4}{2008/06/18}{本科章目录项一直用黑体 (Arial)。} +% 目录生成命令。 +% \begin{macrocode} +\renewcommand\tableofcontents{% + \thu@chapter*[]{\contentsname} + \ifthu@bachelor\xiaosi[1.667]\else\xiaosi[1.65]\fi\@starttoc{toc}\normalsize} +% \end{macrocode} +% 调整目录样式,允许指定目录字体。 +% \changes{v5.2.2}{2016/01/23}{用 \cs{patchcmd} 修改 \cs{@dottedtocline}。} +% \begin{macrocode} +\def\@pnumwidth{2em} +\def\@tocrmarg{\@pnumwidth} +\def\@dotsep{1} +\ifthu@tocarialchapter + \thu@tocarialchapterentrytrue\thu@tocarialchapterpagetrue +\fi +\def\thu@toc@chapter@entry@font{\ifthu@tocarialchapterentry\sffamily\fi} +\def\thu@toc@chapter@page@font{\ifthu@tocarialchapterpage\sffamily\fi} +\renewcommand*\l@chapter[2]{% + \ifnum \c@tocdepth >\m@ne + \addpenalty{-\@highpenalty}% + \ifthu@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 + {\thu@toc@chapter@entry@font #1}% + \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill% + \nobreak{\thu@toc@chapter@page@font #2}\par + \penalty\@highpenalty + \endgroup + \fi} +% \end{macrocode} +% +% 研究生学位论文写作指南中规定:目录中的章标题行居左书写,一级节标题行缩进 1 个 +% 汉字符,二级节标题行缩进 2 个汉字符(但示例文件中为 1.5 个汉字符)。本科生指 +% 南中未作明确规定,示例文件中对于一级和二级节标题分别缩进 1 和 1.5 个汉字符。 +% \changes{v5.0.0}{2015/04/28}{修正学位论文中目录里节前缩进(\#103)} +% \begin{macrocode} +% \patchcmd{\@dottedtocline}{#4}{\csname thu@toc@font\endcsname #4}{}{} +\patchcmd{\@dottedtocline}{\hb@xt@\@pnumwidth}{\hbox}{}{} +\renewcommand*\l@section{% + \@dottedtocline{1}{\ccwd}{2.1em}} +\renewcommand*\l@subsection{% + \@dottedtocline{2}{\ifthu@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}} +\renewcommand*\l@subsubsection{% + \@dottedtocline{3}{\ifthu@bachelor 2.4em\else 3.5em\fi}{3.8em}} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{封面和封底} +% \label{sec:cover} +% \begin{macro}{\thu@def@term} +% 方便的定义封面的一些替换命令。 +% \changes{v2.6.2}{2006/06/18}{引入 \cs{thu@def@term} 定义封面命令。} +% \changes{v3.1}{2006/06/16}{重新定义摘要为环境,long 选项不需要了。} +% \begin{macrocode} +\def\thu@def@term#1{% + \define@key{thu}{#1}{\csname #1\endcsname{##1}} + \expandafter\gdef\csname #1\endcsname##1{% + \expandafter\gdef\csname thu@#1\endcsname{##1}} + \csname #1\endcsname{}} +% \end{macrocode} +% \end{macro} +% +% \changes{v2.0}{2005/12/18}{增加了封面密级,增加博士封面支持} +% \changes{v4.6}{2011/04/27}{增加博士后相关指令。} +% +% 定义密级参数。 +% \begin{macrocode} +\thu@def@term{secretlevel} +\thu@def@term{secretyear} +% \end{macrocode} +% +% 论文中英文题目。 +% \begin{macrocode} +\thu@def@term{ctitle} +\thu@def@term{etitle} +% \end{macrocode} +% +% 作者、导师、副导师、联合指导老师。 +% \begin{macrocode} +\thu@def@term{cauthor} +\thu@def@term{csupervisor} +\thu@def@term{cassosupervisor} +\thu@def@term{ccosupervisor} +\thu@def@term{eauthor} +\thu@def@term{esupervisor} +\thu@def@term{eassosupervisor} +\thu@def@term{ecosupervisor} +% \end{macrocode} +% +% 学位中英文。 +% \begin{macrocode} +\thu@def@term{cdegree} +\thu@def@term{edegree} +% \end{macrocode} +% +% 院系中英文名称。 +% \begin{macrocode} +\thu@def@term{cdepartment} +\thu@def@term{edepartment} +% \end{macrocode} +% +% 学位中英文名称。 +% \changes{v2.5}{2006/05/20}{院系和专业分别改名用 department 和 major,代替原来 +% 的 affil 和 subject。} +% \begin{macrocode} +\thu@def@term{cmajor} +\thu@def@term{emajor} +% \end{macrocode} +% +% 论文成文日期。 +% \begin{macrocode} +\thu@def@term{cdate} +\thu@def@term{edate} +% \end{macrocode} +% +% 博士后专用封面参数。 +% \begin{macrocode} +\thu@def@term{id} +\thu@def@term{udc} +\thu@def@term{catalognumber} +\thu@def@term{cfirstdiscipline} +\thu@def@term{cseconddiscipline} +\thu@def@term{postdoctordate} +\thu@def@term{postdocstartdate} +\thu@def@term{postdocenddate} +% \end{macrocode} +% +% 摘要最好以环境的形式出现(否则命令的形式会导致开始结束的括号距离太远,我不喜 +% 欢),这就必须让环境能够自己保存内容留待以后使用。使用 \pkg{environ} 的 +% \cs{Collect@Body} 来实现。 +% \changes{v3.1}{2006/06/17}{重新定义摘要成为环境。} +% \changes{v5.2.2}{2016/01/31}{用 \pkg{environ} 封装的 \cs{Collect@Body}。} +% \begin{macrocode} +\newcommand{\thu@@cabstract}[1]{\long\gdef\thu@cabstract{#1}} +\newenvironment{cabstract}{\Collect@Body\thu@@cabstract}{} +\newcommand{\thu@@eabstract}[1]{\long\gdef\thu@eabstract{#1}} +\newenvironment{eabstract}{\Collect@Body\thu@@eabstract}{} +% \end{macrocode} +% +% \begin{macro}{\thu@parse@keywords} +% 不同论文格式关键词之间的分割不太相同,我们用 \cs{ckeywords} 和 +% \cs{ekeywords} 来收集关键词列表,然后用本命令来生成符合要求的格式。 +% \begin{macrocode} +\def\thu@parse@keywords#1{ + \define@key{thu}{#1}{\csname #1\endcsname{##1}} + \expandafter\gdef\csname thu@#1\endcsname{} + \expandafter\gdef\csname #1\endcsname##1{ + \@for\reserved@a:=##1\do{ + \expandafter\ifx\csname thu@#1\endcsname\@empty\else + \expandafter\g@addto@macro\csname thu@#1\endcsname{% + \ignorespaces\csname thu@#1@separator\endcsname} + \fi + \expandafter\expandafter\expandafter\g@addto@macro% + \expandafter\csname thu@#1\expandafter\endcsname\expandafter{\reserved@a}}}} +% \end{macrocode} +% \end{macro} +% 利用 \cs{thu@parse@keywords} 来定义,内部通过 \cs{thu@ckeywords} 和 +% \cs{thu@ekeywords} 来引用。 +% \changes{v3.1}{2007/06/16}{增强的关键词命令。} +% \begin{macrocode} +\thu@parse@keywords{ckeywords} +\thu@parse@keywords{ekeywords} +% \end{macrocode} +% +% \begin{macro}{\thusetup} +% \changes{v5.1.0}{2015/12/26}{通过 \cs{thusetup} 统一设置封面信息。} +% 由上可见,封面和封底有一大堆信息需要设置,为了简化操作界面,提供一 +% 个 \cs{thusetup} 命令支持 key/value 的方式来设置。key 就是前面各个设置项的 +% 名字。\note[说明:]{只能设置普通项,不支持环境项, +% 如 \texttt{cabstract} 和 \texttt{eabstract}。} 由于这些设置项被 \cs{makecover} +% 调用,所以此命令需要在 \cs{makecover} 之前被调用。 +% \begin{macrocode} +\def\thusetup{\kvsetkeys{thu}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.4rc1}{2005/12/14}{I have to put all chinese chars into cfg, +% otherwise they would not appear.} +% \changes{v2.5.1}{2006/05/25}{硕士封面的冒号前居然有点小距离!} +% \changes{v3.1}{2007/10/09}{去掉配置文件中的 \cs{hfill}。} +% \changes{v3.1}{2007/10/09}{\textbf{内部}密级前面要五角星了。} +% \changes{v4.0}{2007/11/08}{\textbf{内部}密级前面终究还是不要五角星了。} +% \changes{v4.4.2}{2008/06/05}{本科生格式终于也开始用空格作为关键字分隔符了。} +% \changes{v4.4.2}{2008/06/07}{本科生签名之间距离改为 \cs{hskip1em}。} +% \changes{v4.5.2}{2010/05/29}{本科论文日期具体到日。} +% \changes{v4.6}{2011/04/26}{增加博士后相关配置。} +% \changes{v4.7}{2012/05/27}{修正本科生作者信息名称。} +% \changes{v4.7}{2012/05/27}{本科生关键字也用分号分割了。} +% \changes{v5.3.0}{2016/03/11}{更新到研究生院 2016.3 指南。} +% 定义封面用到的各种文字。 +% \begin{macrocode} +\def\thu@ckeywords@separator{;} +\def\thu@ekeywords@separator{;} +\def\thu@title@sep{:} +\ifthu@postdoctor + \def\thu@secretlevel{密级} +\else + \def\thu@secretlevel{秘密} +\fi +\def\thu@secretyear{\the\year} +\def\thu@schoolname{清华大学} +\def\thu@bachelor@subtitle{综合论文训练} +\def\thu@bachelor@title@pre{题目} +\def\thu@postdoctor@date@title{研究起止日期} +\ifthu@postdoctor + \def\thu@author@title{博士后姓名} +\else + \ifthu@bachelor + \def\thu@author@title{姓名} + \else + \def\thu@author@title{研究生} + \fi +\fi +\def\thu@postdoctor@first@discipline@title{流动站(一级学科)名称} +\def\thu@postdoctor@second@discipline@title{专\hspace{1em}业(二级学科)名称} +\def\thu@secret@content{% + \unskip\ifthu@master$\bigstar$ \fi% + \ifthu@doctor$\bigstar$ \fi% + \thu@secretyear 年} +\def\thu@apply{(申请清华大学\thu@cdegree 学位论文)} +\ifthu@bachelor + \def\thu@department@title{系别} + \def\thu@major@title{专业} +\else + \def\thu@department@title{培养单位} + \def\thu@major@title{学科} +\fi +\ifthu@postdoctor + \def\thu@supervisor@title{合作导师} +\else + \def\thu@supervisor@title{指导教师} +\fi +\ifthu@bachelor + \def\thu@assosuper@title{辅导教师} +\else + \def\thu@assosuper@title{副指导教师} +\fi +\def\thu@cosuper@title{% + \ifthu@doctor 联合导师\else \ifthu@master 联合指导教师\fi\fi} +\cdate{\ifthu@bachelor\CJK@todaysmall\else\ifthu@postdoctor\CJK@todaysmall@short\else\CJK@todaybig@short\fi\fi} +\edate{\ifcase \month \or January\or February\or March\or April\or May% + \or June\or July \or August\or September\or October\or November + \or December\fi\unskip,\ \ \the\year} +\newcommand{\thu@authtitle}{关于学位论文使用授权的说明} +\newcommand{\thu@authorization}{% +\ifthu@bachelor +本人完全了解清华大学有关保留、使用学位论文的规定,即:学校有权保留学位 +论文的复印件,允许该论文被查阅和借阅;学校可以公布该论文的全部或部分内 +容,可以采用影印、缩印或其他复制手段保存该论文。 +\else +本人完全了解清华大学有关保留、使用学位论文的规定,即: + +清华大学拥有在著作权法规定范围内学位论文的使用权,其中包括:(1)已获学位的研究生 +必须按学校规定提交学位论文,学校可以采用影印、缩印或其他复制手段保存研究生上交的 +学位论文;(2)为教学和科研目的,学校可以将公开的学位论文作为资料在图书馆、资料 +室等场所供校内师生阅读,或在校园网上供校内师生浏览部分内容\ifthu@master 。\else ; +(3)根据《中华人民共和国学位条例暂行实施办法》,向国家图书馆报送可以公开的学位 +论文。\fi + +本人保证遵守上述规定。 +\fi} +\newcommand{\thu@authorizationaddon}{% + \ifthu@bachelor(涉密的学位论文在解密后应遵守此规定)\else (保密的论文在解密后应遵守此规定)\fi} +\newcommand{\thu@authorsig}{\ifthu@bachelor 签\hskip1em名:\else 作者签名:\fi} +\newcommand{\thu@teachersig}{导师签名:} +\newcommand{\thu@frontdate}{% + 日\ifthu@bachelor\hspace{1em}\else\hspace{2em}\fi 期:} +\newcommand{\thu@ckeywords@title}{关键词:} +% \end{macrocode} +% +% +% \myentry{封面第一页} +% \begin{macro}{\thu@first@titlepage} +% 题名使用一号黑体字,一行写不下时可分两行写,并采用 1.25 倍行距。 +% 申请学位的学科门类: 小二号宋体字。 +% 中文封面页边距: +% 上- 6.0 厘米,下- 5.5 厘米,左- 4.0 厘米,右- 4.0 厘米,装订线 0 厘米; +% \changes{v2.5.1}{2006/05/21}{本科封面标题调整微小的空隙。} +% \changes{v2.5.1}{2006/05/21}{本科封面标题第二行的横线上移一点。} +% \changes{v2.5.2}{2006/05/29}{研究生论文标题中英文用 arial 字体。} +% \changes{v2.6}{2006/06/09}{本科生题目加长,最多 24 个字。} +% \changes{v4.6}{2011/04/26}{增加博士后封面。} +% \changes{v4.7}{2011/11/28}{硕士中文封面不再需要英文标题。} +% \changes{v4.7}{2012/05/30}{本科生题目下划线长度自动适应字数。} +% \changes{v5.1.0}{2015/12/27}{利用 \env{CJKfilltwosides} 优化封面排版。} +% \changes{v5.5.0}{2019/01/08}{修正博士后封面的格式。} +% +% \begin{macrocode} +\newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt} +\newcommand\thu@CJKunderline[2][6em]{\CJKunderline*{\hb@xt@ #1{\hss#2\hss}}} +\newlength{\thu@title@width} +\newcommand{\thu@put@title}[2][\thu@title@width]{% + \begin{CJKfilltwosides}[b]{#1}#2\end{CJKfilltwosides}} +\def\thu@first@titlepage{% + \ifthu@postdoctor\thu@first@titlepage@postdoctor\else\thu@first@titlepage@other\fi} +\newcommand\thu@first@titlepage@postdoctor{% + \begin{center}% + \setlength{\thu@title@width}{3.5em}% + \renewcommand\ULthickness{0.7pt}% + \vspace*{0.35cm}% + {\sihao[2.6]% + \thu@put@title{分类号}\thu@underline[3.7cm]{\thu@catalognumber}\hfill + 密级\thu@underline[3.7cm]{\ifthu@secret\thu@secret@content\fi}\par + \thu@put@title{U D C}\thu@underline[3.7cm]{\thu@udc}\hfill + 编号\thu@underline[3.7cm]{\thu@id}\par + }% + \vskip 3.15cm% + {\sffamily\bfseries\xiaoer[2.6]% + {\ziju{1.5}\thu@schoolname\par}% + {\ziju{0.5}博士后研究工作报告\par}% + }% + \vskip 0.2cm% + \parbox[t][4.0cm][c]{\textwidth}{% + \centering\sihao[3.46]\CJKunderline*[depth=1em]{\thu@ctitle}\par + }\par + \vskip 0.4cm% + {\xiaosi\thu@cauthor\par}% + \vskip 1.4cm% + {\xiaosi[1.58]\xeCJKsetup{underline/depth=0.9em}% + 工作完成日期\quad\thu@CJKunderline[5.9cm]{\thu@postdoctordate}\par + \vskip 0.55cm% + 报告提交日期\quad\thu@CJKunderline[5.9cm]{\thu@cdate}\par + }% + \vskip 0.45cm% + {\xiaosi[2]{\ziju{1}\thu@schoolname}\quad (北京)\par}% + \vskip 0.25cm% + {\xiaosi[2]\thu@cdate\par}% + \end{center}% + \cleardoublepage + \begin{center}% + \vspace*{1.5cm}% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sanhao[1.95]\thu@ctitle\par + }\par + \vskip 0.15cm% + \parbox[t][3cm][c]{\textwidth}{% + \centering\sihao[1.36]\thu@etitle\par + }\par + \vskip 0.4cm% + {\xiaosi[2.6]% + \setlength{\thu@title@width}{11em}% + \begin{tabular}{l@{\quad}l}% + \thu@put@title{博士后姓名} & \thu@cauthor \\ + \thu@put@title{流动站(一级学科)名称} & \thu@cfirstdiscipline \\ + \thu@put@title{专\quad{}业(二级学科)名称} & \thu@cseconddiscipline \\ + \end{tabular}\par + }% + \vskip 2.7cm% + {\xiaosi[2.6]% + 研究工作起始时间\quad\thu@postdocstartdate\par + \vskip 0.1cm% + 研究工作期满时间\quad\thu@postdocenddate\par + }% + \vskip 2.1cm% + {\xiaosi[2.6]\thu@schoolname{}人事部(北京)\par}% + \vskip 0.6cm% + {\wuhao\thu@cdate\par}% + \end{center}% +} +\newcommand{\thu@first@titlepage@other}{ + \begin{center} + \vspace*{-1.6cm} + \parbox[b][2.4cm][t]{\textwidth}{% + \ifthu@secret{\heiti\sanhao\thu@secretlevel\thu@secret@content}\else\rule{1cm}{0cm}\fi} + \ifthu@bachelor + \vskip0.65cm + {\ifcsname lishu\endcsname\yihao\lishu\ziju{0.5}\thu@schoolname\else\includegraphics{tsinghua.pdf}\fi} + \par\vskip1.5cm + {\xiaochu\heiti\ziju{0.5}\textbf\thu@bachelor@subtitle} + \vskip2.2cm\hskip0.8cm + \noindent\heiti\xiaoer\thu@bachelor@title@pre\thu@title@sep + \parbox[t]{12cm}{% + \ignorespaces\yihao[1.51]% + \renewcommand{\CJKunderlinebasesep}{0.25cm}% + \renewcommand{\ULthickness}{1.3pt}% + \xeCJKsetup{underline/format=\color{black}}% + \CJKunderline*{\thu@ctitle}}% + \vskip1.3cm + \else + \vskip0.8cm + \parbox[t][9cm][t]{\paperwidth-8cm}{ + \renewcommand{\baselinestretch}{1.3} + \begin{center} + \yihao[1.2]{\sffamily\thu@ctitle}\par% + \par\vskip 18bp% + \xiaoer[1]\textrm{\thu@apply}% + \end{center}} + \fi +% \end{macrocode} +% +% 作者及导师信息部分使用三号仿宋字 +% \changes{v2.0}{2005/12/20}{封面的培养单位,学科等内容字距自动调整。} +% \changes{v2.1}{2006/02/29}{增加本科部分。} +% \changes{v2.6.2}{2006/06/17}{如果本科生没有辅导教师则不显示。} +% \changes{v3.1}{2007/10/09}{重新放置封面表格的提示元素。} +% \changes{v4.4.3}{2008/06/09}{修改本科生论文封面格式以符合新样例。} +% \changes{v5.1.0}{2015/12/27}{修改联合指导教师显示问题。} +% \begin{macrocode} + \ifthu@bachelor + \vskip0.75cm + \ifx\thu@cassosupervisor\@empty% + \def\thu@tempa{7.15cm} + \else% + \def\thu@tempa{8.15cm} + \fi% + \parbox[t][\thu@tempa][t]{\textwidth}{% + {\fangsong\sanhao[1.95]% + \hspace*{1.9cm} + \setlength{\thu@title@width}{4em} + \setlength{\extrarowheight}{6pt} + \begin{tabular}{p{\thu@title@width}@{}l@{\extracolsep{8pt}}l} + \thu@put@title{\thu@department@title} & \thu@title@sep + & \thu@cdepartment\\ + \thu@put@title{\thu@major@title} & \thu@title@sep + & \thu@cmajor\\ + \thu@put@title{\thu@author@title} & \thu@title@sep + & \thu@cauthor \\ + \thu@put@title{\thu@supervisor@title} & \thu@title@sep + & \thu@csupervisor\\ + \ifx\thu@cassosupervisor\@empty\else% + \thu@put@title{\thu@assosuper@title} & \thu@title@sep + & \thu@cassosupervisor\\ + \fi + \end{tabular} + }} + \else + \vskip 5bp + \parbox[t][7.8cm][t]{\textwidth}{{\sanhao[1.5] + \begin{center}\fangsong + \setlength{\thu@title@width}{5em} + \setlength{\extrarowheight}{4pt} + \begin{tabular}{p{\thu@title@width}@{}c@{\extracolsep{8pt}}l} + \thu@put@title{\thu@department@title} & \thu@title@sep + & {\ziju{0.1875}\thu@cdepartment}\\ + \thu@put@title{\thu@major@title} & \thu@title@sep + & {\ziju{0.1875}\thu@cmajor}\\ + \thu@put@title{\thu@author@title} & \thu@title@sep + & {\ziju{0.6875}\thu@cauthor}\\ + \thu@put@title{\thu@supervisor@title} & \thu@title@sep + & {\ziju{0.6875}\thu@csupervisor}\\ + \ifx\thu@cassosupervisor\@empty\else + \thu@put@title{\thu@assosuper@title} & \thu@title@sep + & {\ziju{0.6875}\thu@cassosupervisor}\\ + \fi + \ifx\thu@ccosupervisor\@empty\else + \ifthu@master + \hfill\makebox[0pt][r]{\thu@cosuper@title} & \thu@title@sep + & {\ziju{0.6875}\thu@ccosupervisor}\\ + \fi + \ifthu@doctor + \thu@put@title{\thu@cosuper@title} & \thu@title@sep + & {\ziju{0.6875}\thu@ccosupervisor}\\ + \fi + \fi + \end{tabular} + \end{center}}} + \fi +% \end{macrocode} +% +% 论文成文打印的日期,用三号宋体汉字,不用阿拉伯数字 +% 本科:论文成文打印的日期用阿拉伯数字,采用小四号宋体 +% \changes{v4.4.3}{2008/06/09}{修改本科生论文封面日期格式以符合新样例。} +% \begin{macrocode} + \begin{center} + {\ifthu@bachelor\vskip-1.0cm\xiaosi\else% + \vskip-0.5cm\sanhao\fi% + \songti\thu@cdate} + \end{center} + \end{center}} % end of titlepage +% \end{macrocode} +% \end{macro} +% +% \myentry{英文封面} +% \begin{macro}{\thu@doctor@engcover} +% \changes{v4.2}{2008/01/23}{博士英文封面补充联合导师。} +% \changes{v4.7}{2011/11/28}{硕士生新增英文封面。} +% 研究生论文使用。 +% \begin{macrocode} +\def\thu@master@art{Master of Arts} +\def\thu@master@sci{Master of Science} +\def\thu@doctor@phi{Doctor of Philosophy} +\newcommand{\thu@engcover}{% + \newif\ifthu@professional\thu@professionalfalse + \ifthu@master + \ifthenelse{\equal{\thu@edegree}{\thu@master@art}} + {\relax} + {\ifthenelse{\equal{\thu@edegree}{\thu@master@sci}} + {\relax} + {\thu@professionaltrue}} + \fi + \ifthu@doctor + \ifthenelse{\equal{\thu@edegree}{\thu@doctor@phi}} + {\relax} + {\thu@professionaltrue} + \fi + \begin{center} + \vspace*{-5pt} + \parbox[t][5.2cm][t]{\paperwidth-7.2cm}{ + \renewcommand{\baselinestretch}{1.5} + \begin{center} + \erhao[1.1]\bfseries\sffamily\thu@etitle% + \end{center}} + \parbox[t][][t]{\paperwidth-7.2cm}{ + \renewcommand{\baselinestretch}{1.3} + \begin{center} + \sanhao% + \ifthu@master Thesis \else Dissertation \fi + Submitted to\\ + {\bfseries Tsinghua University}\\ + in partial fulfillment of the requirement\\ + for the \ifthu@professional professional \fi + degree of\\ + {\bfseries\sffamily\thu@edegree}% + \ifthu@professional\relax\else + \\in\\[3bp] + {\bfseries\sffamily\thu@emajor}% + \fi + \end{center}} + \parbox[t][][b]{\paperwidth-7.2cm}{ + \renewcommand{\baselinestretch}{1.3} + \begin{center} + \sanhao\sffamily by\\[3bp] + \bfseries\thu@eauthor% + \ifthu@professional + \ifx\thu@emajor\empty\relax\else + \\(~\thu@emajor~)% + \fi\fi + \end{center}} + \par\vspace{0.9cm} + \parbox[t][2.1cm][t]{\paperwidth-7.2cm}{ + \renewcommand{\baselinestretch}{1.2} + \xiaosan\centering + \begin{tabular}{rl} + \ifthu@master Thesis \else Dissertation \fi + Supervisor : & \thu@esupervisor\\ + \ifx\thu@eassosupervisor\@empty + \else Associate Supervisor : & \thu@eassosupervisor\\\fi + \ifx\thu@ecosupervisor\@empty + \else Cooperate Supervisor : & \thu@ecosupervisor\\\fi + \end{tabular}} + \parbox[t][2cm][b]{\paperwidth-7.2cm}{ + \begin{center} + \sanhao\bfseries\sffamily\thu@edate + \end{center}} + \end{center}} +% \end{macrocode} +% \end{macro} +% +% \myentry{授权页面} +% \begin{macro}{\thu@authorization@mk} +% \changes{v4.0}{2007/11/08}{研究生的授权部分调整了一下,不知道老师为什么总爱修改 +% 那些无关紧要的格式,郁闷。感谢 PMHT@newsmth 的认真比对。} +% \changes{v4.4.2}{2008/06/07}{修改本科生的授权部分,按照 2008 年的新样例。} +% 支持扫描文件替换。 +% \begin{macrocode} +\newcommand{\thu@authorization@mk}{% + \ifthu@bachelor\vspace*{0.2cm}\else\vspace*{0.42cm}\fi % shit code! + \begin{center}\erhao\heiti\thu@authtitle\end{center} + \ifthu@bachelor\vskip5pt\else\vskip40pt\sihao[2.03]\fi\par + \thu@authorization\par + \textbf{\thu@authorizationaddon}\par + \ifthu@bachelor\vskip0.7cm\else\vskip1.0cm\fi + \ifthu@bachelor + \indent\mbox{\thu@authorsig\thu@underline\relax% + \thu@teachersig\thu@underline\relax\thu@frontdate\thu@underline\relax} + \else + \begingroup + \parindent0pt\xiaosi + \hspace*{1.5cm}\thu@authorsig\thu@underline[7em]\relax\hfill% + \thu@teachersig\thu@underline[7em]\relax\hspace*{1cm}\\[3pt] + \hspace*{1.5cm}\thu@frontdate\thu@underline[7em]\relax\hfill% + \thu@frontdate\thu@underline[7em]\relax\hspace*{1cm} + \endgroup + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\makecover} +% 生成封面总命令。 +% \changes{v2.1}{2006/02/29}{分成几个小模块来搞,不然这个 macro 太大了,看不过来。} +% \begin{macrocode} +\def\makecover{% + \thu@setup@pdfinfo\thu@makecover} +\def\thu@setup@pdfinfo{% + \ifthu@chinese + \hypersetup{ + pdftitle = \thu@ctitle, + pdfauthor = \thu@cauthor, + pdfsubject = \thu@cdegree, + pdfkeywords = \thu@ckeywords, + }% + \else + \hypersetup{ + pdftitle = \thu@etitle, + pdfauthor = \thu@eauthor, + pdfsubject = \thu@edegree, + pdfkeywords = \thu@ekeywords, + }% + \fi + \hypersetup{ + pdfcreator={\thuthesis-v\version}}} +\NewDocumentCommand{\thu@makecover}{o}{ + \phantomsection + \pdfbookmark[-1]{\thu@ctitle}{ctitle} + \normalsize% + \begin{titlepage} +% \end{macrocode} +% +% 论文封面第一页! +% \begin{macrocode} + \thu@first@titlepage +% \end{macrocode} +% +% \changes{v2.5}{2006/05/19}{本科论文评语位置调整。} +% \changes{v3.0}{2007/05/12}{本科论文评语取消。} +% \changes{v4.7}{2011/11/28}{硕士论文也需要英文封面。} +% +% 研究生论文需要增加英文封面 +% \begin{macrocode} + \ifthu@bachelor\relax\else + \ifthu@postdoctor\relax\else + \cleardoublepage\thu@engcover + \fi\fi +% \end{macrocode} +% +% 授权说明 +% \changes{v3.0}{2007/05/12}{本科论文授权图片扫描取消。} +% \changes{v4.5.2}{2010/05/29}{本科封面和授权说明之间不要空白页。} +% \changes{v4.6}{2011/05/29}{博士后报告无授权说明。} +% \changes{v5.0.0}{2015/06/05}{使用 \pkg{pdfpages} 宏包支持本硕博论文授权说明扫描版(\#36)。} +% \begin{macrocode} + \ifthu@postdoctor\relax\else% + \ifthu@bachelor\clearpage\else\cleardoublepage\fi% + \IfNoValueTF{#1}{% + \ifthu@bachelor\thu@authorization@mk\else% + \begin{list}{}{% + \topsep\z@% + \listparindent\parindent% + \parsep\parskip% + \setlength{\leftmargin}{0.9mm}% + \setlength{\rightmargin}{0.9mm}}% + \item[]\thu@authorization@mk% + \end{list}% + \fi% + }{% + \includepdf{#1}% + }% + \fi + \end{titlepage} +% \end{macrocode} +% +% \changes{v2.5}{2006/05/16}{综合论文训练在授权说明之后。} +% \changes{v3.0}{2007/05/12}{本科综合论文训练在电子版中取消。} +% +% 中英文摘要 +% \begin{macrocode} + \normalsize + \thu@makeabstract + \let\@tabular\thu@tabular} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{摘要} +% \label{sec:abstractformat} +% +% \begin{macro}{\thu@put@keywords} +% 排版关键字。 +% \begin{macrocode} +\newbox\thu@kw +\newcommand\thu@put@keywords[2]{% + \begingroup + \setbox\thu@kw=\hbox{#1} + \ifthu@bachelor\indent\else\noindent\hangindent\wd\thu@kw\hangafter1\fi% + \box\thu@kw#2\par + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\thu@makeabstract} +% 中文摘要部分的标题为“\textbf{摘要}”,用黑体三号字。 +% \changes{v2.5.1}{2006/05/24}{教务处又不要正文前的页眉了。} +% \changes{v2.5.1}{2006/05/24}{不管是哪种论文格式,摘要都要右开。} +% \changes{v2.5.2}{2006/05/29}{在研究生论文中,摘要不出现在目录中,但是要在书签中出现。} +% \changes{v2.5.3}{2006/06/03}{\cs{pagenumber} 会自动设置页码为 1。} +% \changes{v2.6.3}{2006/06/30}{为本科正确设置目录及以后的页码。} +% \changes{v4.5.2}{2010/05/29}{本科论文摘要亦无需右开。} +% \begin{macrocode} +\newcommand{\thu@makeabstract}{% + \ifthu@bachelor\clearpage\else\cleardoublepage\fi + \thu@setchinese + \thu@chapter*[]{\cabstractname} % no tocline + \ifthu@bachelor + \pagestyle{thu@plain} + \else + \pagestyle{thu@headings} + \fi + \pagenumbering{Roman} +% \end{macrocode} +% +% 摘要内容用小四号字书写,两端对齐,汉字用宋体,外文字用 Times New Roman 体, +% 标点符号一律用中文输入状态下的标点符号。 +% \changes{v3.1}{2007/06/16}{研究生关键词不再沉底。} +% \begin{macrocode} + \thu@cabstract +% \end{macrocode} +% 每个关键词之间空两个汉字符宽度, 且为悬挂缩进。 +% \changes{v2.6.2}{2006/06/17}{取消最后一列的空白。} +% \changes{v2.6.2}{2006/06/20}{取消 tabular 环境,用 \cs{hangindent} 实现关键词 +% 悬挂缩进,英文摘要同。} +% \changes{v4.4.2}{2008/06/05}{本科生格式中文关键词采用首行缩进且无悬挂缩进。} +% \begin{macrocode} + \ifthu@doctor\vfill\else\vskip12bp\fi + \thu@put@keywords{\textbf\thu@ckeywords@title}{\thu@ckeywords} +% \end{macrocode} +% +% 英文摘要部分的标题为 \textbf{Abstract},用 Arial 体三号字。研究生的英文摘要要求 +% 非常怪异:虽然正文前的封面部分为右开,但是英文摘要要跟中文摘要连 +% 续。\changes{v2.5.1}{2006/05/28}{研究生封面英文摘要连续。} +% \begin{macrocode} + \thu@setenglish + \thu@chapter*[]{\eabstractname} % no tocline +% \end{macrocode} +% +% 摘要内容用小四号 Times New Roman。 +% \begin{macrocode} + \thu@eabstract +% \end{macrocode} +% +% 每个关键词之间空四个英文字符宽度。 +% \changes{v2.4}{2006/04/14}{It is \textbf{Key words}, but not \textbf{Key +% Words}.} +% \changes{v2.6.2}{2006/06/17}{取消最后一列的空白。} +% \changes{v2.6.4}{2006/10/23}{\textbf{Keywords} but not \textbf{Key words}.} +% \changes{v3.0}{2007/05/13}{\textbf{Key words} but not +% \textbf{Keywords}. What are you doing?} +% \changes{v4.4.2}{2008/06/05}{Bachelor English abstract format requires +% indent and no hang-indent.} +% \changes{v4.7}{2012/06/02}{Bachelor sample uses Keywords w/o space \texttt{-\_-}} +% \begin{macrocode} + \ifthu@doctor\vfill\else\vskip12bp\fi + \thu@put@keywords{% + \textbf{\ifthu@bachelor Keywords:\else Key Words:\fi\enskip}}{\thu@ekeywords}% + \thu@setdefaultlanguage +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{主要符号表} +% \label{sec:denotationfmt} +% \begin{environment}{denotation} +% 主要符号对照表。 +% \changes{v2.0e}{2005/12/18}{主要符号表定义为一个 list,用起来方便。} +% \changes{v2.4}{2006/04/14}{为主要符号表环境增加一个可选参数,调节符号列的宽度。} +% \changes{v5.2.1}{2016/01/11}{利用 \pkg{enumitem} 改造环境定义,更直观。} +% \begin{macrocode} +\newenvironment{denotation}[1][2.5cm]{% + \thu@chapter*[]{\thu@denotation@name} % no tocline + \vskip-30bp\xiaosi[1.6]\begin{thu@denotation}[labelwidth=#1] +}{% + \end{thu@denotation} +} +\newlist{thu@denotation}{description}{1} +\setlist[thu@denotation]{% + nosep, + font=\normalfont, + align=left, + leftmargin=!, % sum of the following 3 lengths + labelindent=0pt, + labelwidth=2.5cm, + labelsep*=0.5cm, + itemindent=0pt, +} +% \end{macrocode} +% \end{environment} +% +% +% \subsubsection{致谢以及声明} +% \label{sec:ackanddeclare} +% +% \begin{environment}{acknowledgement} +% 支持扫描文件替换。 +% \changes{v2.4}{2006/04/14}{调整\textbf{致谢}等中间的距离。} +% \begin{macrocode} +\newcommand\thu@declarename{声\hspace{\ccwd}明} +\newcommand{\thu@declaretext}{本人郑重声明:所呈交的学位论文,是本人在导师指导下 + ,独立进行研究工作所取得的成果。尽我所知,除文中已经注明引用的内容外,本学位论 + 文的研究成果不包含任何他人享有著作权的内容。对本论文所涉及的研究工作做出贡献的 + 其他个人和集体,均已在文中以明确方式标明。} +\newcommand{\thu@signature}{签\hspace{1em}名:} +\newcommand{\thu@backdate}{日\hspace{1em}期:} +% \end{macrocode} +% +% \changes{v2.0}{2005/12/19}{将致谢定义为一个环境更合适,里面也不用像以前段首需 +% 要自己缩进。} +% \changes{v1.5}{2005/12/16}{在那些不显示编号的章节前面先执行一次 +% \cs{cleardoublepage},使新开章节的页码到达正确的状态。否则会因为 \cs{addcontentsline} +% 在 chapter 之前而导致目录页码错误。} +% 定义致谢与声明环境。 +% \changes{v2.5}{2006/05/16}{本科论文要求致谢声明分页,但是研究生的不分。} +% \changes{v2.5.2}{2006/05/29}{研究生致谢右开。} +% \changes{v2.5.2}{2006/05/30}{研究生致谢题目是致谢,目录是致谢与声明。} +% \changes{v2.6.3}{2006/07/01}{重画双虚线,自适应页面宽度。} +% \changes{v4.5.2}{2010/09/19}{研究生论文的致谢和声明终于分开了。} +% \changes{v5.2.1}{2016/01/11}{用 \env{acknowledgement} 替换 \env{ack}。} +% \begin{macrocode} +\NewDocumentEnvironment{acknowledgement}{o}{% + \thu@chapter*{\thu@ack@name} + } +% \end{macrocode} +% +% 声明部分 +% \changes{v3.0}{2007/05/12}{本科论文声明部分图片扫描取消。} +% \changes{v5.0.0}{2015/06/05}{使用 pdfpages 宏包支持本硕博论文声明扫描版(\#36)。} +% \begin{macrocode} + { + \ifthu@postdoctor\relax\else% + \IfNoValueTF{#1}{% + \thu@chapter*{\thu@declarename} + \par{\xiaosi\parindent2em\thu@declaretext}\vskip2cm + {\xiaosi\hfill\thu@signature\thu@underline[2.5cm]\relax% + \thu@backdate\thu@underline[2.5cm]\relax}% + }{% + \includepdf[pagecommand={\thispagestyle{thu@empty}% + \phantomsection\addcontentsline{toc}{chapter}{\thu@declarename}% + }]{#1}% + }% + \fi + } +% \end{macrocode} +% \end{environment} +% \begin{environment}{ack} +% 兼容旧版本保留 \env{ack}。 +% \begin{macrocode} +\let\ack\acknowledgement +\let\endack\endacknowledgement +% \end{macrocode} +% \end{environment} +% +% \subsubsection{图表索引} +% \label{sec:threeindex} +% \begin{macro}{\listoffigures} +% \begin{macro}{\listoffigures*} +% \begin{macro}{\listoftables} +% \begin{macro}{\listoftables*} +% 定义图表以及公式目录样式。 +% \changes{v2.5}{2006/05/18}{增加插图、表格和公式索引。} +% \changes{v2.5}{2006/05/19}{为了让索引中能出现\textbf{图 xxx},不得不修改 \LaTeX +% 内部命令 \cs{@caption}。} +% \changes{v2.6.4}{2006/10/23}{增加 \cs{listoffigures*},\cs{listoftables*}。} +% \changes{v4.5.1}{2009/01/06}{更优雅的插图/表格索引,避免跟 \pkg{caption} 包冲 +% 突。\cs{thu@listof} 相应修改。} +% \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 + \@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@bachelor\relax\else\addvspace{6bp}\fi\@dottedtocline{1}{0em}{4em}} +\renewcommand\listoftables{\thu@listof{table}} +\let\l@table\l@figure +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\equcaption} +% \changes{v2.6.2}{2006/06/19}{此命令配合 \pkg{amsmath} 命令基本可以满足所有 +% 公式需要。} +% 本命令只是为了生成公式列表,所以这个 caption 是假的。如果要编号最好用 +% equation 环境,如果是其它编号环境,请手动添加 \cs{equcaption}。 +% 用法如下: +% +% \cs{equcaption}\marg{counter} +% +% \marg{counter} 指定出现在索引中的编号,一般取 \cs{theequation},如果你是用 +% \pkg{amsmath} 的 \cs{tag},那么默认是 \cs{tag} 的参数;除此之外可能需要你 +% 手工指定。 +% +% \changes{v2.5}{2006/05/19}{将公式编号写入临时文件以便生成公式列表。} +% \changes{v2.5.3}{2006/06/03}{取消 \cs{equcaption} 的参数} +% \begin{macrocode} +\def\ext@equation{loe} +\def\equcaption#1{% + \addcontentsline{\ext@equation}{equation}% + {\protect\numberline{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\listofequations} +% \begin{macro}{\listofequations*} +% \LaTeX\ 默认没有公式索引,此处定义自己的 \cs{listofequations}。 +% \changes{v2.5}{2006/05/19}{增加公式索引命令。} +% \changes{v2.5.1}{2006/05/26}{公式索引项 numwidth 增加。} +% \changes{v2.6.4}{2006/10/23}{增加 \cs{listofequations*}。} +% \begin{macrocode} +\newcommand\listofequations{\thu@listof{equation}} +\let\l@equation\l@figure +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{参考文献} +% \label{sec:ref} +% +% \changes{v5.4.4}{2018/04/12}{参考文献列表的页码使用 hyphen 取代 en dash。} +% +% \begin{macro}{\inlinecite} +% 依赖于 \pkg{natbib} 宏包,修改其中的命令。 旧命令 \cs{onlinecite} 依然可用。 +% \changes{v5.0.0}{2015/11/23}{用 \cs{inlinecite} 替换 \cs{onlinecite}。为保证兼 +% 容性,\cs{onlinecite} 会保留。} +% \begin{macrocode} +\newcommand\bibstyle@inline{\bibpunct{[}{]}{,}{n}{,}{,}} +\DeclareRobustCommand\inlinecite{\@inlinecite} +\def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup} +\let\onlinecite\inlinecite +% \end{macrocode} +% \end{macro} +% +% 参考文献的正文部分用五号字。 +% 行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。 +% 本科生要求固定行距 17pt,段前后间距 3pt。 +% +% 复用 \pkg{natbib} 的 \texttt{thebibliography} 环境,调整距离。 +% \changes{v2.4}{2006/04/15}{参考文献间距调小一点,label 长度增加一点,以便让超过 +% 100 的参考文献更好地对齐。} +% \changes{v2.5}{2006/05/13}{参考文献序号靠左,而不是靠右。} +% \changes{v2.6.4}{2006/10/23}{调整参考文献标签宽度,使得条目增多时仍能对齐。} +% \changes{v5.4.0}{2017/12/03}{基于 \pkg{natbib} 的环境调整距离兼容性更好。} +% \changes{v5.4.4}{2018/04/14}{参考文献标号左对齐。} +% \begin{macrocode} +\renewcommand\bibsection{\thu@chapter*{\bibname}} +\renewcommand\bibfont{\ifthu@bachelor\wuhao[1.619]\else\wuhao[1.5]\fi} +\setlength\bibhang{2\ccwd} +\addtolength{\bibsep}{-0.7em} +\setlength{\labelsep}{0.4em} +\def\@biblabel#1{[#1]\hfill} +% \end{macrocode} +% +% 两种引用样式: +% \changes{v5.4.0}{2017/12/3}{\cs{bibliographystyle}\marg{newbib} will cause \cs{bibstyle@newbib} to +% be called on THE NEXT LATEX RUN (via the aux file).} +% \changes{v5.4.1}{2017/12/04}{bst 在 ctan 上不分路径,故加前缀。} +% \begin{macrocode} +\expandafter\newcommand\csname bibstyle@thuthesis-numeric\endcsname{% + \bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} +\expandafter\newcommand\csname bibstyle@thuthesis-author-year\endcsname{% + \bibpunct{(}{)}{;}{a}{,}{,}} +% \end{macrocode} +% +% 下面修改 \pkg{natbib} 的引用格式,主要是将页码写在上标位置。 +% numeric 模式的 \cs{citet} 的页码: +% \begin{macrocode} +\patchcmd\NAT@citexnum{% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else\NAT@cmt#2\fi + }{}% + \NAT@mbox{\NAT@@close}% +}{% + \NAT@mbox{\NAT@@close}% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else\textsuperscript{#2}\fi + }{}% +}{}{} +% \end{macrocode} +% +% Numeric 模式的 \cs{citep} 的页码: +% \begin{macrocode} +\renewcommand\NAT@citesuper[3]{\ifNAT@swa + \if*#2*\else#2\NAT@spacechar\fi +\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close\if*#3*\else#3\fi}% + \else #1\fi\endgroup} +% \end{macrocode} +% +% Author-year 模式的 \cs{citet} 的页码: +% \begin{macrocode} +\patchcmd{\NAT@citex}{% + \if*#2*\else\NAT@cmt#2\fi + \if\relax\NAT@date\relax\else\NAT@@close\fi +}{% + \if\relax\NAT@date\relax\else\NAT@@close\fi + \if*#2*\else\textsuperscript{#2}\fi +}{}{} +% \end{macrocode} +% +% Author-year 模式的 \cs{citep} 的页码: +% \begin{macrocode} +\renewcommand\NAT@cite% + [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi + #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup} +% \end{macrocode} +% +% 在顺序编码制下,\pkg{natbib} 只有在三个以上连续文献引用才会使用连接号, +% 这里修改为允许两个引用使用连接号。 +% \changes{v5.4.4}{2018/04/12}{允许连续两个文献引用使用连接号。} +% \begin{macrocode} +\patchcmd{\NAT@citexnum}{% + \ifx\NAT@last@yr\relax + \def@NAT@last@yr{\@citea}% + \else + \def@NAT@last@yr{--\NAT@penalty}% + \fi +}{% + \def@NAT@last@yr{-\NAT@penalty}% +}{}{} +% \end{macrocode} +% +% \subsection{附录} +% \label{sec:appendix} +% \begin{environment}{appendix} +% 主要给本科做外文翻译用。 +% \begin{macrocode} +\let\thu@appendix\appendix +\renewenvironment{appendix}{% + \let\title\thu@appendix@title + \thu@appendix}{% + \let\title\@gobble} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\title} +% \changes{v5.2.0}{2016/01/11}{增加 \cs{title} 排版翻译标题。} +% 本科外文翻译文章的标题,用法:\cs{title}\marg{资料标题}。这个命令只能在附录环 +% 境下使用。 +% \begin{macrocode} +\let\title\@gobble +\newcommand{\thu@appendix@title}[1]{% + \begin{center} + \xiaosi[1.667] #1 + \end{center}} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{translationbib} +% \changes{v5.2.0}{2016/01/11}{增加翻译文献环境 \env{translationbib}。} +% 外文资料的参考文用宋体五号字,取固定行距17pt,段前后3pt。 +% \begin{macrocode} +\newlist{translationbib}{enumerate}{1} +\setlist[translationbib]{label=[\arabic*],align=left,nosep,itemsep=6bp, + leftmargin=10mm,labelsep=!,before=\vspace{0.5\baselineskip}\wuhao[1.3]} +% \end{macrocode} +% \end{environment} +% +% \subsection{个人简历} +% +% \begin{environment}{resume} +% \changes{v1.5}{2005/12/16}{增加个人简历章节的命令,去掉主文件中需要重新 +% 定义 \cs{cleardoublepage} 和自己写 \cs{markboth},\cs{addcontentsline} 的部分。} +% \changes{v2.0}{2005/12/18}{最后决定将 resume 定义为环境。这样与前面的主要符号 +% 表、致谢等对应。} +% \changes{v2.5.1}{2006/05/23}{教务处和研究生院非要搞的不一样!} +% \changes{v2.5.2}{2006/05/29}{研究生的个人介绍要右开。} +% \changes{v4.6}{2011/05/02}{支持可选参数,自己定义简历章节标题。} +% 个人简历发表文章等。 +% \begin{macrocode} +\newenvironment{resume}[1][\thu@resume@title]{% + \thu@chapter*{#1}}{} +% \end{macrocode} +% \end{environment} +% +% \begin{macro}{\resumeitem} +% 个人简历部分。每条信息一个段落,故不需要特别处理。 +% \begin{macrocode} +\newcommand{\resumeitem}[1]{% + \vspace{24bp}{\sihao\heiti\centerline{#1}}\par\vspace{6bp}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\researchitem} +% 研究成果用 \cs{researchitem}\marg{类别} 开启,包括“学术论文”和“研究成果”两个 +% 列表。 +% \begin{macrocode} +\newcommand{\researchitem}[1]{% + \vspace{32bp}{\sihao\heiti\centerline{#1}}\par\vspace{14bp}} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{publications} +% \begin{environment}{achievements} +% 二者分别通过两个环境 \env{publications} 和 \env{achievements} 罗 +% 列。 +% +% \changes{v5.0.0}{2015/04/18}{博士后就不提在学期间了,不合适(\#100)} +% \changes{v5.0.0}{2015/05/17}{让简历部分更符合格式指南和示例文件(\#122)} +% \begin{macrocode} +\newlist{publications}{enumerate}{1} +\setlist[publications]{label=[\arabic*],align=left,nosep,itemsep=8bp, + leftmargin=10mm,labelsep=!,before=\xiaosi[1.26],resume} +\newlist{achievements}{enumerate}{1} +\setlist[achievements]{label=[\arabic*],align=left,nosep,itemsep=8bp, + leftmargin=10mm,labelsep=!,before=\xiaosi[1.26]} +% \end{macrocode} +% \end{environment} +% \end{environment} +% +% \begin{macro}{\publicationskip} +% \changes{v5.2.0}{2016/01/11}{增加 \cs{publicationskip}。} +% \env{publications} 环境可以连续出现多次,第二类论文列表前后要空一行,使 +% 用 \cs{publicationskip}。 +% \begin{macrocode} +\def\publicationskip{\bigskip\bigskip} +% \end{macrocode} +% \end{macro} +% +% \subsection{其他宏包的设置} +% +% 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。 +% \begin{macrocode} +\newcommand\thu@atendpackage{\csname ctex_at_end_package:nn\endcsname} +% \end{macrocode} +% +% \subsubsection{\pkg{nomencl} 宏包} +% +% \changes{v5.5.0}{2018/12/09}{增加 \pkg{nomencl} 宏包的支持。} +% \begin{macrocode} +\thu@atendpackage{nomencl}{ + \let\nomname\thu@denotation@name + \def\thenomenclature{\begin{denotation}[\nom@tempdim]} + \def\endthenomenclature{\end{denotation}} +} +% \end{macrocode} +% +% \subsection{书脊} +% \label{sec:shuji} +% \begin{macro}{\shuji} +% 单独使用书脊命令会在新的一页产生竖排书脊。 +% \changes{v4.5}{2009/01/04}{简化代码,同时支持 \XeLaTeX。} +% \changes{v5.0.0}{2015/12/21}{扩展 \cs{shuji}\oarg{标题}\oarg{作者}。} +% \begin{macrocode} +\NewDocumentCommand{\shuji}{O{\thu@ctitle} O{\thu@cauthor}}{% + \newpage\thispagestyle{empty}% + \fangsong\addCJKfontfeatures*{RawFeature={vertical:}} + \xiaosan\ziju{0.4}% + \noindent\hfill\rotatebox[origin=lt]{-90}{\makebox[\textheight]{#1\hfill#2}}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{其它} +% \label{sec:other} +% +% 在模板文档结束时即装入配置文件,这样用户就能在导言区进行相应的修改。 +% \changes{v2.5}{2006/05/13}{不用 \cs{CJKcaption},在导言区直接引入配置文件。} +% \begin{macrocode} +\AtEndOfClass{\sloppy} +%</cls> +% \end{macrocode} +% +% +% \iffalse +% \begin{macrocode} +%<*dtx-style> +\ProvidesPackage{dtx-style} +\RequirePackage{hypdoc} +\RequirePackage{ifthen} +\RequirePackage[UTF8,scheme=chinese]{ctex} +\RequirePackage{newpxtext} +\RequirePackage{newpxmath} +\RequirePackage[ + top=2.5cm, bottom=2.5cm, + left=4cm, right=2cm, + headsep=3mm]{geometry} +\RequirePackage{array,longtable,booktabs} +\RequirePackage{listings} +\RequirePackage{fancyhdr} +\RequirePackage{xcolor} +\RequirePackage{enumitem} +\RequirePackage{etoolbox} +\RequirePackage{metalogo} + +\ifthenelse{\equal{\@nameuse{g__ctex_fontset_tl}}{mac}}{% + \xeCJKsetwidth{‘’“”}{1em} +}{} + +\colorlet{thu@macro}{blue!60!black} +\colorlet{thu@env}{blue!70!black} +\colorlet{thu@option}{purple} +\patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} +\patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{} +\patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} +\patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{} + +\def\DescribeOption{% + \leavevmode\@bsphack\begingroup\MakePrivateLetters% + \Describe@Option} +\def\Describe@Option#1{\endgroup + \marginpar{\raggedleft\PrintDescribeOption{#1}}% + \thu@special@index{option}{#1}\@esphack\ignorespaces} +\def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{thu@option} #1\ } +\def\thu@special@index#1#2{\@bsphack + \begingroup + \HD@target + \let\HDorg@encapchar\encapchar + \edef\encapchar usage{% + \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}% + }% + \index{#2\actualchar{\string\ttfamily\space#2} + (#1)\encapchar usage}% + \index{#1:\levelchar#2\actualchar + {\string\ttfamily\space#2}\encapchar usage}% + \endgroup + \@esphack} + +\lstdefinestyle{lstStyleBase}{% + basicstyle=\small\ttfamily, + aboveskip=\medskipamount, + belowskip=\medskipamount, + lineskip=0pt, + boxpos=c, + showlines=false, + extendedchars=true, + upquote=true, + tabsize=2, + showtabs=false, + showspaces=false, + showstringspaces=false, + numbers=none, + linewidth=\linewidth, + xleftmargin=4pt, + xrightmargin=0pt, + resetmargins=false, + breaklines=true, + breakatwhitespace=false, + breakindent=0pt, + breakautoindent=true, + columns=flexible, + keepspaces=true, + gobble=2, + framesep=3pt, + rulesep=1pt, + framerule=1pt, + backgroundcolor=\color{gray!5}, + stringstyle=\color{green!40!black!100}, + keywordstyle=\bfseries\color{blue!50!black}, + commentstyle=\slshape\color{black!60}} + +\lstdefinestyle{lstStyleShell}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{purple}, + language=bash} + +\lstdefinestyle{lstStyleLaTeX}{% + style=lstStyleBase, + frame=l, + rulecolor=\color{violet}, + language=[LaTeX]TeX} + +\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{} +\lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{} + +\setlist{nosep} + +\DeclareDocumentCommand{\option}{m}{\textsf{#1}} +\DeclareDocumentCommand{\env}{m}{\texttt{#1}} +\DeclareDocumentCommand{\pkg}{s m}{% + \texttt{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}} +\DeclareDocumentCommand{\file}{s m}{% + \texttt{#2}\IfBooleanF#1{\thu@special@index{file}{#2}}} +\newcommand{\myentry}[1]{% + \marginpar{\raggedleft\color{purple}\bfseries\strut #1}} +\newcommand{\note}[2][Note]{{% + \color{magenta}{\bfseries #1}\emph{#2}}} + +\def\thuthesis{\textsc{Thu}\-\textsc{Thesis}} +%</dtx-style> +% \end{macrocode} +% \fi +% +% \Finale +% +\endinput +% \iffalse +% Local Variables: +% mode: doctex +% TeX-master: t +% End: +% \fi diff --git a/macros/latex/contrib/thuthesis/thuthesis.ins b/macros/latex/contrib/thuthesis/thuthesis.ins new file mode 100644 index 0000000000..7912817390 --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis.ins @@ -0,0 +1,67 @@ +%% +%% Copyright (C) 2005-2019 by Ruini Xue <xueruini@gmail.com> +%% +%% This file is part of the ThuThesis package project. +%% --------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. + +\input docstrip + +\askforoverwritefalse +%\askonceonly +\showprogress +\keepsilent + +\usedir{tex/latex/thuthesis} + +\preamble + +This is a generated file. + +Copyright (C) 2005-\the\year by Ruini Xue <xueruini@gmail.com> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +To produce the documentation run the original source files ending with `.dtx' +through LaTeX. + +\endpreamble + +\generate{\file{\jobname.cls}{\from{\jobname.dtx}{cls}} + \usepreamble\defaultpreamble\usepostamble\defaultpostamble + \file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}} + +\ifToplevel{% + \Msg{***********************************************************} + \Msg{*} + \Msg{* To finish the installation you have to move the following} + \Msg{* files into a directory searched by TeX:} + \Msg{*} + \Msg{* The recommended directory is TEXMF/tex/latex/thuthesis} + \Msg{*} + \Msg{* \space\space thuthesis.cls} + \Msg{* \space\space thuthesis-author-year.bst} + \Msg{* \space\space thuthesis-numeric.bst} + \Msg{*} + \Msg{* To produce the documentation run the files ending with} + \Msg{* `.dtx' through LaTeX.} + \Msg{*} + \Msg{* Happy TeXing!} + \Msg{***********************************************************}} + +\endbatchfile diff --git a/macros/latex/contrib/thuthesis/thuthesis.pdf b/macros/latex/contrib/thuthesis/thuthesis.pdf Binary files differnew file mode 100644 index 0000000000..9eb21cceea --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis.pdf diff --git a/macros/latex/contrib/thuthesis/thuthesis.sty b/macros/latex/contrib/thuthesis/thuthesis.sty new file mode 100644 index 0000000000..87585f5396 --- /dev/null +++ b/macros/latex/contrib/thuthesis/thuthesis.sty @@ -0,0 +1,50 @@ +\ProvidesPackage{thuthesis}[2007/11/30 4.1 put any packages you would like to use here] + +% 处理数学公式中的黑斜体的宏包 +% \RequirePackage{bm} + +% 不同于 \mathcal \mathfrak 之类的英文花体字体 +% \RequirePackage{mathrsfs} + +% 表格中支持跨行 +\RequirePackage{multirow} + +% 固定宽度的表格 +\RequirePackage{tabularx} + +% 表格中的反斜线 +\RequirePackage{diagbox} + +% 确定浮动对象的位置,可以使用 H,强制将浮动对象放到这里(可能效果很差) +\RequirePackage{float} + +% 浮动图形控制宏包。 +% 允许上一个 section 的浮动图形出现在下一个 section 的开始部分 +% 该宏包提供处理浮动对象的 \FloatBarrier 命令,使所有未处 +% 理的浮动图形立即被处理。这三个宏包仅供参考,未必使用: +% \RequirePackage[below]{placeins} +% \RequirePackage{floatflt} % 图文混排用宏包 +% \RequirePackage{rotating} % 图形和表格的控制旋转 + +% 给自定义的宏后面自动加空白 +% \RequirePackage{xspace} + +% 借用 ltxdoc 里面的几个命令。 +\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} +\def\cmd@to@cs#1#2{\char\number`#2\relax} +\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} + +\newcommand*{\meta}[1]{{% + \ensuremath{\langle}\rmfamily\itshape#1\/\ensuremath{\rangle}}} +\providecommand\marg[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} +\providecommand\oarg[1]{% + {\ttfamily[}\meta{#1}{\ttfamily]}} +\providecommand\parg[1]{% + {\ttfamily(}\meta{#1}{\ttfamily)}} +\providecommand\pkg[1]{{\sffamily#1}} + +% 定义自己常用的东西 +\newcommand{\china}{中华人民共和国} + +\endinput diff --git a/macros/latex/contrib/thuthesis/tsinghua.pdf b/macros/latex/contrib/thuthesis/tsinghua.pdf Binary files differnew file mode 100644 index 0000000000..69c8521bae --- /dev/null +++ b/macros/latex/contrib/thuthesis/tsinghua.pdf |