Skip to content

Commit

Permalink
Support numbered pdf bookmarks and Chinese pdf properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhiyunyao committed Apr 24, 2024
1 parent 86cd17d commit 9b0fbb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
18 changes: 8 additions & 10 deletions tex/pkuthss.cls
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
\DeclareOption{no#1}{\@nameuse{thss@opt@#1false}}
}
% Process the encoding options.
\newif\ifthss@opt@gbk \thss@opt@gbktrue
\DeclareOption{GBK}{\thss@opt@gbktrue\PassOptionsToClass{GBK}{ctexbook}}
\DeclareOption{UTF8}{\thss@opt@gbkfalse\PassOptionsToClass{UTF8}{ctexbook}}
\newif\ifthss@opt@gbk \thss@opt@gbkfalse
\DeclareOption{GBK}{\thss@opt@gbktrue}
\DeclareOption{UTF8}{\thss@opt@gbkfalse}
% Whether to enable `\Uppercase' (works problematically) in heading marks.
\thss@int@boolopt{uppermark}{false}
% Whether to modify fonts according to school regulation.
Expand All @@ -65,9 +65,6 @@
% Process all class options now.
\ProcessOptions\relax

% Work around the `\lvert already defined' error.
% cf. <https://github.com/CTeX-org/ctex-kit/issues/454>.
\ifthss@opt@pkufont\RequirePackage{amsmath}\fi
% pkuthss is based on ctexbook; we use `xiao 4' as default font size.
\LoadClass[zihao = -4]{ctexbook}[2014/03/06]
% ctex 2.x no longer loads ifpdf and ifxetex by itself.
Expand All @@ -83,10 +80,11 @@
% Provides `\uline' used in `\maketitle' (but do not mess with `\emph').
\RequirePackage[normalem]{ulem}
% `\AtEndOfClass' used to avoid `PDF destination not defined' with setspace.
\AtEndOfClass{\RequirePackage{hyperref}}
\AtEndOfClass{\RequirePackage[bookmarksnumbered, unicode]{hyperref}}
\input{pkuthss.def}

\ifthss@opt@pkufont
\RequirePackage{amsmath}
% Use Times New Roman / Arial according to school regulation.
\ifxetex
\RequirePackage{unicode-math}
Expand Down Expand Up @@ -218,8 +216,8 @@
% information does not leak into the blind version.
\newcommand*{\setpdfproperties}{%
\hypersetup{
pdfauthor = {\@eauthor}, pdftitle = {\@etitle},
pdfsubject = {\euniversity\ \ethesisname}, pdfkeywords = {\@ekeywords}
pdfauthor = {\@cauthor}, pdftitle = {\@ctitle},
pdfsubject = {\cuniversity\cthesisname}, pdfkeywords = {\@ckeywords}
}%
}
% Set up the properties when generating the title page because the document
Expand Down Expand Up @@ -277,7 +275,7 @@
% Set up page layout.
\geometry{a4paper, hmargin = 2.6cm, headheight = 0.5cm, headsep = 0.6cm}
\ifthss@opt@ugly
\geometry{top = 3.1cm, bottom = 3.0cm, footskip = 0.8cm}
\geometry{top = 3.1cm, bottom = 2.5cm, footskip = 0.8cm}
\else
\geometry{top = 3.0cm, bottom = 3.1cm, footskip = 1.1cm}
\fi
Expand Down
9 changes: 2 additions & 7 deletions tex/pkuthss.def
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@
\ProvidesFile{pkuthss.def}
[2024/03/07 v1.9.4 Labels and captions for the pkuthss document class]

\def\label@ementor{Directed by\ }
\def\euniversity{Peking University}
\def\ethesisname{Doctor Thesis}
\def\thesiscover{}
\def\mentorlines{1}
\def\eabstractname{ABSTRACT}

\ifthss@opt@ugly
\def\label@ekeywords{KEY WORDS:\ }
\else
\def\label@ekeywords{KEYWORDS:\ }
\fi
\def\label@ementor{Supervised by\ }
\def\label@ekeywords{KEY WORDS:\ }

\ifthss@opt@gbk
\input{pkuthss-gbk.def}
Expand Down

0 comments on commit 9b0fbb0

Please sign in to comment.