From 7ce31410d12b842b9c2e0ef079bab8d7191eeb76 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Dec 2017 22:18:07 +0000 Subject: thuthesis (3dec17) git-svn-id: svn://tug.org/texlive/trunk@45976 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/thuthesis/thuthesis.dtx | 428 +++++++++++---------- 1 file changed, 235 insertions(+), 193 deletions(-) (limited to 'Master/texmf-dist/source/latex/thuthesis') diff --git a/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx b/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx index ff55cee271e..8e9cb1c6bd8 100644 --- a/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx +++ b/Master/texmf-dist/source/latex/thuthesis/thuthesis.dtx @@ -1,22 +1,22 @@ % \iffalse meta-comment % -% Copyright (C) 2005-2016 by Ruini Xue +% Copyright (C) 2005-2017 by Ruini Xue % -% This file may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3a +% 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: +% 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. % -% http://www.latex-project.org/lppl.txt -% -% and version 1.3a or later is part of all distributions of LaTeX -% version 2004/10/01 or later. +% This work has the LPPL maintenance status `maintained'. % % \fi % % \iffalse %<*driver> -\ProvidesFile{thuthesis.dtx}[2017/03/26 5.3.2 Tsinghua University Thesis Template] +\ProvidesFile{thuthesis.dtx}[2017/12/3 5.4.0 Tsinghua University Thesis Template] \documentclass{ltxdoc} \usepackage{dtx-style} @@ -238,7 +238,8 @@ % thuthesis.dtx & \textsc{DocStrip} 源文件(开发用)\\\midrule % thuthesis.cls & 模板类文件\\ % thuthesis.cfg & 模板配置文件\\ -% thuthesis.bst & 参考文献样式文件\\\midrule +% bst/numeric.bst & 参考文献样式文件\\ +% bst/author-year.bst & 参考文献样式文件\\\midrule % main.tex & 示例文档主文件\\ % shuji.tex & 书脊示例文档\\ % ref/ & 示例文档参考文献目录\\ @@ -265,9 +266,9 @@ % 略此节,直接阅读第~\ref{sec:generate-thesis} 节。若下载 CTAN 包或者 Github 开发 % 代码,请阅读本节了解生成模板文件的步骤。} % -% 模板解压缩后生成文件夹 \file{thuthesis-vX.Y.Z}\footnote{\texttt{vX.Y.Z} 为版本号。}, -% 其中包括:模板源文件(\file{thuthesis.ins} 和 \file{thuthesis.dtx}),参考文献 -% 样式 \file{thuthesis.bst},示例文档 +% 模板解压缩后生成文件夹 \file{thuthesis-vX.Y.Z}\footnote{\texttt{vX.Y.Z} 为版本 +% 号。},其中包括:模板源文件(\file{thuthesis.ins} 和 \file{thuthesis.dtx}),参 +% 考文献样式 \file{bst/numeric.bst} 和 \file{bst/author-year.bst},示例文档 % (\file{main.tex},\file{shuji.tex},\file{thuthesis.sty}\footnote{可能用到的包 % 以及一些命令定义都放在这里,以免 \file{thuthesis.cls} 过分臃 % 肿。},\file{data/} 和 \file{figures/} 和 \file{ref/})。在使用之前需要先生成模 @@ -351,15 +352,15 @@ % \label{sec:updgrade} % \thuthesis\ 升级非常简单,可以通过 \TeX 发行版的包管理工具自动更新发行版,也可 % 以下载最新的开发版, -% 将 \file{thuthesis.ins},\file{thuthesis.dtx} 和 \file{thuthesis.bst} 拷贝至工作目 -% 录覆盖相应的文件,然后运行: +% 将 \file{thuthesis.ins},\file{thuthesis.dtx} 和 \file{bst/} 拷贝至工作目录覆盖 +% 相应的文件,然后运行: % \begin{shell} % $ latex thuthesis.ins % \end{shell} % % 生成新的类文件和配置文件即可。也可以直接拷 -% 贝 \file{thuthesis.cls},\file{thuthesis.cfg} 和 \file{thuthesis.bst},免去上面命令 -% 的执行。 +% 贝 \file{thuthesis.cls},\file{thuthesis.cfg} 和 \file{bst/},免去上面命令的执 +% 行。 % % % \section{使用说明} @@ -379,12 +380,11 @@ % % \subsection{示例文件} % \label{sec:userguide} -% 模板核心文件有三 -% 个:\file{thuthesis.cls},\file{thuthesis.cfg} 和\file{thuthesis.bst},但是如果 -% 没有示例文档用户会发现很难下手。所以推荐新用户从模板自带的示例文档入手,里面包 -% 括了论文写作用到的所有命令及其使用方法,只需要用自己的内容进行相应替换就可以。 -% 对于不清楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自于示 -% 例文档,具体内容可以参考模板附带的 \file{main.tex} 和 \file{data/}。 +% 模板核心文件有:\file{thuthesis.cls},\file{thuthesis.cfg} 和 \file{bst/},但是 +% 如果没有示例文档用户会发现很难下手。所以推荐新用户从模板自带的示例文档入手,里 +% 面包括了论文写作用到的所有命令及其使用方法,只需要用自己的内容进行相应替换就可 +% 以。对于不清楚的命令可以查阅本手册。下面的例子描述了模板中章节的组织形式,来自 +% 于示例文档,具体内容可以参考模板附带的 \file{main.tex} 和 \file{data/}。 % % \lstinputlisting[style=lstStyleLaTeX]{main.tex} % @@ -445,6 +445,52 @@ % \DescribeOption{arialtitle} % 章节标题中英文是否用 \emph{Arial} 字体(默认打开)。 % +% \subsection{引用方式} +% \label{sec:citestyle} +% 模板支持两种引用方式,分别为理工科常用的“数字式 [1]”和文科常用 +% 的“作者-年份 (Zhang, 2008)”。使用者可通过 \cs{bibliographystyle} 来选择: +% \begin{latex} +% % 两个样式文件都置于 bst/,故引用时许注意路径。 +% % 数字式 +% \bibliographystyle{bst/numeric} +% +% % 作者-年份 +% \bibliographystyle{bst/author-year} +% \end{latex} +% +% \DescribeMacro{\inlinecite} +% 学校要求的参考文献引用有两种模式:(1)上标模式。比如``同样的工作有很 +% 多$^{[1,2]}$\ldots''。(2)正文模式。比如``文[3] 中详细说明了\ldots''。其中上标 +% 模式使用远比正文模式频繁,所以为了符合使用习惯,上标模式仍然用常规 +% 的 \cs{cite}\marg{key},而 \cs{inlinecite}\marg{key} 则用来生成正文模式。 +% +% 关于参考文献模板推荐使用 \BibTeX,关于中文参考文献需要额外增加一个 Entry: +% \texttt{lang},将其设置为 \texttt{zh} 用来指示此参考文献为中文。如: +% \begin{latex} +% @INPROCEEDINGS{cnproceed, +% author = {王重阳 and 黄药师 and 欧阳峰 and 洪七公 and 段皇帝}, +% title = {武林高手从入门到精通}, +% booktitle = {第~$N$~次华山论剑}, +% year = 2006, +% address = {西安, 中国}, +% month = sep, +% lang = "zh", +% } +% +% @ARTICLE{cnarticle, +% AUTHOR = "贾宝玉 and 林黛玉 and 薛宝钗 and 贾探春", +% TITLE = "论刘姥姥食量大如牛之现实意义", +% JOURNAL = "红楼梦杂谈", +% PAGES = "260--266", +% VOLUME = "224", +% YEAR = "1800", +% LANG = "zh", +% } +% \end{latex} +% +% 注意如果不需要引用参考文献,请删除 \file{main.tex} 中 \cs{bibliography} 开头的两行, +% 以避免可能的编译错误。 +% % \subsection{中文字体} % \label{sec:chinese-fonts} % @@ -853,12 +899,11 @@ % % \subsubsection{致谢声明} % \DescribeEnv{acknowledgement} -% 把致谢做成一个环境更好一些,直接往里面写感谢的话就可以啦!下面是数学系一位同 -% 学致谢里的话,拿过来做个广告。希望每个人都能写这么一句 :) +% 把致谢做成一个环境更好一些,直接往里面写感谢的话就可以啦。 % \begin{latex} % \begin{acknowledgement} % … -% 还要特别感谢计算机系薛瑞尼同学在论文格式和 \LaTeX\ 编译等方面给我的很多帮助! +% 还要特别感谢 \thuthesis\ 节省了论文排版时间! % \end{acknowledgement} % \end{latex} % @@ -964,6 +1009,32 @@ % % 具体用法请参看示例文档 \file{data/resume.tex}。 % +% \subsection{书脊} +% \DescribeMacro{\shuji} +% 生成装订的书脊,为竖排格式,命令格式:\cs{shuji}\oarg{标题}\oarg{作者}。默认参 +% 数为论文中文题目和中文作者。如果中文题目中没有英文字母,那么直接调用此命令即可。 +% 否则,就要像例子里面那样做一些微调(参看模板自带的 \file{shuji.tex})。下面是一 +% 个例子: +% \begin{latex} +% \documentclass[type=master]{thuthesis} +% % 此处 type 无所谓 +% +% \begin{document} +% \thuset{ +% ctitle={论文中文题目}, +% cauthor={中文姓名}} +% +% \shuji % 使用默认标题和默认作者 +% +% \shuji[使用默认作者的标题] +% +% \shuji[同时修改标题和作者的标题][尼瑞薛] +% +% % 如果标题中有英文,那可以参考如下方法进行微调: +% \shuji[清华大学 \raisebox{-5pt}{\LaTeX} 论文模板 \raisebox{-5pt}{v\version} 样例] +% \end{document} +% \end{latex} +% % \subsection{自定义} % \label{sec:othercmd} % @@ -1008,42 +1079,6 @@ % \medskip % \noindent\framebox[\linewidth][l]{{\heiti 胡说~1.1~~~} % {契丹武士要来中原夺武林秘笈。—— 慕容博}} % -% \subsubsection{引用方式} -% -% \DescribeMacro{\inlinecite} -% 学校要求的参考文献引用有两种模式:(1)上标模式。比如``同样的工作有很 -% 多$^{[1,2]}$\ldots''。(2)正文模式。比如``文[3] 中详细说明了\ldots''。其中上标 -% 模式使用远比正文模式频繁,所以为了符合使用习惯,上标模式仍然用常规 -% 的 \cs{cite}\marg{key},而 \cs{inlinecite}\marg{key} 则用来生成正文模式。 -% -% 关于参考文献模板推荐使用 \BibTeX,关于中文参考文献需要额外增加一个 Entry: -% \texttt{lang},将其设置为 \texttt{zh} 用来指示此参考文献为中文,以 -% 便 \file{thuthesis.bst} 处理。如: -% \begin{latex} -% @INPROCEEDINGS{cnproceed, -% author = {王重阳 and 黄药师 and 欧阳峰 and 洪七公 and 段皇帝}, -% title = {武林高手从入门到精通}, -% booktitle = {第~$N$~次华山论剑}, -% year = 2006, -% address = {西安, 中国}, -% month = sep, -% lang = "zh", -% } -% -% @ARTICLE{cnarticle, -% AUTHOR = "贾宝玉 and 林黛玉 and 薛宝钗 and 贾探春", -% TITLE = "论刘姥姥食量大如牛之现实意义", -% JOURNAL = "红楼梦杂谈", -% PAGES = "260--266", -% VOLUME = "224", -% YEAR = "1800", -% LANG = "zh", -% } -% \end{latex} -% -% 注意如果不需要引用参考文献,请删除 \file{main.tex} 中 \cs{bibliography} 开头的两行, -% 以避免可能的编译错误。 -% % \subsubsection{列表环境} % \DescribeEnv{itemize} % \DescribeEnv{enumerate} @@ -1052,42 +1087,15 @@ % 缩。一方面清除了多余空间,另一方面用户可以自己指定列表环境的样式(如标签符号, % 缩进等)。细节请参看 \pkg{enumitem} 文档,此处不再赘述。 % -% \subsubsection{书脊} -% \DescribeMacro{\shuji} -% 生成装订的书脊,为竖排格式,命令格式:\cs{shuji}\oarg{标题}\oarg{作者}。默认参 -% 数为论文中文题目和中文作者。如果中文题目中没有英文字母,那么直接调用此命令即可。 -% 否则,就要像例子里面那样做一些微调(参看模板自带的 \file{shuji.tex})。下面是一 -% 个例子: -% \begin{latex} -% \documentclass[type=master]{thuthesis} -% % 此处 type 无所谓 -% -% \begin{document} -% \thuset{ -% ctitle={论文中文题目}, -% cauthor={中文姓名}} -% -% \shuji % 使用默认标题和默认作者 -% -% \shuji[使用默认作者的标题] -% -% \shuji[同时修改标题和作者的标题][尼瑞薛] -% -% % 如果标题中有英文,那可以参考如下方法进行微调: -% \shuji[清华大学 \raisebox{-5pt}{\LaTeX} 论文模板 \raisebox{-5pt}{v\version} 样例] -% \end{document} -% \end{latex} -% % \subsection{其它} % 模板的配置文件 \file{thuthesis.cfg} 中定义了很多固定词汇,一般无须修改。如果有特殊需求, % 推荐在导言区使用 \cs{renewcommand}。 % % \section{致谢} % \label{sec:thanks} -% 感谢这些年来一直陪伴 \thuthesis\ 成长的新老同学,大家的需求是模板前进的动力, -% 大家的反馈是模板提高的机会。 +% 感谢这些年来一直陪伴 \thuthesis\ 成长的新老同学! % -% 热烈欢迎各位到 \href{http://github.com/xueruini/thuthesis/}{\thuthesis\ Github 主页}贡献! +% 欢迎各位到 \href{http://github.com/xueruini/thuthesis/}{\thuthesis\ Github 主页}贡献! % % \StopEventually{\PrintChanges\PrintIndex} % \clearpage @@ -1099,7 +1107,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesClass{thuthesis} %\ProvidesFile{thuthesis.cfg} -%[2017/03/26 5.3.2 Tsinghua University Thesis Template] +%[2017/12/3 5.4.0 Tsinghua University Thesis Template] % \end{macrocode} % % \subsection{定义选项} @@ -1118,7 +1126,7 @@ %<*cls> \hyphenation{Thu-Thesis} \def\thuthesis{\textsc{ThuThesis}} -\def\version{5.3.2} +\def\version{5.4.0} \RequirePackage{kvoptions} \SetupKeyvalOptions{ @@ -1127,7 +1135,7 @@ setkeys=\kvsetkeys} % \end{macrocode} % -% 用 \pkg{kvoptions} 的 key=value 方式来设置论文类型。 +% 用 \pkg{kvoptions} 的 \texttt{key=value} 方式来设置论文类型。 % \changes{v5.0.0}{2015/12/13}{使用 \pkg{kvoptions} 简化选项 type。} % \begin{macrocode} \newif\ifthu@bachelor @@ -1139,7 +1147,18 @@ \thu@masterfalse \thu@doctorfalse \thu@postdoctorfalse - \expandafter\csname thu@#1true\endcsname} + \expandafter\csname thu@#1true\endcsname + \ifthu@bachelor\relax\else + \ifthu@master\relax\else + \ifthu@doctor\relax\else + \ifthu@postdoctor\relax\else + \ClassError{thuthesis}% + {Please specify thesis type in option: \MessageBreak + type=[bachelor | master | doctor | postdoctor]}{} + \fi + \fi + \fi + \fi} \def\thu@deprecated@type@option{% \kvsetkeys{thu}{type=\CurrentOption} % for compatability. \ClassError{thuthesis}{Option '\CurrentOption' is deprecated, \MessageBreak @@ -1165,6 +1184,12 @@ \DeclareBoolOption{arialtitle} % \end{macrocode} % +% 在 Windows Vista 或之后系统下时,默认使用微软雅黑,这可能会导致审查不合格。 +% 下面设置默认不使用微软雅黑,同时保持跨平台兼容性。 +% \begin{macrocode} +\IfFileExists{/dev/null}{}{\PassOptionsToClass{fontset=windowsold}{ctexbook}} +% \end{macrocode} +% % \option{raggedbottom} 选项(默认打开) % \changes{v4.8}{2013/03/05}{增加 noraggedbottom 选项。} % \changes{v5.0.0}{2015/12/13}{norggedbottom 选项修改为 raggedbottom。} @@ -1211,20 +1236,6 @@ \LoadClass[a4paper,openany,UTF8,zihao=-4,scheme=plain]{ctexbook} % \end{macrocode} % -% 用户至少要提供一个选项,指定论文类型。 -% \begin{macrocode} -\ifthu@bachelor\relax\else - \ifthu@master\relax\else - \ifthu@doctor\relax\else - \ifthu@postdoctor\relax\else - \ClassError{thuthesis}% - {Please specify thesis type in option: \MessageBreak - type=[bachelor | master | doctor | postdoctor]}{} - \fi - \fi - \fi -\fi -% \end{macrocode} % % \subsection{装载宏包} % \label{sec:loadpackage} @@ -1334,14 +1345,12 @@ % % 参考文献引用宏包。 % \begin{macrocode} -\RequirePackage[numbers,super,sort&compress]{natbib} +\RequirePackage[sort&compress]{natbib} % \end{macrocode} % % 删除默认模板(\file{book.cls})在章之间引入的垂直间隔。要放在 \pkg{hyperref} % 之前。 % \begin{macrocode} -\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{} % lof -\patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{} % lot % \end{macrocode} % 生成有书签的 pdf 及其开关,请结合 gbk2uni 避免书签乱码。 % \changes{v2.6}{2006/06/09}{去除 hyperref 选项,等待全局传递。} @@ -1398,9 +1407,9 @@ left=32mm, headheight=5mm, headsep=5mm, - textheight=220mm, - bottom=37mm, - footskip=17mm} + textheight=227mm, + bottom=32mm, + footskip=12mm} \else \geometry{ left=30mm, @@ -1609,7 +1618,7 @@ \renewcommand{\footrulewidth}{0pt}} \fancypagestyle{thu@headings}{% \fancyhead{} - \fancyhead[C]{\wuhao\songti\leftmark} + \fancyhead[C]{\wuhao\normalfont\leftmark} \fancyfoot{} \fancyfoot[C]{\wuhao\thepage} \renewcommand{\headrulewidth}{0.4pt} @@ -1735,17 +1744,18 @@ % 修改 \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 文件中。} % \begin{macrocode} -\theorembodyfont{\rmfamily\songti} -\theoremheaderfont{\rmfamily\heiti} -% %<*cfg> +\theorembodyfont{\normalfont} +\theoremheaderfont{\normalfont\heiti} \theoremsymbol{\ensuremath{\square}} \newtheorem*{proof}{证明} \theoremstyle{plain} @@ -1811,7 +1821,7 @@ \fi \let\old@tabular\@tabular \def\thu@tabular{\dawu[1.5]\old@tabular} -\DeclareCaptionLabelFormat{thu}{{\dawu[1.5]\songti #1~\rmfamily #2}} +\DeclareCaptionLabelFormat{thu}{{\dawu[1.5]\normalfont #1~#2}} \DeclareCaptionLabelSeparator{thu}{\hspace{1em}} \DeclareCaptionFont{thu}{\dawu[1.5]} \captionsetup{labelformat=thu,labelsep=thu,font=thu} @@ -1887,7 +1897,7 @@ % \begin{macrocode} %<*cls> \def\thu@title@font{% - \ifthu@arialtitle\sffamily\else\relax\fi} + \ifthu@arialtitle\sffamily\else\heiti\fi} % \end{macrocode} % % \pkg{fancyhdr} 定义页眉页脚很方便,但是有一个非常隐蔽的坑。通过 \pkg{fancyhdr} @@ -1937,8 +1947,9 @@ % % \changes{v4.4}{2008/06/04}{调整段前距为 -20bp 而不是原来的 -24bp。} % -% \item[subsection] 二级节标题,例如:\fbox{2.1.1 实验装置}。采用黑体 13pt (本科 -% 生是 14pt) 字居左书写,行距为固定值 20 磅,段前空 12 磅,段后空 6 磅。 +% \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。} @@ -1960,31 +1971,34 @@ chapter={ afterindent=true, pagestyle={\ifthu@bachelor thu@plain\else thu@headings\fi}, - beforeskip={\ifthu@bachelor 13bp\else 9bp\fi}, + beforeskip={\ifthu@bachelor 15bp\else 9bp\fi}, aftername=\hskip\ccwd, afterskip={\ifthu@bachelor 20bp\else 24bp\fi}, - format={\centering\thu@title@font\heiti\ifthu@bachelor\xiaosan\else\sanhao[1]\fi}, + format={\centering\thu@title@font\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={\thu@title@font\heiti\sihao[1.429]}, + format={\thu@title@font\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={\thu@title@font\heiti\ifthu@bachelor\xiaosi[1.667]\else\banxiaosi[1.538]\fi}, + format={\thu@title@font\ifthu@bachelor\xiaosi[1.25]\else\banxiaosi[1.538]\fi}, + numberformat={\thu@title@font\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={\csname thu@title@font\endcsname\heiti\xiaosi[1.667]}, + format={\thu@title@font\ifthu@bachelor\xiaosi[1.25]\else\xiaosi[1.667]\fi}, }, paragraph/afterindent=true, subparagraph/afterindent=true} @@ -2019,7 +2033,9 @@ }{% \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{}{}} @@ -2062,7 +2078,7 @@ % \begin{macrocode} \renewcommand\tableofcontents{% \thu@chapter*[]{\contentsname} - \ifthu@bachelor\xiaosi[1.8]\else\xiaosi[1.65]\fi\@starttoc{toc}\normalsize} + \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}。} @@ -2078,7 +2094,7 @@ \renewcommand*\l@chapter[2]{% \ifnum \c@tocdepth >\m@ne \addpenalty{-\@highpenalty}% - \vskip 4bp \@plus\p@ + \ifthu@bachelor \vskip 6bp \else \vskip 4bp \fi \@plus\p@ \setlength\@tempdima{4em}% \begingroup \parindent \z@ \rightskip \@pnumwidth @@ -2435,8 +2451,13 @@ %<*cls> \newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt} \newlength{\thu@title@width} -\newcommand{\thu@put@title}[2][\thu@title@width]{% +\ifxetex % todo: ugly codes + \newcommand{\thu@put@title}[2][\thu@title@width]{% \begin{CJKfilltwosides}[b]{#1}#2\end{CJKfilltwosides}} +\else + \newcommand{\thu@put@title}[2][\thu@title@width]{% + \begin{CJKfilltwosides}{#1}#2\end{CJKfilltwosides}} +\fi \def\thu@first@titlepage{% \ifthu@postdoctor\thu@first@titlepage@postdoctor\else\thu@first@titlepage@other\fi} \newcommand{\thu@first@titlepage@postdoctor}{ @@ -2492,14 +2513,14 @@ \parbox[b][2.4cm][t]{\textwidth}{% \ifthu@secret{\heiti\sanhao\thu@secretlevel\thu@secret@content}\else\rule{1cm}{0cm}\fi} \ifthu@bachelor - \vskip0.45cm - {\includegraphics{tsinghua}} + \vskip0.65cm + {\yihao\lishu\ziju{0.5}\thu@schoolname} \par\vskip1.5cm - {\xiaochu\heiti\ziju{0.5}\thu@bachelor@subtitle} - \vskip2.2cm + {\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.55]% + \ignorespaces\yihao[1.51]% \renewcommand{\CJKunderlinebasesep}{0.25cm}% \renewcommand{\ULthickness}{1.3pt}% \ifxetex @@ -2514,7 +2535,7 @@ \parbox[t][9cm][t]{\paperwidth-8cm}{ \renewcommand{\baselinestretch}{1.3} \begin{center} - \yihao[1.2]{\sffamily\heiti\thu@ctitle}\par% + \yihao[1.2]{\sffamily\thu@ctitle}\par% \par\vskip 18bp% \xiaoer[1]\textrm{\thu@apply}% \end{center}} @@ -2530,15 +2551,15 @@ % \changes{v5.1.0}{2015/12/27}{修改联合指导教师显示问题。} % \begin{macrocode} \ifthu@bachelor - \vskip1cm + \vskip0.75cm \ifx\thu@cassosupervisor\@empty% - \def\thu@tempa{7.0cm} + \def\thu@tempa{7.15cm} \else% - \def\thu@tempa{8.0cm} + \def\thu@tempa{8.15cm} \fi% \parbox[t][\thu@tempa][t]{\textwidth}{% - {\fangsong\sanhao[1.8]% - \hspace*{1.65cm} + {\fangsong\sanhao[1.95]% + \hspace*{1.9cm} \setlength{\thu@title@width}{4em} \setlength{\extrarowheight}{6pt} \ifxetex % todo: ugly codes @@ -2597,7 +2618,7 @@ % \changes{v4.4.3}{2008/06/09}{修改本科生论文封面日期格式以符合新样例。} % \begin{macrocode} \begin{center} - {\ifthu@bachelor\vskip-1.0cm\hskip-1.2cm\xiaosi\else% + {\ifthu@bachelor\vskip-1.0cm\xiaosi\else% \vskip-0.5cm\sanhao\fi% \songti\thu@cdate} \end{center} @@ -2839,7 +2860,7 @@ % \changes{v4.4.2}{2008/06/05}{本科生格式中文关键词采用首行缩进且无悬挂缩进。} % \begin{macrocode} \vskip12bp - \thu@put@keywords{\heiti\thu@ckeywords@title}{\thu@ckeywords} + \thu@put@keywords{\textbf\thu@ckeywords@title}{\thu@ckeywords} % \end{macrocode} % % 英文摘要部分的标题为 \textbf{Abstract},用 Arial 体三号字。研究生的英文摘要要求 @@ -2998,7 +3019,7 @@ {\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{\addvspace{6bp}\@dottedtocline{1}{0em}{4em}} +\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} @@ -3049,19 +3070,18 @@ % \label{sec:ref} % % \begin{macro}{\inlinecite} -% 正文引用模式。依赖于 \pkg{natbib} 宏包,修改其中的命令。旧命令 \cs{onlinecite} -% 依然可用。 +% 依赖于 \pkg{natbib} 宏包,修改其中的命令。 旧命令 \cs{onlinecite} 依然可用。 % \changes{v5.0.0}{2015/11/23}{用 \cs{inlinecite} 替换 \cs{onlinecite}。为保证兼 % 容性,\cs{onlinecite} 会保留。} +% \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).} % \begin{macrocode} %<*cls> -\bibpunct{[}{]}{,}{s}{}{,} -\renewcommand\NAT@citesuper[3]{\ifNAT@swa% - \unskip\kern\p@\textsuperscript{\NAT@@open #1\NAT@@close}% - \if*#3*\else\ (#3)\fi\else #1\fi\endgroup} +\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} % @@ -3069,18 +3089,6 @@ % 行距采用固定值 16 磅,段前空 3 磅,段后空 0 磅。 % 本科生要求固定行距 17pt,段前后间距 3pt。 % -% \begin{macro}{\thudot} -% 研究生参考文献条目最后可加点,图书文献一般不加。 -% 本科生未作说明。 -% 只好定义一个东西来拙劣地处理了, -% 本来这个命令通过 \texttt{@preamble} 命令放到 bib 文件中是最省事的,但是那 -% 样的话很多人肯定不知道该怎么做了。 -% \changes{v3.1}{2007/06/19}{引入 \cs{thudot} 来自动完成参考文献最后的点。} -% \begin{macrocode} -\def\thudot{\ifthu@bachelor\else\unskip.\fi} -% -% \end{macrocode} -% \end{macro} % \begin{macro}{\thumasterbib} % \begin{macro}{\thuphdbib} % 本科生和研究生模板要求外文硕士论文参考文献显示``[Master Thesis]'',而博士模板 @@ -3093,46 +3101,78 @@ % \changes{v4.7}{2012/05/29}{修改两个宏使其对应不同的中文论文需求。} % \begin{macrocode} %<*cfg> -\def\thumasterbib{\ifthu@bachelor [D]\else [硕士学位论文]\fi} -\def\thuphdbib{\ifthu@bachelor [D]\else [博士学位论文]\fi} +\def\thumasterbib{\ifthu@bachelor D\else 硕士学位论文\fi} +\def\thuphdbib{\ifthu@bachelor D\else 博士学位论文\fi} % % \end{macrocode} % \end{macro} % \end{macro} -% \begin{environment}{thebibliography} -% 修改默认的 thebibliography 环境,增加一些调整代码。 +% +% 复用 \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} 的环境调整距离兼容性更好。} % \begin{macrocode} %<*cls> -\renewenvironment{thebibliography}[1]{% - \thu@chapter*{\bibname}% - \wuhao[1.5] - \list{\@biblabel{\@arabic\c@enumiv}}% - {\renewcommand{\makelabel}[1]{##1\hfill} - \settowidth\labelwidth{1.1cm} - \setlength{\labelsep}{0.4em} - \setlength{\itemindent}{0pt} - \setlength{\leftmargin}{\labelwidth+\labelsep} - \addtolength{\itemsep}{-0.7em} - \usecounter{enumiv}% - \let\p@enumiv\@empty - \renewcommand\theenumiv{\@arabic\c@enumiv}}% - \sloppy\frenchspacing - \clubpenalty4000 - \@clubpenalty \clubpenalty - \widowpenalty4000% - \interlinepenalty4000% - \sfcode`\.\@m} - {\def\@noitemerr - {\@latex@warning{Empty `thebibliography' environment}}% - \endlist\frenchspacing} -% +\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} +% \end{macrocode} +% +% 两种引用样式: +% \begin{macrocode} +\expandafter\newcommand\csname bibstyle@numeric\endcsname{% + \bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} +\expandafter\newcommand\csname bibstyle@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} -% \end{environment} % +% 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} % % \subsection{附录} % \label{sec:appendix} @@ -3156,7 +3196,7 @@ \let\title\@gobble \newcommand{\thu@appendix@title}[1]{% \begin{center} - \bfseries\xiaosi #1 + \xiaosi[1.667] #1 \end{center}} % \end{macrocode} % \end{macro} @@ -3255,7 +3295,9 @@ % \begin{macrocode} %<*cls> \NewDocumentCommand{\shuji}{O{\thu@ctitle} O{\thu@cauthor}}{% - \newpage\thispagestyle{empty}\fangsong\xiaosan\ziju{0.4}% + \newpage\thispagestyle{empty}% + \fangsong\ifxetex\addCJKfontfeatures*{RawFeature={vertical:}}\fi + \xiaosan\ziju{0.4}% \noindent\hfill\rotatebox[origin=lt]{-90}{\makebox[\textheight]{#1\hfill#2}}} % % \end{macrocode} -- cgit v1.2.3