Update and refactor code that modify spacing.

This commit is contained in:
Casper Ti. Vector 2015-04-27 17:16:06 +08:00
parent 5e08f27e1a
commit e39c568d60
6 changed files with 93 additions and 45 deletions

View File

@ -34,6 +34,9 @@
% 产生 originauth.tex 里的 \square
\usepackage{amssymb}
% 按学校要求设定参考文献列表中的条目间距。
\setlength{\bibitemsep}{3bp}
% 设定文档的基本信息。
\pkuthssinfo{
cthesisname = {本科生毕业论文}, ethesisname = {Undergraduate Thesis},

View File

@ -101,9 +101,31 @@
\item 页脚中脚注编号和脚注文本之间默认间隔一个空格。
\end{itemize}
\item \textbf{\texttt{[no]spacing}}
是否采用一些常用的对空白进行调整的版式设定。
具体地说,启用 \verb|space| 选项后会进行以下几项设置:
\item \textbf{\texttt{[no]pkuspace}}
是否根据学校对论文格式的要求\mbox{\supercite{pku-thesisstyle}}%
修改排版中的一些间距及相关设置。
具体地说,启用 \verb|pkuspace| 选项后会按
\parencite{pku-thesisstyle} 中的要求修改以下几项设置:
\begin{itemize}
\item 目录中条目的缩进方式。
\item 图表标题的字号,
以及标题中编号和标题文字之间的间隔方式
(例如图 \ref{fig:example} 所示)。
\end{itemize}
\begin{figure}[htbp!]
\centering
\includegraphics[width = 0.5\textwidth]{pkuword}
\caption{示例插图}\label{fig:example}
\end{figure}
\item \textbf{\texttt{[no]spacing}}\footnote{%
因为代码重构的缘故,
此选项同时提供 1.5.5 及以前版本 pkuthss-extra 宏包%
\texttt{[no]tightlist} 选项所提供的功能。%
}
是否采用一些常用的调整间距的额外版式设定。
具体地说,启用 \verb|spacing| 选项后会进行以下几项设置:
\begin{itemize}
\item 自动忽略 CJK 文字之间的空白而%
保留CJK 文字与英文之间等的)其它空白。
@ -112,31 +134,16 @@
\item 设定行距为 1.41\footnote{%
为什么是 1.41?因为 $\sqrt{2}\approx1.41$%
}
\item 采用比 \hologo{LaTeX} 默认设定更加紧密的枚举环境%
\footnote{%
在枚举环境itemize、enumerate 和 description
每个条目的内容较少时,条目往往显得稀疏;
在参考文献列表中也有类似的现象。
启用 \texttt{spacing} 选项后,
将去掉这些环境中额外增加的(垂直)间隔。%
}
\end{itemize}
\item \textbf{\texttt{[no]tightlist}}
是否采用比 \hologo{LaTeX} 默认设定更加紧密的枚举环境。
在枚举环境itemize、enumerate 和 description
每个条目的内容较少时,条目往往显得稀疏;
在参考文献列表中也有类似的现象。
启用 \verb|tightlist| 选项后,
将去掉这些环境中额外增加的(垂直)间隔。
\item \textbf{\texttt{[no]caption}}
是否使图表标题使用和正文不同的字体
(此处设为中文楷书、英文斜体,
如图 \ref{fig:example} 所示)。
根据排版中常见的审美原则,
一般应使图表标题的字体、字号轻
(例如楷书之于宋体、五号字之于小四号字)于正文,
图表内容的字体、字号轻于图表标题。
\begin{figure}[htbp!]
\centering
\includegraphics[width = 0.5\textwidth]{pkuword}
\caption{示例插图}\label{fig:example}
\end{figure}
\item \textbf{\texttt{[no]pdftoc}}\footnote{%
此选项部分等价于 1.4 alpha2 及以前版本 pkuthss-extra 宏包%
\texttt{[no]tocbibind} 选项。
@ -344,11 +351,11 @@
\begin{itemize}
\item 启用 \verb|footfmt| 选项时会调用 %
tikz\supercite{tikz} 和 scrextend\supercite{scrextend} 宏包。
\item 启用 \verb|spacing| 选项时会调用 setspace 宏包。
\item 启用 \verb|tightlist| 选项时会调用 %
enumitem\supercite{enumitem} 宏包。
\item 启用 \verb|caption| 选项时会调用 %
\item 启用 \verb|pkuspace| 选项时会调用 %
tocloft\supercite{tocloft}、subfig\supercite{subfig}%
caption\supercite{caption} 宏包。
\item 启用 \verb|spacing| 选项时会调用 setspace 和 %
enumitem\supercite{enumitem} 宏包。
\end{itemize}
因此在启用相应选项时,用户可以使用对应宏包所提供的功能。

View File

@ -120,6 +120,16 @@
language = {english},
}
@online{subfig,
author = {Cochran, Steven Douglas},
title = {The Subfig Package (v1.3)},
type = {M/OL},
date = {2005-07-05},
url = {http://mirror.ctan.org/macros/latex/contrib/subfig},
urldate = {2015-04-26},
language = {english},
}
@online{tikz,
author = {Till Tantau},
title = {The TikZ and PGF Packages: Manual for version 3.0.0},
@ -130,6 +140,16 @@
language = {english},
}
@online{tocloft,
author = {Robertson, Will},
title = {The tocloft package},
type = {M/OL},
date = {2013-12-20},
url = {http://mirror.ctan.org/macros/latex/contrib/tocloft/},
urldate = {2013-05-02},
language = {english},
}
@online{xCJK2uni,
author = {李清},
title = {xCJK2uni 宏包v0.1},

View File

@ -36,6 +36,7 @@
\usepackage{fancyvrb}
\usepackage{hologo}
\setlength{\bibitemsep}{3bp}
\newcommand{\myemph}[1]{\emph{\textcolor{red}{#1}}}
\newcommand{\unemph}[1]{\textup{\textcolor{black}{#1}}}
\newcommand{\docversion}{v1.5.5}

View File

@ -47,12 +47,10 @@
}
% Whethet to modify footnote format.
\pkuthssextra@int@boolopt{footfmt}{true}
% Whethet to modify spacing according to school regulation.
\pkuthssextra@int@boolopt{pkuspace}{true}
% Whethet to use some common settings for adjusting spacing.
\pkuthssextra@int@boolopt{spacing}{true}
% Whether to use list environments that are tighter than LaTeX defaults.
\pkuthssextra@int@boolopt{tightlist}{true}
% Whether to let captions use a different font from the main text.
\pkuthssextra@int@boolopt{caption}{true}
% Add PDF bookmark for table of contents.
\pkuthssextra@int@boolopt{pdftoc}{true}
% Whether to enable the `\spacialchap' command.
@ -90,6 +88,23 @@
\deffootnote{2\ccwd}{3.5\ccwd}{\thefootnotemark\hspace{0.75\ccwd}}
\fi
\ifpkuthssextra@opt@pkuspace
% Quite harmless and frequently used package. Loaded together with `tocloft'
% plus a compatibility option to avoid package clash.
\RequirePackage{subfig}
% Provides utilities for setting TOC format; `titles' applied to avoid
% interfering with LaTeX's own title mechanism.
\RequirePackage[subfigure, titles]{tocloft}
\setlength{\cftbeforechapskip}{6bp plus 1bp}
\setlength{\cftsecindent}{\ccwd}
\setlength{\cftsubsecindent}{2\ccwd}
% Modify font size and separator of captions.
\RequirePackage{caption}
\DeclareCaptionFont{cfive}{\zihao{5}}
\DeclareCaptionLabelSeparator{quad}{\quad}
\captionsetup{font = cfive, labelsep = quad}
\fi
\ifpkuthssextra@opt@spacing
% Automatically ignore spaces between CJK characters and preserve spaces in other
% situations. XeCJK itself will handle this issue, therefore we do not use
@ -101,22 +116,12 @@
\geometry{centering}
% Set line skip.
\linespread{1.41}\selectfont
\fi
\ifpkuthssextra@opt@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.
% Biblatex uses `\itemsep' as default `\bibitemsep', no need to change it.
\RequirePackage{enumitem}
\setlist{nolistsep}
\fi
\ifpkuthssextra@opt@caption
% According to common aesthetics of typography, it is nice to make the font of
% captions lighter than main text, and tables lighter than captions.
\RequirePackage[font = it]{caption}
\fi
\ifpkuthssextra@opt@pdftoc
% Add PDF bookmark for table of contents.
\let\pkuthssextra@tmp@tableofcontents\tableofcontents
@ -140,6 +145,18 @@
\fi
\AtBeginDocument{
\ifpkuthssextra@opt@pkuspace
% Kludge for `tocloft' used with `ctex'.
% <http://bbs.ctex.org/forum.php?mod=redirect&goto=findpost&ptid=43535&pid=310238>.
\renewcommand{\numberline}[1]{%
\settowidth\@tempdimb{#1\hspace{0.5em}}%
\ifdim\@tempdima<\@tempdimb%
\@tempdima=\@tempdimb%
\fi%
\hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb%
}%
\fi
\ifpkuthssextra@opt@pdfprop
% Automatically generate properties for generated PDF.
% Use English properties to avoid problems with character encodings.

View File

@ -51,8 +51,8 @@
% Pass options to `pkuthss-extra'.
% See pkuthss-extra.sty for an explanation of the options.
\pkuthss@int@extraopt{footfmt}
\pkuthss@int@extraopt{pkuspace}
\pkuthss@int@extraopt{spacing}
\pkuthss@int@extraopt{tightlist}
\pkuthss@int@extraopt{pdftoc}
\pkuthss@int@extraopt{spechap}
\pkuthss@int@extraopt{pdfprop}