From c862b5452d8ad2e4a80b25807e1b9bc4de5ce938 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 12 Jun 2020 21:01:26 +0000 Subject: thuthesis (12jun20) git-svn-id: svn://tug.org/texlive/trunk@55523 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/thuthesis/thuthesis.cls | 228 ++++++++++++++++----- 1 file changed, 177 insertions(+), 51 deletions(-) (limited to 'Master/texmf-dist/tex/latex/thuthesis') diff --git a/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls b/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls index 16447ec4d81..a1f76838a0b 100644 --- a/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls +++ b/Master/texmf-dist/tex/latex/thuthesis/thuthesis.cls @@ -23,7 +23,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2017/04/15] \ProvidesClass{thuthesis} -[2020/06/08 6.1.0 Tsinghua University Thesis Template] +[2020/06/12 6.1.1 Tsinghua University Thesis Template] \newcommand\thu@error[1]{% \ClassError{thuthesis}{#1}{}% } @@ -38,7 +38,7 @@ \fi \hyphenation{Thu-Thesis} \def\thuthesis{ThuThesis} -\def\version{6.1.0} +\def\version{6.1.1} \RequirePackage{kvdefinekeys} \RequirePackage{kvsetkeys} \RequirePackage{kvoptions} @@ -179,6 +179,13 @@ }, default = xits, }, + output = { + choices = { + print, + electronic, + }, + default = print, + }, } \newif\ifthu@degree@graduate \newcommand\thu@set@graduate{% @@ -204,7 +211,7 @@ \else \PassOptionsToClass{openany}{book} \fi -\PassOptionsToPackage{quiet}{xeCJK} +\PassOptionsToPackage{quiet}{fontspec} \LoadClass[a4paper,UTF8,zihao=-4,scheme=plain,fontset=none]{ctexbook}[2017/04/01] \RequirePackage{etoolbox} \RequirePackage{xparse} @@ -251,28 +258,55 @@ marginparwidth = 2cm, marginparsep = 0.5cm } -\ifthu@degree@bachelor - \geometry{ - top = 3.8cm, - bottom = 3.2cm, - left = 3.2cm, - right = 3cm, - headheight = 0.5cm, - headsep = 1.8cm, - footskip = 1.45cm, - } -\else - \geometry{ - margin = 3cm, - headheight = 0.5cm, - headsep = 0.3cm, - footskip = 0.8cm, - } -\fi -\let\thu@cleardoublepage\cleardoublepage -\newcommand{\thu@clearemptydoublepage}{% - \clearpage{\pagestyle{thu@empty}\thu@cleardoublepage}} -\let\cleardoublepage\thu@clearemptydoublepage +\newcommand\thu@set@geometry{% + \ifthu@degree@bachelor + \geometry{ + top = 3.8cm, + bottom = 3.2cm, + left = 3.2cm, + right = 3cm, + headheight = 0.5cm, + headsep = 1.8cm, + footskip = 1.45cm, + }% + \ifthu@output@print + \geometry{ + left = 3.2cm, + right = 3cm, + }% + \else + \geometry{ + hmargin = 3cm, + }% + \fi + \else + \geometry{ + margin = 3cm, + headheight = 0.5cm, + headsep = 0.3cm, + footskip = 0.8cm, + }% + \fi +} +\thu@set@geometry +\thu@option@hook{degree}{\thu@set@geometry} +\thu@option@hook{output}{\thu@set@geometry} +\def\cleardoublepage{% + \clearpage + \if@twoside + \ifthu@output@print + \ifodd\c@page + \else + \thispagestyle{empty}% + \hbox{} + \newpage + \if@twocolumn + \hbox{}\newpage + \fi + \fi + \fi + \fi +} \renewcommand\frontmatter{% \cleardoublepage \ifthu@degree@bachelor @@ -1163,6 +1197,14 @@ name = end@date, default = {\the\year-\two@digits{\month}-\two@digits{\day}}, }, + include-spine = { + name = include@spine, + choices = { + false, + true, + }, + default = false, + }, } \newcommand\thu@format@date[2]{% \edef\thu@@date{#2}% @@ -1236,6 +1278,9 @@ \pagenumbering{Alph}% \thu@pdfbookmark{-1}{\thu@title}% \thu@titlepage + \ifthu@include@spine@true + \thu@spine + \fi \ifthu@degree@graduate \cleardoublepage \thu@titlepage@en @@ -1542,11 +1587,7 @@ \fi\par }\par \begingroup - \ifcsname lishu\endcsname - \lishu\yihao\ziju{0.5}清华大学% - \else - \includegraphics{tsinghua.pdf}% - \fi + \includegraphics{tsinghua-name-bachelor.pdf}% \par \endgroup \vskip 0.94cm% @@ -1661,7 +1702,8 @@ {\wuhao\thu@format@date{\thu@date@zh@digit@short}{\thu@date}\par}% \end{center}% } -\newcommand{\thu@authorization}{% +\newcommand{\thu@authorization@title}{关于学位论文使用授权的说明} +\newcommand{\thu@authorization@content}{% \ifthu@degree@bachelor 本人完全了解清华大学有关保留、使用学位论文的规定,即:学校有权保留学位 论文的复印件,允许该论文被查阅和借阅;学校可以公布该论文的全部或部分内 @@ -1678,15 +1720,16 @@ 本人保证遵守上述规定。 \fi} -\newcommand{\thu@authorizationaddon}{% +\newcommand{\thu@authorization@addon}{% \ifthu@degree@bachelor(涉密的学位论文在解密后应遵守此规定)\else (保密的论文在解密后应遵守此规定)\fi} -\newcommand{\thu@authorsig}{\ifthu@degree@bachelor 签\hskip1em名:\else 作者签名:\fi} -\newcommand{\thu@teachersig}{导师签名:} -\newcommand{\thu@frontdate}{% +\newcommand{\thu@authorization@authorsig}{\ifthu@degree@bachelor 签\hskip1em名:\else 作者签名:\fi} +\newcommand{\thu@authorization@teachersig}{导师签名:} +\newcommand{\thu@authorization@frontdate}{% 日\ifthu@degree@bachelor\hspace{1em}\else\hspace{2em}\fi 期:} \newcommand\copyrightpage[1][]{% \ifthu@degree@postdoc\relax\else \cleardoublepage + \thu@pdfbookmark{0}{\thu@authorization@title}% \def\thu@@tmp{#1} \ifx\thu@@tmp\@empty \ifthu@degree@bachelor\thu@authorization@mk\else% @@ -1706,21 +1749,21 @@ } \newcommand{\thu@authorization@mk}{% \ifthu@degree@bachelor\vspace*{0.2cm}\else\vspace*{0.42cm}\fi % shit code! - \begin{center}\erhao\heiti 关于学位论文使用授权的说明\end{center} + \begin{center}\erhao\heiti \thu@authorization@title\end{center} \ifthu@degree@bachelor\vskip5pt\else\vskip40pt\sihao[2.03]\fi\par - \thu@authorization\par - \textbf{\thu@authorizationaddon}\par + \thu@authorization@content\par + \textbf{\thu@authorization@addon}\par \ifthu@degree@bachelor\vskip0.7cm\else\vskip1.0cm\fi \ifthu@degree@bachelor - \indent\mbox{\thu@authorsig\thu@underline\relax% - \thu@teachersig\thu@underline\relax\thu@frontdate\thu@underline\relax} + \indent\mbox{\thu@authorization@authorsig\thu@underline\relax% + \thu@authorization@teachersig\thu@underline\relax\thu@authorization@frontdate\thu@underline\relax} \else \begingroup \parindent0pt\xiaosi - \hspace*{1.5cm}\thu@authorsig\thu@underline[7em]\relax\hfill% - \thu@teachersig\thu@underline[7em]\relax\hspace*{1cm}\\[3pt] - \hspace*{1.5cm}\thu@frontdate\thu@underline[7em]\relax\hfill% - \thu@frontdate\thu@underline[7em]\relax\hspace*{1cm} + \hspace*{1.5cm}\thu@authorization@authorsig\thu@underline[7em]\relax\hfill% + \thu@authorization@teachersig\thu@underline[7em]\relax\hspace*{1cm}\\[3pt] + \hspace*{1.5cm}\thu@authorization@frontdate\thu@underline[7em]\relax\hfill% + \thu@authorization@frontdate\thu@underline[7em]\relax\hspace*{1cm} \endgroup \fi} \thu@define@key{ @@ -2182,9 +2225,10 @@ \normalfont \topsep\z@\relax \trivlist \item[\hskip\labelsep - \itshape + % \itshape % #1\@addpunct{.}]\ignorespaces - \textsf{#1}\@addpunct{\thu@theorem@separator}]\ignorespaces + \sffamily + #1\@addpunct{\thu@theorem@separator}]\ignorespaces }{% \popQED\endtrivlist\@endpefalse } @@ -2258,11 +2302,93 @@ \thu@set@listing@language \thu@option@hook{language}{\thu@set@listing@language} } -\NewDocumentCommand{\spine}{O{\thu@title} O{\thu@author}}{% - \newpage\thispagestyle{empty}% - \fangsong\addCJKfontfeatures*{RawFeature={vertical:}} - \xiaosan\ziju{0.4}% - \noindent\hfill\rotatebox[origin=lt]{-90}{\makebox[\textheight]{#1\hfill#2}}} +\thu@define@key{ + spine-font = { + name = spine@font, + default = {\sanhao}, + }, + spine-title = { + name = spine@title, + }, + spine-author = { + name = spine@author, + }, +} +\newcommand*\CJKmovesymbol[1]{\raise.3em\hbox{#1}} +\newcommand*\CJKmove{% + \punctstyle{plain}% + \let\CJKsymbol\CJKmovesymbol + \let\CJKpunctsymbol\CJKsymbol +} +\NewDocumentCommand{\spine}{ + O{ + \ifx\thu@spine@title\@empty + \thu@title + \else + \thu@spine@title + \fi + } + O{ + \ifx\thu@spine@author\@empty + \thu@author + \else + \thu@spine@author + \fi + }}{% + \clearpage + \ifthu@degree@bachelor + \newgeometry{ + vmargin = 3cm, + hmargin = 1cm, + }% + \else + \newgeometry{ + vmargin = 5.5cm, + hmargin = 1cm, + }% + \fi + \thispagestyle{empty}% + \ifthu@language@chinese + \thu@pdfbookmark{0}{书脊}% + \else + \thu@pdfbookmark{0}{Spine}% + \fi + \begingroup + \noindent\hfill + \rotatebox[origin=lt]{-90}{% + \makebox[\textheight]{% + \fangsong + \addCJKfontfeatures*{RawFeature={vertical}}% + \thu@spine@font + \CJKmove + #1\hfill + \thu@stretch{4.5em}{#2}% + }% + }% + \endgroup + \clearpage + \restoregeometry +} +\newcommand\thu@input@spine{% + \IfFileExists{spine.pdf}{}{% + \immediate\write18{xelatex spine.tex}% + \IfFileExists{spine.pdf}{}{% + \thu@error{Cannot find file "spine.pdf". Compile "spine.tex" first, or enable shell escape}% + }% + }% + \includepdf[pages=1]{spine.pdf}% +} +\newcommand\thu@spine{% + \ifthu@cjk@font@fandol + \thu@input@spine + \else + \ifthu@cjk@font@noto + \thu@input@spine + \else + \spine + \fi + \fi +} \AtEndOfClass{\sloppy} \endinput %% -- cgit v1.2.3