forked from qcts33/BUPTthesis-ctex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUPTthesis.cls
228 lines (207 loc) · 5.91 KB
/
BUPTthesis.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{BUPTthesis}
[2018/12/12 v7.0 BUPT graduate thesis LaTeX2e class]
\RequirePackage{etoolbox}
\newtoggle{txmath}
\DeclareOption{txmath}{\toggletrue{txmath}}
\newtoggle{review}
\DeclareOption{review}{\toggletrue{review}}
\newtoggle{chapterbib}
\DeclareOption{chapterbib}{\toggletrue{chapterbib}}
% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions
% config ctex
\LoadClass[a4paper,UTF8,zihao=-4,scheme=chinese,linespread=1.4]{ctexbook}
\ctexset{%
listfigurename = \bupt@listfigurename,
listtablename = \bupt@listtablename,
part/pagestyle = empty,
chapter = {%
format = \zihao{3}\heiti\centering,
pagestyle = main,
beforeskip = 0pt,
afterskip = 40pt,
},
section/format = \zihao{4}\heiti,
subsection/format = \zihao{-4}\heiti,
}
\newcommand{\refname}{\bibname}
\AtEndOfClass{\input{BUPTthesis.cfg}}
% define names
\newcommand{\studentid}[1]{\def\bupt@meta@studentid{#1}}
\newcommand{\ctitle}[1]{\def\bupt@meta@ctitle{#1}}
\newcommand{\etitle}[1]{\def\bupt@meta@etitle{#1}}
\newcommand{\cdegree}[1]{\def\bupt@meta@cdegree{#1}}
\newcommand{\cdepartment}[1]{\def\bupt@meta@cdepartment{#1}}
\newcommand{\edepartment}[1]{\def\bupt@meta@edepartment{#1}}
\newcommand{\cmajor}[1]{\def\bupt@meta@cmajor{#1}}
\newcommand{\emajor}[1]{\def\bupt@meta@emajor{#1}}
\newcommand{\cauthor}[1]{\def\bupt@meta@cauthor{#1}}
\newcommand{\eauthor}[1]{\def\bupt@meta@eauthor{#1}}
\newcommand{\csupervisor}[1]{\def\bupt@meta@csupervisor{#1}}
\newcommand{\esupervisor}[1]{\def\bupt@meta@esupervisor{#1}}
\newcommand{\ckeywords}[1]{\def\bupt@meta@ckeywords{#1}}
\newcommand{\ekeywords}[1]{\def\bupt@meta@ekeywords{#1}}
\newcommand{\cdate}[1]{\def\bupt@meta@cdate{#1}}
\newcommand{\edate}[1]{\def\bupt@meta@edate{#1}}
% Load packages
\RequirePackage{mathtools,amsthm,amsfonts,amssymb,bm}
\RequirePackage{newtxtext}
\iftoggle{txmath}{\RequirePackage{newtxmath}}{}
\RequirePackage{graphicx}
\RequirePackage{caption}
\RequirePackage{subcaption}
\RequirePackage{siunitx}
\RequirePackage{algorithm, algorithmicx}
\RequirePackage{longtable}
% biblatex
\iftoggle{chapterbib}{\PassOptionsToPackage{refsection=chapter}{biblatex}}{}
\RequirePackage[backend=biber,style=gb7714-2015,gbnamefmt=lowercase,doi=false]{biblatex}
\iftoggle{chapterbib}
{%
\newcommand{\chapterbib}{\printbibliography[heading=subbibliography]}
\newcommand{\mainbib}{\relax}
}
{%
\newcommand{\chapterbib}{\relax}
\newcommand{\mainbib}{\printbibliography}
}
% hyperref
\AtBeginDocument{
\hypersetup{
colorlinks,
urlcolor=black,
linkcolor=black,
citecolor=black,
pdfauthor={\bupt@meta@cauthor},
pdftitle={\bupt@meta@ctitle},
}
}
\RequirePackage{hyperref}
% config page
\RequirePackage{geometry}
\geometry{
paper = a4paper,
top = 25mm,
bottom = 25mm,
left = 22.5mm,
right = 22.5mm,
}
% config toc lof lot
\RequirePackage{tocloft}
\tocloftpagestyle{main}
\setlength\cftbeforetoctitleskip{0pt}
\setlength\cftaftertoctitleskip{40pt}
\renewcommand{\cfttoctitlefont}{\hfill\zihao{3}\heiti}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}
\setlength\cftbeforeloftitleskip{0pt}
\setlength\cftafterloftitleskip{40pt}
\renewcommand{\cftloftitlefont}{\hfill\zihao{3}\heiti}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength\cftbeforelottitleskip{0pt}
\setlength\cftafterlottitleskip{40pt}
\renewcommand{\cftlottitlefont}{\hfill\zihao{3}\heiti}
\renewcommand{\cftafterlottitle}{\hfill}
% define heading
\usepackage{fancyhdr}
\fancypagestyle{main}{%
\fancyhf{}
\fancyhead[CE]{\zihao{-5}\bupt@page@head}
\fancyhead[CO]{\zihao{-5}\leftmark}
\fancyfoot[C]{\zihao{5}\thepage}
}
\appto\frontmatter{\pagestyle{main}\pagenumbering{roman}}
\appto\mainmatter{\pagestyle{main}\pagenumbering{arabic}}
% 使用enumitem宏包配制列表环境
% 紧凑间距
\RequirePackage[inline]{enumitem}
\setlist{nosep}
% config numbering for equation fig table and so on.
\AtBeginDocument{%
\renewcommand{\theequation}{\thechapter--\arabic{equation}}
\renewcommand{\thefigure}{\thechapter--\arabic{figure}}
\renewcommand\p@subfigure{\thefigure}
\renewcommand{\thetable}{\thechapter--\arabic{table}}
\renewcommand{\thealgorithm}{\thechapter--\arabic{algorithm}}
}
% draw front pages
\newtoggle{addcover}
\IfFileExists{cover.tex}
{%
\input{cover.tex}
\renewcommand\maketitle{%
\makechinesetitle
\makeenglishtitle
\makedeclaration
}
\toggletrue{addcover}
}{}
\IfFileExists{cover.pdf}
{%
\RequirePackage{pdfpages}
\renewcommand\maketitle{\includepdf[pages=-]{cover.pdf}}
\toggletrue{addcover}
}{}
\nottoggle{addcover}{\renewcommand{\maketitle}{\relax}}{}
% 中英文摘要+关键词
\newenvironment{cabstract}
{%
\cleardoublepage
\pdfbookmark[0]{\bupt@label@cabstract}{abstract}
\begin{center}
{\zihao{3}\heiti\bupt@meta@ctitle}
\vskip 20pt
{\zihao{-3}\heiti\bupt@label@cabstract}
\end{center}
\markboth{\bupt@label@cabstract}{}
\zihao{4}
\par
}
{
\par
\vspace{20pt}
\noindent
{\zihao{4} {\heiti\bupt@label@ckeywords} {\bupt@meta@ckeywords}}
}
\newenvironment{eabstract}
{%
\cleardoublepage
\pdfbookmark[0]{\bupt@label@cabstract}{ebstract}
\begin{center}
\begin{minipage}{110mm}
\centering
{\zihao{3}\bfseries\bupt@meta@etitle}
\vskip 20pt
{\zihao{-3}\bfseries\bupt@label@eabstract}
\end{minipage}
\end{center}
\markboth{\bupt@label@eabstract}{}
\vskip 20pt
\zihao{4}
\par
}
{
\par
\vspace{20pt}
\noindent
{\zihao{4} {\bfseries\bupt@label@ekeywords} {\bupt@meta@ekeywords}}
}
\newenvironment{notations}
{%
\chapter*{\bupt@label@notations}
\markboth{\bupt@label@notations}{}
\begin{longtable}{lp{120mm}}
}
{\end{longtable}}
\newenvironment{acknowledgement}
{%
\chapter*{\bupt@label@acknowledgement}
\markboth{\bupt@label@acknowledgement}{}
}
{}
\endinput