hfbzthesis/thesis.cls

3145 lines
87 KiB
OpenEdge ABL
Raw Normal View History

2024-08-13 13:25:46 +08:00
%
% Copyright (C) 2015-2023 by USTC TeX Users Group <https://github.com/ustctug>
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
\NeedsTeXFormat{LaTeX2e}[2017/04/15]
\newcommand\ustcthesisversion{3.3.4}
\ProvidesClass{thesis}[2023/05/10 {\ustcthesisversion} USTC thesis template]
%
\newcommand\ustc@error[1]{%
\ClassError{thesis}{#1}{}%
}
\newcommand\ustc@warning[1]{%
\ClassWarning{thesis}{#1}%
}
% \LaTeXe{} kernel
\@ifl@t@r\fmtversion{2017/04/15}{}{
\ustc@error{%
TeX Live 2017 or later version is required to compile this document%
}
}
% 使 XeLaTeX LuaLaTeX
\RequirePackage{iftex}
\ifXeTeX\else
\ifLuaTeX\else
\ustc@error{XeLaTeX or LuaLaTeX is required to compile this document}
\fi
\fi
% \subsection{}
\RequirePackage{kvdefinekeys}
\RequirePackage{kvsetkeys}
\RequirePackage{kvoptions}
% \cs{ustcsetup} \emph{key-value}
\let\ustc@setup@hook\@empty
\newcommand\ustcsetup[1]{%
\let\ustc@setup@hook\@empty
\kvsetkeys{ustc}{#1}%
\ustc@setup@hook
}
% \emph{key-value}
% \begin{latex}
% \ustc@define@key{
% <key> = {
% name = <name>,
% choices = {
% <choice1>,
% <choice2>,
% },
% default = <default>,
% code = <code>,
% },
% }
% \end{latex}
% |choices| 使 \meta{default}
% \meta{code}
\newcommand\ustc@define@key[1]{%
\kvsetkeys{ustc@key}{#1}%
}
\kv@set@family@handler{ustc@key}{%
%
% \cs{ustcsetup} \meta{value} \cs{ustc@\meta{key}}
% - 便 |key = math-style|
% |name| \meta{key} |key = math@style|
% \cs{ustc@math@style}
% |default| \meta{key}
%
\@namedef{ustc@#1@@name}{#1}%
\def\ustc@@default{}%
\def\ustc@@choices{}%
\kv@define@key{ustc@value}{name}{%
\@namedef{ustc@#1@@name}{##1}%
}%
%
% \cs{ustc@\meta{key}@@code}
% / |key| |code|
% \cs{ustc@\meta{key}@@code} /
%
\@namedef{ustc@#1@@check}{}%
\@namedef{ustc@#1@@code}{}%
%
% |choices = {}| \cs{ustc@\meta{name}}
%
\kv@define@key{ustc@value}{choices}{%
\def\ustc@@choices{##1}%
\@namedef{ustc@#1@@reset}{}%
%
% \cs{ustc@\meta{key}@check} |value|
% \cs{ifustc@\meta{name}@\meta{value}}
%
\@namedef{ustc@#1@@check}{%
\@ifundefined{%
ifustc@\@nameuse{ustc@#1@@name}@\@nameuse{ustc@\@nameuse{ustc@#1@@name}}%
}{%
\ustc@error{Invalid value "#1 = \@nameuse{ustc@\@nameuse{ustc@#1@@name}}"}%
}%
\@nameuse{ustc@#1@@reset}%
\@nameuse{ustc@\@nameuse{ustc@#1@@name}@\@nameuse{ustc@\@nameuse{ustc@#1@@name}}true}%
}%
}%
\kv@define@key{ustc@value}{default}{%
\def\ustc@@default{##1}%
}%
\kvsetkeys{ustc@value}{#2}%
\@namedef{ustc@\@nameuse{ustc@#1@@name}}{}%
%
% \meta{choice} \meta{default}
% \meta{choice} \cs{ifustc@\meta{name}@\meta{choice}}
%
\kv@set@family@handler{ustc@choice}{%
\ifx\ustc@@default\@empty
\def\ustc@@default{##1}%
\fi
\expandafter\newif\csname ifustc@\@nameuse{ustc@#1@@name}@##1\endcsname
\expandafter\g@addto@macro\csname ustc@#1@@reset\endcsname{%
\@nameuse{ustc@\@nameuse{ustc@#1@@name}@##1false}%
}%
}%
\kvsetkeys@expandafter{ustc@choice}{\ustc@@choices}%
%
% \meta{default} \cs{ustc@\meta{name}}
%
\expandafter\let\csname ustc@\@nameuse{ustc@#1@@name}\endcsname\ustc@@default
\expandafter\ifx\csname ustc@\@nameuse{ustc@#1@@name}\endcsname\@empty\else
\@nameuse{ustc@#1@@check}%
\fi
%
% \cs{ustcsetup}
%
\kv@define@key{ustc}{#1}{%
\@namedef{ustc@\@nameuse{ustc@#1@@name}}{##1}%
\@nameuse{ustc@#1@@check}%
\@nameuse{ustc@#1@@code}%
}%
}
% |key| |code|
\newcommand\ustc@option@hook[2]{%
\expandafter\g@addto@macro\csname ustc@#1@@code\endcsname{#2}%
}
\ustc@define@key{
degree = {
choices = {
doctor,
master,
bachelor,
},
default = doctor,
},
degree-type = {
name = degree@type,
choices = {
academic,
professional,
},
default = academic,
},
main-language = {
name = main@language,
choices = {
chinese,
english,
},
default = chinese,
},
language = {
choices = {
chinese,
english,
},
default = chinese,
},
system = {
choices = {
auto,
mac,
unix,
windows,
},
default = auto,
},
fontset = {
choices = {
auto,
windows,
mac,
ubuntu,
fandol,
none,
},
default = auto,
},
font = {
choices = {
auto,
times,
termes,
stix,
xits,
libertinus,
newcm,
lm,
newtx,
none,
},
default = auto,
},
cjk-font = {
name = cjk@font,
choices = {
auto,
windows,
mac,
noto,
fandol,
none,
},
default = auto,
},
math-font = {
name = math@font,
choices = {
auto,
stix,
xits,
libertinus,
newcm,
cm,
lm,
newtx,
none,
},
default = auto,
},
math-style = {
name = math@style,
choices = {
GB,
ISO,
TeX,
},
},
uppercase-greek = {
name = uppercase@greek,
choices = {
italic,
upright,
},
},
less-than-or-equal = {
name = leq,
choices = {
slanted,
horizontal,
},
},
integral = {
choices = {
upright,
slanted,
},
},
integral-limits = {
name = integral@limits,
choices = {
true,
false,
},
},
partial = {
choices = {
upright,
italic,
},
},
math-ellipsis = {
name = math@ellipsis,
choices = {
centered,
lower,
AMS,
},
},
real-part = {
name = real@part,
choices = {
roman,
fraktur,
},
},
cite-style = {
name = cite@style,
choices = {
super,
inline,
authoryear,
},
},
output = {
choices = {
print,
electronic,
},
default = print,
},
section-style = {
name = section@style,
choices = {
chinese,
arabic,
},
default = chinese,
},
badge-color = {
name = badge@color,
choices = {
blue,
black,
},
default = blue,
},
reviewer = {
choices = {
true,
false,
},
default = false,
},
}
% \ustc@cite@style 便
\def\ustc@cite@style{}
\newif\ifustc@degree@graduate
\newcommand\ustc@set@graduate{%
\ifustc@degree@bachelor
\ustc@degree@graduatefalse
\else
\ustc@degree@graduatetrue
\fi
}
\ustc@set@graduate
\ustc@option@hook{degree}{%
\ustc@set@graduate
}
% 使 \pkg{kvoptions} key-value
\SetupKeyvalOptions{
family = ustc,
prefix = ustc@,
setkeys = \kvsetkeys,
}
% \option{openany}
\DeclareBoolOption[false]{openright}
\DeclareComplementaryOption{openany}{openright}
%
% Reserved for compatibility until 2020-07-01.
\DeclareVoidOption{doctor}{\ustcsetup{degree=doctor}}
\DeclareVoidOption{master}{\ustcsetup{degree=master}}
\DeclareVoidOption{bachelor}{\ustcsetup{degree=bachelor}}
\DeclareVoidOption{chinese}{\ustcsetup{language=chinese}}
\DeclareVoidOption{english}{\ustcsetup{language=english}}
\DeclareVoidOption{academic}{\ustcsetup{degree-type=academic}}
\DeclareVoidOption{professional}{\ustcsetup{degree-type=professional}}
\DeclareVoidOption{print}{\ustcsetup{output=print}}
\DeclareVoidOption{pdf}{\ustcsetup{output=electronic}}
\newif\ifustc@legacy@cite@style
\DeclareVoidOption{super}{\ustcsetup{cite-style=super}\ustc@legacy@cite@styletrue}
\DeclareVoidOption{numbers}{\ustcsetup{cite-style=inline}\ustc@legacy@cite@styletrue}
\DeclareVoidOption{authoryear}{\ustcsetup{cite-style=authoryear}\ustc@legacy@cite@styletrue}
\DeclareVoidOption{arabic}{\ustcsetup{section-style=arabic}}
\DeclareVoidOption{colorlogo}{\ustcsetup{badge-color=blue}}
\DeclareVoidOption{bwlogo}{\ustcsetup{badge-color=black}}
% \cls{ctexbook}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessKeyvalOptions*
% \subsection{}
\ifustc@openright
\PassOptionsToClass{openright}{book}
\else
\PassOptionsToClass{openany}{book}
\fi
\ifustc@output@electronic
\PassOptionsToClass{oneside}{book}
\fi
\PassOptionsToPackage{no-math}{fontspec}
% \cls{ctexbook} 2.4.9
\LoadClass[UTF8,a4paper,scheme=plain,zihao=-4,fontset=none]{ctexbook}[2017/04/01]
%
% \pkg{hyperref}
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
\RequirePackage{fontspec}[2017/03/31]
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
\RequirePackage{color}
\RequirePackage{titletoc}
\RequirePackage{caption}
\RequirePackage[perpage]{footmisc}
\RequirePackage{url}
\RequirePackage{notoccite}
\RequirePackage{multirow}
% \pkg{biblatex} \pkg{natbib}
\AtEndPreamble{
\@ifpackageloaded{biblatex}{}{
\RequirePackage{natbib}
}
}
%
\RequirePackage{filehook}
\newcommand\ustc@package@conflict[2]{
\AtEndOfPackageFile*{#1}{%
\AtBeginOfPackageFile*{#2}{%
\ustc@error{The "#2" package is incompatible with "#1"}%
}%
}%
}
\ustc@package@conflict{biblatex}{bibunits}
\ustc@package@conflict{biblatex}{chapterbib}
\ustc@package@conflict{biblatex}{cite}
\ustc@package@conflict{biblatex}{multibib}
\ustc@package@conflict{biblatex}{natbib}
\ustc@package@conflict{bibunits}{biblatex}
\ustc@package@conflict{bibunits}{chapterbib}
\ustc@package@conflict{bibunits}{multibib}
\ustc@package@conflict{unicode-math}{amscd}
\ustc@package@conflict{unicode-math}{amsfonts}
\ustc@package@conflict{unicode-math}{amssymb}
\ustc@package@conflict{unicode-math}{bbm}
\ustc@package@conflict{unicode-math}{bm}
\ustc@package@conflict{unicode-math}{eucal}
\ustc@package@conflict{unicode-math}{eufrak}
\ustc@package@conflict{unicode-math}{mathrsfs}
\ustc@package@conflict{unicode-math}{newtxmath}
\ustc@package@conflict{unicode-math}{upgreek}
\ustc@package@conflict{natbib}{biblatex}
\ustc@package@conflict{natbib}{cite}
\ustc@package@conflict{newtxmath}{amsfonts}
\ustc@package@conflict{newtxmath}{amssymb}
\ustc@package@conflict{newtxmath}{unicode-math}
\ustc@package@conflict{newtxmath}{upgreek}
% \pkg{amsthm} \pkg{newtx} \pkg{newtx}
\AtBeginOfPackageFile*{amsthm}{
\@ifpackageloaded{newtxmath}{
\ustc@error{The "amsthm" package should be loaded before setting "newtxmath"}
}{}
}%
% \subsection{}
% \cs{ustc@main@language} \option{language}
%
% \cs{ustc@reset@main@language}
% \begin{macrocode}
\ustcsetup{main-language=\ustc@language}%
\let\ustc@main@language\ustc@language
\ustc@option@hook{language}{%
\ifx\@begindocumenthook\@undefined\else
\ustcsetup{main-language=\ustc@language}%
\let\ustc@main@language\ustc@language
\fi
}
\newcommand\ustc@reset@main@language{%
\ustcsetup{language = \ustc@main@language}%
\let\ustc@language\ustc@main@language
}
% 使
\ifLuaTeX
% ctex U+2460U+24FF 3ALchar 6JAchar
\ltjdefcharrange{3}{%
"2000-"243F, "2500-"27BF, "2900-"29FF, "2B00-"2BFF}
\ltjdefcharrange{6}{%
"2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF,
"4E00-"9FFF, "F900-"FAFF, "FE10-"FE1F, "FE30-"FE6F, "FF00-"FFEF,
"1B000-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF}
\else
\ifXeTeX
\xeCJKDeclareCharClass{CJK}{"2460 -> "2473}
\xeCJKDeclareCharClass{CJK}{"2605}
\fi
\fi
% Unicode 西
% U+00B7U+2013U+2014U+2018U+2019
% U+201CU+201DU+2025U+2026U+2E3A
%
% https://github.com/CTeX-org/ctex-kit/issues/389
\newcommand\ustc@set@punctuations{%
\ifustc@language@chinese
\ifLuaTeX
\ltjsetparameter{jacharrange={+9}}
\else
\ifXeTeX
\xeCJKDeclareCharClass{FullLeft}{"2018, "201C}%
\xeCJKDeclareCharClass{FullRight}{
"00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
}%
\fi
\fi
\else
\ifLuaTeX
\ltjsetparameter{jacharrange={-9}}
\else
\ifXeTeX
\xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}%
\xeCJKDeclareCharClass{HalfRight}{
"00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A,
}%
\fi
\fi
\fi
}
\ustc@set@punctuations
\ustc@option@hook{language}{\ustc@set@punctuations}
% \option{language}
%
% speciality使
% acknowledgements
\newcommand\ustc@set@chapter@names{%
\ifustc@main@language@chinese
\def\contentsname{}%
\def\listfigurename{}%
\def\listtablename{}%
\ctexset{
chapter/name = {,},
}%
\def\bibname{}%
\def\appendixname{}%
\def\ustc@acknowledgements@name{}%
\def\ustc@publication@name{}%
\newcommand\ustc@notation@name{}%
\else
\def\contentsname{Contents}%
\def\listfigurename{List of Figures}%
\def\listtablename{List of Tables}%
\ctexset{
chapter/name = {\chaptername\space},
}%
\def\bibname{Bibliography}%
\def\appendixname{Appendix}%
\def\ustc@acknowledgements@name{Acknowledgements}%
\def\ustc@publication@name{Publications}%
\def\ustc@notation@name{Notation}%
\fi
}
\ustc@set@chapter@names
\ustc@option@hook{main-language}{\ustc@set@chapter@names}
%
\newcommand\ustc@set@names{%
\ifustc@language@chinese
\def\figurename{}%
\def\tablename{}%
\else
\def\figurename{Figure}%
\def\tablename{Table}%
\fi
}
\ustc@set@names
\ustc@option@hook{language}{\ustc@set@names}
% \subsection{}
%
% 12bp20bp22bp
% ~\ref{tab:fontsize}
% \begin{table}[htb]
% \centering
% \caption{}
% \label{tab:fontsize}
% \begin{tabular}{lllll}
% \toprule
% & 字号 & bp & 研究生行距 & 本科生行距 \\
% \midrule
% \cs{tiny} & 小六 & 6.5 & 10.83 & 11.92 \\
% \cs{scriptsize} & 六号 & 7.5 & 12.5 & 13.75 \\
% \cs{footnotesize} & 小五 & 9 & 15 & 16.5 \\
% \cs{small} & 五号 & 10.5 & 17.5 & 19.25 \\
% \cs{normalsize} & 小四 & 12 & 20 & 22 \\
% \cs{large} & 小三 & 15 & 25 & 27.5 \\
% \cs{Large} & 小二 & 18 & 30 & 33 \\
% \cs{LARGE} & 二号 & 22 & 36.67 & 40.33 \\
% \cs{huge} & 小一 & 24 & 40 & 44 \\
% \cs{Huge} & 一号 & 26 & 43.33 & 47.67 \\
% \bottomrule
% \end{tabular}
% \end{table}
%
% \normalsize \pkg{unicode-math} \cs{setmathfont}
\newcommand\ustc@set@font@size{%
\ifustc@degree@graduate
\renewcommand\normalsize{%
\@setfontsize\normalsize{12bp}{20bp}%
\abovedisplayskip 12bp \@plus3bp \@minus7bp%
\abovedisplayshortskip \z@ \@plus3bp%
\belowdisplayshortskip 6.5bp \@plus3.5bp \@minus3bp%
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}%
%
% ~\ref{sec:list} \cs{@listi}
\else
\renewcommand\normalsize{%
\@setfontsize\normalsize{12bp}{22bp}%
\abovedisplayskip 12bp \@plus3bp \@minus7bp%
\abovedisplayshortskip \z@ \@plus3bp%
\belowdisplayshortskip 6.5bp \@plus3.5bp \@minus3bp%
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}%
\fi
\normalsize
\ifx\MakeRobust\@undefined \else
\MakeRobust\normalsize
\fi
}
\ustc@set@font@size
\ustc@option@hook{degree}{\ustc@set@font@size}
% 1
\linespread{1}\selectfont
%
\ifustc@system@auto
\IfFileExists{/System/Library/Fonts/Menlo.ttc}{
\ustcsetup{system = mac}
}{
\IfFileExists{/dev/null}{
\IfFileExists{null:}{
\ustcsetup{system = windows}
}{
\ustcsetup{system = unix}
}
}{
\ustcsetup{system = windows}
}
}
\fi
% \opt{fontset}
\ifustc@fontset@auto
\ifustc@system@windows
\ustcsetup{fontset = windows}
\else
\ifustc@system@mac
\ustcsetup{fontset = mac}
\else
\IfFontExistsTF{Noto Serif CJK SC}{
\ustcsetup{fontset = ubuntu}
}{
\ustcsetup{fontset = fandol}
}
\fi
\fi
\fi
% 西使 Times New Roman Arial
% Linux 使 TeX Gyre Termes
% TeX Gyre Heros
\ifustc@font@auto
\ifustc@fontset@windows
\ustcsetup{font=times}
\else
\ifustc@fontset@mac
\ustcsetup{font=times}
\else
\ustcsetup{font=termes}
\fi
\fi
\fi
% Times New Roman + Arial
\newcommand\ustc@set@font@times{%
\setmainfont{Times New Roman}%
\setsansfont{Arial}%
\ifustc@system@mac
\setmonofont{Menlo}[Scale = MatchLowercase]%
\else
\setmonofont{Courier New}[Scale = MatchLowercase]%
\fi
}
% TeX Gyre Termes
\newcommand\ustc@set@font@termes{%
\setmainfont{texgyretermes}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]%
\ustc@set@texgyre@sans@mono
}
\newcommand\ustc@set@texgyre@sans@mono{%
\setsansfont{texgyreheros}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]%
\setmonofont{texgyrecursor}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
Scale = MatchLowercase,
Ligatures = CommonOff,
]%
}
% STIX Two
% STIX v2.10 2020-12-19
% \file{STIX2Text-Regular.otf}\file{STIX2Math.otf}
% \file{STIXTwoText-Regular.otf}\file{STIXTwoMath-Regular.otf}
\let\ustc@font@family@stix\@empty
\newcommand\ustc@set@stix@names{%
\ifx\ustc@font@family@stix\@empty
\IfFontExistsTF{STIXTwoText-Regular.otf}{%
\gdef\ustc@font@family@stix{STIXTwoText}%
\gdef\ustc@font@name@stix@math{STIXTwoMath-Regular}%
}{%
\gdef\ustc@font@family@stix{STIX2Text}%
\gdef\ustc@font@name@stix@math{STIX2Math}%
}%
\fi
}
\newcommand\ustc@set@font@stix{%
\ustc@set@stix@names
\setmainfont{\ustc@font@family@stix}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
]%
\ustc@set@texgyre@sans@mono
}
% XITS
% XITS v1.109 2018-09-30
% \file{xits-regular.otf}\file{xits-math.otf}
% \file{XITS-Regular.otf}\file{XITSMath-Regular.otf}
\let\ustc@font@family@xits\@empty
\newcommand\ustc@set@xits@names{%
\ifx\ustc@font@family@xits\@empty
\IfFontExistsTF{XITSMath-Regular.otf}{%
\gdef\ustc@font@family@xits{XITS}%
\gdef\ustc@font@style@xits@rm{Regular}%
\gdef\ustc@font@style@xits@bf{Bold}%
\gdef\ustc@font@style@xits@it{Italic}%
\gdef\ustc@font@style@xits@bfit{BoldItalic}%
\gdef\ustc@font@name@xits@math{XITSMath-Regular}%
}{%
\gdef\ustc@font@family@xits{xits}%
\gdef\ustc@font@style@xits@rm{regular}%
\gdef\ustc@font@style@xits@bf{bold}%
\gdef\ustc@font@style@xits@it{italic}%
\gdef\ustc@font@style@xits@bfit{bolditalic}%
\gdef\ustc@font@name@xits@math{xits-math}%
}%
\fi
}
\newcommand\ustc@set@font@xits{%
\ustc@set@xits@names
\setmainfont{\ustc@font@family@xits}[
Extension = .otf,
UprightFont = *-\ustc@font@style@xits@rm,
BoldFont = *-\ustc@font@style@xits@bf,
ItalicFont = *-\ustc@font@style@xits@it,
BoldItalicFont = *-\ustc@font@style@xits@bfit,
]%
\ustc@set@texgyre@sans@mono
}
% Libertinus v6.7 2019-04-03
%
\let\ustc@font@family@libertinus\@empty
\newcommand\ustc@set@libertinus@names{%
\ifx\ustc@font@family@libertinus\@empty
\IfFontExistsTF{LibertinusSerif-Regular.otf}{%
\gdef\ustc@font@family@libertinus@serif{LibertinusSerif}%
\gdef\ustc@font@family@libertinus@sans{LibertinusSans}%
\gdef\ustc@font@name@libertinus@math{LibertinusMath-Regular}%
\gdef\ustc@font@style@libertinus@rm{Regular}%
\gdef\ustc@font@style@libertinus@bf{Bold}%
\gdef\ustc@font@style@libertinus@it{Italic}%
\gdef\ustc@font@style@libertinus@bfit{BoldItalic}%
}{%
\gdef\ustc@font@family@libertinus@serif{libertinusserif}%
\gdef\ustc@font@family@libertinus@sans{libertinussans}%
\gdef\ustc@font@name@libertinus@math{libertinusmath-regular}%
\gdef\ustc@font@style@libertinus@rm{regular}%
\gdef\ustc@font@style@libertinus@bf{bold}%
\gdef\ustc@font@style@libertinus@it{italic}%
\gdef\ustc@font@style@libertinus@bfit{bolditalic}%
}%
\fi
}
\newcommand\ustc@set@font@libertinus{%
\ustc@set@libertinus@names
\setmainfont{\ustc@font@family@libertinus@serif}[
Extension = .otf,
UprightFont = *-\ustc@font@style@libertinus@rm,
BoldFont = *-\ustc@font@style@libertinus@bf,
ItalicFont = *-\ustc@font@style@libertinus@it,
BoldItalicFont = *-\ustc@font@style@libertinus@bfit,
]%
\setsansfont{\ustc@font@family@libertinus@sans}[
Extension = .otf,
UprightFont = *-\ustc@font@style@libertinus@rm,
BoldFont = *-\ustc@font@style@libertinus@bf,
ItalicFont = *-\ustc@font@style@libertinus@it,
]%
\setmonofont{lmmonolt10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-oblique,
BoldItalicFont = *-boldoblique,
]%
}
% New Computer Modern
\newcommand\ustc@set@font@newcm{%
\setmainfont{NewCM10}[
Extension = .otf,
UprightFont = *-Book,
BoldFont = *-Bold,
ItalicFont = *-BookItalic,
BoldItalicFont = *-BoldItalic,
]%
\setsansfont{NewCMSans10}[
Extension = .otf,
UprightFont = *-Book,
BoldFont = *-Bold,
ItalicFont = *-BookOblique,
BoldItalicFont = *-BoldOblique,
]%
\setmonofont{NewCMMono10}[
Extension = .otf,
UprightFont = *-Book,
ItalicFont = *-BookItalic,
BoldFont = *-Bold,
BoldItalicFont = *-BoldOblique,
]%
}
% Latin Modern
\newcommand\ustc@set@font@lm{%
\setmainfont{lmroman10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]%
\setsansfont{lmsans10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-oblique,
BoldItalicFont = *-boldoblique,
]%
\setmonofont{lmmonolt10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-oblique,
BoldItalicFont = *-boldoblique,
]%
}
\newcommand\ustc@set@font@newtx{%
\RequirePackage{newtxtext}%
}
\newcommand\ustc@set@font{%
\@nameuse{ustc@set@font@\ustc@font}%
}
\ustc@set@font
\ustc@option@hook{font}{\ustc@set@font}
%
\ifustc@cjk@font@auto
\ifustc@fontset@mac
\ustcsetup{cjk-font = mac}
\else
\ifustc@fontset@windows
\ustcsetup{cjk-font = windows}
\else
\ifustc@fontset@ubuntu
\ustcsetup{cjk-font = noto}
\else
\ustcsetup{cjk-font = fandol}
\fi
\fi
\fi
\fi
% Windows
\newcommand\ustc@set@cjk@font@windows{%
\setCJKmainfont{SimSun}[
AutoFakeBold = 3,
ItalicFont = KaiTi,
]%
\setCJKsansfont{SimHei}[AutoFakeBold = 3]%
\setCJKmonofont{FangSong}%
\setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold = 3]%
\setCJKfamilyfont{zhhei}{SimHei}[AutoFakeBold = 3]%
\setCJKfamilyfont{zhkai}{KaiTi}%
\setCJKfamilyfont{zhfs}{FangSong}%
}
% macOS
\newcommand\ustc@set@cjk@font@mac{%
\defaultCJKfontfeatures{}%
\setCJKmainfont{Songti SC}[
UprightFont = * Light,
BoldFont = * Bold,
ItalicFont = Kaiti SC Regular,
BoldItalicFont = Kaiti SC Bold,
]%
\setCJKsansfont{Heiti SC}[
UprightFont = * Light,
BoldFont = * Medium,
]%
\setCJKmonofont{STFangsong}
\setCJKfamilyfont{zhsong}{Songti SC}[
UprightFont = * Light,
BoldFont = * Bold,
]%
\setCJKfamilyfont{zhhei}{Heiti SC}[
UprightFont = * Light,
BoldFont = * Medium,
]%
\setCJKfamilyfont{zhfs}{STFangsong}%
\setCJKfamilyfont{zhkai}{Kaiti SC}[
UprightFont = * Regular,
BoldFont = * Bold,
]%
\setCJKfamilyfont{zhli}{Baoli SC}%
\setCJKfamilyfont{zhyuan}{Yuanyi SC}[
UprightFont = * Light,
BoldFont = * Bold,
]%
}
%
% Noto CJK regular Regular
\newcommand\ustc@set@cjk@font@noto{%
\defaultCJKfontfeatures{}%
\setCJKmainfont{Noto Serif CJK SC}[
UprightFont = * Light,
BoldFont = * Bold,
ItalicFont = FandolKai-Regular,
ItalicFeatures = {Extension = .otf},
Script = CJK,
]%
\setCJKsansfont{Noto Sans CJK SC}[
BoldFont = * Medium,
Script = CJK,
]%
\setCJKmonofont{Noto Sans Mono CJK SC}[
Script = CJK,
]%
\setCJKfamilyfont{zhsong}{Noto Serif CJK SC}[
UprightFont = * Light,
UprightFont = * Bold,
Script = CJK,
]%
\setCJKfamilyfont{zhhei}{Noto Sans CJK SC}[
BoldFont = * Medium,
Script = CJK,
]%
\setCJKfamilyfont{zhfs}{FandolFang}[
Extension = .otf,
UprightFont = *-Regular,
]%
\setCJKfamilyfont{zhkai}{FandolKai}[
Extension = .otf,
UprightFont = *-Regular,
]%
}
% Fandol
\newcommand\ustc@set@cjk@font@fandol{%
\defaultCJKfontfeatures{}%
\setCJKmainfont{FandolSong}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = FandolKai-Regular,
ItalicFeatures = {Extension = .otf},
]%
\setCJKsansfont{FandolHei}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
]%
\setCJKmonofont{FandolFang}[
Extension = .otf,
UprightFont = *-Regular,
]%
\setCJKfamilyfont{zhsong}{FandolSong}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
]%
\setCJKfamilyfont{zhhei}{FandolHei}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
]%
\setCJKfamilyfont{zhfs}{FandolFang}[
Extension = .otf,
UprightFont = *-Regular,
]%
\setCJKfamilyfont{zhkai}{FandolKai}[
Extension = .otf,
UprightFont = *-Regular,
]%
}
\ifustc@cjk@font@none\else
\providecommand\songti{\CJKfamily{zhsong}}
\providecommand\heiti{\CJKfamily{zhhei}}
\providecommand\fangsong{\CJKfamily{zhfs}}
\providecommand\kaishu{\CJKfamily{zhkai}}
\fi
\newcommand\ustc@set@cjk@font{%
\@nameuse{ustc@set@cjk@font@\ustc@cjk@font}%
}
\ustc@set@cjk@font
\ustc@option@hook{cjk-font}{\ustc@set@cjk@font}
%
%
\newcommand\ustc@set@math@style{%
\ifustc@math@style@TeX
\ustcsetup{
uppercase-greek = upright,
less-than-or-equal = horizontal,
integral = slanted,
integral-limits = false,
partial = italic,
math-ellipsis = AMS,
real-part = fraktur,
}%
\else
\ustcsetup{
uppercase-greek = italic,
integral = upright,
partial = upright,
real-part = roman,
}%
\ifustc@math@style@ISO
\ustcsetup{
less-than-or-equal = horizontal,
integral-limits = true,
math-ellipsis = lower,
}%
\else
\ifustc@math@style@GB
\ustcsetup{
less-than-or-equal = slanted,
integral-limits = false,
math-ellipsis = centered,
}%
\fi
\fi
\fi
}
\ifustc@main@language@chinese
\ustcsetup{math-style = GB}%
\else
\ustcsetup{math-style = TeX}%
\fi
\ustc@set@math@style
\ustc@option@hook{math-style}{\ustc@set@math@style}
\ustc@option@hook{main-language}{%
\ifustc@main@language@chinese
\ustcsetup{math-style = GB}%
\else
\ustcsetup{math-style = TeX}%
\fi
}
% \pkg{unicode-math}
\newcommand\ustc@set@unimath@leq{%
\ifustc@leq@horizontal
\ifx\@begindocumenthook\@undefined
\let\le\ustc@save@leq
\let\ge\ustc@save@geq
\let\leq\ustc@save@leq
\let\geq\ustc@save@geq
\else
\AtBeginDocument{%
\let\le\ustc@save@leq
\let\ge\ustc@save@geq
\let\leq\ustc@save@leq
\let\geq\ustc@save@geq
}%
\fi
\else
\ifustc@leq@slanted
\ifx\@begindocumenthook\@undefined
\let\le\leqslant
\let\ge\geqslant
\let\leq\leqslant
\let\geq\geqslant
\else
\AtBeginDocument{%
\let\le\leqslant
\let\ge\geqslant
\let\leq\leqslant
\let\geq\geqslant
}%
\fi
\fi
\fi
}
\newcommand\ustc@set@unimath@integral@limits{%
\ifustc@integral@limits@true
\removenolimits{%
\int\iint\iiint\iiiint\oint\oiint\oiiint
\intclockwise\varointclockwise\ointctrclockwise\sumint
\intbar\intBar\fint\cirfnint\awint\rppolint
\scpolint\npolint\pointint\sqint\intlarhk\intx
\intcap\intcup\upint\lowint
}%
\else
\addnolimits{%
\int\iint\iiint\iiiint\oint\oiint\oiiint
\intclockwise\varointclockwise\ointctrclockwise\sumint
\intbar\intBar\fint\cirfnint\awint\rppolint
\scpolint\npolint\pointint\sqint\intlarhk\intx
\intcap\intcup\upint\lowint
}%
\fi
}
\newcommand\ustc@set@unimath@ellipsis{%
\ifustc@math@ellipsis@centered
\DeclareRobustCommand\mathellipsis{\mathinner{\unicodecdots}}%
\else
\DeclareRobustCommand\mathellipsis{\mathinner{\unicodeellipsis}}%
\fi
}
\newcommand\ustc@set@unimath@real@part{%
\ifustc@real@part@roman
\AtBeginDocument{%
\def\Re{\operatorname{Re}}%
\def\Im{\operatorname{Im}}%
}%
\else
\AtBeginDocument{%
\let\Re\ustc@save@Re
\let\Im\ustc@save@Im
}%
\fi
}
\newcommand\ustc@set@unimath@style{%
\ifustc@uppercase@greek@upright
\unimathsetup{math-style = TeX}%
\else
\ifustc@uppercase@greek@italic
\unimathsetup{math-style = ISO}%
\fi
\fi
\ifustc@math@style@TeX
\unimathsetup{bold-style = TeX}%
\else
\unimathsetup{bold-style = ISO}%
\fi
\ustc@set@unimath@leq
\ustc@set@unimath@integral@limits
\ifustc@partial@upright
\unimathsetup{partial = upright}%
\else
\ifustc@partial@italic
\unimathsetup{partial = italic}%
\fi
\fi
\ustc@set@unimath@ellipsis
\ustc@set@unimath@real@part
}
\newcommand\ustc@qed{\rule{1ex}{1ex}}
\newcommand\ustc@load@unimath{%
\@ifpackageloaded{unicode-math}{}{%
\RequirePackage{unicode-math}%
\AtBeginDocument{%
\let\ustc@save@leq\leq
\let\ustc@save@geq\geq
\let\ustc@save@Re\Re
\let\ustc@save@Im\Im
}%
%
% \pkg{bm} \cs{bm} \pkg{amsmath} \cs{boldsymbol}
\DeclareRobustCommand\bm[1]{{\symbfit{##1}}}%
\DeclareRobustCommand\boldsymbol[1]{{\symbfit{##1}}}%
%
% \pkg{amsfonts} \pkg{amssymb}
\newcommand\square{\mdlgwhtsquare}%
\newcommand\blacksquare{\mdlgblksquare}%
\AtBeginDocument{%
\renewcommand\checkmark{\ensuremath{}}%
}%
%
% \pkg{amsthm} \cs{qedsymbol}
\renewcommand\ustc@qed{\ensuremath{\QED}}%
}%
}
% STIX Two Math
\newcommand\ustc@set@math@font@stix{%
\ustc@load@unimath
\ustc@set@unimath@style
\ustc@set@stix@names
\setmathfont{\ustc@font@name@stix@math}[
Extension = .otf,
Scale = MatchLowercase,
StylisticSet = \ustc@xits@integral@stylistic@set,
]%
\setmathfont{\ustc@font@name@stix@math}[
Extension = .otf,
Scale = MatchLowercase,
StylisticSet = 1,
range = {scr,bfscr},
]%
}
% XITS Math
\newcommand\ustc@xits@integral@stylistic@set{%
\ifustc@integral@upright
8%
\fi
}
\newcommand\ustc@set@math@font@xits{%
\ustc@load@unimath
\ustc@set@unimath@style
\ustc@set@xits@names
\setmathfont{\ustc@font@name@xits@math}[
Extension = .otf,
StylisticSet = \ustc@xits@integral@stylistic@set,
]%
\setmathfont{\ustc@font@name@xits@math}[
Extension = .otf,
StylisticSet = 1,
range = {cal,bfcal},
]%
}
% Libertinus Math
\newcommand\ustc@libertinus@integral@stylistic@set{%
\ifustc@integral@slanted
8%
\fi
}
\newcommand\ustc@set@math@font@libertinus{%
\ustc@load@unimath
\ustc@set@unimath@style
\ustc@set@libertinus@names
\ustc@set@xits@names
\setmathfont{\ustc@font@name@libertinus@math}[
Extension = .otf,
StylisticSet = \ustc@libertinus@integral@stylistic@set,
]%
\setmathfont{\ustc@font@name@xits@math}[
Extension = .otf,
range = {\checkmark},
]%
}
% New Computer Modern Math
\newcommand\ustc@newcm@integral@stylistic@set{%
\ifustc@integral@upright
2%
\fi
}
\newcommand\ustc@set@math@font@newcm{%
\ustc@load@unimath
\ustc@set@unimath@style
\setmathfont{NewCMMath-Book}[
Extension = .otf,
StylisticSet = \ustc@newcm@integral@stylistic@set,
]%
\setmathfont{NewCMMath-Book}[
Extension = .otf,
StylisticSet = 1,
range = {scr,bfscr},
]%
\setmathrm{NewCM10}[
Extension = .otf,
UprightFont = *-Book,
BoldFont = *-Bold,
ItalicFont = *-BookItalic,
BoldItalicFont = *-BoldItalic,
]%
\setmathsf{NewCMSans10}[
Extension = .otf,
UprightFont = *-Book,
BoldFont = *-Bold,
ItalicFont = *-BookOblique,
BoldItalicFont = *-BoldOblique,
]%
\setmathtt{NewCMMono10}[
Extension = .otf,
UprightFont = *-Book,
ItalicFont = *-BookItalic,
BoldFont = *-Bold,
BoldItalicFont = *-BoldOblique,
]%
}
% Latin Modern Math
\newcommand\ustc@set@math@font@lm{%
\ustc@load@unimath
\ustc@set@unimath@style
\setmathfont{latinmodern-math}[Extension=.otf]%
\setmathrm{lmroman10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-italic,
BoldItalicFont = *-bolditalic,
]%
\setmathsf{lmsans10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-oblique,
BoldItalicFont = *-boldoblique,
]%
\setmathtt{lmmonolt10}[
Extension = .otf,
UprightFont = *-regular,
BoldFont = *-bold,
ItalicFont = *-oblique,
BoldItalicFont = *-boldoblique,
]%
}
% NewTX Math
% NewTX Math Type 1 西使 OpenType
\newcommand\ustc@set@math@font@newtx{%
\ifustc@font@newtx\else
\let\ustc@save@encodingdefault\encodingdefault
\let\ustc@save@rmdefault\rmdefault
\let\ustc@save@sfdefault\sfdefault
\let\ustc@save@ttdefault\ttdefault
\RequirePackage[T1]{fontenc}%
\renewcommand{\rmdefault}{ntxtlf}%
\renewcommand{\sfdefault}{qhv}%
\renewcommand{\ttdefault}{ntxtt}%
\fi
\ifustc@uppercase@greek@italic
\PassOptionsToPackage{slantedGreek}{newtxmath}%
\fi
\ifustc@integral@upright
\PassOptionsToPackage{upint}{newtxmath}%
\fi
\RequirePackage{newtxmath}
\let\ustc@save@leq\leq
\let\ustc@save@geq\geq
\ifustc@leq@slanted
\let\le\leqslant
\let\ge\geqslant
\let\leq\leqslant
\let\geq\geqslant
\fi
\ifustc@integral@limits@true
\let\ilimits@\displaylimits
\fi
\let\ustc@save@partial\partial
\ifustc@partial@upright
\let\partial\uppartial
\fi
\ifustc@math@ellipsis@centered
\DeclareRobustCommand\mathellipsis{\mathinner{\cdotp\cdotp\cdotp}}%
\else
\DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}%
\fi
\let\ustc@save@Re\Re
\let\ustc@save@Im\Im
\ifustc@real@part@roman
\def\Re{\operatorname{Re}}%
\def\Im{\operatorname{Im}}%
\fi
\RequirePackage{bm}%
\ifustc@font@newtx\else
\let\encodingdefault\ustc@save@encodingdefault
\let\rmdefault\ustc@save@rmdefault
\let\sfdefault\ustc@save@sfdefault
\let\ttdefault\ustc@save@ttdefault
\fi
\DeclareRobustCommand\symup[1]{{\mathrm{##1}}}%
\DeclareRobustCommand\symbf[1]{{\bm{##1}}}%
\DeclareRobustCommand\symbfsf[1]{{\bm{##1}}}%
\let\increment\upDelta%
\renewcommand\ustc@qed{\openbox}%
}
% Computer Modern
% 使 LaTeX cm
\newcommand\ustc@set@math@font@cm{%
\RequirePackage{amssymb}
\let\ustc@save@leq\leq
\let\ustc@save@geq\geq
\ifustc@leq@slanted
\let\le\leqslant
\let\ge\geqslant
\let\leq\leqslant
\let\geq\geqslant
\fi
\ifustc@integral@limits@true
\let\ilimits@\displaylimits
\fi
\ifustc@math@ellipsis@centered
\DeclareRobustCommand\mathellipsis{\mathinner{\cdotp\cdotp\cdotp}}%
\else
\DeclareRobustCommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}%
\fi
\let\ustc@save@Re\Re
\let\ustc@save@Im\Im
\ifustc@real@part@roman
\def\Re{\operatorname{Re}}%
\def\Im{\operatorname{Im}}%
\fi
\RequirePackage{bm}%
\DeclareRobustCommand\symup[1]{{\mathrm{##1}}}%
\DeclareRobustCommand\symbf[1]{{\bm{##1}}}%
\DeclareRobustCommand\symbfsf[1]{{\bm{##1}}}%
\let\increment\Delta
\renewcommand\ustc@qed{\openbox}%
\let\uppi\pi
}
%
\newcommand\ustc@set@math@font@none{%
\RequirePackage{amssymb}
\RequirePackage{bm}%
\DeclareRobustCommand\symup[1]{{\mathrm{##1}}}%
\DeclareRobustCommand\symbf[1]{{\bm{##1}}}%
\DeclareRobustCommand\symbfsf[1]{{\bm{##1}}}%
\let\increment\Delta
\renewcommand\ustc@qed{\openbox}%
\let\uppi\pi
}
\newcommand\ustc@set@math@font{%
\@nameuse{ustc@set@math@font@\ustc@math@font}%
}
\ustc@option@hook{math-font}{\g@addto@macro\ustc@setup@hook{\ustc@set@math@font}}
\newcommand\ustc@set@math@font@auto{%
\ifustc@math@font@auto
\ustcsetup{math-font=xits}%
\fi
}
\AtBeginOfPackageFile*{siunitx}{\ustc@set@math@font@auto}
\AtEndPreamble{%
\ustc@set@math@font@auto
\ifx\square\@undefined
\RequirePackage{amssymb}%
\fi
}
% \subsection{}
% 使 \pkg{geometry}
% A4
% 2.54 cm 3.17 cm 1.5 cm 1.75 cm
% 1.5 cm
% 2.54cm - 0.8cm - 0.24cm = 1.5cm
\geometry{
paper = a4paper,
vmargin = 2.54cm,
hmargin = 3.17cm,
headheight = 0.75cm,
headsep = 0.29cm,
footskip = 0.79cm,
}
% 使 \pkg{fancy} |\pagestyle{fancy}| \cs{chaptermark}
% \cs{sectionmark}
\pagestyle{fancy}
\let\sectionmark\@gobble
\renewcommand\headrulewidth{0.4\p@}
% |plain| page style
\fancypagestyle{plain}{%
\fancyhf{}%
%
% 10.5
% 10.5
\ifustc@degree@graduate
\def\ustc@hf@font{\fontsize{10.5bp}{12bp}\selectfont}
\fancyhead[C]{\ustc@hf@font\leftmark}%
\fancyfoot[C]{\ustc@hf@font\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{\CTEXifname{\CTEXthechapter\quad}{}\ustc@spacetitle{##1}}{}%
}%
\let\sectionmark\@gobble
\else
%
%
% 5 9 bp
% 9 bp
\def\ustc@hf@font{\fontsize{9bp}{12bp}\selectfont}
\fancyhead[C]{\ustc@hf@font }%
\fancyfoot[C]{\ustc@hf@font\thepage}%
\let\@mkboth\@gobbletwo
\let\chaptermark\@gobble
\let\sectionmark\@gobble
\fi
}
\pagestyle{plain}
% |headings| front matter
\fancypagestyle{headings}{\fancyfoot{}}
% page style
\def\ps@chapter{}
\ctexset{chapter/pagestyle=chapter}
%
\def\cleardoublepage{%
\clearpage
\if@twoside
\ifodd\c@page\else
\hbox{}%
\thispagestyle{empty}%
\newpage
\if@twocolumn
\hbox{}%
\newpage
\fi
\fi
\fi
}
%
%
% frontmatter
\renewcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
\pagenumbering{Roman}%
\ifustc@degree@graduate
\pagestyle{plain}%
\else
\pagestyle{headings}%
\fi
}
% 1
\renewcommand\mainmatter{%
\ifustc@degree@graduate
\cleardoublepage
\pagenumbering{arabic}%
\else
\clearpage
\fi
\pagestyle{plain}%
\@mainmattertrue
}
\g@addto@macro\appendix{\@mainmattertrue}%
% \subsection{}
%
\ustc@define@key{
title = {
default = {},
},
class = {
default = {},
},
author = {
default = {},
},
speciality = {
default = {},
},
speciality* = {
default = {Speciality},
name = speciality@en,
},
supervisor = {
default = {},
},
advisor = {
default = {},
},
advisor* = {
default = {},
name = advisor@en,
},
date = {
default = {\the\year-\two@digits{\month}-\two@digits{\day}},
},
professional-type = {
name = professional@type,
},
professional-type* = {
name = professional@type@en,
},
department,
student-id = {
name = student@id,
},
secret-level = {
name = secret@level,
},
secret-level* = {
name = secret@level@en,
},
secret-year = {
name = secret@year,
},
keywords,
keywords* = {
name = keywords@en,
},
}
% \cs{ustc@format@date}\marg{format}\marg{date}
% \meta{format}
% \meta{date} ISO yyyy-mm-dd
\newcommand\ustc@format@date[2]{%
\edef\ustc@@date{#2}%
\def\ustc@@process@date##1-##2-##3\@nil{%
#1{##1}{##2}{##3}%
}%
\expandafter\ustc@@process@date\ustc@@date\@nil
}
\newcommand\ustc@date@format@zh@small[3]{\number#1 \number#2 \number#3 }
\newcommand\ustc@date@format@zh@big[3]{\zhdigits{#1}\zhnumber{#2}\zhnumber{#3}}
\newcommand\ustc@date@month[1]{%
\ifcase\number#1\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December%
\fi
}
\newcommand\ustc@date@format@zh@short[3]{\number#1 \number#2 }
\newcommand\ustc@date@format@en[3]{\ustc@date@month{#2} \number#3, #1}
\newcommand\ustc@date@zh@small{\ustc@format@date{\ustc@date@format@zh@small}{\ustc@date}}
\newcommand\ustc@date@zh@big{\ustc@format@date{\ustc@date@format@zh@big}{\ustc@date}}
\newcommand\ustc@date@zh@short{\ustc@format@date{\ustc@date@format@zh@short}{\ustc@date}}
\newcommand\ustc@date@en{\ustc@format@date{\ustc@date@format@en}{\ustc@date}}
% v3.2 使 \cs{ustcsetup}
%
% Reserved for compatibility until 2020-07-01.
\def\ustc@define@term#1#2{%
\expandafter\gdef\csname #1\endcsname##1{%
\ustcsetup{#2 = {##1}}%
}%
}
\ustc@define@term{title}{title}
\ustc@define@term{entitle}{title*}
\ustc@define@term{author}{author}
\ustc@define@term{enauthor}{author*}
\ustc@define@term{supervisor}{supervisor}
\gdef\date#1{\renewcommand\ustc@date@zh@big{#1}}
\gdef\endate#1{\renewcommand\ustc@date@en{#1}}
\ustc@define@term{professionaltype}{professional-type}
\ustc@define@term{enprofessionaltype}{professional-type*}
\ustc@define@term{secretlevel}{secret-level}
\ustc@define@term{ensecretlevel}{secret-level*}
\ustc@define@term{secretyear}{secret-year}
\gdef\keywords#1{\renewcommand\ustc@keywords@text{#1}}
\gdef\enkeywords#1{\renewcommand\ustc@keywords@en@text{#1}}
%
\ifustc@degree@doctor
\newcommand\ustc@thesis@name{}
\newcommand\ustc@thesis@name@en{A dissertation for doctor's degree}
\else
\ifustc@degree@master
\newcommand\ustc@thesis@name{}
\newcommand\ustc@thesis@name@en{A dissertation for master's degree}
\else
\newcommand\ustc@thesis@name{}
\newcommand\ustc@thesis@name@en{A dissertation for bachelor's degree}
\fi
\fi
\ifustc@degree@type@academic
\newcommand\ustc@speciality@name{}
\else
\ifustc@degree@doctor
\renewcommand\ustc@thesis@name{}
\else
\renewcommand\ustc@thesis@name{}
\fi
\ifustc@cjk@font@mac
\providecommand\lishu{\CJKfamily{zhli}}
\else
\ifustc@cjk@font@windows
\setCJKfamilyfont{zhli}{LiSu}
\providecommand\lishu{\CJKfamily{zhli}}
\else
\ustc@warning{LiShu font is required}
\providecommand\lishu{\sffamily}
\fi
\fi
\newcommand\ustc@speciality@name{}
\fi
%
%
% \pkg{xcolor}
\AtBeginDocument{
\definecolor{ustcblue}{cmyk}{1,0.8,0,0}
}
% PDF \pkg{hyperref}
\newcommand\ustc@pdfbookmark{\@gobble}
% \env{titlepage}
\renewenvironment{titlepage}{%
\cleardoublepage
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse\newpage
\fi
\thispagestyle{empty}%
}{%
\if@restonecol\twocolumn \else \newpage \fi
}
%
% 仿 14
% 56
% 26
% 16
%
% 使
\newcommand\ustc@speciality@sse{}
\newcommand\ustc@title@page@graduate@zh{%
\ustcsetup{language=chinese}%
\begin{titlepage}%
\ustc@pdfbookmark{}%
\centering
\parbox[t][0.6cm][t]{\textwidth}{%
\raggedleft\fangsong\fontsize{14bp}{14bp}\selectfont
\null\ustc@secret@level\par}\par
\vskip 0.5cm%
\includegraphics[height=1.3cm]{figures/logo-left.png}\par
\vskip 0.6cm%
{\sffamily\fontsize{56bp}{56bp}\selectfont
\ustc@thesis@name\par}%
\ifustc@degree@type@academic
\vskip 2.0cm%
\else
\vskip 0.8cm%
\begingroup
\fontsize{26bp}{26bp}\selectfont
\ifx\ustc@professional@type\@empty
\null
\else
\lishu \ustc@professional@type %
\fi
\par
\endgroup
\vskip 1.0cm%
\fi
\ifustc@badge@color@blue
\textcolor{ustcblue}{%
\includegraphics[height=4.1cm]{figures/hfbz-icon.pdf}}%
\else
\includegraphics[height=4.1cm]{figures/hfbz-icon.pdf}%
\fi\par
\vskip 0.9cm%
\parbox[t][3.5cm][c]{\textwidth}{%
\centering\sffamily\bfseries\fontsize{26bp}{50bp}\selectfont
\ustc@title\par}\par
\vskip 0.6cm%
{\fontsize{16bp}{31bp}\selectfont
\begin{tabular}{@{}l@{\hspace{\ccwd}}l@{}}%
\textsf{} & \ustc@class \\
\textsf{} & \ustc@author \\
\textsf{} & \ustc@supervisor \\
\textsf{} & \ustc@date@zh@big
\end{tabular}\par}%
\end{titlepage}%
\ustc@reset@main@language
}
\newbox\ustc@title@box
\newlength\ustc@title@page@item@width
% \cs{maketitle} \cs{ustc@makezhtitle}, \cs{ustc@makeentitle}
%
\renewcommand\maketitle{
\newgeometry{margin=2.54cm}
\pagenumbering{Alph}
\pagestyle{empty}
\ustc@title@page@graduate@zh
% \cleardoublepage
\restoregeometry
\pagestyle{plain}
}
\newcommand\ustc@underline[2][3.2cm]{\underline{\hb@xt@ #1{\hss#2\hss}}}
\newcommand\ustc@checkbox{%
\makebox[\z@][l]{$\square$}%
\raisebox{-0.2ex}{\hspace{0.1em}$\checkmark$}%
}
\ifustc@degree@bachelor
\let\copyrightpage\relax
\fi
% Reserved for compatibility until 2020-07-01.
\let\makestatement\copyrightpage
% \subsection{}
% 使
\setcounter{secnumdepth}{5}
%
% \LaTeX3 \cs{str\_count:N}
% \pkg{stringstrings} \verb+\|+
\newcount\ustc@titlelength
\DeclareRobustCommand\ustc@spacetitle[1]{%
\ustc@titlelength=\csname str_count:N\endcsname{#1}%
\begingroup
\ifustc@degree@graduate
\ifcase\ustc@titlelength
\or\or
\ziju{2}%
\or
\ziju{1}%
\or
\ziju{0.5}%
\fi
\else
\if@mainmatter\else
\ifcase\ustc@titlelength
\or\or
\ziju{1}%
\or\or
\ziju{0.5}%
\fi
\fi
\fi
#1%
\endgroup
}
% 使使 \cs{ustc@circlefont}
\newcommand\ustc@textcircled[1]{%
\ifnum\value{#1}<21\relax
{\symbol{\numexpr\value{#1} + "245F\relax}}%
\else
\ustc@error{Cannot display more than 20 footnotes}%
\fi
}
% \pkg{ctex}
% 16 24 18
%
% Word 使 TeX
%
% \pkg{ctex} v2.4.3 bug
% \pkg{ctex} v2.2 beforeskip
\ctexset{
chapter = {
format = \centering\sffamily\bfseries\fontsize{16bp}{26.67bp}\selectfont,
nameformat = {},
titleformat = \ustc@spacetitle,
number = \thechapter,
aftername = \hspace{\ccwd},
beforeskip = 24bp,
afterskip = 18bp,
fixskip = true,
},
}
% 14 24 6
%
\ctexset{
section = {
format = \sffamily\fontsize{14bp}{23.33bp}\selectfont,
aftername = \hspace{\ccwd},
beforeskip = 24bp,
afterskip = 6bp,
},
%
% 13 12 6
%
subsection = {
format = \sffamily\fontsize{13bp}{21.67bp}\selectfont,
aftername = \hspace{\ccwd},
indent = 2\ccwd,
beforeskip = 12bp,
afterskip = 6bp,
},
%
% Word
% 使 12 20 0
subsubsection = {
format = \sffamily\fontsize{12bp}{20bp}\selectfont,
number = \arabic{subsubsection},
aftername = .\hspace{0.5\ccwd},
indent = 2\ccwd,
beforeskip = \z@,
afterskip = \z@,
},
%
% Word 12 20
% 0 使
paragraph = {
format = \rmfamily\fontsize{12bp}{20bp}\selectfont,
number = \arabic{paragraph},
aftername = \hspace{0.5\ccwd},
indent = 2\ccwd,
beforeskip = \z@,
afterskip = \z@,
runin = false,
},
%
% Word 12 20
% 0 使
subparagraph = {
format = \rmfamily\fontsize{12bp}{20bp}\selectfont,
number = \ustc@textcircled{subparagraph},
aftername = \hspace{0.5\ccwd},
indent = 2\ccwd,
beforeskip = \z@,
afterskip = \z@,
runin = false,
},
}
\ifustc@degree@bachelor
\ifustc@main@language@english
\ustcsetup{section-style = arabic}
\fi
\fi
\ustc@option@hook{main-language}{%
\ifustc@degree@bachelor
\ifustc@main@language@english
\ustcsetup{section-style = arabic}%
\fi
\fi
}
%
\ifustc@degree@bachelor
\setcounter{secnumdepth}{4}
\ctexset{
%
% 18 bp
% \cs{if@mainmatter}
%
% 16 bp15 bp14 bp
chapter = {
format = {
\centering\sffamily
\if@mainmatter
\fontsize{16bp}{29.33bp}\selectfont
\else
\fontsize{18bp}{33bp}\selectfont
\fi
},
},
section = {
format = \centering\sffamily\fontsize{15bp}{27.5bp}\selectfont,
},
subsection = {
format = \sffamily\fontsize{14bp}{25.67bp}\selectfont,
indent = \z@,
},
subsubsection = {
format = \rmfamily\fontsize{12bp}{22bp}\selectfont,
indent = \ccwd,
},
paragraph = {
format = \rmfamily\fontsize{12bp}{22bp}\selectfont,
aftername = {},
indent = \ccwd,
},
}
%
%
\ifustc@section@style@arabic\else
\ctexset{
chapter = {
number = \chinese{chapter},
},
section = {
name = {,},
number = \chinese{section},
},
subsection = {
number = \chinese{subsection},
aftername = {},
},
}
\fi
\fi
% \cs{chapter*}
% PDF
%
% PDF
% \cs{ustc@chapter} %
\NewDocumentCommand\ustc@chapter{o m}{%
\if@openright\cleardoublepage\else\clearpage\fi
\IfValueTF{#1}{%
\ustc@pdfbookmark{#1}%
\chaptermark{#1}%
}{%
\ustc@pdfbookmark{#2}%
\chaptermark{#2}%
}%
\chapter*{#2}}
% \subsection{}
%
\newcommand\ustc@keywords@text{%
\ifustc@degree@graduate
\ustc@clist@use{\ustc@keywords}{\quad}%
\else
\ustc@clist@use{\ustc@keywords}{}%
\fi
}
\newcommand\ustc@keywords@en@text{%
\ifustc@degree@graduate
\ustc@clist@use{\ustc@keywords@en}{, }%
\else
\ustc@clist@use{\ustc@keywords@en}{; }%
\fi
}
\newenvironment{abstract}{%
\ustcsetup{language=chinese}%
\ustc@chapter{}%
}{
\par\null\par\noindent\hangindent=4\ccwd\relax
\textbf{}\ustc@keywords@text\par
\ustc@reset@main@language
}
\newbox\ustc@keywords@box
\newlength\ustc@keywords@width
%
\newenvironment{abstract*}{%
\ustcsetup{language=english}%
\ifustc@degree@graduate
\ustc@chapter[Abstract]{ABSTRACT}%
\else
\begingroup
% 使线
\ctexset{chapter/format=\centering\fontsize{18bp}{33bp}\selectfont}%
\ustc@chapter{ABSTRACT}%
\endgroup
\fi
}{
\par\null\par\noindent
\savebox\ustc@keywords@box{\textbf{Key Words}: }%
\ustc@keywords@width=\linewidth
\advance\ustc@keywords@width-\wd\ustc@keywords@box
\textbf{Key Words}: \parbox[t]{\ustc@keywords@width}{\ustc@keywords@en@text\par}\par
\ifustc@degree@graduate
\cleardoublepage
\fi
\ustc@reset@main@language
}
% Reserved for compatibility until 2020-07-01.
\newenvironment{enabstract}{%
\begin{abstract*}%
}{%
\end{abstract*}%
}
% \subsection{}
%
%
\renewcommand\tableofcontents{%
\ustc@chapter{\contentsname}%
\@starttoc{toc}%
\thispagestyle{empty}
}
% \pkg{titletoc}
% 线
\newcommand\ustc@leaders{%
\hspace{2bp}%
\titlerule*[4bp]{\textperiodcentered}%
\hspace{2bp}%
}
\contentsmargin{0bp}
% 14 6 0
%
% Word 20
\ifustc@degree@graduate
\titlecontents{chapter}
[\z@]{\addvspace{6bp}\fontsize{14bp}{20bp}\selectfont}
{\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
{\fontsize{12bp}{20bp}\selectfont\ustc@leaders\thecontentspage}
%
% 12 6 0
%
% Word 20 0
\titlecontents{section}
[\ccwd]{\fontsize{12bp}{20bp}\selectfont}
{\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
{\ustc@leaders\thecontentspage}
%
% 仿 12 6 0
%
% Word 20 0
\titlecontents{subsection}
[2\ccwd]{\fangsong\fontsize{12bp}{20bp}\selectfont}
{\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
{\ustc@leaders\thecontentspage}
%
% 使
\else
\titlecontents{chapter}
[\z@]{\normalsize}
{\contentspush{\thecontentslabel\unskip\hspace{\ccwd}}}{}
{\ustc@leaders\thecontentspage}
\titlecontents{section}
[\ccwd]{\normalsize}
{\contentspush{\thecontentslabel\hspace{\ccwd}}}{}
{\ustc@leaders\thecontentspage}
\titlecontents{subsection}
[2\ccwd]{\normalsize}
{\contentspush{\thecontentslabel
\ifustc@section@style@arabic\hspace{\ccwd}\else \fi}}{}
{\ustc@leaders\thecontentspage}
\fi
%
% \cs{if@mainmatter} \cs{mainmatter}
\newif\ifustc@addtocspace
\ifustc@degree@bachelor
\ustc@addtocspacetrue
\g@addto@macro\frontmatter{\ustc@addtocspacefalse}%
\g@addto@macro\mainmatter{\ustc@addtocspacetrue}%
\g@addto@macro\backmatter{\ustc@addtocspacefalse}%
\g@addto@macro\appendix{\ustc@addtocspacefalse}%
\fi
%
\renewcommand\chapter{%
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{\CTEX@chapter@pagestyle}%
\global\@topnum\z@
\@afterindenttrue
\ifustc@degree@bachelor
\ifustc@addtocspace
\addtocontents{toc}{\protect\addvspace{12bp}}%
\fi
\fi
\secdef\@chapter\@schapter
}
%
\newlength{\ustc@lof@label@width}
\newcommand\ustc@set@lof@format{%
\settowidth{\ustc@lof@label@width}{\figurename~9.99}%
\addtolength{\ustc@lof@label@width}{1em}%
\titlecontents{figure}%
[\ustc@lof@label@width]{\normalsize}%
{\contentslabel[\figurename~\thecontentslabel]{\ustc@lof@label@width}}{}%
{\ustc@leaders\thecontentspage}%
\titlecontents{table}%
[\ustc@lof@label@width]{\normalsize}%
{\contentslabel[\tablename~\thecontentslabel]{\ustc@lof@label@width}}{}%
{\ustc@leaders\thecontentspage}%
}
\ustc@set@lof@format
\ustc@option@hook{main-language}{\ustc@set@lof@format}
\renewcommand\listoffigures{%
\ifustc@degree@graduate
\cleardoublepage
\fi
\ustc@chapter{\listfigurename}%
\@starttoc{lof}%
}
\renewcommand\listoftables{%
\ifustc@degree@graduate
\cleardoublepage
\fi
\ustc@chapter{\listtablename}%
\@starttoc{lot}%
}
% \subsection{}
%
% 9 1.10(2)
\newenvironment{notation}{%
\ifustc@degree@graduate
\cleardoublepage
\pagestyle{headings}%
\fi
\ustc@chapter{\ustc@notation@name}%
}{%
\ifustc@degree@graduate
\clearpage
\pagestyle{plain}%
\fi
}%
\newcommand*\notationlabel[1]{#1\hfil}%
\newenvironment{notationlist}[1]{%
\list{}{%
\itemsep 3bp%
\labelwidth #1\relax%
\labelsep 1em%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\advance\leftmargin 3em%
\rightmargin 3em%
\let\makelabel\notationlabel
}%
}{%
\endlist
}
% \subsection{}
% \cs{sloppy} overfull boxes
\sloppy
% \href{https://github.com/ustctug/ustcthesis/issues/209}{
% ustctug/ustcthesis\#209}
\raggedbottom
% 0
\setlength{\parskip}{\z@}
%
\ctexset{autoindent=2}
%
\let\@afterindentfalse\@afterindenttrue
\@afterindenttrue
% URL
\urlstyle{same}
% 使 \pkg{xurl} URL
\def\UrlBreaks{%
\do\/%
\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l%
\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L%
\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
\do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
\do\*\do\-\do\~\do\'\do\"\do\-}
\Urlmuskip=0mu plus 0.1mu
%
\renewcommand\thefootnote{\ustc@textcircled{footnote}}
% LaTeX
% |\@addtoreset{footnote}{page}|
% \footnote{\url{https://texfaq.org/FAQ-footnpp.html}}
% 使 \pkg{footmisc}
% 线
\renewcommand\footnoterule{%
\kern-3\p@
\hrule\@width.25\textwidth
\kern2.6\p@}
%
%
\renewcommand\@makefntext[1]{%
\parindent 2\ccwd\relax
\noindent
\hb@xt@2\ccwd{\hss\@makefnmark}#1}
% \subsection{}
% \label{sec:list}
%
\setlength\partopsep{\z@}
\newcommand\ustc@nolistsep{%
\parsep 0\p@ \@plus.2\p@
\topsep 0\p@ \@plus.2\p@
\itemsep0\p@ \@plus.2\p@
}
\def\@listi{\leftmargin\leftmargini
\ustc@nolistsep}
\let\@listI\@listi
\@listi
\def\@listii {\leftmargin\leftmarginii
\labelwidth\leftmarginii
\advance\labelwidth-\labelsep
\ustc@nolistsep}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii
\advance\labelwidth-\labelsep
\ustc@nolistsep}
% \subsection{}
% \LaTeX{} UK TeX FAQ
% \footnote{\url{https://texfaq.org/FAQ-floats}}
\renewcommand\topfraction{.85}
\renewcommand\bottomfraction{.7}
\renewcommand\textfraction{.15}
\renewcommand\floatpagefraction{.66}
\renewcommand\dbltopfraction{.66}
\renewcommand\dblfloatpagefraction{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
% |h|
\def\fps@figure{h}
\def\fps@table{h}
% \pkg{caption}
% 10.5 6 12
%
%
% 10.5 6 6
%
%
\setlength{\floatsep}{6bp}
\setlength{\textfloatsep}{6bp}
\setlength{\intextsep}{6bp}
\DeclareCaptionFont{ustc}{%
\ifustc@language@chinese
\fontsize{10.5bp}{13.65bp}\selectfont
\else
\fontsize{10.5bp}{12.075bp}\selectfont
\fi
}
\captionsetup{
font = ustc,
labelsep = quad,
skip = 6bp,
figureposition = bottom,
tableposition = top,
}
\ifustc@degree@graduate
\captionsetup{font+=bf}
\captionsetup[table]{font+=sf}
\fi
\captionsetup[figure]{
belowskip = 6bp,
}
% LaTeX2e kernel patch
% \href{https://github.com/tuna/thuthesis/issues/614}{tuna/thuthesis/issues\#614}
% \url{https://www.zhihu.com/question/46618031}
% \url{https://tex.stackexchange.com/a/40363/82731}
% \begin{macrocode}
\patchcmd{\@addtocurcol}%
{\vskip \intextsep}%
{\edef\save@first@penalty{\the\lastpenalty}\unpenalty
\ifnum \lastpenalty = \@M % hopefully the OR penalty
\unpenalty
\else
\penalty \save@first@penalty \relax % put it back
\fi
\ifnum\outputpenalty <-\@Mii
\addvspace\intextsep
\vskip\parskip
\else
\addvspace\intextsep
\fi}%
{}{\ustc@patch@error{\@addtocurcol}}
\patchcmd{\@addtocurcol}%
{\vskip\intextsep \ifnum\outputpenalty <-\@Mii \vskip -\parskip\fi}%
{\ifnum\outputpenalty <-\@Mii
\aftergroup\vskip\aftergroup\intextsep
\aftergroup\nointerlineskip
\else
\vskip\intextsep
\fi}%
{}{\ustc@patch@error{\@addtocurcol}}
\patchcmd{\@getpen}{\@M}{\@Mi}
{}{\ustc@patch@error{\@getpen}}
% \cs{note}
% \cs{caption}
% \cs{bicaption}
\newcommand\note[1]{%
\begingroup
\captionsetup{
font = ustc,
margin = 2\ccwd,
position = bottom,
}%
\caption*{#1}%
\endgroup
}
%
\patchcmd\@floatboxreset{%
\normalsize
}{%
\small
}{}{\ustc@patch@error{\@floatboxreset}}
% \pkg{longtable}
%
% Word
% 1 1 30
% 1 1 33
% \begin{macrocode}
\AtEndOfPackageFile*{longtable}{
\AtBeginEnvironment{longtable}{%
\ifdim\f@size pt > 12pt\relax
\small
\fi
}
}
% \subsection{}
\PassOptionsToPackage{compress}{natbib}
\AtEndOfPackageFile*{natbib}{
%
\newcommand\bibstyle@super{\bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}}
\newcommand\bibstyle@inline{\bibpunct{[}{]}{,}{n}{,}{,}}
\newcommand\bibstyle@authoryear{\bibpunct{(}{)}{;}{a}{,}{,}}
\@namedef{bibstyle@author-year}{\bibstyle@authoryear}
%
% \file{bst}
% 使 \cs{bibliographystyle}
\@namedef{bibstyle@ustcthesis-numerical}{\bibstyle@super}
\@namedef{bibstyle@ustcthesis-authoryear}{\bibstyle@authoryear}
\@namedef{bibstyle@ustcthesis-bachelor}{\bibstyle@super}
%
% `natbib` `cite-style`
% https://github.com/ustctug/ustcthesis/issues/327
\ifx\ustc@cite@style\@empty\else
\citestyle{\ustc@cite@style}%
\fi
%
% cite-style
\ustc@option@hook{cite-style}{%
\citestyle{\ustc@cite@style}%
}
%
%
\DeclareRobustCommand\inlinecite{\@inlinecite}
\def\@inlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup}
%
%
% filehook 使 \cs{patchcmd}
%
% super \cs{citep}
\renewcommand\NAT@citesuper[3]{%
\ifNAT@swa
\if*#2*\else
#2\NAT@spacechar
\fi
% \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%
% \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup}
\unskip\kern\p@
\textsuperscript{%
\NAT@@open#1\NAT@@close
\if*#3*\else#3\fi
}%
\kern\p@
\else
#1%
\fi
\endgroup
}
%
% numbers \cs{citep}
\renewcommand\NAT@citenum[3]{%
\ifNAT@swa
\NAT@@open
\if*#2*\else
#2\NAT@spacechar
\fi
% #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close
#1\NAT@@close
\if*#3*\else
\textsuperscript{#3}%
\fi
\else
#1%
\fi
\endgroup
}
%
% filehook 使 \cs{patchcmd}
\def\NAT@citexnum[#1][#2]#3{%
\NAT@reset@parser
\NAT@sort@cites{#3}%
\NAT@reset@citea
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
\@for\@citeb:=\NAT@cite@list\do
{\@safe@activestrue
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\@safe@activesfalse
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
{\reset@font\bfseries?}
\NAT@citeundefined\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}}%
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa
\@ifnum{\NAT@ctype>\@ne}{%
\@citea
\NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}%
}{%
\@ifnum{\NAT@cmprs>\z@}{%
\NAT@ifcat@num\NAT@num
{\let\NAT@nm=\NAT@num}%
{\def\NAT@nm{-2}}%
\NAT@ifcat@num\NAT@last@num
{\@tempcnta=\NAT@last@num\relax}%
{\@tempcnta\m@ne}%
\@ifnum{\NAT@nm=\@tempcnta}{%
\@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%
}{%
\advance\@tempcnta by\@ne
\@ifnum{\NAT@nm=\@tempcnta}{%
% \pkg{natbib} 使
% 使
% https://tex.stackexchange.com/a/86991/82731 。
%
% \ifx\NAT@last@yr\relax
% \def@NAT@last@yr{\@citea}%
% \else
% \def@NAT@last@yr{--\NAT@penalty}%
% \fi
\def@NAT@last@yr{-\NAT@penalty}%
}{%
\NAT@last@yr@mbox
}%
}%
}{%
\@tempswatrue
\@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}%
\if@tempswa\NAT@citea@mbox\fi
}%
}%
\NAT@def@citea
\else
\ifcase\NAT@ctype
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else
\@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}%
\fi
\if*#1*\else#1\NAT@spacechar\fi
\NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
\NAT@def@citea@box
\or
\NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
\or
\NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
\or
\NAT@hyper@citea@space\NAT@alias
\fi
\fi
}%
}%
\@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}%
\ifNAT@swa\else
% numerical \cs{citet}
%
% \@ifnum{\NAT@ctype=\z@}{%
% \if*#2*\else\NAT@cmt#2\fi
% }{}%
\NAT@mbox{\NAT@@close}%
\@ifnum{\NAT@ctype=\z@}{%
\if*#2*\else
\textsuperscript{#2}%
\fi
}{}%
\NAT@super@kern
\fi
}{#1}{#2}%
}%
%
% author-year \cs{citep}
\renewcommand\NAT@cite%
[3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
% #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
#1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup}
%
% author-year \cs{citet}
\def\NAT@citex%
[#1][#2]#3{%
\NAT@reset@parser
\NAT@sort@cites{#3}%
\NAT@reset@citea
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
\@for\@citeb:=\NAT@cite@list\do
{\@safe@activestrue
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\@safe@activesfalse
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
{\reset@font\bfseries ?}\NAT@citeundefined
\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\NAT@hyper@{\NAT@exlab}%
\else\unskip\NAT@spacechar
\NAT@hyper@{\NAT@date}%
\fi
\else
\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{%
\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb
}%
\NAT@date
}%
\fi
\fi
\or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
\or\@citea\NAT@hyper@{\NAT@date}%
\or\@citea\NAT@hyper@{\NAT@alias}%
\fi \NAT@def@citea
\else
\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\NAT@hyper@{\NAT@exlab}%
\else
\unskip\NAT@spacechar
\NAT@hyper@{\NAT@date}%
\fi
\else
\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date
}%
\fi
\fi
\or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
\or\@citea\NAT@hyper@{\NAT@date}%
\or\@citea\NAT@hyper@{\NAT@alias}%
\fi
\if\relax\NAT@date\relax
\NAT@def@citea
\else
\NAT@def@citea@close
\fi
\fi
}}\ifNAT@swa\else
% author-year \cs{citet}
%
% \if*#2*\else\NAT@cmt#2\fi
\if\relax\NAT@date\relax\else\NAT@@close\fi
\if*#2*\else\textsuperscript{#2}\fi
\fi}{#1}{#2}}
%
% pdf \pkg{natbib} \cmd{bibsection}
% \pkg{chapterbib} 使 \opt{sectionbib}
% 使 \cs{section}
\newcommand\ustc@bib@chapter{%
\@mainmatterfalse
\chapter{\bibname}%
}%
\newcommand\ustc@bib@section{%
\begingroup
\ctexset{section/numbering=false}%
\section{\bibname}%
\endgroup
}%
\@ifpackagewith{chapterbib}{sectionbib}{%
\ustc@error{The "sectionbib" option cannot be used with chaperbib if natbib loaded}%
}{}%
\@ifpackageloaded{chapterbib}{%
\let\bibsection\ustc@bib@section
}{%
\@ifxundefined\NAT@sectionbib{%
\let\bibsection\ustc@bib@chapter
}{%
\let\bibsection\ustc@bib@section
}%
}%
%
% 10.5 20
%
\renewcommand\bibfont{%
\ifustc@degree@graduate
\fontsize{10.5bp}{20bp}\selectfont
\else
\normalsize
\fi
}
\setlength{\bibsep}{0\p@ \@plus.2\p@}
\renewcommand\@biblabel[1]{[#1]\hfill}
\setlength{\bibhang}{2\ccwd}
}
% biblatex
\AtEndOfPackageFile*{biblatex}{
\DeclareRobustCommand\inlinecite{\parencite}
\defbibheading{bibliography}[\bibname]{%
\@mainmatterfalse
\chapter{\bibname}%
}
\renewcommand\bibfont{%
\ifustc@degree@graduate
\fontsize{10.5bp}{20bp}\selectfont
\else
\normalsize
\fi
}
\setlength{\bibitemsep}{0\p@ \@plus.2\p@}
\setlength{\bibhang}{2\ccwd}
}
% \subsection{}
%
\newenvironment{acknowledgements}{%
\@mainmatterfalse
\chapter{\ustc@acknowledgements@name}%
}{
\ifustc@degree@bachelor
\par
\null\par
\begingroup
\raggedleft
\ustc@date@zh@short\par
\endgroup
\fi
}
% acknowledgments
% Reserved for compatibility until 2020-07-01.
\newenvironment{acknowledgments}{%
\begin{acknowledgements}%
}{%
\end{acknowledgements}%
}
%
\newenvironment{publications}{%
\@mainmatterfalse
\chapter{\ustc@publication@name}%
}{}
% \subsection{}
% 便使
% \subsubsection{\pkg{hyperref} }
\AtEndOfPackageFile*{hyperref}{
\hypersetup{
bookmarksnumbered = true,
bookmarksopen = true,
bookmarksopenlevel = 1,
linktoc = all,
unicode = true,
psdextra = true,
}
%
% \opt{pdf} hyperlink
\ifustc@output@electronic
\hypersetup{
colorlinks = true,
allcolors = blue,
}
\else
\hypersetup{hidelinks}
\fi
%
% PDF
\AtBeginDocument{
\hypersetup{
pdftitle = \ustc@title,
pdfauthor = \ustc@author,
}
}
%
% PDF
%
\newcounter{ustc@bookmarknumber}
\renewcommand\ustc@pdfbookmark[1]{%
\phantomsection
\stepcounter{ustc@bookmarknumber}%
\pdfbookmark[0]{#1}{ustcchapter.\theustc@bookmarknumber}%
}
%
% PDF \pkg{hyperref}
\pdfstringdefDisableCommands{
\let\\\@empty
\let\hspace\@gobble
}
%
% \pkg{hyperref} \pkg{unicode-math}
% \href{https://github.com/ustctug/ustcthesis/issues/223}{%
% ustctug/ustcthesis\#223}
% \href{https://github.com/ho-tex/hyperref/pull/90}{ho-tex/hyperref\#90}
% \href{https://github.com/ustctug/ustcthesis/issues/235}{%
% ustctug/ustcthesis/\#235}
\@ifpackagelater{hyperref}{2019/04/27}{}{%
\g@addto@macro\psdmapshortnames{\let\mu\textmu}%
}
%
% \cs{autoref}
% \footnote{\url{https://tex.stackexchange.com/a/66150/82731}}
\ifustc@language@chinese
\def\equationautorefname~#1\null{~(#1)\null}
\def\footnoteautorefname{}
\def\itemautorefname~#1\null{~#1~\null}
\def\figureautorefname{}
\def\tableautorefname{}
\def\partautorefname~#1\null{~#1~\null}
\def\appendixautorefname{}
\def\chapterautorefname~#1\null{~#1~\null}
\def\sectionautorefname~#1\null{~#1~\null}
\def\subsectionautorefname~#1\null{~#1~\null}
\def\subsubsectionautorefname~#1\null{~#1~\null}
\def\paragraphautorefname~#1\null{~#1~\null}
\def\subparagraphautorefname~#1\null{~#1~\null}
\def\theoremautorefname{}
\def\HyRef@autopageref#1{\hyperref[{#1}]{~\pageref*{#1} }}
\fi
%
% \tableofcontents \pagenumbering
% 使 notoccite PDF #293
% https://tex.stackexchange.com/a/593839/82731 的 patch。
% LuaTeX patch
\ifXeTeX
\def\HyPL@StorePageLabel#1{%
\begingroup
\edef\Hy@tempa{\the\Hy@abspage<<#1>>}%
\immediate\write\@mainaux{%
\string\HyPL@Entry{\Hy@tempa}%
}%
\endgroup
}
\fi
}
% \subsubsection{\pkg{amsthm} }
\AtEndOfPackageFile*{amsthm}{
\newtheoremstyle{ustcplain}
{}{}
{}{2\ccwd}
{\bfseries}{}
{\ccwd}{}
\theoremstyle{ustcplain}
%
\ifustc@language@chinese
\newcommand\ustc@assertion@name{}
\newcommand\ustc@assumption@name{}
\newcommand\ustc@axiom@name{}
\newcommand\ustc@corollary@name{}
\newcommand\ustc@definition@name{}
\newcommand\ustc@example@name{}
\newcommand\ustc@lemma@name{}
\newcommand\ustc@proof@name{}
\newcommand\ustc@proposition@name{}
\newcommand\ustc@remark@name{}
\newcommand\ustc@theorem@name{}
\else
\newcommand\ustc@assertion@name{Assertion}
\newcommand\ustc@assumption@name{Assumption}
\newcommand\ustc@axiom@name{Axiom}
\newcommand\ustc@corollary@name{Corollary}
\newcommand\ustc@definition@name{Definition}
\newcommand\ustc@example@name{Example}
\newcommand\ustc@lemma@name{Lemma}
\newcommand\ustc@proof@name{Proof}
\newcommand\ustc@proposition@name{Proposition}
\newcommand\ustc@remark@name{Remark}
\newcommand\ustc@theorem@name{Theorem}
\fi
\newtheorem{theorem} {\ustc@theorem@name} [chapter]
\newtheorem{assertion} [theorem]{\ustc@assertion@name}
\newtheorem{axiom} [theorem]{\ustc@axiom@name}
\newtheorem{corollary} [theorem]{\ustc@corollary@name}
\newtheorem{lemma} [theorem]{\ustc@lemma@name}
\newtheorem{proposition}[theorem]{\ustc@proposition@name}
\newtheorem{assumption} {\ustc@assumption@name} [chapter]
\newtheorem{definition} {\ustc@definition@name} [chapter]
\newtheorem{example} {\ustc@example@name} [chapter]
\newtheorem*{remark} {\ustc@remark@name}
% \pkg{amsthm} proof
% 仿 \pkg{amsthm} |\item[\hskip\labelsep\hskip2\ccwd #1\hskip\ccwd]|
%
\renewenvironment{proof}[1][\ustc@proof@name]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item\relax\hskip2\ccwd
\textbf{#1}
\hskip\ccwd\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\renewcommand\qedsymbol{\ustc@qed}
}
% \subsubsection{\pkg{algorithm2e} }
%
\PassOptionsToPackage{algochapter}{algorithm2e}
\AtEndOfPackageFile*{algorithm2e}{
\ifustc@language@chinese
\SetAlgorithmName{}{}{}
\else
\SetAlgorithmName{Algorithm}{Algorithm}{List of Algorithms}
\fi
%
%
\SetAlCapSkip{6bp}
\SetAlCapFnt{\small}
\SetAlCapNameFnt{\small}
\ifustc@degree@graduate
\SetAlCapNameSty{textbf}
\fi
\SetAlgoCaptionSeparator{\unskip\hspace*{\ccwd}}
%
%
\renewcommand\listofalgocfs{%
\ifustc@degree@graduate
\cleardoublepage
\fi
\ustc@chapter{\listalgorithmcfname}%
\@starttoc{loa}%
}
\titlecontents{algocf}
[2.3em]{\normalsize}
{\contentslabel{2.3em}}{}
{\ustc@leaders\contentspage}
\contentsuse{algocf}{loa}
}
% \subsubsection{\pkg{mathtools} }
% \pkg{mathtools} \pkg{unicode-math} `\underbrace` `\overbrace`
% `\LaTeXunderbrace` `\LaTeXoverbrace`
% \url{https://tex.stackexchange.com/q/521394/82731}
\AtEndOfPackageFile*{mathtools}{
\@ifpackageloaded{unicode-math}{
\let\underbrace\LaTeXunderbrace
\let\overbrace\LaTeXoverbrace
}{}
}
% \subsubsection{\pkg{nomencl} }
\AtEndOfPackageFile*{nomencl}{
\let\nomname\ustc@notation@name
\def\thenomenclature{%
\ifustc@degree@graduate
\cleardoublepage
\pagestyle{headings}%
\fi
\ustc@chapter{\ustc@notation@name}%
\nompreamble
\list{}{%
\labelwidth\nom@tempdim
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\itemsep\nomitemsep
\let\makelabel\nomlabel}}
\def\endthenomenclature{%
\endlist
\nompostamble
\ifustc@degree@graduate
\clearpage
\pagestyle{plain}%
\fi
}
}
% \subsubsection{\pkg{siunitx} }
\AtEndOfPackageFile*{siunitx}{
\newcommand\ustc@set@siunitx@language{%
\ifustc@language@chinese
\sisetup{
list-final-separator = { ~},
list-pair-separator = { },
range-phrase = {},
}%
\else
\sisetup{
list-final-separator = {, and },
list-pair-separator = { and },
range-phrase = { to },
}%
\fi
}
\ustc@set@siunitx@language
\ustc@option@hook{language}{\ustc@set@siunitx@language}
}
% \subsubsection{\pkg{chapterbib} }
\AtEndOfPackageFile*{chapterbib}{
\@ifpackageloaded{natbib}{%
\@ifpackagewith{chapterbib}{sectionbib}{%
\ustc@error{The "sectionbib" option cannot be used with chaperbib if natbib loaded}%
}{}%
\renewcommand\bibsection{%
\begingroup
\ctexset{section/numbering=false}%
\section{\bibname}%
\endgroup
}
}{}
}