Skip to content

Commit

Permalink
Minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
xueruini committed Dec 25, 2015
1 parent 332151e commit f92109d
Showing 1 changed file with 42 additions and 37 deletions.
79 changes: 42 additions & 37 deletions thuthesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
%
% \iffalse
%<*driver>
\ProvidesFile{thuthesis.dtx}[2015/12/24 5.0 Tsinghua University Thesis Template]
\ProvidesFile{thuthesis.dtx}[2015/12/25 5.0.0 Tsinghua University Thesis Template]
\documentclass{ltxdoc}

\usepackage{dtx-style}
Expand Down Expand Up @@ -118,12 +118,9 @@
% \GlossaryPrologue{\section*{修改记录}%
% \addcontentsline{toc}{section}{修改记录}}
%
% \renewcommand{\abstractname}{摘~~要}
% \renewcommand{\contentsname}{目~~录}
%
% \title{\bfseries\thuthesis:清华大学学位论文模板\thanks{Tsinghua University \LaTeX{} Thesis Template.}}
% \author{{\fangsong 薛瑞尼\thanks{LittleLeo@newsmth}}\\[5pt]{\fangsong 清华大学
% 计算机系高性能所\thanks{目前于电子科技大学工作。}}\\[5pt] \texttt{xueruini@gmail.com}}
% \title{\bfseries\thuthesis:清华大学学位论文模板\thanks{\textbf{T}sing\textbf{h}ua \textbf{U}niversity \LaTeX{} \textbf{Thesis} Template.}}
% \author{{\fangsong 薛瑞尼\thanks{LittleLeo@newsmth}}\\[5pt] \texttt{xueruini@gmail.com}}
% \date{v\fileversion\ (\filedate)}
% \maketitle\thispagestyle{empty}
%
Expand Down Expand Up @@ -265,7 +262,7 @@
% \label{sec:xelatex}
% 很多用户对 \LaTeX{} 命令执行的次数不太清楚,一个基本的原则是多次运行 \LaTeX{}命
% 令直至不再出现警告。下面给出生成示例文档的详细过程(\# 开头的行为注释),首先来
% 看比较推荐的 \texttt{xelatex} 方式:
% 看推荐的 \texttt{xelatex} 方式:
% \begin{shell}
% # 1. 发现里面的引用关系,文件后缀 .tex 可以省略
% $ xelatex main
Expand Down Expand Up @@ -457,7 +454,7 @@
% \label{sec:option}
% 本模板提供了一些选项以方便使用:
% \begin{options}
% \changes{v4.8.2}{2015/12/13}{使用 \pkg{kvoptions} 简化选项 type。}
% \changes{v5.0.0}{2015/12/13}{使用 \pkg{kvoptions} 简化选项 type。}
% \item[type]
% 选择论文类型,当前支持:bachelor,master,doctor,postdoctor。默认为:bachelor。
% \begin{example}
Expand Down Expand Up @@ -610,7 +607,7 @@
% \end{example}
%
% \myentry{引用方式}
% \changes{v4.8.2}{2015/11/23}{用 \cs{inlinecite} 替换 \cs{onlinecite}。为保证兼
% \changes{v5.0.0}{2015/11/23}{用 \cs{inlinecite} 替换 \cs{onlinecite}。为保证兼
% 容性,\cs{onlinecite} 会保留。}
% \DescribeMacro{\inlinecite}
%
Expand Down Expand Up @@ -1023,7 +1020,7 @@
%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<cls>\ProvidesClass{thuthesis}
%<cfg>\ProvidesFile{thuthesis.cfg}
%<cls|cfg>[2015/12/24 5.0 Tsinghua University Thesis Template]
%<cls|cfg>[2015/12/25 5.0.0 Tsinghua University Thesis Template]
% \end{macrocode}
%
% \subsection{定义选项}
Expand All @@ -1042,7 +1039,7 @@
%<*cls>
\hyphenation{Thu-Thesis}
\def\thuthesis{\textsc{ThuThesis}}
\def\version{4.8.1}
\def\version{5.0.0}

\RequirePackage{kvoptions}
\SetupKeyvalOptions{
Expand Down Expand Up @@ -1093,7 +1090,7 @@
%
% noraggedbottom 选项
% \changes{v4.8}{2013/03/05}{增加 noraggedbottom 选项。}
% \changes{v4.8.2}{2015/12/13}{norggedbottom 选项修改未 raggedbottom。}
% \changes{v5.0.0}{2015/12/13}{norggedbottom 选项修改未 raggedbottom。}
% \begin{macrocode}
\DeclareBoolOption{raggedbottom}
% \end{macrocode}
Expand All @@ -1108,7 +1105,7 @@
% \changes{v3.1}{2007/10/09}{本科的目录又不要 arial 字体了。}
% \changes{v4.8}{2013/03/10}{使用 ctexbook 类,优于调用 ctex 宏包。}
% \changes{v4.8}{2013/05/29}{添加 nocap 选项,恢复默认标题样式,模板会进一步定制。}
% \changes{v4.8.2}{2015/03/12}{使用 XeTeX 引擎时,fontspec 宏包会被 xeCJK 自动
% \changes{v5.0.0}{2015/03/12}{使用 XeTeX 引擎时,fontspec 宏包会被 xeCJK 自动
% 调用。传递给 fontspec 宏包 no-math 选项,避免部分数学符号字体自动调整为 CMR。
% 其他引擎下没有这个问题,这一行会被无视。}
% \begin{macrocode}
Expand Down Expand Up @@ -1183,7 +1180,7 @@
% \changes{v2.6.2}{2006/06/18}{去掉 \pkg{paralist} 的 newitem 和 newenum 选项,因为默
% 认是打开的。}
% \changes{v2.6.4}{2006/10/23}{增加 \texttt{neverdecrease} 选项。}
% \changes{v4.8.2}{2012/12/13}{删除 \pkg{paralist} 选项。}
% \changes{v5.0.0}{2012/12/13}{删除 \pkg{paralist} 选项。}
% \begin{macrocode}
\RequirePackage[shortlabels]{enumitem}
% \end{macrocode}
Expand Down Expand Up @@ -1214,7 +1211,7 @@
% 默认采用中易的六款免费字体。缺少上述字体的用户可以通过
% \file{ctex-fontset-thuthesis.def} 文件自定义字体。
% \changes{v4.8}{2013/05/28}{在 CJK 模式下用 \pkg{CJKspace} 保留中英文间空格。}
% \changes{v4.8.2}{2015/04/17}{固定字体设置,同时改善与 ctex 兼容性。}
% \changes{v5.0.0}{2015/04/17}{固定字体设置,同时改善与 ctex 兼容性。}
% \begin{macrocode}
\IfFileExists{ctex-fontset-thuthesis.def}%
{\ctexset{fontset=thuthesis}}%
Expand Down Expand Up @@ -1299,9 +1296,9 @@
% 过 dvips 不指定页面类型而得到古怪的结果。}
% \changes{v4.5.2}{2010/09/19}{研究生页面边距由 3.2cm 改为 3cm。}
% \changes{v4.7}{2012/05/29}{修改本科生页脚间距与样例基本一致。}
% \changes{v4.8.2}{2015/03/10}{不再将页面尺寸写入 dvi,因为已不支持 dvips,
% \changes{v5.0.0}{2015/03/10}{不再将页面尺寸写入 dvi,因为已不支持 dvips,
% 而该方案会使得在使用 tikzexternalize 时外部 PDF 图片 BBox 不对。}
% \changes{v4.8.2}{2015/12/14}{用 \pkg{geometry} 简化设置。}
% \changes{v5.0.0}{2015/12/14}{用 \pkg{geometry} 简化设置。}
% \begin{macrocode}
\RequirePackage{geometry}
\geometry{
Expand Down Expand Up @@ -1537,7 +1534,7 @@
% \changes{v2.5}{2006/05/13}{本科的奇偶页眉不同。}
% \changes{v2.5}{2006/05/20}{增加 empty 页面样式。}
% \changes{v4.7}{2012/05/29}{本科页码用小五号字。}
% \changes{v4.8.2}{2015/12/20}{利用 \pkg{fancyhdr} 设置页眉页脚。}
% \changes{v5.0.0}{2015/12/20}{利用 \pkg{fancyhdr} 设置页眉页脚。}
% \begin{macro}{\ps@thu@empty}
% \begin{macro}{\ps@thu@plain}
% \begin{macro}{\ps@thu@headings}
Expand Down Expand Up @@ -1711,7 +1708,7 @@
% 定理字样使用黑体,正文使用宋体,冒号隔开
% \changes{v2.6.2}{2006/06/17}{增加问题和猜想两个数学环境。}
% \changes{v4.2}{2008/03/07}{调整证明环境的编号和结尾的方块。}
% \changes{v4.8.2}{2015/04/18}{修正定理字样为黑体 (\#104)。}
% \changes{v5.0.0}{2015/04/18}{修正定理字样为黑体 (\#104)。}
% \begin{macrocode}
\theorembodyfont{\rmfamily\songti}
\theoremheaderfont{\rmfamily\heiti}
Expand Down Expand Up @@ -1776,7 +1773,7 @@
% \changes{v2.5.1}{2006/05/24}{重新定义表格默认字体。}
% \changes{v2.5.3}{2006/06/07}{不管 caption 出现在什么位置,\cs{aboveskip} 总是出现在标题和浮动体之间的距离。}
% \changes{v4.3}{2008/03/11}{子图引用时加括号。}
% \changes{v4.8.2}{2015/06/27}{本科附录图表编号用-不用.(如图A-1,表A-2)。}
% \changes{v5.0.0}{2015/06/27}{本科附录图表编号用-不用.(如图A-1,表A-2)。}
% \begin{macrocode}
\ifthu@bachelor
\g@addto@macro\appendix{\renewcommand*{\thefigure}{\thechapter-\arabic{figure}}}
Expand Down Expand Up @@ -1897,7 +1894,7 @@
% \end{macrocode}
%
% 各级标题格式设置。
% \changes{v4.8.2}{2012/12/23}{用 \cs{ctexset} 来设置,替换复杂的 \cs{@startsection}。}
% \changes{v5.0.0}{2012/12/23}{用 \cs{ctexset} 来设置,替换复杂的 \cs{@startsection}。}
% \begin{description}
% \item[chapter] 章序号与章名之间空一个汉字符 黑体三号字,居中书写,单倍行距,段
% 前空 24 磅,段后空 18 磅。本科要求:段前段后间距 30/20 pt,行距 20pt。但正文
Expand All @@ -1906,7 +1903,7 @@
% \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}{英文摘要标题要搞特殊化,ft!}
% \changes{v4.8.2}{2015/04/17}{修正章节间距问题(\#57)}
% \changes{v5.0.0}{2015/04/17}{修正章节间距问题(\#57)}
%
% \item[section] 一级节标题,例如:\fbox{2.1 实验装置与实验方法}。节标题序号与标
% 题名之间空一个汉字符(下同)。采用黑体四号(14pt)字居左书写,行距为固定
Expand Down Expand Up @@ -2024,7 +2021,7 @@
% 最多涉及 4 层,即: x.x.x.x。\par
% chapter(0), section(1), subsection(2), subsubsection(3)
% \changes{v3.1}{2007/10/09}{博士论文目录只出现到第 3 级标题即可。}
% \changes{v4.8.2}{2015/05/21}{硕士博士论文目录只出现到第 3 级标题即可。其他未明确要求。}
% \changes{v5.0.0}{2015/05/21}{硕士博士论文目录只出现到第 3 级标题即可。其他未明确要求。}
% \begin{macrocode}
%<*cls>
\setcounter{secnumdepth}{3}
Expand Down Expand Up @@ -2091,7 +2088,7 @@
% 研究生学位论文写作指南中规定:目录中的章标题行居左书写,一级节标题行缩进 1 个
% 汉字符,二级节标题行缩进 2 个汉字符(但示例文件中为 1.5 个汉字符)。本科生指
% 南中未作明确规定,示例文件中对于一级和二级节标题分别缩进 1 和 1.5 个汉字符。
% \changes{v4.8.2}{2015/04/28}{修正学位论文中目录里节前缩进(\#103)}
% \changes{v5.0.0}{2015/04/28}{修正学位论文中目录里节前缩进(\#103)}
% \begin{macrocode}
\renewcommand*\l@section{\@dottedtocline{1}{\ccwd}{2.1em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{\ifthu@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}}
Expand Down Expand Up @@ -2661,7 +2658,7 @@
% \changes{v3.0}{2007/05/12}{本科论文授权图片扫描取消。}
% \changes{v4.5.2}{2010/05/29}{本科封面和授权说明之间不要空白页。}
% \changes{v4.6}{2011/05/29}{博士后报告无授权说明。}
% \changes{v4.8.2}{2015/06/05}{使用 pdfpages 宏包支持本硕博论文授权说明扫描版(\#36)。}
% \changes{v5.0.0}{2015/06/05}{使用 pdfpages 宏包支持本硕博论文授权说明扫描版(\#36)。}
% \begin{macrocode}
\ifthu@postdoctor\relax\else%
\ifthu@bachelor\clearpage\else\cleardoublepage\fi%
Expand Down Expand Up @@ -2835,7 +2832,7 @@
% \end{macrocode}
% 声明部分
% \changes{v3.0}{2007/05/12}{本科论文声明部分图片扫描取消。}
% \changes{v4.8.2}{2015/06/05}{使用 pdfpages 宏包支持本硕博论文声明扫描版(\#36)。}
% \changes{v5.0.0}{2015/06/05}{使用 pdfpages 宏包支持本硕博论文声明扫描版(\#36)。}
% \begin{macrocode}
{
\ifthu@postdoctor\relax\else%
Expand Down Expand Up @@ -3046,8 +3043,8 @@
% 分别用于个人简历里面会出现的学术论文列表和研究成果列表。
% publications 环境可以连续出现多次,模板会自动在之间加入空行。
% \changes{v2.5.1}{2006/05/23}{ft,教务处和研究生院非要搞的不一样!}
% \changes{v4.8.2}{2015/04/18}{博士后就不提在学期间了,不合适(\#100)}
% \changes{v4.8.2}{2015/05/17}{让简历部分更符合格式指南和示例文件(\#122)}
% \changes{v5.0.0}{2015/04/18}{博士后就不提在学期间了,不合适(\#100)}
% \changes{v5.0.0}{2015/05/17}{让简历部分更符合格式指南和示例文件(\#122)}
% \begin{macro}{\resumeitem}
% \begin{macro}{\researchitem}
% \begin{environment}{publications}
Expand Down Expand Up @@ -3085,7 +3082,7 @@ leftmargin=10mm,labelsep=!,before*=\xiaosi[1.26]}
% \begin{macro}{\shuji}
% 单独使用书脊命令会在新的一页产生竖排书脊。
% \changes{v4.5}{2009/01/04}{简化代码,同时支持 xelatex。}
% \changes{v4.8.2}{2015/12/21}{扩展 \cs{shuji}\oarg{标题}\oarg{作者}。}
% \changes{v5.0.0}{2015/12/21}{扩展 \cs{shuji}\oarg{标题}\oarg{作者}。}
% \begin{macrocode}
%<*cls>
\NewDocumentCommand{\shuji}{O{\thu@ctitle} O{\thu@cauthor}}{%
Expand Down Expand Up @@ -3178,17 +3175,18 @@ leftmargin=10mm,labelsep=!,before*=\xiaosi[1.26]}
\ProvidesPackage{dtx-style}

\RequirePackage[UTF8,scheme=chinese]{ctex}
\RequirePackage[top=2.5cm, bottom=2.5cm]{geometry}
\RequirePackage[top=2.5cm, bottom=2.5cm, headsep=5mm]{geometry}

\RequirePackage{calc}
\RequirePackage{array,longtable}
\RequirePackage{fancybox,fancyvrb}
\RequirePackage{fancyhdr}
\RequirePackage{xcolor}
\RequirePackage{url}
\RequirePackage{hyperref}
\RequirePackage{enumitem}
\RequirePackage{ifxetex}

\RequirePackage{hyperref}
\hypersetup{%
bookmarksnumbered=true,
bookmarksopen=true,
Expand All @@ -3207,6 +3205,7 @@ leftmargin=10mm,labelsep=!,before*=\xiaosi[1.26]}
CJKbookmarks=false}
\fi

\setlist{nosep}
\def\SpecialOptionIndex#1{\@bsphack%
\index{#1\actualchar{\protect\bfseries #1}}\@esphack}
\newenvironment{options}
Expand All @@ -3218,22 +3217,28 @@ leftmargin=10mm,labelsep=!,before*=\xiaosi[1.26]}
\ovalbox{\color{magenta}\bfseries\sffamily ##1}%
\SpecialOptionIndex{##1}}}
}{\endlist}

\DefineVerbatimEnvironment{example}{Verbatim}%
{frame=single,framerule=0.3mm,rulecolor=\color{violet},%
fillcolor=\color{violet!5},framesep=1mm,baselinestretch=1.2,%
fontsize=\small,gobble=1}

\DefineVerbatimEnvironment{shell}{Verbatim}%
{frame=single,framerule=0.3mm,rulecolor=\color{olive},%
fillcolor=\color{olive!5},framesep=1mm,fontsize=\small,gobble=1}
\newcommand{\myentry}[1]{%
\vskip5pt\par\noindent\llap{{\color{purple}\bfseries #1}}\marginpar{\strut}\hskip\parindent}

\newcommand{\myentry}[1]{\vskip5pt\par%
\noindent\llap{{\color{purple}\bfseries #1}}%
\marginpar{\strut}\hskip\parindent}

\MakeShortVerb{\|}
\def\pkg#1{\texttt{#1}}
\def\option#1{\textsf{#1}}
\def\file#1{\textsl{#1}}

\newcommand*\pkg[1]{\texttt{#1}}
\newcommand*\option[1]{\textsf{#1}}
\newcommand*\file[1]{\textsl{#1}}
\def\thuthesis{\textsc{Thu}\-\textsc{Thesis}}
\newcommand{\note}[1]{\par%
{\color{magenta}\bfseries 说明:#1}}
{\color{magenta}{\bfseries 说明:}\emph{#1}}}
%</dtx-style>
% \end{macrocode}
% \fi
Expand Down

14 comments on commit f92109d

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢两位~

试用了一下遇到几个小问题,过来汇报一下~

  1. geometry 那里应该设置一下页眉的高度,这样后面不会在页眉的地方报 overfull vbox,要么就是现在 \headsep 设置的有点儿大...
  2. \normalsize 的定理里面 @setfontsize 那行最后面应该加个 % 取消掉后面的回车,不然就多引入了一个空格...
    目前最主要的表现是每页的页眉页脚最左侧都多了一个空格,然后右边就超出去了,然后每页就报了两个 overfull hbox,并且尺寸还特别小
    现在用了 fancyhdr,里面会用 \normalsize,原来模板的页眉页脚自己写的就没有这个问题
  3. \thu@clearemptydoublepage 定义里面是否改成 \pagestyle{thu@empty} 更好一些,原来是 \pagestyle{empty}
  4. 四个文章类型的旧选项报 class error 是不是太严厉了一些...

@xueruini
Copy link
Contributor Author

@xueruini xueruini commented on f92109d Dec 26, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

写作指南上只有版心上边距 3 cm,页眉上边距 2.2 cm,那么 headheight + headsep = 0.8 cm 就好,正文字号 12 pt 大约是 0.43cm...headheight 比这个大应该就行
原来的模板里面写过 headheight = 0.6 cm 和 headheight = 20 pt(大约 0.7 cm),感觉上 0.6 cm 更好一些,稍微和正文有些间隔...

刚刚又试了试,发现页眉都是向下对齐的...这样 headsep 太小上面就不够 2.2 cm 了
要么 headsep 在 headheight 尽量大一些,要么页眉里面在 headrule 下面加上一些 vfil 撑满
前面可以 headheight = 0.45 cm,headsep = 0.35 cm,不过这样太极限,页眉有些数学符号高一些估计就不够了...或者用放宽些的 0.5 cm 和 0.3 cm
后面的试了试没搞定...

@xueruini
Copy link
Contributor Author

@xueruini xueruini commented on f92109d Dec 26, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就先 0.5 cm 和 0.3 cm 吧,我后面边写边看看是不是有更好的方式...

@xueruini
Copy link
Contributor Author

@xueruini xueruini commented on f92109d Dec 27, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry...只是研究生的...
本科生的标准哪里能找到呀...

@xueruini
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

教务处有吧

@xueruini
Copy link
Contributor Author

@xueruini xueruini commented on f92109d Dec 27, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

教务处的网页上面翻了翻没找到...

学校的写作指南里面那个 2.2 cm,是 Word 里面有这项参数,直接设置就好了,和 LaTeX 还不太一样...

下面那两个图片看不到...Word 的示例里面确实间隔比较大,打印了两张觉得 4 mm 也足够了,5 mm 还是太大了吧...

headheight 倒是随意一些就好,反正下对齐,够大不会报 warning 就好吧

@xueruini
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当时的参数都是比对word的效果做的,还是保持的比较好。

image

@xueruini
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请试一下 master HEAD,除了pdf info的warning,其它基本都没有了。

现在例子里title里有\,keywords里有\TeX(\kern, \lower)等,会有warning,其实还好。就不提供[]了。

@mengfl05
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,其他的都搞定了的,师兄辛苦~

@xueruini
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

刚才把示例文件的所有underfull/overfull boxes都干掉了,感觉清爽了。

Please sign in to comment.