summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx')
-rw-r--r--Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx248
1 files changed, 147 insertions, 101 deletions
diff --git a/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx b/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
index 061749cc9a1..2a9e07f9b4a 100644
--- a/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
+++ b/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx
@@ -14,7 +14,7 @@
%
% \iffalse
%<*driver>
-\ProvidesFile{thuthesis.dtx}[2021/03/21 7.2.1 Tsinghua University Thesis Template]
+\ProvidesFile{thuthesis.dtx}[2021/04/03 7.2.2 Tsinghua University Thesis Template]
\documentclass{ltxdoc}
\usepackage{dtx-style}
@@ -1246,7 +1246,7 @@
% \begin{macrocode}
%<cls>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
%<cls>\ProvidesClass{thuthesis}
-%<cls>[2021/03/21 7.2.1 Tsinghua University Thesis Template]
+%<cls>[2021/04/03 7.2.2 Tsinghua University Thesis Template]
% \end{macrocode}
%
% 报错
@@ -1302,7 +1302,7 @@
%<*cls>
\hyphenation{Thu-Thesis}
\def\thuthesis{ThuThesis}
-\def\version{7.2.1}
+\def\version{7.2.2}
\RequirePackage{kvdefinekeys}
\RequirePackage{kvsetkeys}
\RequirePackage{kvoptions}
@@ -2100,6 +2100,10 @@
% 注意重定义 \cs{normalsize} 应在 \pkg{unicode-math} 的 \cs{setmathfont} 前。
%
% 表达式行的行距为单倍行距,段前空 6 磅,段后空 6 磅。
+%
+% \cs{small} 等其他命令通常用于表格等环境中,这部分要求单倍行距,与正文的字号-行距比例不同,
+% 所以保留默认的 1.2 倍字号的行距,作为单倍行距在英文(1.15 倍字号)和中文(1.3倍字号)
+% 两种情况的折衷。
% \begin{macrocode}
\renewcommand\normalsize{%
\@setfontsize\normalsize{12bp}{20bp}%
@@ -2112,35 +2116,6 @@
\ifx\MakeRobust\@undefined \else
\MakeRobust\normalsize
\fi
-\DeclareRobustCommand\small{%
- \@setfontsize\small{10.5bp}{17.5bp}%
- \abovedisplayskip 6bp%
- \abovedisplayshortskip 6bp%
- \belowdisplayshortskip 6bp%
- \def\@listi{\leftmargin\leftmargini
- \topsep \z@skip
- \parsep \z@skip
- \itemsep \z@skip}%
- \belowdisplayskip \abovedisplayskip
-}
-\DeclareRobustCommand\footnotesize{%
- \@setfontsize\footnotesize{9bp}{15bp}%
- \abovedisplayskip 6bp%
- \abovedisplayshortskip 6bp%
- \belowdisplayshortskip 6bp%
- \def\@listi{\leftmargin\leftmargini
- \topsep \z@skip
- \parsep \z@skip
- \itemsep \z@skip}%
- \belowdisplayskip \abovedisplayskip
-}
-\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize{7.5bp}{12.5bp}}
-\DeclareRobustCommand\tiny{\@setfontsize\tiny{6.5bp}{10.83bp}}
-\DeclareRobustCommand\large{\@setfontsize\large{15bp}{25bp}}
-\DeclareRobustCommand\Large{\@setfontsize\Large{18bp}{30bp}}
-\DeclareRobustCommand\LARGE{\@setfontsize\LARGE{22bp}{36.67bp}}
-\DeclareRobustCommand\huge{\@setfontsize\huge{24bp}{40bp}}
-\DeclareRobustCommand\Huge{\@setfontsize\Huge{26bp}{43.33bp}}
% \end{macrocode}
% \end{macro}
%
@@ -3361,6 +3336,39 @@
\setlength{\@fpbot}{0bp \@plus1.0fil}
% \end{macrocode}
%
+% 由于 LaTeX2e kernel 的问题,图表等浮动体与文字前后的距离不一致,需要进行 patch。
+% 参考 \href{https://github.com/tuna/thuthesis/issues/614}{tuna/thuthesis/issues\#614}、
+% \url{https://www.zhihu.com/question/46618031} 和
+% \url{https://tex.stackexchange.com/a/40363/82731}。
+% \begin{macrocode}
+\patchcmd{\@addtocurcol}%
+ {\vskip \intextsep}%
+ {\edef\save@first@penalty{\the\lastpenalty}\unpenalty
+ \ifnum \lastpenalty = \@M % hopefully the OR penalty
+ \unpenalty
+ \else
+ \penalty \save@first@penalty \relax % put it back
+ \fi
+ \ifnum\outputpenalty <-\@Mii
+ \addvspace\intextsep
+ \vskip\parskip
+ \else
+ \addvspace\intextsep
+ \fi}%
+ {}{\thu@patch@error{\@addtocurcol}}
+\patchcmd{\@addtocurcol}%
+ {\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
+ {\ifnum\outputpenalty <-\@Mii
+ \aftergroup\vskip\aftergroup\intextsep
+ \aftergroup\nointerlineskip
+ \else
+ \vskip\intextsep
+ \fi}%
+ {}{\thu@patch@error{\@addtocurcol}}
+\patchcmd{\@getpen}{\@M}{\@Mi}
+ {}{\thu@patch@error{\@getpen}}
+% \end{macrocode}
+%
% 下面这组命令使浮动对象的缺省值稍微宽松一点,从而防止幅度对象占据过多的文本页面,
% 也可以防止在很大空白的浮动页上放置很小的图形。
% \begin{macrocode}
@@ -3419,37 +3427,7 @@
\thu@option@hook{number-separator}{\thu@set@number@separator}
% \end{macrocode}
%
-% 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距。段前空 3 磅,段后空 3 磅。
-% 段前段后的高度直接加到行距上,对于中文,修正后的行距为
-% $11 \times 1.3 + 6 = 20.3$(pt),
-% 而英文版的行距为 $11 \times 1.3 + 6 = 18.65$(pt)。
-% 用户可以手动设置 \cs{arraystretch} 调整表格的行距 。
-% \begin{macrocode}
-\patchcmd\@floatboxreset{%
- \normalsize
-}{%
- \ifthu@language@chinese
- \fontsize{11bp}{20.3bp}\selectfont
- \else
- \fontsize{11bp}{18.65bp}\selectfont
- \fi
-}{}{\thu@patch@error{\@floatboxreset}}
-% \end{macrocode}
-%
-% 对 \pkg{longtable} 跨页表格进行相同的设置。
-% \begin{macrocode}
-\AtEndOfPackageFile*{longtable}{
- \AtBeginEnvironment{longtable}{%
- \ifthu@language@chinese
- \fontsize{11bp}{20.3bp}\selectfont
- \else
- \fontsize{11bp}{18.65bp}\selectfont
- \fi
- }
-}
-% \end{macrocode}
-%
-% 定制浮动图形和表格标题样式,以及改变附录中浮动体的编号规则:
+% 定制浮动图形和表格标题样式:
% \begin{itemize}
% \item 图表标题字体为 11pt
% \item 去掉图表号后面的冒号,图序与图名文字之间空一个汉字符宽度
@@ -3461,14 +3439,17 @@
\ifthu@degree@bachelor
\fontsize{11bp}{15bp}\selectfont
\else
- \fontsize{11bp}{14.3bp}\selectfont
+ \ifthu@language@chinese
+ \fontsize{11bp}{14.3bp}\selectfont
+ \else
+ \fontsize{11bp}{12.65bp}\selectfont
+ \fi
\fi
}
\captionsetup{
font = thu,
labelsep = quad,
- aboveskip = 6bp,
- belowskip = 0bp,
+ skip = 6bp,
figureposition = bottom,
tableposition = top,
}
@@ -3478,6 +3459,50 @@
% \renewcommand{\p@subfigure}{:}
% \end{macrocode}
%
+% 研究生要求表单元格中的文字采用 11pt 宋体字,单倍行距。段前空 3 磅,段后空 3 磅。
+% 对于中文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.3) \approx 1.42$。
+% 对于英文,\cs{arraystretch} 需要调整为 $1 + 6 / (11 \times 1.15) \approx 1.47$。
+%
+% 注意不能简单地把行距设为 $\SI{11}{pt} \times 1.3 + \SI{6}{pt} = \SI{20.3}{pt}$,
+% 这会导致含有多行文字的单元格中行距有误。
+%
+% 其他浮动体中(比如 \env{algorithm})的字号默认同表格一致。
+% \begin{macrocode}
+\newcommand\thu@set@table@font{
+ \ifthu@language@chinese
+ \def\thu@table@font{%
+ \fontsize{11bp}{14.3bp}\selectfont
+ \renewcommand\arraystretch{1.42}%
+ }%
+ \else
+ \def\thu@table@font{%
+ \fontsize{11bp}{12.65bp}\selectfont
+ \renewcommand\arraystretch{1.47}%
+ }%
+ \fi
+}
+\thu@set@table@font
+\thu@option@hook{language}{\thu@set@table@font}
+\patchcmd\@floatboxreset{%
+ \normalsize
+}{%
+ \thu@table@font
+}{}{\thu@patch@error{\@floatboxreset}}
+% \end{macrocode}
+%
+% 对 \pkg{longtable} 跨页表格进行相同的设置。
+%
+% 在 Word 模板中按照正确的设置(需要去掉文档网格),
+% 中文模板每页能装下 1 行标题、1 行表头、30 行表身,
+% 英文模板每页能装下 1 行标题、1 行表头、33 行表身。
+% \begin{macrocode}
+\AtEndOfPackageFile*{longtable}{
+ \AtBeginEnvironment{longtable}{%
+ \thu@table@font
+ }
+}
+% \end{macrocode}
+%
% 研究生和本科生都推荐使用三线表,并且要求表的上、下边线为单直线,线粗为 1.5 磅;
% 第三条线为单直线,线粗为 1 磅。
% 这里设置 \pkg{booktabs} 线粗的默认值。
@@ -4835,52 +4860,45 @@
\newcommand{\thu@authorization@frontdate}{%
日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:}
\newcommand\thu@copyright@page@graduate{%
- \newgeometry{
- vmargin = 3.8cm,
- hmargin = 3.2cm,
- }%
\begingroup
\ctexset{
chapter = {
format = {\centering\sffamily\erhao},
- beforeskip = 18bp,
- afterskip = 6bp,
+ beforeskip = 40bp,
+ afterskip = 36bp,
},
}%
\thu@chapter*[]{关于学位论文使用授权的说明}%
\thispagestyle{empty}%
\endgroup
- \vskip 50bp%
+ \vskip 13bp%
\begingroup
\fontsize{14bp}{26bp}\selectfont
本人完全了解清华大学有关保留、使用学位论文的规定,即:\par
清华大学拥有在著作权法规定范围内学位论文的使用权,其中包括:%
- (1)已获学位的研究生必须按学校规定提交学位论文,%
- 学校可以采用影印、缩印或其他复制手段保存研究生上交的学位论文;%
+ (1)\nobreak 已获学位的研究生必须按学校规定提交学位论文,%
+ 学校可以采用影印、缩印或其他复制手段保存研究生上交的学位论文;\allowbreak
(2)\nobreak 为教学和科研目的,学校可以将公开的学位论文作为资料在图书馆、资料室等场所供校内师生阅读,%
- 或在校园网上供校内师生浏览部分内容;%
+ 或在校园网上供校内师生浏览部分内容;\allowbreak
\ifthu@degree@doctor
- (3)根据《中华人民共和国学位条例暂行实施办法》及上级教育主管部门具体要求,向国家图书馆报送相应的学位论文。%
+ (3)\nobreak 根据《中华人民共和国学位条例暂行实施办法》及上级教育主管部门具体要求,向国家图书馆报送相应的学位论文。%
\else
- (3)按照上级教育主管部门督导、抽查等要求,报送相应的学位论文。%
+ (3)\nobreak 按照上级教育主管部门督导、抽查等要求,报送相应的学位论文。%
\fi
\par
本人保证遵守上述规定。\par
- \vskip 6bp%
- \textbf{(保密的论文在解密后遵守此规定)}\par
\endgroup
- \vskip1.2cm%
+ \vskip 33bp%
\begingroup
- \noindent\xiaosi
- \hspace*{1.5cm}%
- 作者签名:\thu@underline[7em]\relax\hfill
- 导师签名:\thu@underline[7em]\relax\hspace*{1cm}\\[3pt]%
- \hspace*{1.5cm}%
- 日\hspace{2em}期:\thu@underline[7em]\relax\hfill
- 日\hspace{2em}期:\thu@underline[7em]\relax\hspace*{1cm}%
+ \fontsize{12bp}{23.4bp}\selectfont
+ \parindent\z@
+ \leftskip 43bp%
+ 作者签名:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}%
+ 导师签名:\hspace{4bp}\thu@underline[7em]{}\par
+ \vskip 6bp%
+ 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\hspace{47bp}%
+ 日\hspace{2em}期:\hspace{4bp}\thu@underline[7em]{}\par
\endgroup
- \clearpage
- \restoregeometry
}
\newcommand\thu@copyright@page@bachelor{%
\begingroup
@@ -5345,20 +5363,44 @@
%
% 将 \cs{citep} super 式引用的页码改为上标。
% \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\NAT@spacechar#3\fi\else #1\fi\endgroup}
- \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close\if*#3*\else#3\fi}%
- \else #1\fi\endgroup}
+ \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\NAT@spacechar#3\fi\else #1\fi\endgroup}
+ \unskip\kern\p@
+ \textsuperscript{%
+ \NAT@@open#1\NAT@@close
+ \if*#3*\else#3\fi
+ }%
+ \kern\p@
+ \else
+ #1%
+ \fi
+ \endgroup
+ }
% \end{macrocode}
%
% 将 \cs{citep} numbers 式引用的页码改为上标并置于括号外。
% \begin{macrocode}
- \renewcommand\NAT@citenum%
- [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
- % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
- #1\NAT@@close\textsuperscript{\if*#3*\else#3\fi}\else#1\fi\endgroup}
+ \renewcommand\NAT@citenum[3]{%
+ \ifNAT@swa
+ \NAT@@open
+ \if*#2*\else
+ #2\NAT@spacechar
+ \fi
+ % #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close
+ #1\NAT@@close
+ \if*#3*\else
+ \textsuperscript{#3}%
+ \fi
+ \else
+ #1%
+ \fi
+ \endgroup
+ }
% \end{macrocode}
%
% 修改 \cs{citet} 引用的样式。
@@ -5452,8 +5494,11 @@
% }{}%
\NAT@mbox{\NAT@@close}%
\@ifnum{\NAT@ctype=\z@}{%
- \if*#2*\else\textsuperscript{#2}\fi
+ \if*#2*\else
+ \textsuperscript{#2}%
+ \fi
}{}%
+ \NAT@super@kern
\fi
}{#1}{#2}%
}%
@@ -6391,6 +6436,7 @@
\RequirePackage{fontspec}[2017/01/20]
\RequirePackage{amsmath}
\RequirePackage{unicode-math}
+\RequirePackage{siunitx}
\RequirePackage[UTF8,scheme=chinese]{ctex}
\RequirePackage[
top=2.5cm, bottom=2.5cm,