summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thuthesis/thuthesis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/thuthesis/thuthesis.dtx')
-rw-r--r--macros/latex/contrib/thuthesis/thuthesis.dtx152
1 files changed, 114 insertions, 38 deletions
diff --git a/macros/latex/contrib/thuthesis/thuthesis.dtx b/macros/latex/contrib/thuthesis/thuthesis.dtx
index 2a9e07f9b4..3233b5e580 100644
--- a/macros/latex/contrib/thuthesis/thuthesis.dtx
+++ b/macros/latex/contrib/thuthesis/thuthesis.dtx
@@ -14,7 +14,7 @@
%
% \iffalse
%<*driver>
-\ProvidesFile{thuthesis.dtx}[2021/04/03 7.2.2 Tsinghua University Thesis Template]
+\ProvidesFile{thuthesis.dtx}[2021/05/31 7.2.3 Tsinghua University Thesis Template]
\documentclass{ltxdoc}
\usepackage{dtx-style}
@@ -344,12 +344,13 @@
% Courier & Menlo & TeX Gyre Cursor & TeX Gyre Cursor \\
% 中易宋体 & 华文宋体 & 思源宋体 & Fandol 宋体 \\
% 中易黑体 & 华文黑体 & 思源黑体 & Fandol 黑体 \\
+% 中易仿宋 & 华文仿宋 & Fandol 仿宋 & Fandol 仿宋 \\
% \bottomrule
% \end{tabular}
% \end{table}
%
-% 需要注意,研究生院建议中文字体同 Word 模板一致。
-% 也就是说,用户在提交终版前应使用 Windows 平台的字体进行编译。
+% 需要注意,建议用户在提交终版前使用 Windows 平台的字体进行编译。
+% 这样中文字体同 Word 模板一致。
%
% 关于字体的配置,
% 详见 \pkg{fontspec}、\pkg{xeCJK}、\pkg{ctex} 等宏包的使用说明和代码。
@@ -806,7 +807,7 @@
% 积分号上下限的位置,可选:\option{true}(在上下)、\option{false}(在右侧)。
% 这个设置只影响行间公式,行内公式统一居右侧,不受影响。
% \item \DescribeOption{partial}
-% 偏微分符号的正/斜体,可选:\option{upright}、\option{slanted}。
+% 偏微分符号的正/斜体,可选:\option{upright}、\option{italic}。
% \item \DescribeOption{math-ellipsis}
% 省略号 \cs{dots} 的样式,可选:\option{centered}(按照中文的习惯固定居中)、
% \option{lower} 和 \option{AMS}(取决于前后符号的位置)。
@@ -997,7 +998,7 @@
% 参考文献表采用“著者-出版年”制组织时,各篇文献首先按文种集中,然后按著者字
% 顺和出版年排列;中文文献可以按著者汉语拼音字顺排列,也可以按著者的笔画笔顺排列。
% 但由于 \hologo{BibTeX} 功能的局限性,无法自动获取著者姓名的拼音或笔画笔顺进行正确排序。
-% 一种解放方法是在 \file{.bib} 数据库的中文文献的 |key| 域手动录入著者姓名的拼音,
+% 一种解决方法是在 \file{.bib} 数据库的中文文献的 |key| 域手动录入著者姓名的拼音,
% 这比较适合中文文献数量较少的情况,如:
% \begin{latex}
% @book{capital,
@@ -1006,7 +1007,7 @@
% ...
% }
% \end{latex}
-% 另一种方式是使用 biblatex,应在在导言区设置
+% 另一种方式是使用 biblatex,应在导言区设置
% \begin{latex}
% \usepackage[backend=biber,style=thuthesis-author-year]{biblatex}
% \addbibresource{ref/refs.bib}
@@ -1075,18 +1076,21 @@
% \statement[file=scan-statement.pdf]
% \end{latex}
%
-% 由于本科生打印版和电子版有空白页的差别,声明的页码可能不同。
-% 所以编译声明页时默认不加页脚(\texttt{page-style=empty}),
-% 在签字后插入扫描页时再补上页脚,防止页码冲突。
+% 由于本科生的打印版和电子版有空白页的差别,声明的页码可能不同。
+% 所以编译生成声明页时默认不加页脚(\option{empty}),
+% 在签字后插入扫描页时再补上页脚(\option{plain}),防止页码冲突。
+% 研究生不存在空白页的问题,在编译生成声明时默认加页眉页脚(\option{plain}),
+% 而插入扫描版时不再重复(\option{empty})。
%
-% 如果需要编译时也加页码(如直接对电子版进行签名而不是插入扫描页),
-% 可以使用在 \cs{statement} 命令设置
+% 声明的页眉页脚也可以通过 \option{pagestyle} 参数手动控制,
+% 比如编译生成时固定不加页眉页脚:
% \begin{latex}
% \statement[page-style=plain]
% \end{latex}
-% 注意,本科生插入扫描页时总是会加页码,不受该选项控制。
-%
-% 研究生不存在空白页的问题,但是为了灵活性也允许用户选择是否添加页眉和页脚。
+% 插入扫面版声明补上页眉页脚:
+% \begin{latex}
+% \statement[file=scan-statement.pdf, page-style=plain]
+% \end{latex}
%
% \subsubsection{附录}
%
@@ -1149,7 +1153,7 @@
%
% \subsubsection{个人简历、在学期间完成的相关学术成果}
% \DescribeEnv{resume}
-% 研究生的标题为为“个人简历、在学期间完成的相关学术成果”,
+% 研究生的标题为“个人简历、在学期间完成的相关学术成果”,
% 本科生的标题为“在学期间参加课题的研究成果”或“PUBLICATIONS”。
%
% \DescribeEnv{achievements}
@@ -1194,11 +1198,11 @@
% 生成装订的书脊,为竖排格式。内容默认使用论文的标题和作者。
% 可以设置 \option{spine-title} 和 \option{spine-author} 来修改。
%
-% 书脊字体默认为三号字,同研究生的示例一致。
+% 博士论文的书脊字体默认为三号字,硕士的为小三号。
% 本科生要求字体大小根据论文的薄厚而定,可以使用 \option{spine-font} 设置字号。
% \begin{latex}
% \thusetup{
-% spine-font = {\Huge},
+% spine-font = {\zihao{3}},
% spine-title = {书脊的标题},
% spine-author = {书脊的作者姓名},
% }
@@ -1246,7 +1250,7 @@
% \begin{macrocode}
%<cls>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
%<cls>\ProvidesClass{thuthesis}
-%<cls>[2021/04/03 7.2.2 Tsinghua University Thesis Template]
+%<cls>[2021/05/31 7.2.3 Tsinghua University Thesis Template]
% \end{macrocode}
%
% 报错
@@ -1302,7 +1306,7 @@
%<*cls>
\hyphenation{Thu-Thesis}
\def\thuthesis{ThuThesis}
-\def\version{7.2.2}
+\def\version{7.2.3}
\RequirePackage{kvdefinekeys}
\RequirePackage{kvsetkeys}
\RequirePackage{kvoptions}
@@ -1936,7 +1940,7 @@
\def\thu@list@algorithm@name{算法索引}%
\def\thu@acknowledgements@name{致\qquad 谢}%
\def\listequationname{公式索引}%
- \def\thu@denotation@name{主要符号对照表}%
+ \def\thu@denotation@name{主要符号表}%
\def\thu@resume@name{在学期间参加课题的研究成果}%
\else
\def\listfigurename{插图清单}%
@@ -2223,17 +2227,29 @@
% 但是在 Linux 下没有这两个字体,所以使用它们的克隆版 TeX Gyre Termes 和
% TeX Gyre Heros。
% \begin{macrocode}
-\ifthu@font@auto
- \ifthu@fontset@windows
- \thusetup{font=times}
- \else
- \ifthu@fontset@mac
- \thusetup{font=times}
+\newcommand\thu@set@font{%
+ \@nameuse{thu@set@font@\thu@font}%
+}
+\thu@option@hook{font}{\thu@set@font}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand\thu@set@font@auto{%
+ \ifthu@font@auto
+ \ifthu@fontset@windows
+ \thusetup{font=times}%
\else
- \thusetup{font=termes}
+ \ifthu@fontset@mac
+ \thusetup{font=times}%
+ \else
+ \thusetup{font=termes}%
+ \fi
\fi
\fi
-\fi
+}
+\thu@option@hook{math-font}{\g@addto@macro\thu@setup@hook{\thu@set@font@auto}}
+\AtBeginOfPackageFile*{siunitx}{\thu@set@font@auto}
+\AtEndPreamble{\thu@set@font@auto}
% \end{macrocode}
%
% Times New Roman + Arial
@@ -2452,14 +2468,13 @@
BoldItalicFont = *-boldoblique,
]%
}
+% \end{macrocode}
+%
+% NewTX
+% \begin{macrocode}
\newcommand\thu@set@font@newtx{%
\RequirePackage{newtxtext}%
}
-\newcommand\thu@set@font{%
- \@nameuse{thu@set@font@\thu@font}%
-}
-\thu@set@font
-\thu@option@hook{font}{\thu@set@font}
% \end{macrocode}
%
% \subsubsection{中文字体}
@@ -2993,6 +3008,7 @@
\fi
\DeclareRobustCommand\symup[1]{{\mathrm{##1}}}%
\DeclareRobustCommand\symbf[1]{{\bm{##1}}}%
+ \DeclareRobustCommand\symbfsf[1]{{\bm{\mathsf{##1}}}}%
\let\increment\upDelta%
\renewcommand\thu@qed{\openbox}%
}
@@ -3317,6 +3333,34 @@
%
% 公式距前后文的距离由 4 个参数控制,参见 \cs{normalsize} 的定义。
%
+% 中文模板的公式编号使用中文括号。需要修改 \pkg{amsmath} 的 \cs{tagform@}。
+% 这里中文的 \cs{unskip} 是为了“|式~\eqref|”这样的写法不产生额外的空格。
+% \begin{macrocode}
+\newcommand\thu@put@parentheses[1]{%
+ \ifthu@language@chinese
+ \unskip
+ (#1)%
+ \else
+ (#1)%
+ \fi
+}
+% \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
+\def\tagform@#1{\maketag@@@{\thu@put@parentheses{\ignorespaces#1\unskip\@@italiccorr}}}
+% \end{macrocode}
+%
+% 重定义 \cs{eqref},去掉原来的的 \cs{tagform@} 中 \cs{maketag@@@} 的 \cs{hbox} 和
+% \cs{m@th},防止中文左括号与前面文字的距离过窄。
+% \begin{macrocode}
+% \newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}
+\renewcommand{\eqref}[1]{%
+ \textup{%
+ \normalfont\thu@put@parentheses{%
+ \ignorespaces\ref{#1}\unskip\@@italiccorr
+ }%
+ }%
+}
+% \end{macrocode}
+%
% \subsubsection{浮动对象:插图和表格}
% \label{sec:float}
%
@@ -5038,7 +5082,7 @@
% \subsubsection{主要符号表}
% \label{sec:denotationfmt}
% \begin{environment}{denotation}
-% 主要符号对照表。
+% 主要符号表。
% \begin{macrocode}
\newenvironment{denotation}[1][2.5cm]{%
\ifthu@degree@bachelor
@@ -5355,7 +5399,6 @@
\@namedef{bibstyle@thuthesis-numeric}{\citestyle{super}}
\@namedef{bibstyle@thuthesis-author-year}{\citestyle{author-year}}
\@namedef{bibstyle@thuthesis-bachelor}{\citestyle{super}}
- \@namedef{bibstyle@thuthesis-inline}{\citestyle{inline}}
% \end{macrocode}
%
% 修改引用的样式。
@@ -5793,6 +5836,20 @@
% 所以这里定义 \env{survey} 和 \env{translation} 专门处理这两种情况,
% 其中参考文献使用了 \pkg{bibunits} 宏包的功能。
%
+% 注意 \pkg{titletoc} 在 2019/07/14 v2.11.1702 修改了 \cs{printcontents} 接口,
+% 而且 \cs{@ifpackagelater} 只能用在导言区中,所以需要定义辅助宏。
+% \begin{macrocode}
+\@ifpackagelater{titletoc}{2019/07/14}{
+ \newcommand\thu@print@contents[5]{%
+ \printcontents[#1]{#2}{#3}[#4]{}%
+ }
+}{
+ \newcommand\thu@print@contents[5]{%
+ \printcontents[#1]{#2}{#3}{\setcounter{tocdepth}{#4}#5}%
+ }
+}
+% \end{macrocode}
+%
% \begin{environment}{survey}
% 外文资料的调研阅读报告。
% \begin{macrocode}
@@ -5805,7 +5862,7 @@
\renewcommand\tableofcontents{%
\section*{Contents}%
\thu@pdfbookmark{1}{Contents}%
- \printcontents[survey]{l}{1}[2]{}%
+ \thu@print@contents{survey}{l}{1}{2}{}%
\vskip 20bp%
}%
\renewcommand\bibname{参考文献}%
@@ -5831,11 +5888,23 @@
\thusetup{language = chinese}%
\let\title\thu@appendix@title
\let\maketitle\thu@appendix@maketitle
+ \renewenvironment{abstract}{%
+ \ctexset{
+ section = {
+ format += \centering,
+ numbering = false,
+ },
+ }%
+ \section{摘要}%
+ \quotation
+ }{%
+ \endquotation
+ }%
\thu@set@partial@toc@format
\renewcommand\tableofcontents{%
\section*{目录}%
\thu@pdfbookmark{1}{目录}%
- \printcontents[translation]{l}{1}[2]{}%
+ \thu@print@contents{translation}{l}{1}{2}{}%
\vskip 20bp%
}%
\def\bibsection{%
@@ -6310,12 +6379,12 @@
% 书脊上方写论文题目,下方写本科生姓名,距上下页边均为 3cm。
%
% 研究生:
+% 博士论文的书脊使用三号字,硕士的为小三号。
% 示例中上下页边距为 5.5 cm,左右边距为 1 cm。
% \begin{macrocode}
\thu@define@key{
spine-font = {
name = spine@font,
- default = {\sanhao},
},
spine-title = {
name = spine@title,
@@ -6324,6 +6393,13 @@
name = spine@author,
},
}
+\renewcommand\thu@spine@font{%
+ \ifthu@degree@doctor
+ \fontsize{16bp}{20.8bp}\selectfont
+ \else
+ \fontsize{15bp}{19.5bp}\selectfont
+ \fi
+}
\newcommand*\CJKmovesymbol[1]{\raise.3em\hbox{#1}}
\newcommand*\CJKmove{%
\punctstyle{plain}%