From 9788a8cf3f4f60828e8b9157e5036156a4da4dd4 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 1 Feb 2016 23:07:09 +0000
Subject: thuthesis (2feb16)

git-svn-id: svn://tug.org/texlive/trunk@39543 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/thuthesis/thuthesis.cls   | 159 +++++++++------------
 1 file changed, 64 insertions(+), 95 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 f9a0f9c781e..f7358e248c6 100644
--- a/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
+++ b/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls
@@ -23,13 +23,12 @@
 %% To produce the documentation run the original source files ending with `.dtx'
 %% through LaTeX.
 %% 
-%% \end{latex}
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesClass{thuthesis}
 [2016/01/18 5.2.1 Tsinghua University Thesis Template]
 \hyphenation{Thu-Thesis}
 \def\thuthesis{\textsc{ThuThesis}}
-\def\version{5.2.1}
+\def\version{5.2.2}
 
 \RequirePackage{kvoptions}
 \SetupKeyvalOptions{
@@ -46,7 +45,6 @@
   \thu@doctorfalse
   \thu@postdoctorfalse
   \expandafter\csname thu@#1true\endcsname}
-
 \def\thu@deprecated@type@option{%
   \kvsetkeys{thu}{type=\CurrentOption} % for compatability.
   \ClassError{thuthesis}{Option '\CurrentOption' is deprecated, \MessageBreak
@@ -55,12 +53,12 @@
 \DeclareVoidOption{master}{\thu@deprecated@type@option}
 \DeclareVoidOption{doctor}{\thu@deprecated@type@option}
 \DeclareVoidOption{postdoctor}{\thu@deprecated@type@option}
-
 \DeclareBoolOption{secret}
 \DeclareBoolOption{arial}
 \DeclareBoolOption{arialtoc}
 \DeclareBoolOption{arialtitle}
 \DeclareBoolOption{raggedbottom}
+\DeclareBoolOption{pifootnote}
 \DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
 \kvsetkeys{thu}{%
   raggedbottom,
@@ -80,10 +78,11 @@
     \fi
   \fi
 \fi
+\RequirePackage{etoolbox}
 \RequirePackage{ifxetex}
 \RequirePackage{xparse}
 \RequirePackage{amsmath}
-\RequirePackage{newtxtext}
+\RequirePackage[defaultsups]{newtxtext}
 \RequirePackage{newtxmath}
 \RequirePackage{tgcursor}
 \RequirePackage{graphicx}
@@ -91,11 +90,15 @@
 \RequirePackage{pdfpages}
 \includepdfset{fitpaper=true}
 \RequirePackage[shortlabels]{enumitem}
+\RequirePackage{environ}
 \ifthu@raggedbottom
-  \RequirePackage[bottom,perpage]{footmisc}
+  \RequirePackage[bottom,perpage,hang]{footmisc}
   \raggedbottom
 \else
-  \RequirePackage[perpage]{footmisc}
+  \RequirePackage[perpage,hang]{footmisc}
+\fi
+\ifthu@pifootnote
+  \RequirePackage{pifont}
 \fi
 \RequirePackage{CJKfntef}
 \renewcommand{\baselinestretch}{1.0} % todo:?
@@ -110,7 +113,7 @@
   \ifthu@arial
     \IfFileExists{arial.sty}%
                  {\RequirePackage{arial}}%
-                 {\ClassWarning{thuthesis}{no arial.sty availiable!}}
+                 {\ClassWarning{thuthesis}{arial.sty is not availiable!}}
   \fi
 \fi
 \RequirePackage[amsmath,thmmarks,hyperref]{ntheorem}
@@ -128,6 +131,7 @@
     CJKbookmarks=false}
 \fi
 \hypersetup{%
+  linktoc=all,
   bookmarksnumbered=true,
   bookmarksopen=true,
   bookmarksopenlevel=1,
@@ -230,31 +234,25 @@
   autoindent=true}
 \setlist{nosep}
 \def\thu@textcircled#1{%
-  \ifnum \value{#1} <10 \textcircled{\xiaoliu\arabic{#1}}
-  \else\ifnum \value{#1} <100 \textcircled{\qihao\arabic{#1}}\fi
+  \ifnum\value{#1} >9
+    \ClassError{thuthesis}%
+      {Too many footnotes in this page.}{Keep footnote less than 10.}
+  \fi
+  \ifthu@pifootnote%
+    \ding{\numexpr171+\value{#1}}%
+  \else%
+    \textcircled{\xiaoliu\arabic{#1}}%
   \fi}
 \renewcommand{\thefootnote}{\thu@textcircled{footnote}}
 \renewcommand{\thempfootnote}{\thu@textcircled{mpfootnote}}
 \def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@}
 \let\thu@footnotesize\footnotesize
 \renewcommand\footnotesize{\thu@footnotesize\xiaowu[1.5]}
-\def\@makefnmark{\textsuperscript{\hbox{\normalfont\@thefnmark}}}
-\long\def\@makefntext#1{
-  \bgroup
-    \newbox\thu@tempboxa
-    \setbox\thu@tempboxa\hbox{%
-      \hb@xt@ 2em{\@thefnmark\hss}}
-    \leftmargin\wd\thu@tempboxa
-    \rightmargin\z@
-    \linewidth \columnwidth
-    \advance \linewidth -\leftmargin
-    \parshape \@ne \leftmargin \linewidth
-    \footnotesize
-    \@setpar{{\@@par}}%
-    \leavevmode
-    \llap{\box\thu@tempboxa}%
-    #1
-  \par\egroup}
+\footnotemargin1.5em\relax
+\let\thu@makefnmark\@makefnmark
+\def\thu@@makefnmark{\hbox{{\normalfont\@thefnmark}}}
+\pretocmd{\@makefntext}{\let\@makefnmark\thu@@makefnmark}{}{}
+\apptocmd{\@makefntext}{\let\@makefnmark\thu@makefnmark}{}{}
 \allowdisplaybreaks[4]
 \renewcommand\theequation{\ifnum \c@chapter>\z@ \thechapter-\fi\@arabic\c@equation}
 \def\make@df@tag{\@ifstar\thu@make@df@tag@@\make@df@tag@@@}
@@ -263,21 +261,6 @@
 \renewcommand\theequation{\ifnum \c@chapter>\z@ \thechapter-\fi\@arabic\c@equation}
 \def\thu@maketag#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)}}
 \def\tagform@#1{\maketag@@@{(\ignorespaces #1\unskip\@@italiccorr)\equcaption{#1}}}
-\gdef\@endtrivlist#1{%  % from \endtrivlist
-  \if@inlabel \indent\fi
-  \if@newlist \@noitemerr\fi
-  \ifhmode
-    \ifdim\lastskip >\z@ #1\unskip \par
-      \else #1\unskip \par \fi
-  \fi
-  \if@noparlist \else
-    \ifdim\lastskip >\z@
-       \@tempskipa\lastskip \vskip -\lastskip
-      \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
-      \vskip\@tempskipa
-    \fi
-    \@endparenv
-  \fi #1}
 \theorembodyfont{\rmfamily\songti}
 \theoremheaderfont{\rmfamily\heiti}
 \setlength{\floatsep}{20bp \@plus4pt \@minus1pt}
@@ -387,23 +370,11 @@
 \ifthu@arialtoc
   \def\thu@toc@font{\sffamily}
 \fi
-\def\@pnumwidth{2em} % 这个参数没用了
-\def\@tocrmarg{2em}
-\def\@dotsep{1} % 目录点间的距离
-\def\@dottedtocline#1#2#3#4#5{%
-  \ifnum #1>\c@tocdepth \else
-    \vskip \z@ \@plus.2\p@
-    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
-    \parindent #2\relax\@afterindenttrue
-    \interlinepenalty\@M
-    \leavevmode
-    \@tempdima #3\relax
-    \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
-    {\csname thu@toc@font\endcsname #4}\nobreak
-    \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
-    \nobreak{\normalfont \normalcolor #5}%
-    \par}%
-  \fi}
+\def\@pnumwidth{2em}
+\def\@tocrmarg{\@pnumwidth}
+\def\@dotsep{1}
+\patchcmd{\@dottedtocline}{#4}{\csname thu@toc@font\endcsname #4}{}{}
+\patchcmd{\@dottedtocline}{\hb@xt@\@pnumwidth}{\hbox}{}{}
 \renewcommand*\l@chapter[2]{%
   \ifnum \c@tocdepth >\m@ne
     \addpenalty{-\@highpenalty}%
@@ -433,58 +404,52 @@
   \expandafter\gdef\csname #1\endcsname##1{%
     \expandafter\gdef\csname thu@#1\endcsname{##1}}
   \csname #1\endcsname{}}
-\thu@def@term{id}
-\thu@def@term{udc}
-\thu@def@term{catalognumber}
 \thu@def@term{secretlevel}
 \thu@def@term{secretyear}
 \thu@def@term{ctitle}
+\thu@def@term{etitle}
+\thu@def@term{cauthor}
+\thu@def@term{csupervisor}
+\thu@def@term{cassosupervisor}
+\thu@def@term{ccosupervisor}
+\thu@def@term{eauthor}
+\thu@def@term{esupervisor}
+\thu@def@term{eassosupervisor}
+\thu@def@term{ecosupervisor}
 \thu@def@term{cdegree}
+\thu@def@term{edegree}
 \thu@def@term{cdepartment}
 \def\caffil{% for compatibility
   \ClassWarning{thuthesis}
     {'\string\caffil' is deprecated, please use '\string\cdepartment' instead.}{}%
   \cdepartment}
-\thu@def@term{cmajor}
-\def\csubject{% for compatibility
-  \ClassWarning{thuthesis}
-    {'\string\csubject' is deprecated, please use '\string\cmajor' instead.}{}%
-  \cmajor}
-\thu@def@term{cfirstdiscipline}
-\thu@def@term{cseconddiscipline}
-\thu@def@term{cauthor}
-\thu@def@term{csupervisor}
-\thu@def@term{cassosupervisor}
-\thu@def@term{ccosupervisor}
-\thu@def@term{cdate}
-\thu@def@term{postdoctordate}
-\thu@def@term{etitle}
-\thu@def@term{edegree}
 \thu@def@term{edepartment}
 \def\eaffil{% for compability
   \ClassWarning{thuthesis}
     {'\string\eaffil' is deprecated, please use '\string\edepartment' instead.}{}%
   \edepartment}
+\thu@def@term{cmajor}
+\def\csubject{% for compatibility
+  \ClassWarning{thuthesis}
+    {'\string\csubject' is deprecated, please use '\string\cmajor' instead.}{}%
+  \cmajor}
 \thu@def@term{emajor}
 \def\esubject{%for compability
   \ClassWarning{thuthesis}
     {'\string\esubject' is deprecated, please use '\string\emajor' instead.}{}%
   \emajor}
-\thu@def@term{eauthor}
-\thu@def@term{esupervisor}
-\thu@def@term{eassosupervisor}
-\thu@def@term{ecosupervisor}
+\thu@def@term{cdate}
 \thu@def@term{edate}
-\long\@xp\def\@xp\collect@@body\@xp#\@xp1\@xp\end\@xp#\@xp2\@xp{%
-  \collect@@body{#1}\end{#2}}
-\long\@xp\def\@xp\push@begins\@xp#\@xp1\@xp\begin\@xp#\@xp2\@xp{%
-  \push@begins{#1}\begin{#2}}
-\long\@xp\def\@xp\addto@envbody\@xp#\@xp1\@xp{%
-  \addto@envbody{#1}}
+\thu@def@term{id}
+\thu@def@term{udc}
+\thu@def@term{catalognumber}
+\thu@def@term{cfirstdiscipline}
+\thu@def@term{cseconddiscipline}
+\thu@def@term{postdoctordate}
 \newcommand{\thu@@cabstract}[1]{\long\gdef\thu@cabstract{#1}}
-\newenvironment{cabstract}{\collect@body\thu@@cabstract}{}
+\newenvironment{cabstract}{\Collect@Body\thu@@cabstract}{}
 \newcommand{\thu@@eabstract}[1]{\long\gdef\thu@eabstract{#1}}
-\newenvironment{eabstract}{\collect@body\thu@@eabstract}{}
+\newenvironment{eabstract}{\Collect@Body\thu@@eabstract}{}
 \def\thu@parse@keywords#1{
   \define@key{thu}{#1}{\csname #1\endcsname{##1}}
   \expandafter\gdef\csname thu@#1\endcsname{}
@@ -769,6 +734,13 @@
   \normalsize
   \thu@makeabstract
   \let\@tabular\thu@tabular}
+\newbox\thu@kw
+\newcommand\thu@put@keywords[2]{%
+  \begingroup
+    \setbox\thu@kw=\hbox{#1}
+    \ifthu@bachelor\indent\else\noindent\hangindent\wd\thu@kw\hangafter1\fi%
+    \box\thu@kw#2\par
+  \endgroup}
 \newcommand{\thu@makeabstract}{%
   \ifthu@bachelor\clearpage\else\cleardoublepage\fi
   \thu@chapter*[]{\cabstractname} % no tocline
@@ -780,15 +752,12 @@
   \pagenumbering{Roman}
   \thu@cabstract
   \vskip12bp
-  \setbox0=\hbox{{\heiti\thu@ckeywords@title}}
-  \ifthu@bachelor\indent\else\noindent\hangindent\wd0\hangafter1\fi
-    \box0\thu@ckeywords
+  \thu@put@keywords{\heiti\thu@ckeywords@title}{\thu@ckeywords}
   \thu@chapter*[]{\eabstractname} % no tocline
   \thu@eabstract
   \vskip12bp
-  \setbox0=\hbox{\textbf{\ifthu@bachelor Keywords:\else Key words:\fi\enskip}}
-  \ifthu@bachelor\indent\else\noindent\hangindent\wd0\hangafter1\fi
-    \box0\thu@ekeywords}
+  \thu@put@keywords{%
+    \textbf{\ifthu@bachelor Keywords:\else Key words:\fi\enskip}}{\thu@ekeywords}}
 \newenvironment{denotation}[1][2.5cm]{%
   \thu@chapter*[]{\thu@denotation@name} % no tocline
   \vskip-30bp\xiaosi[1.6]\begin{thu@denotation}[labelwidth=#1]
-- 
cgit v1.2.3

