diff options
author | Norbert Preining <preining@logic.at> | 2012-10-13 09:59:21 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2012-10-13 09:59:21 +0000 |
commit | 71f4dd313248c2db8fef21a4c5c3d3c14a5af46a (patch) | |
tree | 1e962c8cb5102077c7ea82fe32614ef4e129eef6 /Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty | |
parent | ff9712db1ca63bc7701b625784c67abee7e1f17c (diff) |
new latex package pkuthss (13Oct)
git-svn-id: svn://tug.org/texlive/trunk@27955 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty b/Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty new file mode 100644 index 00000000000..a16e4a1e35d --- /dev/null +++ b/Master/texmf-dist/tex/latex/pkuthss/pkuthss-extra.sty @@ -0,0 +1,166 @@ +% vim:ft=tex:ts=2:sw=2 +% +% Peking University dissertation document class +% +% Copyright (c) 2008-2009 solvethis +% Copyright (c) 2010-2012 Casper Ti. Vector +% +% 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 +% 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. +% +% This work has the LPPL maintenance status `maintained'. +% The current maintainer of this work is Casper Ti. Vector. +% +% This work consists of the following files: +% pkuthss.cls +% pkuthss-gbk.def +% pkuthss-utf8.def +% pkuthss-extra.sty + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{pkuthss-extra} + [2012/10/11 v1.4-beta2 Common extra settings for the pkuthss document class] + +% 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.} +} + +% eg. `\pkuthssextra@int@boolopt{spacing}{true}' will expand to: +% \newif\ifpkuthssextra@opt@spacing \pkuthssextra@opt@spacingtrue +% \DeclareOption{spacing}{\pkuthssextra@opt@spacingtrue} +% \DeclareOption{nospacing}{\pkuthssextra@opt@spacingfalse} +\def\pkuthssextra@int@boolopt#1#2{ + \expandafter\newif\csname ifpkuthssextra@opt@#1\endcsname + \@nameuse{pkuthssextra@opt@#1#2} + \DeclareOption{#1}{\@nameuse{pkuthssextra@opt@#1true}} + \DeclareOption{no#1}{\@nameuse{pkuthssextra@opt@#1false}} +} +% 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 use some common settings about table of contents, bibliography and +% indexes. +\pkuthssextra@int@boolopt{pdftoc}{true} +% Whether to enable `\Uppercase' (works problematically) in heading marks. +\pkuthssextra@int@boolopt{uppermark}{false} +% Whether to enable the `\spacialchap' command. +\pkuthssextra@int@boolopt{spechap}{true} +% Whether to automatically set properties for generated PDF from user defined +% document information (author, title, etc.). +\pkuthssextra@int@boolopt{pdfprop}{true} +% Whether to use coloured hyperlinks in generated PDF. +\pkuthssextra@int@boolopt{colorlinks}{true} +% Process all class options now. +\ProcessOptions\relax + +\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 + % `CJKspace' when using XeLaTeX. + \unless\ifxetex\RequirePackage{CJKspace}\fi + % Make spacing nicer in some situations (eg. footnotes and verbatims). + \RequirePackage{setspace} + % Make the text area centered in the page. + \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 + +\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@pdftoc + % Add PDF bookmark for table of contents. + \let\pkuthssextra@tmp@tableofcontents\tableofcontents + \renewcommand{\tableofcontents}{ + % Make the `Contents' bookmark point correctly to the title of the table of + % contents. + \cleardoublepage + % Actually add the PDF bookmark. + \pdfbookmark[1]{\contentsname}{contents} + \pkuthssextra@tmp@tableofcontents + } +\fi + +\ifpkuthssextra@opt@spechap + % 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 + } +\fi + +\AtBeginDocument{ + % `\MakeUppercase' works problematically. + % eg. it converts `\cite{ctex}' into `\cite{CTEX}'. + % This option can disable `\MakeUppercase' in left/right heading marks. + \unless\ifpkuthssextra@opt@uppermark + % Code modified from part of ctex-book.def in `ctex' package. + % The main difference is the deletion of calls to `\MakeUppercase' here. + \if@twoside + \renewcommand\chaptermark[1]{% + \markboth{% + \ifnum\value{secnumdepth}>-1 \if@mainmatter \CTEXthechapter \quad \fi\fi + #1% + }{}% + } + \renewcommand\sectionmark[1]{% + \markright{\ifnum\value{secnumdepth}>-1 \CTEXthesection \quad \fi #1}% + } + % One side typesetting should also be considered. + \else + \renewcommand\chaptermark[1]{% + \markright{% + \ifnum\value{secnumdepth}>-1 \if@mainmatter \CTEXthechapter \quad \fi\fi + #1% + }% + } + \fi + \fi + + \ifpkuthssextra@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 the properties when generating the title page because the document + % information should have been all defined before this. + \let\pkuthssextra@tmp@maketitle\maketitle + % NOTE: `\hypersetup' must appear before `\maketitle', otherwise it might not + % act as wished. + \renewcommand\maketitle{\setpdfproperties\pkuthssextra@tmp@maketitle} + \fi + + \ifpkuthssextra@opt@colorlinks + % Use coloured hyperlinks in generated PDF. + \hypersetup{colorlinks = true, allcolors = blue} + \else + % 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 +} + +\endinput |