-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathgraduate.cls
328 lines (283 loc) · 13.4 KB
/
graduate.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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
% !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{CSUBachelor}[2020/01/16 2.0 Zhongnan University Thesis Template for Bachelor Degree]
\LoadClass[zihao=-4,a4paper,oneside]{ctexbook}
\setmainfont{Times New Roman}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions
\newif\ifprint\printfalse
\DeclareOption{forprint}{\printtrue}
\ProcessOptions
\newcommand\degree{^\circ} %用degree代替上标的角度的单位°,类似于宏定义??
% 这部分不需要ctex提供了\zihao指令
\newcommand{\chuhao}{\fontsize{42.2pt}{\baselineskip}\selectfont}
\newcommand{\xiaochu}{\fontsize{36.1pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{26.1pt}{\baselineskip}\selectfont}
\newcommand{\xiaoyi}{\fontsize{24.1pt}{\baselineskip}\selectfont}
\newcommand{\erhao}{\fontsize{22.1pt}{\baselineskip}\selectfont}
\newcommand{\xiaoer}{\fontsize{18.1pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{16.1pt}{\baselineskip}\selectfont}
\newcommand{\xiaosan}{\fontsize{15.1pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14.1pt}{\baselineskip}\selectfont}
\newcommand{\xiaosi}{\fontsize{12.1pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowu}{\fontsize{9.0pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaoliu}{\fontsize{6.5pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.5pt}{\baselineskip}\selectfont}
\newcommand{\bahao}{\fontsize{5.0pt}{\baselineskip}\selectfont}
%------------------------ Page layout ----------------------------------
% \RequirePackage{fancyhdr,hyperref,CJKfntef,ulem,array}
% TODO:其余包都在csuthesis.cls require
\RequirePackage{CJKfntef,ulem}
% 设置超链接打印
\hypersetup{pdfencoding=auto}
\ifprint
\hypersetup{hidelinks}
\else
\hypersetup{citecolor=magenta,linkcolor=blue}
\fi
\RequirePackage[top=2.7truecm,bottom=2.2truecm,left=3truecm,right=3truecm,includefoot,xetex]{geometry} % 页面设置%
\newtoks\StudentNumber %学号
\newtoks\miji %密级
\newtoks\Cmajor %学科专业中文名
\newtoks\Emajor %学科专业英文名
\newtoks\Edate %英文日期
\newtoks\Etitle %英文题目
\newtoks\Eauthor %作者英文名
\newtoks\Esupervisor %指导教师英文名
\newtoks\Csupervisor %指导教师中文名
\newtoks\Eschoolname %学院英文名
\newtoks\Cschoolname %学院中文名
\newtoks\Eclassname %专业班级英文名
\newtoks\Cclassname %专业班级中文名
%------------------------------------- 页眉 页脚 -------------------------------------------
%\RequirePackage{ifthen} %第一页页眉与其他页不同
%fancyhdr宏包来设置页眉和页脚,默认每章的第一页的page style是plain,需要单独处理。
% 设置 plain 的属性
\fancypagestyle{plain}
{
\fancyhf{} %清除以前对页眉页脚的设置
% 设置页眉 (head)
\fancyhead[RE,RO]{\heiti \xiaowu \@title} %自定义标题,奇数页偶数页均
\fancyhead[LE,LO]{\includegraphics[scale=0.15]{coverCSU.png}}
\renewcommand{\headrulewidth}{0.7pt} % 页眉与正文之间的水平线粗细
% 设置页脚(foot)
\renewcommand{\footrulewidth}{0pt} %隐藏页脚横线
\fancyfoot[C]{-\,\thepage\,-} %正文页脚格式-1-
}
% 设置 fancy 的属性
\pagestyle{fancy}
{
\fancyhf{}
\fancyhead[RE,RO]{\heiti \xiaowu \@title} %自定义标题
\fancyhead[LE,LO]{\includegraphics[scale=0.1]{coverCSU.png}}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{-\,\thepage\,-}
}
%----------------------------------------封面--------------------------------------------
\RequirePackage{makecell} %表格内换行
\def\maketitle{%
\thispagestyle{empty}%
\begin{center}\
\begin{figure}[ht] %开始图片
\centering
\includegraphics[scale=0.5]{coverCSU.png}
\label{fig:good}
\end{figure}
%\setlength{\parskip}{2em} %设置段落间距
\vspace*{24pt} %两行,小四号空白12pt
{
\noindent
%\setlength{\lineskip}{26pt} %设置行间距
\heiti\fontsize{45pt}{45pt} \makebox[9cm][c]{本科毕业设计(论文)}\\
\vspace{26pt} %一行,一号空白26pt
\heiti\yihao \makebox[9cm][c]{GRADUATION DESIGN(THESIS)}
}
\par
\vspace*{48pt} %四行,小四号空白12pt
{\heiti \xiaoer
\begin{tabular}{ccc} %\CJKunderline \the\ 中南大学本科毕业设计~\LaTeX~模板
%{\makebox[3.2cm][s]{题\hfill 目:}} & {\uline\kaishu \xiaoer \makebox[8cm][c]{ \@title} }& \\[2ex]
{\makebox[3.2cm][s]{题\hfill 目:}} & {\uline{\kaishu \xiaoer \makebox[8cm]{\shortstack[c]{中南大学本科毕业设计 \\ ~\LaTeX~模板}}} }& \\[2ex]
%此处感谢网友 http://blog.sina.com.cn/s/blog_665f991f0100q7j9.html
{\makebox[3.2cm][s]{学\hfill 生\hfill 姓\hfill 名:}} & {\kaishu \xiaoer\uline{\makebox[8cm][c]{\@author}}}& \\[2ex]
{\makebox[3.2cm][s]{指\hfill 导\hfill 教\hfill 师:}} & {\kaishu \xiaoer\uline{\makebox[8cm][c]{\the\Csupervisor}}}& \\[2ex]
{\makebox[3.2cm][s]{学\hfill 院:}} & {\kaishu \xiaoer\uline{\makebox[8cm][c]{\the\Cschoolname}}}& \\[3ex]
{\makebox[3.2cm][s]{专\hfill 业\hfill 班\hfill 级:}} & {\kaishu \xiaoer\uline{\makebox[8cm][c]{\the\Cclassname}}}& \\[2ex]
\end{tabular}
}
\par
\vspace{72pt} %6行,小四号空白12pt
{
\heiti \erhao 本科生院制\\
\heiti \xiaoer \@date \par
}
\end{center}
% \null
% \cleardoublepage
}
%--------------------------------------- Abstract & Keywords -------------------------------------------
\setCJKfamilyfont{zhsong}[AutoFakeBold = {2.17}]{SimSun}
\renewcommand*{\songti}{\CJKfamily{zhsong}} %解决宋体无法加粗的问题
\newcommand\cnabstractname{摘要}
\newcommand\enabstractname{ABSTRACT}
\newcommand\cnkeywords[1]{ {\noindent\bfseries\songti\zihao{-4}\cnkeywordsname: }#1}
\newcommand\cnkeywordsname{关键词}
\newcommand\enkeywords[1]{ {\noindent\bfseries\zihao{-4}\enkeywordsname: }#1}
\newcommand\enkeywordsname{Key words}
\newenvironment{cnabstract}{
\newpage
\begin{center}
\heiti \xiaoer
\vspace*{1em} %空一行
\@title\\
\vspace*{1em} %空一行
{\heiti\zihao{3}\cnabstractname}
\vspace*{1em} %空一行
\end{center}
\songti\zihao{-4}
}
\newenvironment{enabstract}{
\newpage
\begin{center}
\heiti \xiaoer
\vspace*{1em} %空一行
\the\Etitle\\
\vspace*{1em} %空一行
{\heiti\zihao{3}\enabstractname}
\vspace*{1em} %空一行
\end{center}
\songti\zihao{-4}
}
% {\par}
%-------------------------------------常用宏包----------------------------------------
\RequirePackage{amsmath,amssymb}
\RequirePackage[amsmath,thmmarks]{ntheorem}% AMSLaTeX宏包.
\RequirePackage{graphicx} % 图形
\RequirePackage{color,xcolor} %支持彩色
%\RequirePackage{mathrsfs} % 不同于\mathcal or \mathfrak 之类的英文花体字体
\RequirePackage{url}
\RequirePackage{enumerate}
%%----------------------- Theorems -----------------------------------
\theoremstyle{plain}
\theoremheaderfont{\heiti}
\theorembodyfont{\songti} \theoremindent0em
\theorempreskip{0pt}
\theorempostskip{0pt}
\theoremnumbering{arabic}
%\theoremsymbol{} %定理结束时自动添加的标志
\newtheorem{theorem}{\hspace{2em}定理}[section]
\newtheorem{definition}{\hspace{2em}定义}[section]
\newtheorem{lemma}{\hspace{2em}引理}[section]
\newtheorem{corollary}{\hspace{2em}推论}[section]
\newtheorem{proposition}{\hspace{2em}性质}[section]
\newtheorem{example}{\hspace{2em}例}[section]
\newtheorem{remark}{\hspace{2em}注}[section]
\theoremstyle{nonumberplain}
\theoremheaderfont{\heiti}
\theorembodyfont{\normalfont \rm \songti}
\theoremindent0em \theoremseparator{\hspace{1em}}
\theoremsymbol{$\square$}
\newtheorem{proof}{\hspace{2em}证明}
\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}} %自定义新命令\upcite, 使参考文献引用以上标出现
%---------------------- suppress extra inter-line spacing in \list environments--------------------
\makeatletter \setlength\partopsep{0pt}
\def\@listI{\leftmargin\leftmargini
\parsep 0pt
\topsep \parsep
\itemsep \parsep}
\@listI
\def\@listii {\leftmargin\leftmarginii
\labelwidth\leftmarginii
\advance\labelwidth-\labelsep
\parsep \z@ \@plus\z@ \@minus\z@
\topsep \parsep
\itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii
\advance\labelwidth-\labelsep
\parsep \z@ \@plus\z@ \@minus\z@
\topsep \parsep
\itemsep \parsep}
\def\@listiv{\leftmargin\leftmarginiv
\labelwidth\leftmarginiv
\advance\labelwidth-\labelsep
\parsep \z@ \@plus\z@ \@minus\z@
\topsep \parsep
\itemsep \parsep}
\def\@listv{\leftmargin\leftmarginv
\labelwidth\leftmarginv
\advance\labelwidth-\labelsep
\parsep \z@ \@plus\z@ \@minus\z@
\topsep \parsep
\itemsep \parsep}
\def\@listvi{\leftmargin\leftmarginvi
\labelwidth\leftmarginvi
\advance\labelwidth-\labelsep
\parsep \z@ \@plus\z@ \@minus\z@
\topsep \parsep
\itemsep \parsep}
%
% Change default margins for \list environments
\setlength\leftmargini {2\ccwd} \setlength\leftmarginii
{\leftmargini} \setlength\leftmarginiii {\leftmargini}
\setlength\leftmarginiv {\leftmargini} \setlength\leftmarginv
{\ccwd} \setlength\leftmarginvi {\ccwd} \setlength\leftmargin
{\leftmargini} \setlength\labelsep {.5\ccwd}
\setlength\labelwidth {\leftmargini}
%
\setlength\listparindent{2\ccwd}
% Change \listparindent to 2\ccwd in \list
\def\list#1#2{\ifnum \@listdepth >5\relax \@toodeep
\else \global\advance\@listdepth\@ne \fi
\rightmargin \z@ \listparindent2\ccwd \itemindent \z@
\csname @list\romannumeral\the\@listdepth\endcsname
\def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax
\@trivlist
\parskip\parsep \parindent\listparindent
\advance\linewidth -\rightmargin \advance\linewidth -\leftmargin
\advance\@totalleftmargin \leftmargin
\parshape \@ne \@totalleftmargin \linewidth
\ignorespaces}
\makeatother
%-----------------------------------------------------------------------------------------------------------------
\newcommand\acknowledgement{\chapter*{\ziju{0}结束语(或致谢)}}
%--------------------------------------- 章节标题设置 -------------------------------------------------
\RequirePackage{ctex,indentfirst}
\ctexset{chapter={format+={\heiti\zihao{3}},afterskip={12pt},beforeskip={-12pt},number={\arabic{chapter}},name={第,章}}}
\ctexset{section={format+={\heiti\zihao{-4}\raggedright},indent={2em},afterskip={0pt},beforeskip={0pt}}}
\ctexset{subsection={format+={\kaishu\zihao{-4}\raggedright},indent={2em}}}
\ctexset{subsubsection={format={\zihao{-4}\bf\raggedright}}}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
%-----------------------------------------图表标题设置 ---------------------------------------
\RequirePackage[labelsep=quad]{caption} %序号之后空一格写标题
\captionsetup[table]{textfont=bf} %设置表格标题字体为黑体 。2016.06.07
\renewcommand\figurename{\heiti\zihao{5} 图}
\renewcommand\tablename{\heiti\zihao{5} 表}
%-----------------------------------------目录设置-------------------------------------------
\RequirePackage{titletoc}
\ctexset{contentsname={目录}}
\RequirePackage{tocloft} %\usepackage[subfigure]{tocloft} %模板中用了subfigure,不加此选项会产生冲突
\renewcommand\cfttoctitlefont{\hfill\heiti\zihao{3}}
\renewcommand\cftaftertoctitle{\hfill}
\renewcommand\cftdotsep{1} % change the space between dots
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}%类似的,report类中为section补上引导点
\renewcommand\cftbeforetoctitleskip{0pt}
\renewcommand\cftaftertoctitleskip{0pt}
\renewcommand\cftchapfont{\songti\xiaosi}
\renewcommand\cftchappagefont{\songti\xiaosi} %将章节后面默认的加粗给去掉
\renewcommand\cftsecfont{\songti\xiaosi}
\renewcommand\cftsubsecfont{\songti\xiaosi}
%---------------------------------------------参考文献---------------------------------------------------
\bibliographystyle{abbrv} % 参考文献样式, plain,unsrt,alpha,abbrv,chinesebst 等等
%----------------------------------------------------------------------------------------------
\graphicspath{{figures/}} % 图片文件路径
%----------------------------------------------------------------------------------------------
\allowdisplaybreaks
\endlinechar `\^^M
\endinput
%-----------------------------------------附录,代码------------------------------
\RequirePackage{listings} %对代码进行抄录环境的宏包
\lstset{columns=flexable,numbers=left,numberstyle=\footnotesize,escapechar=`}%设置·为转义字符,这样才可以显示汉语