From 3f859926aa0c82e95948c0cd64dfe1d9bfd0003c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 29 Dec 2015 00:14:23 +0000
Subject: thuthesis (27dec15)

git-svn-id: svn://tug.org/texlive/trunk@39220 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/thuthesis/thuthesis.cls   | 125 +++++++++++----------
 1 file changed, 66 insertions(+), 59 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls')

diff --git a/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls b/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
index ff65bda19c3..35320b4a26c 100644
--- a/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
+++ b/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
@@ -25,10 +25,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesClass{thuthesis}
-[2015/12/24 5.0 Tsinghua University Thesis Template]
+[2015/12/27 5.1.0 Tsinghua University Thesis Template]
 \hyphenation{Thu-Thesis}
 \def\thuthesis{\textsc{ThuThesis}}
-\def\version{4.8.1}
+\def\version{5.1.0}
 
 \RequirePackage{kvoptions}
 \SetupKeyvalOptions{
@@ -47,7 +47,7 @@
   \expandafter\csname thu@#1true\endcsname}
 
 \def\thu@deprecated@type@option{%
-  \setkeys{thu}{type=\CurrentOption} % for compatability.
+  \kvsetkeys{thu}{type=\CurrentOption} % for compatability.
   \ClassError{thuthesis}{Option '\CurrentOption' is deprecated, \MessageBreak
                          please use 'type=\CurrentOption' instead}{}}
 \DeclareVoidOption{bachelor}{\thu@deprecated@type@option}
@@ -61,8 +61,7 @@
 \DeclareBoolOption{arialtitle}
 \DeclareBoolOption{raggedbottom}
 \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
-\setkeys{thu}{%
-  type=bachelor,
+\kvsetkeys{thu}{%
   raggedbottom,
   arial,
   arialtitle}
@@ -96,9 +95,7 @@
 \else
   \RequirePackage[perpage]{footmisc}
 \fi
-\ifthu@bachelor
-  \RequirePackage{CJKfntef}
-\fi
+\RequirePackage{CJKfntef}
 \renewcommand{\baselinestretch}{1.0} % todo:?
 \ifxetex
   % todo: minor fix of CJKnumb
@@ -151,6 +148,7 @@
 \ifthu@bachelor
   \geometry{
     left=32mm,
+    headheight=5mm,
     headsep=5mm,
     textheight=220mm,
     bottom=37mm,
@@ -158,6 +156,7 @@
 \else
   \geometry{
     left=30mm,
+    headheight=5mm,
     headsep=5mm,
     textheight=237mm,
     bottom=29mm,
@@ -166,7 +165,7 @@
 \RequirePackage{fancyhdr}
 \let\thu@cleardoublepage\cleardoublepage
 \newcommand{\thu@clearemptydoublepage}{%
-  \clearpage{\pagestyle{empty}\thu@cleardoublepage}}
+  \clearpage{\pagestyle{thu@empty}\thu@cleardoublepage}}
 \let\cleardoublepage\thu@clearemptydoublepage
 \renewcommand\frontmatter{%
   \if@openright\cleardoublepage\else\clearpage\fi
@@ -207,7 +206,7 @@
 \thu@def@fontsize{qihao}{5.5bp}
 \thu@def@fontsize{bahao}{5bp}
 \renewcommand\normalsize{%
-  \@setfontsize\normalsize{12bp}{20bp}
+  \@setfontsize\normalsize{12bp}{20bp}%
   \abovedisplayskip=20bp \@plus 2bp \@minus 2bp
   \abovedisplayshortskip=20bp \@plus 2bp \@minus 2bp
   \belowdisplayskip=\abovedisplayskip
@@ -437,7 +436,8 @@
 \renewcommand*\l@section{\@dottedtocline{1}{\ccwd}{2.1em}}
 \renewcommand*\l@subsection{\@dottedtocline{2}{\ifthu@bachelor 1.5\ccwd\else 2\ccwd\fi}{3em}}
 \renewcommand*\l@subsubsection{\@dottedtocline{3}{\ifthu@bachelor 2.4em\else 3.5em\fi}{3.8em}}
-\def\thu@def@term#1{
+\def\thu@def@term#1{%
+  \define@key{thu}{#1}{\csname #1\endcsname{##1}}
   \expandafter\gdef\csname #1\endcsname##1{%
     \expandafter\gdef\csname thu@#1\endcsname{##1}}
   \csname #1\endcsname{}}
@@ -448,12 +448,16 @@
 \thu@def@term{secretyear}
 \thu@def@term{ctitle}
 \thu@def@term{cdegree}
-\newcommand\cdepartment[2][]{\def\thu@cdepartment@short{#1}\def\thu@cdepartment{#2}}
-\def\caffil{\cdepartment} % todo: for compatibility
+\newcommand\cdepartment[2][]{% todo: for definekeys
+  \def\thu@cdepartment@short{#1}
+  \def\thu@cdepartment{#2}}
+\define@key{thu}{cdepartment}{%
+  \expandafter\cdepartment#1}
+\def\caffil{\cdepartment} % for compatibility
 \def\thu@cdepartment@short{}
 \def\thu@cdepartment{}
 \thu@def@term{cmajor}
-\def\csubject{\cmajor} % todo: for compatibility
+\def\csubject{\cmajor} % for compatibility
 \thu@def@term{cfirstdiscipline}
 \thu@def@term{cseconddiscipline}
 \thu@def@term{cauthor}
@@ -465,9 +469,9 @@
 \thu@def@term{etitle}
 \thu@def@term{edegree}
 \thu@def@term{edepartment}
-\def\eaffil{\edepartment} % todo: for compability
+\def\eaffil{\edepartment} % for compability
 \thu@def@term{emajor}
-\def\esubject{\emajor} % todo: for compability
+\def\esubject{\emajor} %for compability
 \thu@def@term{eauthor}
 \thu@def@term{esupervisor}
 \thu@def@term{eassosupervisor}
@@ -484,7 +488,8 @@
 \newcommand{\thu@@eabstract}[1]{\long\gdef\thu@eabstract{#1}}
 \newenvironment{eabstract}{\collect@body\thu@@eabstract}{}
 \def\thu@parse@keywords#1{
-  \expandafter\gdef\csname thu@#1\endcsname{} % todo: need or not?
+  \define@key{thu}{#1}{\csname #1\endcsname{##1}}
+  \expandafter\gdef\csname thu@#1\endcsname{}
   \expandafter\gdef\csname #1\endcsname##1{
     \@for\reserved@a:=##1\do{
       \expandafter\ifx\csname thu@#1\endcsname\@empty\else
@@ -494,9 +499,11 @@
         \expandafter\csname thu@#1\expandafter\endcsname\expandafter{\reserved@a}}}}
 \thu@parse@keywords{ckeywords}
 \thu@parse@keywords{ekeywords}
+\def\thusetup{\kvsetkeys{thu}}
 \newcommand\thu@underline[2][6em]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt}
 \newlength{\thu@title@width}
-\def\thu@put@title#1{\makebox{\hb@xt@\thu@title@width{#1}}}
+\newcommand{\thu@put@title}[2][\thu@title@width]{%
+  \begin{CJKfilltwosides}{#1}#2\end{CJKfilltwosides}}
 \def\thu@first@titlepage{%
   \ifthu@postdoctor\thu@first@titlepage@postdoctor\else\thu@first@titlepage@other\fi}
 \newcommand{\thu@first@titlepage@postdoctor}{
@@ -537,7 +544,6 @@
     \vskip2cm
     {\sihao\thu@postdoctor@date@title\hskip1em\underline\thu@postdoctordate}
   \end{center}}
-\newcommand*{\getcmlength}[1]{\strip@pt\dimexpr0.035146\dimexpr#1\relax\relax}
 \newcommand{\thu@first@titlepage@other}{
   \begin{center}
     \vspace*{-1.6cm}
@@ -573,23 +579,24 @@
     \fi
     \ifthu@bachelor
       \vskip1cm
-      \parbox[t][7.0cm][t]{\textwidth}{{\sanhao[1.8]
-        \hspace*{1.65cm}\fangsong
-          \setlength{\thu@title@width}{4em}
-          \setlength{\extrarowheight}{6pt}
-          \ifxetex % todo: ugly codes
-            \begin{tabular}{p{\thu@title@width}@{}l@{\extracolsep{8pt}}l}
-          \else
-            \begin{tabular}{p{\thu@title@width}l@{}l}
-          \fi
-              \thu@put@title{\thu@department@title} & \thu@title@sep & \thu@cdepartment\\
-              \thu@put@title{\thu@major@title}      & \thu@title@sep & \thu@cmajor\\
-              \thu@put@title{\thu@author@title}     & \thu@title@sep & \thu@cauthor \\
-              \thu@put@title{\thu@supervisor@title}         & \thu@title@sep & \thu@csupervisor\\
-              \ifx\thu@cassosupervisor\@empty\else
-                \thu@put@title{\thu@assosuper@title}        & \thu@title@sep & \thu@cassosupervisor\\
-              \fi
-            \end{tabular}
+      \parbox[t][7.0cm][t]{\textwidth}{%
+        {\fangsong\sanhao[1.8]%
+         \hspace*{1.65cm}
+         \setlength{\thu@title@width}{4em}
+         \setlength{\extrarowheight}{6pt}
+         \ifxetex % todo: ugly codes
+           \begin{tabular}{p{\thu@title@width}@{}l@{\extracolsep{8pt}}l}
+         \else
+           \begin{tabular}{p{\thu@title@width}l@{}l}
+         \fi
+             \thu@put@title{\thu@department@title} & \thu@title@sep & \thu@cdepartment\\
+             \thu@put@title{\thu@major@title}      & \thu@title@sep & \thu@cmajor\\
+             \thu@put@title{\thu@author@title}     & \thu@title@sep & \thu@cauthor \\
+             \thu@put@title{\thu@supervisor@title} & \thu@title@sep & \thu@csupervisor\\
+             \ifx\thu@cassosupervisor\@empty\else%
+               \thu@put@title{\thu@assosuper@title} & \thu@title@sep & \thu@cassosupervisor\\
+             \fi
+           \end{tabular}
         }}
     \else
       \vskip 5bp
@@ -610,7 +617,7 @@
                 \thu@put@title{\thu@assosuper@title} & \thu@title@sep & {\ziju{0.6875}\thu@cassosupervisor}\\
               \fi
               \ifx\thu@ccosupervisor\@empty\else
-                \thu@put@title{\thu@cosuper@title}   & \thu@title@sep & {\ziju{0.6875}\thu@ccosupervisor}\\
+                \hfill\makebox[0pt][r]{\thu@cosuper@title} & \thu@title@sep & {\ziju{0.6875}\thu@ccosupervisor}\\
               \fi
             \end{tabular}
         \end{center}}}
@@ -620,18 +627,19 @@
      \end{center}
     \end{center}} % end of titlepage
 \newcommand{\thu@engcover}{%
-  \def\thu@master@art{Master of Arts}
-  \def\thu@master@sci{Master of Science}
-  \def\thu@doctor@phi{Doctor of Philosophy}
-  \newif\ifthu@professional
-  \thu@professionalfalse
+  \newif\ifthu@professional\thu@professionalfalse
   \ifthu@master
-    \ifx\thu@edegree\thu@master@art\relax\else
-      \ifx\thu@edegree\thu@master@sci\relax\else
-        \thu@professionaltrue\fi\fi\fi
+    \ifthenelse{\equal{\thu@edegree}{\thu@master@art}}
+      {\relax}
+      {\ifthenelse{\equal{\thu@edegree}{\thu@master@sci}}
+        {\relax}
+        {\thu@professionaltrue}}
+  \fi
   \ifthu@doctor
-    \ifx\thu@edegree\thu@doctor@phi\relax\else
-      \thu@professionaltrue\fi\fi
+    \ifthenelse{\equal{\thu@edegree}{\thu@doctor@phi}}
+      {\relax}
+      {\thu@professionaltrue}
+  \fi
   \begin{center}
     \vspace*{-5pt}
     \parbox[t][5.2cm][t]{\paperwidth-7.2cm}{
@@ -700,7 +708,16 @@
                      \thu@frontdate\thu@underline[7em]\relax\hspace*{1cm}
     \endgroup
   \fi}
-\NewDocumentCommand{\makecover}{o}{
+\def\makecover{%
+  \thu@setup@pdfinfo\thu@makecover}
+\def\thu@setup@pdfinfo{%
+  \hypersetup{%
+    pdftitle={\thu@ctitle},
+    pdfauthor={\thu@cauthor},
+    pdfsubject={\thu@cdegree},
+    pdfkeywords={\thu@ckeywords},
+    pdfcreator={\thuthesis-v\version}}}
+\NewDocumentCommand{\thu@makecover}{o}{
   \phantomsection
   \pdfbookmark[-1]{\thu@ctitle}{ctitle}
   \normalsize%
@@ -810,8 +827,6 @@
 \def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup}
 \let\onlinecite\inlinecite
 \def\thudot{\ifthu@bachelor\else\unskip.\fi}
-\def\thumasterbib{\ifthu@bachelor [D]\else [硕士学位论文]\fi}
-\def\thuphdbib{\ifthu@bachelor [D]\else [博士学位论文]\fi}
 \renewenvironment{thebibliography}[1]{%
    \thu@chapter*{\bibname}%
    \wuhao[1.5]
@@ -867,16 +882,8 @@ leftmargin=10mm,labelsep=!,before*=\xiaosi[1.26]}
   \texttt{#1}}
 \newcommand{\wi}[1]{\index{#1}#1}
 \fi
-\newcommand{\pozhehao}{\kern0.3ex\rule[0.8ex]{2em}{0.1ex}\kern0.3ex}
+\newcommand{\pozhehao}{——}
 \AtEndOfClass{\input{thuthesis.cfg}}
-\def\thu@setup@pdfinfo{%
-  \hypersetup{%
-    pdftitle={\thu@ctitle},
-    pdfauthor={\thu@cauthor},
-    pdfsubject={\thu@cdegree},
-    pdfkeywords={\thu@ckeywords},
-    pdfcreator={\thu@cauthor},
-    pdfproducer={\thuthesis}}}
 \AtEndOfClass{\sloppy}
 \endinput
 %%
-- 
cgit v1.2.3

