summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thuthesis/thuthesis.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-15 03:01:25 +0000
committerNorbert Preining <norbert@preining.info>2020-06-15 03:01:25 +0000
commit539648a9305d6107a588ecdff34b5cdce48fb930 (patch)
treef6d097a665031b2889e491085366de0158f1fe98 /macros/latex/contrib/thuthesis/thuthesis.dtx
parent893b65e5d4c0b7cb8ebbfca9ee6b090b9a4a182c (diff)
CTAN sync 202006150301
Diffstat (limited to 'macros/latex/contrib/thuthesis/thuthesis.dtx')
-rw-r--r--macros/latex/contrib/thuthesis/thuthesis.dtx207
1 files changed, 127 insertions, 80 deletions
diff --git a/macros/latex/contrib/thuthesis/thuthesis.dtx b/macros/latex/contrib/thuthesis/thuthesis.dtx
index 6d7d046b56..fe1a16b6fa 100644
--- a/macros/latex/contrib/thuthesis/thuthesis.dtx
+++ b/macros/latex/contrib/thuthesis/thuthesis.dtx
@@ -17,7 +17,7 @@
%
% \iffalse
%<*driver>
-\ProvidesFile{thuthesis.dtx}[2020/06/12 6.1.1 Tsinghua University Thesis Template]
+\ProvidesFile{thuthesis.dtx}[2020/06/14 6.1.2 Tsinghua University Thesis Template]
\documentclass{ltxdoc}
\usepackage{dtx-style}
@@ -268,7 +268,6 @@
% \begin{shell}
% $ xelatex -shell-escape thuthesis.dtx
% $ makeindex -s gind.ist -o thuthesis.ind thuthesis.idx
-% $ makeindex -s gglo.ist -o thuthesis.gls thuthesis.glo
% $ xelatex -shell-escape thuthesis.dtx
% $ xelatex -shell-escape thuthesis.dtx # 生成说明文档 thuthesis.pdf
% \end{shell}
@@ -395,7 +394,8 @@
% 选择输出的格式是打印版还是电子版(用于提交),可选:\option{print}(默认)、\option{electronic}。
% 一些院系要求提交的电子版不含空白页,但是这对打印并不友好,
% 比如正文第一页可能会在左侧;以及一些部分需要单面打印,需要插入空白页。
-% 注意在不同选项下,生成的\textbf{声明页码很可能不同},需要打印签字并扫描后插入的用户请特别关注这一情况。
+% 注意在不同选项下,生成的声明页码很可能不同。为了避免页码错误,
+% \thuthesis{}将会在插入扫描的 PDF 文件时自动生成页码,因此\textbf{扫描声明页时请移除底部的页码},以防重叠。
%
% \begin{latex}
% \thusetup{
@@ -578,8 +578,8 @@
% 生成授权说明。用法:\cs{copyrightpage}\oarg{file}。
% 可选参数为扫描得到的 PDF 文件名,例如:
% \begin{latex}
-% % 将签字扫描后授权文件 scan-auth.pdf 替换原始页面
-% \copyrightpage[scan-auth.pdf]
+% % 将签字扫描后授权文件 scan-copyright.pdf 替换原始页面
+% \copyrightpage[scan-copyright.pdf]
% \end{latex}
%
% \subsubsection{摘要}
@@ -877,6 +877,18 @@
% \statement[scan-statement.pdf]
% \end{latex}
%
+% 由于打印版和电子版有空白页的差别,声明的页码可能不同。所以编译声明页时默认不加页码,
+% 在签字后插入扫描页时再补上页码,防止页码冲突。
+%
+% \DescribeOption{statement-page-number}
+% 如果需要编译时也加页码(如直接对电子版进行签名而不是插入扫描页),可以使用在 \cs{statement} 前设置
+% \begin{latex}
+% \thusetup{
+% statement-page-number = true,
+% }
+% \end{latex}
+% 注意,插入扫描页总是会加页码,不受该选项控制。
+%
% \subsubsection{附录}
%
% 附录由 \cs{appendix} 命令开启,然后像正文一样书写。
@@ -1001,6 +1013,15 @@
%
% 具体用法请参看示例文档 \file{data/resume.tex}。
%
+% \subsubsection{综合论文训练记录表}
+% \DescribeMacro{\record}
+% 本科生需要在最后附上综合论文训练记录表,可以用如下命令:
+%
+% \begin{latex}
+% \record{scan-record.pdf}
+% \end{latex}
+%
+%
% \subsection{书脊}
% \DescribeMacro{\spine}
% \DescribeOption{spine-font}
@@ -1061,7 +1082,7 @@
% \begin{macrocode}
%<cls>\NeedsTeXFormat{LaTeX2e}[2017/04/15]
%<cls>\ProvidesClass{thuthesis}
-%<cls>[2020/06/12 6.1.1 Tsinghua University Thesis Template]
+%<cls>[2020/06/14 6.1.2 Tsinghua University Thesis Template]
% \end{macrocode}
%
% 报错
@@ -1095,7 +1116,7 @@
%<*cls>
\hyphenation{Thu-Thesis}
\def\thuthesis{ThuThesis}
-\def\version{6.1.1}
+\def\version{6.1.2}
\RequirePackage{kvdefinekeys}
\RequirePackage{kvsetkeys}
\RequirePackage{kvoptions}
@@ -1570,7 +1591,7 @@
\ifodd\c@page
\else
\thispagestyle{empty}%
- \hbox{}
+ \hbox{}%
\newpage
\if@twocolumn
\hbox{}\newpage
@@ -1589,11 +1610,6 @@
% \begin{macrocode}
\renewcommand\frontmatter{%
\cleardoublepage
- \ifthu@degree@bachelor
- \pagestyle{thu@plain}
- \else
- \pagestyle{thu@headings}
- \fi
\@mainmatterfalse
\pagenumbering{Roman}%
\let\@tabular\thu@tabular
@@ -1601,10 +1617,14 @@
\renewcommand\mainmatter{%
\cleardoublepage
\@mainmattertrue
- \pagenumbering{arabic}
- \ifthu@degree@bachelor\pagestyle{thu@plain}\else\pagestyle{thu@headings}\fi}
+ \pagenumbering{arabic}%
+}
\renewcommand\backmatter{%
- \if@openright\cleardoublepage\else\clearpage\fi
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
\@mainmattertrue}
% \end{macrocode}
% \end{macro}
@@ -2281,38 +2301,57 @@
% \subsubsection{页眉页脚}
% \label{sec:headerfooter}
%
+% \pkg{fancyhdr} 定义页眉页脚很方便,但是有一个非常隐蔽的坑。
+% 第一次调用 \pkg{fancyhdr} 定义的样式时会修改 \cs{chaptermark},
+% 这会导致页眉信息错误(多余章号并且英文大写)。
+% 这是因为在 \cs{ps@fancy} 中对 \cs{chaptermark} 进行重定义,
+% 所以我们先调用 \cs{ps@fancy},再修改 \cs{chaptermark}。
+% \begin{macrocode}
+\pagestyle{fancy}
+% \end{macrocode}
+%
% 定义页眉和页脚。
-% \begin{macro}{\ps@thu@empty}
-% \begin{macro}{\ps@thu@plain}
-% \begin{macro}{\ps@thu@headings}
-% 定义三种页眉页脚格式:
-% \begin{itemize}
-% \item \texttt{thu@empty}:页眉页脚都没有
-% \item \texttt{thu@plain}:只显示页脚的页码。\cs{chapter} 自动调用
-% \cs{thispagestyle\{thu@plain\}}。
-% \item \texttt{thu@headings}:页眉页脚同时显示
-% \end{itemize}
+% 研究生要求:
+% 页眉宋体五号字,宋体五号字居中书写;
+% 页码五号 Times New Roman 体。
+%
+% 本科生要求:
+% 页眉:无;
+% 页码:位于页面底端,居中书写。
+%
+% 本科外文专业要求页码字号 12pt。
+% \begin{macrocode}
+\fancypagestyle{plain}{%
+ \fancyhf{}%
+ \renewcommand\footrulewidth{0pt}%
+ \ifthu@degree@bachelor
+ \renewcommand\headrulewidth{0pt}%
+ \fancyfoot[C]{\xiaowu\thepage}%
+ \let\@mkboth\@gobbletwo
+ \else
+ \renewcommand\headrulewidth{0.75bp}%
+ \fancyhead[C]{\wuhao\leftmark}%
+ \fancyfoot[C]{\wuhao\thepage}%
+ \let\@mkboth\markboth
+ \fi
+ \def\chaptermark##1{%
+ \markboth{\CTEXifname{\CTEXthechapter\hskip\ccwd}{}##1}{}%
+ }%
+}
+\pagestyle{plain}
+% \end{macrocode}
+%
+% 用于声明页,不含页脚。
% \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}}
+\fancypagestyle{nofooter}{%
+ \fancyfoot{}%
+}
+% \end{macrocode}
+%
+% \cs{chapter} 会调用特殊的 page style。
+% \begin{macrocode}
+\ctexset{chapter/pagestyle = plain}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
%
% \subsubsection{段落}
@@ -2611,35 +2650,6 @@
\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}
-%
% 各级标题格式设置。
% \begin{description}
% \item[chapter] 章序号与章名之间空一个汉字符 黑体三号字,居中书写,单倍行距,段
@@ -2669,7 +2679,6 @@
\ctexset{%
chapter={
afterindent=true,
- pagestyle={\ifthu@degree@bachelor thu@plain\else thu@headings\fi},
beforeskip={\ifthu@degree@bachelor 15bp\else 9bp\fi},
aftername=\hskip\ccwd,
afterskip={\ifthu@degree@bachelor 20bp\else 24bp\fi},
@@ -3068,7 +3077,6 @@
% \begin{macrocode}
\renewcommand\maketitle{%
\cleardoublepage
- \pagestyle{thu@empty}%
\pagenumbering{Alph}%
\thu@pdfbookmark{-1}{\thu@title}%
\thu@titlepage
@@ -3128,6 +3136,7 @@
bottom = 6cm,
hmargin = 3.5cm,
}%
+ \thispagestyle{empty}%
\null\vskip 0.2cm%
\begingroup
\centering
@@ -3156,6 +3165,7 @@
bottom = 6cm,
hmargin = 3.5cm,
}%
+ \thispagestyle{empty}%
\null\vskip 0.45cm%
\begingroup
\centering
@@ -3315,6 +3325,7 @@
bottom = 5cm,
hmargin = 3.6cm,
}%
+ \thispagestyle{empty}%
\ifthu@degree@type@academic
\thu@titlepage@en@graduate@academic
\else
@@ -3435,6 +3446,7 @@
vmargin = 2.54cm,
hmargin = 3.17cm,
}%
+ \thispagestyle{empty}%
\null\vskip 0.44cm%
\begingroup
\centering
@@ -3500,6 +3512,7 @@
% \myentry{博士后封面}
% \begin{macrocode}
\newcommand\thu@cover@postdoc{%
+ \thispagestyle{empty}%
\begin{center}%
\renewcommand\ULthickness{0.7pt}%
\vspace*{0.35cm}%
@@ -3542,6 +3555,7 @@
% \myentry{博士后题名页}
% \begin{macrocode}
\newcommand\thu@titlepage@postdoc{%
+ \thispagestyle{empty}%
\begin{center}%
\vspace*{1.5cm}%
\parbox[t][3cm][c]{\textwidth}{%
@@ -3604,6 +3618,7 @@
\newcommand\copyrightpage[1][]{%
\ifthu@degree@postdoc\relax\else
\cleardoublepage
+ \thispagestyle{empty}%
\thu@pdfbookmark{0}{\thu@authorization@title}%
\def\thu@@tmp{#1}
\ifx\thu@@tmp\@empty
@@ -3618,6 +3633,7 @@
\end{list}%
\fi%
\else
+ \thu@phantomsection
\includepdf{#1}%
\fi
\fi
@@ -3777,7 +3793,7 @@
% \label{sec:ackanddeclare}
%
% \begin{environment}{acknowledgements}
-% 支持扫描文件替换。
+% 定义致谢环境
% \begin{macrocode}
\newcommand\thu@statement@name{声\hspace{\ccwd}明}
\newcommand{\thu@statement@text}{本人郑重声明:所呈交的学位论文,是本人在导师指导下
@@ -3802,8 +3818,20 @@
}
% \end{macrocode}
%
-% 声明部分
+% \end{environment}
+% \begin{environment}{statement}
+% 声明部分(支持扫描文件替换)
% \begin{macrocode}
+\thu@define@key{
+ statement-page-number = {
+ name = statement@page@number,
+ choices = {
+ false,
+ true,
+ },
+ default = false,
+ },
+}
\newcommand\statement[1][]{%
\ifthu@degree@bachelor
\cleardoublepage
@@ -3811,6 +3839,9 @@
\def\thu@@tmp{#1}%
\ifx\thu@@tmp\@empty
\thu@chapter*{\thu@statement@name}%
+ \ifthu@statement@page@number@false
+ \thispagestyle{nofooter}%
+ \fi
\thu@statement@text\par
\ifthu@degree@graduate
\vskip 2cm%
@@ -3820,7 +3851,8 @@
{\hfill\thu@signature\thu@underline[2.5cm]\relax
\thu@backdate\thu@underline[2.5cm]\relax}%
\else
- \includepdf[pagecommand={\thispagestyle{thu@empty}%
+ \includepdf[pagecommand={%
+ \thu@phantomsection
\addcontentsline{toc}{chapter}{\thu@statement@name}%
}]{#1}%
\fi
@@ -4053,7 +4085,7 @@
\g@addto@macro\appendix{%
\thusetup{
toc-depth = 0,
- }
+ }%
}
% \end{macrocode}
%
@@ -4234,6 +4266,21 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{综合论文训练记录表}
+%
+% \begin{macro}{\record}
+% (本科生专用)插入综合论文训练记录表的 PDF 版本,并加入书签。
+%
+% \begin{macrocode}
+\newcommand{\record}[1]{%
+ \clearpage
+ \thu@pdfbookmark{0}{综合论文训练记录表}%
+ \includepdf[pages=-]{#1}%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
% \subsection{其他宏包的设置}
%
% 这些宏包并非格式要求,但是为了方便同学们使用,在这里进行简单设置。