-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathswustthesis.cls
539 lines (533 loc) · 16.5 KB
/
swustthesis.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
%%
%% This is file `swustthesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% swustthesis.dtx (with options: `class')
%%
%% Copyright (C) 2016 by japinli <japinli@hotmail.com>
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{swustthesis}
[2016/08/21 v0.0.2 SWUST Thesis Template]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=swust@opt,prefix=swust@opt@,setkeys=\kvsetkeys}
\DeclareBoolOption[false]{bachelor}
\DeclareBoolOption[false]{master}
\DeclareBoolOption[false]{doctor}
\DeclareBoolOption[false]{pdf}
\DeclareComplementaryOption{print}{pdf}
\SetupKeyvalOptions{family=swust@pae,prefix=swust@page@,setkeys=\kvsetkeys}
\DeclareBoolOption[false]{oneside}
\DeclareComplementaryOption{twoside}{oneside}
\DeclareBoolOption[false]{openany}
\DeclareComplementaryOption{openright}{openany}
\DeclareBoolOption[true]{pageouter}
\DeclareComplementaryOption{pagecenter}{pageouter}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessKeyvalOptions{swust@opt}
\ifswust@opt@master\relax\else
\ifswust@opt@doctor\relax\else
\swust@opt@bachelortrue
\fi
\fi
\ifswust@opt@bachelor
\swust@page@onesidetrue
\swust@page@pageouterfalse
\fi
\ifswust@opt@pdf
\swust@page@onesidetrue
\swust@page@pageouterfalse
\fi
\ifswust@page@openany
\PassOptionsToClass{openany}{ctexbook}
\fi
\ifswust@page@oneside
\PassOptionsToClass{oneside}{ctexbook}
\fi
\LoadClass[a4paper,UTF8,zihao=-4]{ctexbook}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}
\newCJKfontfamily{\hwxk}{STXingkai}
\RequirePackage{hyperref}
\hypersetup{
CJKbookmarks=true,
bookmarksopen=true,
bookmarksnumbered=true,
bookmarksopenlevel=1,
pdfborder= 0 0 0,
unicode=true,
linktoc=all,
allcolors=black,
colorlinks=true,
}
\newcommand{\zhspace}[1][1]{\hspace{#1\ccwd}}
\newcommand{\swust@underline}[2][6em]{
\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt\relax
}
\def\swust@define@term#1{
\expandafter\gdef\csname #1\endcsname##1{
\expandafter\gdef\csname swust@#1\endcsname{##1}
}
\csname #1\endcsname{}
}
\swust@define@term{zhtitle} % 中文论文标题
\swust@define@term{entitle} % 英文论文标题
\swust@define@term{zhdegree} % 中文学位类型
\swust@define@term{endegree} % 英文学位类型
\swust@define@term{zhauthor} % 作者中文姓名
\swust@define@term{enauthor} % 作者英文姓名
\swust@define@term{zhadvisor} % 指导教师中文姓名
\swust@define@term{enadvisor} % 指导教师英文姓名
\swust@define@term{zhacademy} % 学院中文名
\swust@define@term{enacademy} % 学院英文名
\swust@define@term{zhmajor} % 专业中文名
\swust@define@term{enmajor} % 专业英文名
\swust@define@term{zhdate} % 中文答辩日期
\swust@define@term{endate} % 英文答辩日期
\swust@define@term{stuid} % 学生学号
\swust@define@term{classified} % 分类号
\swust@define@term{udc} % UDC编号
\swust@define@term{secret} % 密级
\RequirePackage{geometry}
\ifswust@opt@bachelor
\geometry{
paper=a4paper,
paperwidth=21.0cm,paperheight=29.7cm,
top=3.0cm,bottom=3.0cm,
left=3.0cm,right=2.5cm,
headheight=2.0cm,footskip=1.0cm,
}
\else
\geometry{
paper=a4paper,
paperwidth=21.0cm,paperheight=29.7cm,
top=3.0cm,bottom=2.5cm,
left=2.6cm,right=2.6cm,
headheight=2.0cm,footskip=1.25cm,
}
\fi
\RequirePackage[pagestyles]{titlesec}
\ifswust@opt@doctor
\newcommand{\swust@zh@thesis@name}{西南科技大学博士学位论文}
\newcommand{\swust@en@thesis@name}{A Dissertation Submitted to Southwest
University of Science and Technology for the Degree of Doctor}
\else
\ifswust@opt@master
\newcommand{\swust@zh@thesis@name}{西南科技大学硕士学位论文}
\newcommand{\swust@en@thesis@name}{A Thesis Submitted to Southwest University
of Scienceand Technology for the Degree of Master}
\else
\newcommand{\swust@zh@thesis@name}{西南科技大学本科毕业论文}
\newcommand{\swust@en@thesis@name}{A Thesis Submitted to Southwest University
of Scienceand Technology for the Degree of Bachelor}
\fi
\fi
\newcommand{\swust@header@title}{\swust@zh@thesis@name}
\newcommand{\swust@header@size}{\zihao{5}}
\ifswust@opt@bachelor
\newcommand{\swust@header@font}{\hwxk}
\else
\newcommand{\swust@header@font}{\songti}
\fi
\newpagestyle{front}[\swust@header@size\swust@header@font]{
\ifswust@opt@bachelor
\sethead{}{\swust@header@title}{\thepage}
\renewcommand{\makeheadrule}{
\makebox[0pt][l]{\rule[-.3\baselineskip]{\linewidth}{.5pt}}
\rule[-.5\baselineskip]{\linewidth}{2pt}
}
\else
\sethead[][\swust@header@title][]{}{\chaptertitle}{}
\setfoot[\thepage][][]{}{}{\thepage}
\renewcommand{\makeheadrule}{
\makebox[0pt][l]{\rule[-.3\baselineskip]{\linewidth}{.5pt}}
\rule[-.4\baselineskip]{\linewidth}{.5pt}
}
\setfootrule{.5pt}
\fi
}
\newpagestyle{main}[\swust@header@size\swust@header@font]{
\ifswust@opt@bachelor
\sethead{}{\swust@header@title}{}
\setfoot{}{\thepage}{}
\renewcommand{\makeheadrule}{
\makebox[0pt][l]{\rule[-.3\baselineskip]{\linewidth}{.5pt}}
\rule[-.5\baselineskip]{\linewidth}{2pt}
}
\else
\sethead[][\swust@header@title][]{}{\chaptertitle}{}
\setfoot[\thepage][][]{}{}{\thepage}
\renewcommand{\makeheadrule}{
\makebox[0pt][l]{\rule[-.3\baselineskip]{\linewidth}{.5pt}}
\rule[-.4\baselineskip]{\linewidth}{.5pt}
}
\setfootrule{.5pt}
\fi
}
\renewcommand{\frontmatter}{
\if@openright\cleardoublepage\else\clearpage\fi
\@mainmatterfalse
\pagenumbering{Roman}
\pagestyle{front}
}
\renewcommand{\mainmatter}{
\if@openright\cleardoublepage\else\clearpage\fi
\@mainmattertrue
\pagenumbering{arabic}
\pagestyle{main}
}
\renewcommand{\chapter}{
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindenttrue
\secdef\@chapter\@schapter
}
\setcounter{secnumdepth}{4}
\ifswust@opt@bachelor
\ctexset{
chapter = {
name = {第,章},
number = \thechapter,
format = \centering\zihao{-2}\heiti,
beforeskip = 2ex,
afterskip = 1ex,
},
section = {
format = \raggedright\zihao{4}\heiti,
beforeskip = 1ex,
afterskip = .5ex,
},
subsection = {
format = \raggedright\zihao{-4}\songti,
beforeskip = .5ex,
afterskip = 0ex,
},
subsubsection = {
format = \raggedright\zihao{-4}\songti,
beforeskip = 0ex,
afterskip = 0ex,
},
}
\else
\ctexset{
chapter = {
name = {},
number = \thechapter,
format = \centering\zihao{3},
beforeskip = 2ex,
afterskip = 1ex,
},
section = {
format = \raggedright\zihao{-3},
beforeskip = 1ex,
afterskip = .5ex,
},
subsection = {
format = \raggedright\zihao{4},
beforeskip = .5ex,
afterskip = 0ex,
},
subsubsection = {
format = \raggedright\zihao{-4},
beforeskip = 0ex,
afterskip = 0ex,
},
}
\fi
\newcommand{\swust@pdf@contentsname}{目录}
\let\swust@save@tableofcontents=\tableofcontents
\renewcommand{\tableofcontents}{
\if@openright\cleardoublepage\else\clearpage\fi
\pdfbookmark[0]{\swust@pdf@contentsname}{swusttoc}
\swust@save@tableofcontents
}
\renewcommand{\contentsname}{目\zhspace[2] 录}
\RequirePackage{titletoc}
\newcommand{\swust@toc@leaders}{\titlerule*[.5pc]{$\cdot$}}
\newcommand{\swust@chap@font}{\heiti}
\newcommand{\swust@chap@size}{\zihao{-4}}
\newcommand{\swust@sect@font}{\songti}
\newcommand{\swust@sect@size}{\zihao{-4}}
\newcommand{\swust@subs@font}{\songti}
\newcommand{\swust@subs@size}{\zihao{-4}}
\newcommand{\swust@chap@toc@indent}{0bp}
\newcommand{\swust@sect@toc@indent}{2\ccwd}
\newcommand{\swust@subs@toc@indent}{4\ccwd}
\titlecontents{chapter}
[\swust@chap@toc@indent]
{\swust@chap@size\swust@chap@font}
{\thecontentslabel\hspace*{.5em}}
{}{\swust@toc@leaders\contentspage}
\titlecontents{section}
[\swust@sect@toc@indent]
{\swust@sect@size\swust@sect@font}
{\thecontentslabel\hspace*{.5em}}
{}{\swust@toc@leaders\contentspage}
\titlecontents{subsection}
[\swust@subs@toc@indent]
{\swust@subs@size\swust@subs@font}
{\thecontentslabel\hspace*{.5em}}
{}{\swust@toc@leaders\contentspage}
\newcommand{\swust@declare@text}{
本人郑重声明:所呈交的学位论文是我个人在导师的指导下进行的研究工作及
取得的研究成果。尽我所知,除了文中特别加以标注和致谢的地方外,论文中
不包含其他人已经发表或撰写过的研究成功。与我一同工作的同志对本研究所
做的任何贡献均已在论文中坐了明确的说明,并表示了感谢。本人依法享有和
承担由此论文所产生的权利和责任。
}
\newcommand{\swust@warranty@text}{
本学位论文作者完全了解学校有关保存、使用学位论文的规定,即:研究生在
西南科技大学学习和工作期间论文工作的知识产权单位属于西南科技大学。同
意授权西南科技大学保留并向国家有关部门或机构送交该论文的印刷本和电子
版本,允许该论文被查阅和借阅。同意授权西南科技大学可以将本学位论文的
全部或部分内容编入有关数据库进行检索,可以采用影印、缩印、扫描或数字
化等其他复制手段保存和汇编本学位论文。保密论文在解密后遵守此规定。
}
\newcommand{\swust@make@statement}{
\pdfbookmark[0]{声明}{statement}
\vspace*{.5cm}
\begin{center}
\heiti\zihao{-2}\textbf{学位论文独创性声明}
\end{center}
\vskip .5cm
\par\swust@declare@text
\begin{flushright}
\vskip .5cm
论文作者签名:\makebox[5em]{}
日期:\makebox[3em]{}年\makebox[2em]{}月\makebox[2em]{}日
\end{flushright}
\vskip .5cm
\begin{center}
\heiti\zihao{-2}\textbf{学位论文版权使用授权声明}
\end{center}
\vskip .5cm
\par\swust@warranty@text
\begin{flushright}
\vskip .5cm
论文作者签名:\makebox[5em]{}
日期:\makebox[3em]{}年\makebox[2em]{}月\makebox[2em]{}日
\vskip .5cm
指导教师签名:\makebox[5em]{}
日期:\makebox[3em]{}年\makebox[2em]{}月\makebox[2em]{}日
\end{flushright}
}
\renewcommand{\maketitle}{
\newgeometry{
top=3cm,bottom=3cm,
left=3cm,right=2.5cm,
headheight=2cm, footskip=.5cm,
}
\pagestyle{empty}
\pdfbookmark[0]{封面}{titlepage}
\swust@maketitle
\restoregeometry
}
\newcommand{\swust@zh@titlepage}{
\begin{titlepage}
\vspace*{1cm}
\centering
\songti\zihao{4}
\begin{tabular}{rp{7cm}rl}
分类号: & \swust@classified & 学校代码:& 10619 \\
UDC: & \swust@udc & 密级:& \swust@secret \\
\end{tabular}
\vskip 2cm
\zihao{-2}\textbf{\swust@zh@thesis@name}
\vskip .5cm
\zihao{4}\songti\swust@zhdegree
\vskip 2cm
\zihao{2}\heiti\swust@zhtitle
\vskip 2cm
\zihao{3}\songti\swust@zhauthor
\vskip 4cm
\zihao{4}\songti
\begin{tabular}{rc}
\makebox[12em][s]{指导教师姓名、职称:} & \swust@zhadvisor \\
\makebox[12em][s]{学科(专业)或领域名称:} & \swust@zhmajor \\
\makebox[12em][s]{学生所属学院:} & \swust@zhacademy \\
\makebox[12em][s]{论文答辩日期:} & \swust@zhdate \\
\end{tabular}
\end{titlepage}
}
\newcommand{\swust@en@titlepage}{
\begin{titlepage}
\vspace*{1cm}
\centering
\zihao{3}\swust@en@thesis@name
\vskip .5cm
\zihao{-4}\swust@endegree
\vskip 2cm
\zihao{-2}\swust@entitle
\vskip 5cm
\zihao{-3}
\begin{tabular}{rl}
Candidate: & \swust@enauthor \\
Supervisor: & \swust@enadvisor \\
\end{tabular}
\vskip 6cm
\zihao{-4}
\swust@endate
\end{titlepage}
}
\ifswust@opt@bachelor
\newcommand{\swust@maketitle}{
\begin{titlepage}
\vspace*{1cm}
\begin{minipage}{3cm}
\includegraphics[width=3cm]{figures/swust_logo_fig}
\end{minipage}
\begin{minipage}{4cm}
\begin{tabular}{c}
\includegraphics[width=9cm]{figures/swust_logo_text} \\
\zihao{3}Southwest University of Science and Technology \\
\end{tabular}
\end{minipage}
\centering
\vspace{2cm}
\heiti\zihao{-0}{本科毕业设计(论文)} \\
\vspace{3cm}
\zihao{2}\swust@zhtitle\\
\vspace{3cm}
\zihao{-3}
\begin{tabular}{cc}
\makebox[4em][s]{学院名称} & \swust@underline[16em]{\swust@zhacademy} \\
\makebox[4em][s]{专业名称} & \swust@underline[16em]{\swust@zhmajor} \\
\makebox[4em][s]{学生姓名} & \swust@underline[16em]{\swust@zhauthor} \\
\makebox[4em][s]{学号} & \swust@underline[16em]{\swust@stuid} \\
\makebox[4em][s]{指导教师} & \swust@underline[16em]{\swust@zhadvisor} \\
\end{tabular}\\
\vspace{3cm}
\swust@zhdate
\end{titlepage}
}
\else
\newcommand{\swust@maketitle}{
\begin{titlepage}
\vspace*{2cm}
\centering
\zihao{-2}\textbf{\swust@zh@thesis@name}
\vskip .5cm
\songti\zihao{-4}\swust@zhdegree
\vskip 3cm
\heiti\zihao{2}\swust@zhtitle
\vskip 4cm
\songti\zihao{3}\swust@zhauthor
\vskip 0cm
\swust@stuid
\vskip 7cm
\zihao{-4}\swust@zhdate
\end{titlepage}
\swust@zh@titlepage\cleardoublepage
\swust@en@titlepage\cleardoublepage
\swust@make@statement\cleardoublepage
}
\fi
\ifswust@opt@bachelor
\newenvironment{zhabstract}{
\begin{center}
\vspace*{2ex}
\pdfbookmark[0]{摘要}{zhabstract}
\zihao{-1}\heiti\swust@zhtitle
\vspace{1ex}
\end{center}
{
\noindent\zihao{-4}\heiti 摘要:
}
}{}
\else
\newenvironment{zhabstract}{
\chapter[摘要]{摘\zhspace 要}
}{}
\fi
\ifswust@opt@bachelor
\newenvironment{enabstract}{
\newpage
\begin{center}
\vspace*{2ex}
\pdfbookmark[0]{Abstract}{enabstract}
\zihao{-1}\textbf{\swust@entitle}
\vspace{1ex}
\end{center}
\noindent\zihao{-4}\textbf{Abstract: }
}{}
\else
\newenvironment{enabstract}{
\chapter[Abstract]{ABSTRACT}
}{}
\fi
\ifswust@opt@bachelor
\newcommand{\zhkeywords}[2][\zihao{-4}]{
\par\phantom{关键词}\par\noindent
{
#1{\heiti 关键词: }#2
}
}
\else
\newcommand{\zhkeywords}[2][\zihao{5}]{
\par\phantom{关键词}\par\noindent
{
#1\textbf{关键词:}#2
}
}
\fi
\ifswust@opt@bachelor
\newcommand{\enkeywords}[2][\zihao{-4}]{
\par\phantom{keywords}\par\noindent
{
#1\textbf{Key words: }#2
}
}
\else
\newcommand{\enkeywords}[2][\zihao{5}]{
\par\phantom{keywords}\par\noindent
{
#1\textbf{KEY WORDS: }#2
}
}
\fi
\RequirePackage{ccaption}
\captiondelim{\hspace{1\ccwd}}
\captionnamefont{\zihao{5}\bf}
\captiontitlefont{\zihao{5}\bf}
\setlength{\abovecaptionskip}{6bp}
\RequirePackage{amsmath}
\numberwithin{table}{chapter}
\numberwithin{figure}{chapter}
\renewcommand{\thetable}{\thechapter-\arabic{table}}
\renewcommand{\thefigure}{\thechapter-\arabic{figure}}
\RequirePackage{graphicx}
\graphicspath{{./}{figures/}}
\RequirePackage[numbers,super,sort&compress]{natbib}
\bibpunct{[}{]}{,}{s}{}{,}
\setlength{\bibsep}{0.5ex}
\newcommand{\inlinecite}[1]{
\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup
}
\renewcommand{\thebibliography}[1]{
\if@openright\cleardoublepage\else\clearpage\fi
\@mainmatterfalse
\chapter{\bibname}
\list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}
}
\newenvironment{acknowledgements}{
\chapter{致谢}
}{}
\newenvironment{publications}{
\chapter{攻读学位期间取得的研究成果}
}{}
\endinput
%%
%% End of file `swustthesis.cls'.