Use English comments in core files.
This commit is contained in:
parent
a7b7cf8b95
commit
303ddbf635
@ -26,15 +26,14 @@
|
||||
\ProvidesPackage{pkuthss-extra}
|
||||
[2011/05/23 v1.3 beta4 Common extra settings for the pkuthss document class]
|
||||
|
||||
% 检查对 pkuthss 文档类的依赖是否满足。
|
||||
% Check the dependency of pkuthss.
|
||||
\@ifclassloaded{pkuthss}{}{
|
||||
\PackageError{pkuthss-extra}%
|
||||
{The pkuthss document class is not loaded}%
|
||||
{The pkuthss-extra package depends on the pkuthss document class.}
|
||||
}
|
||||
|
||||
% 例如:
|
||||
% \pkuthss@int@extraopt{spacing} 最终被扩展为:
|
||||
% eg. `\pkuthss@int@extraopt{spacing}' will expand to:
|
||||
% \newif\ifpkuthss@extraopt@spacing \pkuthss@extraopt@spacingtrue
|
||||
% \DeclareOption{spacing}{\pkuthss@extraopt@spacingtrue}
|
||||
% \DeclareOption{nospacing}{\pkuthss@extraopt@spacingfalse}
|
||||
@ -45,64 +44,68 @@
|
||||
\expandafter\DeclareOption{no#1}%
|
||||
{\csname pkuthss@extraopt@#1false\endcsname}
|
||||
}
|
||||
% 是否采用一些常用的对空白进行调整的版式设定。
|
||||
% Whethet to use some common settings for adjusting spacing.
|
||||
\pkuthss@int@extraopt{spacing}
|
||||
% 是否采用比 LaTeX 默认设定更加紧密的枚举环境。
|
||||
% Whether to use list environments that are tighter than LaTeX defaults.
|
||||
\pkuthss@int@extraopt{tightlist}
|
||||
% 是否采用一些和目录、参考文献和索引等相关的常见设置。
|
||||
% Whether to use some common settings about table of contents, bibliography and
|
||||
% indexes.
|
||||
\pkuthss@int@extraopt{tocbibind}
|
||||
% 是否启用 \spacialchap 命令。
|
||||
% Whether to enable the `\spacialchap' command.
|
||||
\pkuthss@int@extraopt{spechap}
|
||||
% 是否默认使引用标记成为上标。
|
||||
% Whether to make citation labels superscript as default.
|
||||
\pkuthss@int@extraopt{upcite}
|
||||
% 是否自动根据设定的论文文档信息设置生成的 pdf 文档的文档信息。
|
||||
% Whether to automatically set metadata for generated PDF from user defined document
|
||||
% information.
|
||||
\pkuthss@int@extraopt{pdfmeta}
|
||||
% 是否在生成的 pdf 文档中使用彩色的链接。
|
||||
% Whether to use coloured hyperlinks in generated PDF.
|
||||
\pkuthss@int@extraopt{linkcolor}
|
||||
% 立刻处理所有宏包选项。
|
||||
% Process all class options now.
|
||||
\ProcessOptions\relax
|
||||
|
||||
\ifpkuthss@extraopt@spacing
|
||||
% 忽略 CJK 文字之间的空白而保留(CJK 文字与英文之间等的)其它空白。
|
||||
% (XeCJK 自动控制这些空白,故用 XeLaTeX 编译时不需要这个宏包。)
|
||||
% Automatically ignore spaces between CJK characters and preserve spaces in other
|
||||
% situations. XeCJK itself will handle this issue, therefore we do not use
|
||||
% `CJKspace' when using XeLaTeX.
|
||||
\ifxetex\else\RequirePackage{CJKspace}\fi
|
||||
% 使某些细节(如脚注、抄录)处的空间安排更美观。
|
||||
% Make spacing nicer in some situations (eg. footnotes and verbatims).
|
||||
\RequirePackage{setspace}
|
||||
% 设置页芯居中。
|
||||
% Make the type page centered.
|
||||
\geometry{centering}
|
||||
% 设定行距。
|
||||
% Set line skip.
|
||||
\linespread{1.41}\selectfont
|
||||
% 使脚注编号和脚注文本之间默认间隔一个空格。
|
||||
% Automatically insert a space between the label and the text in footnotes.
|
||||
\RequirePackage{footmisc}
|
||||
\renewcommand{\footnotelayout}{\ }
|
||||
\fi
|
||||
|
||||
\ifpkuthss@extraopt@tightlist
|
||||
% 枚举环境中每个条目的内容较少时,条目往往显得稀疏。此处将枚举环境中的额外
|
||||
% (垂直)间隔改为零。
|
||||
% Lists often appear to be too sparse when items are just one or two lines long.
|
||||
% Here we cancel the extra vertical spacing between list items.
|
||||
\RequirePackage{enumitem}
|
||||
\setlist{nolistsep}
|
||||
% 参考文献的条目间隔往往显得较大,此处取消其额外增加的(垂直)间隔。
|
||||
% Similarly for bibliography items.
|
||||
\setlength{\bibsep}{\parsep}
|
||||
\fi
|
||||
|
||||
\ifpkuthss@extraopt@tocbibind
|
||||
% 在目录中加入参考文献、索引(如果存在)等的条目,但不加入“目录”自身。
|
||||
% Add bibliography and indexes in table of contents, but not contents itself.
|
||||
\RequirePackage[nottoc]{tocbibind}
|
||||
% 在生成的 pdf 中加入“目录”的书签。
|
||||
% Add PDF bookmark for table of contents.
|
||||
\let\tmp@tableofcontents\tableofcontents
|
||||
\renewcommand{\tableofcontents}{
|
||||
% 使生成的 pdf 中“目录”的书签刚好指向目录的标题处。
|
||||
% Make the `Contents' bookmark point correctly to the title of the table of
|
||||
% contents.
|
||||
\cleardoublepage
|
||||
% 在生成的 pdf 中加入相当于“章”一级的书签。
|
||||
% Actually add the PDF bookmark.
|
||||
\pdfbookmark[1]{\contentsname}{contents}
|
||||
\tmp@tableofcontents
|
||||
}
|
||||
\fi
|
||||
|
||||
\ifpkuthss@extraopt@spechap
|
||||
% 此命令用于开始不标号的一章。
|
||||
% 通过 \matkboth 命令设置相应的页眉内容(尽管可能不显示)。
|
||||
% This command is used to start a chapter without numbering, and correctly set the
|
||||
% headers and footers in the chapter.
|
||||
\newcommand\specialchap[1]{
|
||||
\chapter*{#1}\addcontentsline{toc}{chapter}{#1}
|
||||
\markboth{#1}{}\phantomsection
|
||||
@ -110,30 +113,33 @@
|
||||
\fi
|
||||
|
||||
\ifpkuthss@extraopt@upcite
|
||||
% 使引用标记默认成为上标。
|
||||
% Make citation labels superscript as default.
|
||||
\setcitestyle{super,square,comma}
|
||||
\fi
|
||||
|
||||
\AtBeginDocument{
|
||||
\ifpkuthss@extraopt@pdfmeta
|
||||
% 此命令自动设置 pdf 文档的文档信息。
|
||||
% Automatically generate metadata for generated PDF.
|
||||
\newcommand{\setpdfmetadata}{
|
||||
\hypersetup{
|
||||
pdfauthor={\@eauthor},pdftitle={\@etitle},
|
||||
pdfsubject={\euniversity\ \ethesisname},pdfkeywords={\@ekeywords}
|
||||
}
|
||||
}
|
||||
% 在生成标题页时进行这项设置是因为此时所有的文档信息应该已经设置完毕。
|
||||
% Set the metadata when generating the title page because the document
|
||||
% information should have been all defined before this.
|
||||
\let\tmp@maketitle\maketitle
|
||||
% 注意 \hypersetup 一定要在原 \maketitle 之前,否则会失效。
|
||||
% NOTE: `\hypersetup' must appear before `\maketitle', otherwise it might not
|
||||
% act as you wished.
|
||||
\renewcommand\maketitle{\setpdfmetadata\tmp@maketitle}
|
||||
\fi
|
||||
|
||||
\ifpkuthss@extraopt@linkcolor
|
||||
% 在生成的 pdf 中使用彩色的链接。
|
||||
% Use coloured hyperlinks in generated PDF.
|
||||
\hypersetup{colorlinks=true}
|
||||
\else
|
||||
% 将所有链接改为黑色,以免打印时相应部分颜色过淡。
|
||||
\else hyperlinks in generated PDF.
|
||||
% Set hyperlink colour to black in order to prevent hyperlinks from being too
|
||||
% hard-to-recognise in printed thesis.
|
||||
\hypersetup{colorlinks=false, pdfborder={0 0 0}}
|
||||
\fi
|
||||
}
|
||||
|
||||
@ -26,40 +26,40 @@
|
||||
\ProvidesClass{pkuthss}
|
||||
[2011/05/23 v1.3 beta4 Peking University dissertation document class]
|
||||
|
||||
% 处理编码选项。
|
||||
% Process the encoding options.
|
||||
\newif\ifpkuthss@opt@gbk \pkuthss@opt@gbktrue
|
||||
\DeclareOption{GBK}{\pkuthss@opt@gbktrue\PassOptionsToClass{GBK}{ctexbook}}
|
||||
\DeclareOption{UTF8}%
|
||||
{\pkuthss@opt@gbkfalse\PassOptionsToClass{UTF8}{ctexbook}}
|
||||
% 是否采用默认的额外设置。
|
||||
% Whether to enable the default extra settings.
|
||||
\newif\ifpkuthss@opt@extra \pkuthss@opt@extratrue
|
||||
\DeclareOption{extra}{\pkuthss@opt@extratrue}
|
||||
\DeclareOption{noextra}{\pkuthss@opt@extrafalse}
|
||||
% 将其余的文档类参数全部传递给 ctexbook 文档类。
|
||||
% Pass all other options to `ctexbook' document class.
|
||||
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
|
||||
% 立刻处理所有宏包选项。
|
||||
% Process all class options now.
|
||||
\ProcessOptions\relax
|
||||
|
||||
% 此文档类以 ctexbook 为基础,设定页面尺寸为 A4,默认字号为小四号。
|
||||
% CJKfntef 宏包提供了 \maketitle 中用到的 \CJKunderline 命令。
|
||||
% fancyhdr 宏包提供了方便使用的命令用于设置页眉、页脚。
|
||||
% pkuthss is based on ctexbook; We use a4 paper size, `xiao 4' as default font size.
|
||||
% CJKfntef provides \CJKunderline used in \maketitle.
|
||||
% fancyhdr provides utilities for setting headers and footers.
|
||||
\LoadClass[fntef,a4paper,fancyhdr,cs4size]{ctexbook}[2009/10/20]
|
||||
% 此宏包提供对 key=val 格式设置的支持。
|
||||
% Provide support for key=val grammar.
|
||||
\RequirePackage{keyval}
|
||||
% 此宏包提供图形支持。
|
||||
% Graphics support.
|
||||
\RequirePackage{graphicx}[1999/02/16]
|
||||
% 此宏包提供了方便使用的命令用于设置页面布局。
|
||||
% Provide utilities for setting page layout.
|
||||
\RequirePackage{geometry}
|
||||
% 此宏包提供了方便使用的命令用于设置引用标记的格式。
|
||||
% 默认使用顺序(数字)编码制。
|
||||
% Provide utilities for setting format of citation labels.
|
||||
% Use the numerical scheme as default.
|
||||
\RequirePackage[numbers]{natbib}
|
||||
% 提供后面使用的 \AtEndPreamble 命令。
|
||||
% Provide \AtEndPreamble used later.
|
||||
\RequirePackage{etoolbox}
|
||||
% 是否采用默认的额外设置。
|
||||
% Whether to enable the default extra settings.
|
||||
\ifpkuthss@opt@extra\RequirePackage{pkuthss-extra}\fi
|
||||
|
||||
\ifxetex\ifpkuthss@opt@gbk
|
||||
% 不支持非用 XeLaTeX 编译非 UTF-8 的文档。
|
||||
% No support for XeLaTeX compilation in non-unicode encoding, i.e. GBK.
|
||||
\ClassError{pkuthss}%
|
||||
{XeLaTeX compilation is not supported without UTF-8}%
|
||||
{%
|
||||
@ -69,18 +69,20 @@
|
||||
\fi\fi
|
||||
|
||||
\AtEndOfClass{%
|
||||
% 设定各处标题的内容。
|
||||
% Setting chinese captions and labels.
|
||||
\ifpkuthss@opt@gbk\input{pkuthss-gbk.def}
|
||||
\else\input{pkuthss-utf8.def}
|
||||
\fi
|
||||
|
||||
% 为文章中的目录、交叉和索引等自动产生链接,并自动生成书签。
|
||||
% 代码复制自 ctex 宏包的 ctex-common.def,有改动。
|
||||
% 不直接使用 ctex 宏包的 hyperref 选项是为了避免 1.02c 版以前的 ctex 宏
|
||||
% 包中先调用 hyperref 而造成的和 setspace 的冲突。
|
||||
% 考虑到新版本 ctex 宏包将逐渐被更多人采用,2013 年夏(应该正值 Casper
|
||||
% 毕业 :))时下面一段代码将被删除,而前面调用 ctexbook 文档类时将加上
|
||||
% hyperref 选项。
|
||||
% Automatically generate hyperlinks and bookmarks for table of contents, citations
|
||||
% and index.
|
||||
% Code copied with minor modifications from ctex-common.def in `ctex' package.
|
||||
% Not directly using the `hyperref' option of `ctex' package in order to avoid
|
||||
% the conflicts caused by loading of `hyperref' before `setspace' in `ctex'
|
||||
% package older than 1.02c.
|
||||
% This piece of code will be deleted by summer in 2013, and we will use the
|
||||
% `hyperref' option of `ctex' package instead, considering most people
|
||||
% will be using newer versions of `ctex' package at that time.
|
||||
\providecommand\hypersetup[1]{\PassOptionsToPackage{#1}{hyperref}}
|
||||
\AtEndPreamble{\@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}}
|
||||
\ifxetex
|
||||
@ -102,22 +104,21 @@
|
||||
\fi
|
||||
}
|
||||
|
||||
% 设定页面布局。
|
||||
% Set page layout.
|
||||
\geometry{height=240mm,width=150mm,includeheadfoot,headheight=1.2em}
|
||||
% 设定页眉、页脚样式。
|
||||
% Set headers and footers.
|
||||
\pagestyle{fancy}\fancyhf{}
|
||||
\fancyhead[LE]{\small\normalfont\leftmark}
|
||||
\fancyhead[RO]{\small\normalfont\rightmark}
|
||||
\fancyhead[LO,RE]{\small\normalfont\cuniversity\cthesisname}
|
||||
\fancyfoot[RO,LE]{\small\normalfont --~\thepage~--}
|
||||
% 设定每个章一级部分的第一页的页眉、页脚样式。
|
||||
% Set the headers and footers on the first page in every chapter.
|
||||
\fancypagestyle{plain}{
|
||||
\fancyhf{}\renewcommand{\headrulewidth}{0pt}
|
||||
\fancyfoot[RO,LE]{\small\normalfont --~\thepage~--}
|
||||
}
|
||||
|
||||
% 例如:
|
||||
% \pkuthss@int@infoitema{ctitle} 最终被扩展为:
|
||||
% eg. `\pkuthss@int@infoitema{ctitle}' will expand to:
|
||||
% \def\ctitle#1{\def\@ctitle{#1}}
|
||||
% \define@key{pkuthss@info}{ctitle}{\ctitle{#1}}
|
||||
\def\pkuthss@int@infoitema#1{
|
||||
@ -125,14 +126,13 @@
|
||||
{\expandafter\def\csname @#1\endcsname{##1}}
|
||||
\expandafter\define@key{pkuthss@info}{#1}{\csname #1\endcsname{##1}}
|
||||
}
|
||||
% 例如:
|
||||
% \pkuthss@int@infoitemb{cuniversity} 最终被扩展为:
|
||||
% eg. `\pkuthss@int@infoitemb{cuniversity}' will expand to:
|
||||
% \define@key{pkuthss@info}{cuniversity}{\def\cuniversity{#1}}
|
||||
\def\pkuthss@int@infoitemb#1{
|
||||
\expandafter\define@key{pkuthss@info}{#1}%
|
||||
{\expandafter\def\csname #1\endcsname{##1}}
|
||||
}
|
||||
% 设定各项文档信息的具体内容。
|
||||
% Setting document information entries.
|
||||
\pkuthss@int@infoitema{ctitle}
|
||||
\pkuthss@int@infoitema{etitle}
|
||||
\pkuthss@int@infoitema{cauthor}
|
||||
@ -153,29 +153,30 @@
|
||||
\pkuthss@int@infoitemb{ethesisname}
|
||||
\pkuthss@int@infoitemb{cabstractname}
|
||||
\pkuthss@int@infoitemb{eabstractname}
|
||||
% 此命令用于以 key=val 格式设置文档信息。
|
||||
% Set document information using the key=value grammar.
|
||||
\newcommand{\pkuthssinfo}[1]{\setkeys{pkuthss@info}{#1}}
|
||||
|
||||
% 设定封面格式,并在生成封面时设定文档信息。
|
||||
% Set format of the title page (cover).
|
||||
\renewcommand{\maketitle}{
|
||||
\cleardoublepage
|
||||
% Add PDF bookmark for the title page.
|
||||
\pdfbookmark[1]{\titlepagename}{titlepage}
|
||||
\begin{titlepage}
|
||||
% 封面使用这个行距较为美观。
|
||||
% It will be more nice to use this line skip level in the title page.
|
||||
\linespread{1.6}\selectfont
|
||||
% 此命令用下划线填充指定的空间。
|
||||
% Fill specified space will underline on the bottom line (not the baseline).
|
||||
\def\pkuthss@int@fillinblank##1##2%
|
||||
{\CJKunderline{\makebox[##1]{##2}}}
|
||||
% 居中。
|
||||
% Make the title page centered.
|
||||
\begin{center}
|
||||
% 第一部分:校徽、“北京大学”字样和论文类别。
|
||||
% Emblem and inscription of the university, and type of thesis.
|
||||
{
|
||||
\includegraphics[height=0.07\textheight]{img/pkulogo}\hspace{1em}
|
||||
\includegraphics[height=0.07\textheight]{img/pkuword}\\[2.25em]
|
||||
{\zihao{1}\bfseries\cthesisname}
|
||||
}
|
||||
\vfill
|
||||
% 第二部分:论文标题。
|
||||
% Title of the thesis.
|
||||
{
|
||||
\zihao{2}
|
||||
{\label@ctitle}\makebox[0pt][l]{
|
||||
@ -187,9 +188,9 @@
|
||||
}
|
||||
}
|
||||
\vfill
|
||||
% 第三部分:作者信息。
|
||||
% Information about the author.
|
||||
{
|
||||
% 字号有改变,行距设定须稍作调整。
|
||||
% Slightly adjust the line skip when using new font size.
|
||||
\zihao{-2}\linespread{1.75}\selectfont
|
||||
\begin{tabular}{l@{\extracolsep{0.2em}}c}
|
||||
{\label@cauthor} &
|
||||
@ -207,13 +208,13 @@
|
||||
\end{tabular}
|
||||
}
|
||||
\vfill
|
||||
% 第四部分:日期。
|
||||
% Date.
|
||||
{\kaishu\zihao{2}\@date}
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
}
|
||||
|
||||
% 用于排版摘要的内部环境。
|
||||
% Internal environment for typesetting abstracts.
|
||||
\newenvironment{pkuthss@int@abstract}{
|
||||
\cleardoublepage
|
||||
\pdfbookmark[1]{\tmp@abstractname}{\tmp@abstlabel}
|
||||
@ -228,11 +229,11 @@
|
||||
\vspace{1em}\par
|
||||
\section*{\zihao{4}\tmp@abstractname}
|
||||
\vskip 0.5em
|
||||
}{% 在页面底部排版关键词。
|
||||
}{% Keywords at the bottom of the page.
|
||||
\vfill\noindent\textbf{\tmp@label@keywords}{\tmp@keywords}
|
||||
}
|
||||
|
||||
% 此环境用于排版中文摘要。
|
||||
% Typesetting the Chinese abstract.
|
||||
\newenvironment{cabstract}{
|
||||
\def\tmp@abstlabel{cabstract}
|
||||
\let\tmp@title\@ctitle
|
||||
@ -246,7 +247,7 @@
|
||||
\begin{pkuthss@int@abstract}
|
||||
}{\end{pkuthss@int@abstract}}
|
||||
|
||||
% 此环境用于排版英文摘要。
|
||||
% Typesetting the English abstract.
|
||||
\newenvironment{eabstract}{
|
||||
\def\tmp@abstlabel{eabstract}
|
||||
\let\tmp@title\@etitle
|
||||
|
||||
Loading…
Reference in New Issue
Block a user