diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls | 186 |
1 files changed, 152 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls b/Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls index a630a829f13..01f249063f3 100644 --- a/Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls +++ b/Master/texmf-dist/tex/latex/pkuthss/pkuthss.cls @@ -20,48 +20,51 @@ % pkuthss.cls % pkuthss-gbk.def % pkuthss-utf8.def -% pkuthss-extra.sty % pkulogo.eps % pkuword.eps \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{pkuthss} - [2015/06/30 v1.6.3 Peking University dissertation document class] + [2015/12/16 v1.7.0 Peking University dissertation document class] +% eg. `\pkuthss@int@boolopt{spacing}{true}' will expand to: +% \newif\ifpkuthss@opt@spacing \pkuthss@opt@spacingtrue +% \DeclareOption{spacing}{\pkuthss@opt@spacingtrue} +% \DeclareOption{nospacing}{\pkuthss@opt@spacingfalse} +\def\pkuthss@int@boolopt#1#2{ + \expandafter\newif\csname ifpkuthss@opt@#1\endcsname + \@nameuse{pkuthss@opt@#1#2} + \DeclareOption{#1}{\@nameuse{pkuthss@opt@#1true}} + \DeclareOption{no#1}{\@nameuse{pkuthss@opt@#1false}} +} % 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}} +\DeclareOption{UTF8}{\pkuthss@opt@gbkfalse\PassOptionsToClass{UTF8}{ctexbook}} % Whether to enable `\Uppercase' (works problematically) in heading marks. -\newif\ifpkuthss@opt@uppermark \pkuthss@opt@uppermarkfalse -\DeclareOption{uppermark}{\pkuthss@opt@uppermarktrue} -\DeclareOption{nouppermark}{\pkuthss@opt@uppermarkfalse} -% Whether to enable the default extra settings. -\newif\ifpkuthss@opt@extra \pkuthss@opt@extratrue -\DeclareOption{extra}{\pkuthss@opt@extratrue} -\DeclareOption{noextra}{\pkuthss@opt@extrafalse} -% eg. `\pkuthss@int@extraopt{spacing}' will expand to: -% \DeclareOption{spacing}{\PassOptionsToPackage{spacing}{pkuthss-extra}} -% \DeclareOption{nospacing}{\PassOptionsToPackage{nospacing}{pkuthss-extra}} -\def\pkuthss@int@extraopt#1{ - \DeclareOption{#1}{\PassOptionsToPackage{#1}{pkuthss-extra}} - \DeclareOption{no#1}{\PassOptionsToPackage{no#1}{pkuthss-extra}} -} -% 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{pdftoc} -\pkuthss@int@extraopt{spechap} -\pkuthss@int@extraopt{pdfprop} -\pkuthss@int@extraopt{colorlinks} +\pkuthss@int@boolopt{uppermark}{false} +% Whether to modify fonts according to school regulation. +\pkuthss@int@boolopt{pkufont}{true} +% Whether to modify footnote format according to school regulation. +\pkuthss@int@boolopt{pkufoot}{true} +% Whether to modify spacing according to school regulation. +\pkuthss@int@boolopt{pkuspace}{true} +% Whether to use some common settings for adjusting spacing. +\pkuthss@int@boolopt{spacing}{true} +% Add PDF bookmark for table of contents. +\pkuthss@int@boolopt{pdftoc}{true} +% Whether to enable the `\spacialchap' command. +\pkuthss@int@boolopt{spechap}{true} +% Whether to automatically set up properties for generated PDF from user +% defined document information (author, title, etc.). +\pkuthss@int@boolopt{pdfprop}{true} % Pass all other options to `ctexbook' document class. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}} % Process all class options now. \ProcessOptions\relax +% Prevent fontspec (loaded by xeCJK) from interfering with newtxmath. +\ifpkuthss@opt@pkufont\PassOptionsToPackage{no-math}{fontspec}\fi % pkuthss is based on ctexbook; we use `xiao 4' as default font size. % CJKfntef provides `\CJKunderline' used in `\maketitle'. % fancyhdr provides utilities for setting up headers and footers. @@ -72,10 +75,13 @@ \RequirePackage{graphicx}[1999/02/16] % Provides utilities for setting up page layout. \RequirePackage{geometry} -% Whether to enable the default extra settings. -\ifpkuthss@opt@extra\RequirePackage{pkuthss-extra}\fi +% `hyperref', `fntef', `fancyhdr' and `cs4size' are deprecated in ctex 2.x. +% hyperref now does not make citation hyperlinks if not explicitly loaded. +% All compatibility support for ctex 1.x is scheduled for removal in 2017. +\RequirePackage{hyperref} \ifpkuthss@opt@gbk + \input{pkuthss-gbk.def} \ifxetex % No support for XeLaTeX compilation in non-unicode encoding, i.e. GBK. \ClassError{pkuthss}% @@ -90,12 +96,124 @@ % loads xCJK2uni by itself when necessary. \RequirePackage{xCJK2uni} \fi\fi +\else + \input{pkuthss-utf8.def} +\fi + +\ifpkuthss@opt@pkufont + % Use Times New Roman / Arial according to school regulation. + % Option used to prevent newtxtext from manipulating footnote marks. + \RequirePackage[defaultsups]{newtxtext} + \RequirePackage{newtxmath} +\else + % Provides `\Box' for originauth.tex if newtx is absent. + \RequirePackage{latexsym} +\fi + +\ifpkuthss@opt@pkufoot + % Handle the `Unparsed material' issue with latex/dvipdfmx compilation. + \unless\ifxetex\unless\ifpdf + \newcommand*\pgfsysdriver{pgfsys-dvipdfm.def} + \fi\fi + % Circled text, cf. <https://tex.stackexchange.com/questions/7032/>. + \RequirePackage{tikz} + \newcommand*\pkuthss@int@circled[1]{% + \scalebox{0.8}{\tikz[baseline = (char.base)]{ + \node[ + shape = circle, draw = black, minimum size = 1.25em, inner sep = 0pt + ] (char) {#1}; + }}% + } + % Use circled numbers as footnote symbols. Does not affect title page, but + % footnote is rarely used in dissertation covers ;) + \renewcommand\thefootnote% + {\protect\pkuthss@int@circled{\arabic{footnote}}} + % Provides utility to modify footnote spacing. + % Option used to make sure it does not render interleaf pages totally blank. + \RequirePackage[cleardoublepage = current]{scrextend} + % Set up footnote spacing: symbol indent 2 ccwd, paragraph indent 3.5 ccwd, + % 0.75 ccwd between symbol and paragraph. + \deffootnote{2\ccwd}{3.5\ccwd}{\thefootnotemark\hspace{0.75\ccwd}} +\fi + +\ifpkuthss@opt@pkuspace + % lineskip / baselineskip = 20 bp / (12 bp * (6 / 5)). + \linespread{1.39}\selectfont + % 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 + +\ifpkuthss@opt@spacing + % Automatically ignore spaces between CJK characters, or otherwise preserve + % spaces. XeCJK itself will handle this issue, therefore we do not use + % `CJKspace' when using XeLaTeX. + \unless\ifxetex\RequirePackage{CJKspace}\fi + % Make spacing nicer in some situations (eg. footnotes and verbatims). + \RequirePackage{setspace} + % 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} +\fi + +\ifpkuthss@opt@pdftoc + % Add PDF bookmark for table of contents. + \let\pkuthss@tmp@tableofcontents\tableofcontents + \renewcommand{\tableofcontents}{% + \pkuthss@int@pdfmark{\contentsname}{contents} + \pkuthss@tmp@tableofcontents% + } \fi -\AtEndOfClass{ - % Set up chinese captions and labels. - \ifpkuthss@opt@gbk\input{pkuthss-gbk.def} - \else\input{pkuthss-utf8.def} +\ifpkuthss@opt@spechap + % This command is used to start a chapter without numbering, and correctly set + % up the headers and footers in the chapter. + \newcommand\specialchap[1]{% + \chapter*{#1}\addcontentsline{toc}{chapter}{#1} + \markboth{#1}{}\phantomsection% + } +\fi + +\AtBeginDocument{ + \ifpkuthss@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 + + \ifpkuthss@opt@pdfprop + % Automatically generate properties for generated PDF. + % Use English properties to avoid problems with character encodings. + \newcommand*{\setpdfproperties}{% + \hypersetup{ + pdfauthor = {\@eauthor}, pdftitle = {\@etitle}, + pdfsubject = {\euniversity\ \ethesisname}, pdfkeywords = {\@ekeywords} + }% + } + % Set up the properties when generating the title page because the document + % information should have been all defined before this. + \let\pkuthss@tmp@maketitle\maketitle + % NOTE: `\hypersetup' must appear before `\maketitle', otherwise it might not + % act as wished. + \renewcommand\maketitle{\setpdfproperties\pkuthss@tmp@maketitle} \fi } @@ -208,7 +326,7 @@ % because the bookmark will point to somewhere below the chapter mark. \def\pkuthss@int@pdfmark#1#2{% \if@openright\cleardoublepage\else\clearpage\fi - \pdfbookmark[1]{#1}{#2}% + \pdfbookmark[0]{#1}{#2}% } % Usage: \pkuthss@int@fillinblank{(number of lines)}{(line width)}{(contents)} |