-
Notifications
You must be signed in to change notification settings - Fork 3
/
swjtuThesis.cls
325 lines (283 loc) · 10.3 KB
/
swjtuThesis.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
%% start of file 'SWJTU_Thesis.cls'.
%% Copyright 2015
%% Original Author Limin HUANG.
%% 2015/01/30 v0.0, Begin of the projet, @Chengdu China
%% 2015/12/08 v1.0, Release of the projet, @Grenoble, France
%% 2020/06/01 v2.0, Revision by Hao WANG, @Chengdu, China
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
% 请注意:本文件已经定义好需要使用的参数,不建议用户更改。
%-------------------------------------------------------------------------------
% 标识
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{swjtuThesis}[2015/12/07 v1.0 Southwest Jiaotong University Thesis document class]
\typeout{Document Class `swjtuThesis' updated by cshaowang (cshaowang@gmail.com) (2020/06/01)}
%-------------------------------------------------------------------------------
% 宏包
%-------------------------------------------------------------------------------
% SWJTU_Thesis类基于ctexbook文档类制作
% 将文档类其他参数全部传递给 ctexbook 文档类。
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions\relax
% CJKfntef 宏包提供了 \makecover 中用到的 \CJKunderline 命令。
% fancyhdr 宏包提供了方便使用的命令用于设置页眉、页脚。
% cs4size 表示小四字号, 也指12pt.
\LoadClass[UTF8,fntef,fancyhdr,a4paper,cs4size]{ctexbook} %论文使用A4大小纸张,默认小四号字体
% 装载样式文件中使用的宏包
\RequirePackage[bookmarksnumbered,pdfstartview=XYZ]{hyperref}
\RequirePackage{graphicx}
\RequirePackage{setspace}
\RequirePackage{ifthen}
%-------------------------------------------------------------------------------
% 标题及版面格式(依照《西南交通大学研究生学位论文撰写规范》 附录)
%-------------------------------------------------------------------------------
% 版面上空25.4 mm,下空25.4 mm,左空 26.0 mm,右空 26.0 mm
%\RequirePackage{anysize}
%\papersize{29.7cm}{21.0cm}
%\marginsize{26.0mm}{26.0mm}{25.4mm}{25.4mm}
\RequirePackage{geometry}
\geometry{total={160mm,250mm}, top=25.4mm, bottom=25.4mm, left=26.0mm, right=26.0mm, includeheadfoot}
%%段落间距
%\setlength{\parskip}{3pt plus1pt minus2pt} % 段落之间的竖直距离
%%行间距
\setlength{\baselineskip}{20pt plus 2pt minus 2pt} %段落内的行距
%\renewcommand{\baselinestretch}{1.2} % 定义行距
%\linespread{1.35} % 设置行距
% 各章题序及标题:小2号黑体,题序和标题之间空一格,不加标点
\CTEXsetup[format = {\centering\zihao{-2}\heiti}, nameformat = {}, number = {~\arabic{chapter}~}, titleformat = {}, aftername = {\quad}]{chapter}
\CTEXsetup[beforeskip = {-20pt}, afterskip = {20pt plus 2pt minus 2pt}]{chapter}
% 各节的一级题序及标题:小3号黑体,题序和标题之间空一格,不加标点
\CTEXsetup[format = {\raggedright\zihao{-3}\heiti}, aftername = {\quad}]{section}
% 各节的二级题序及标题:4号黑体,题序和标题之间空一格,不加标点
\CTEXsetup[format = {\raggedright\zihao{4}\heiti}, aftername = {\quad}]{subsection}
% 各节的三级(及以下)题序、款、项:小4号黑体,缩进两字符与正文相同,题序需要自己加入
\CTEXsetup[format = {\raggedright\zihao{-4}\heiti}, indent = {2em}]{subsubsection}
% 目录格式:字体和缩进定义
\def\@dotsep{0.7}
\renewcommand*\l@chapter{\heiti\@dottedtocline{0}{0em}{3em}}
\renewcommand*\l@section{\songti\@dottedtocline{1}{1.75em}{2.05em}}
\renewcommand*\l@subsection{\songti\@dottedtocline{2}{2.5em}{2.5em}}
% 修改图和表的题注格式为 章-图表号
\renewcommand{\thefigure}{\thechapter-\arabic{figure}}
\renewcommand{\thetable}{\thechapter-\arabic{table}}
% 修改公式的编号格式为 章-公式号
\renewcommand{\theequation}{\thechapter--\arabic{equation}}
%-------------------------------------------------------------------------------
% 论文信息(题目、作者、导师、专业、图书信息等)
%-------------------------------------------------------------------------------
% 申请学位级别
\newcommand{\cDiscipline}[1]{\def\@cDiscipline{#1}}
\newcommand{\eDiscipline}[1]{\def\@eDiscipline{#1}}
% 论文中英题目
\newcommand{\cTitle}[1]{\def\@cTitle{#1}}
\newcommand{\eTitle}[1]{\def\@eTitle{#1}}
% 论文作者信息
\newcommand{\grade}[1]{\def\@grade{#1}}
\newcommand{\gradeN}[1]{\def\@gradeN{#1}}
\newcommand{\eAuthor}[1]{\def\@eAuthor{#1}}
\newcommand{\cMajor}[1]{\def\@cMajor{#1}}
\newcommand{\eMajor}[1]{\def\@eMajor{#1}}
% 论文导师信息
\newcommand{\cTutor}[1]{\def\@cTutor{#1}}
\newcommand{\eTutor}[1]{\def\@eTutor{#1}}
% 论文分类及时间
\newcommand{\CI}[1]{\def\@CI{#1}}
\newcommand{\UDC}[1]{\def\@UDC{#1}}
\newcommand{\secLevel}[1]{\def\@secLevel{#1}}
\newcommand{\cDate}[3]{\def\@cDate{\dateprint{#1}{#2}{#3}}}
\newcommand{\eDate}[3]{\def\@eDate{\dateprintE{#1}{#2}{#3}}}
%-------------------------------------------------------------------------------
% 页眉及页脚
%-------------------------------------------------------------------------------
% 文武线设计
\renewcommand{\headrule}{
\hrule width \hsize height 2pt \vspace{0.6pt} \hrule width \hsize height 0.5pt
}
\renewcommand{\footrule}{
\hrule width \hsize height 0.5pt \vspace{0.6pt} \hrule width \hsize height 2pt
}
% 自定义页眉
\newcommand{\thesispagestyle}[3]{
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{\zihao{-4}\heiti #2}
\fancyhead[OR,EL]{\zihao{-4}\heiti #3}
\fancyfoot[C]{}
\fancypagestyle{plain}{\pagestyle{fancy}}
}
%-------------------------------------------------------------------------------
% 封面设计
%-------------------------------------------------------------------------------
%为了使封面适应双面打印, 可使用\clearpagebyprint命令(同时类参数需指定为twoside)
\newcommand{\clearpagebyprint}{\if@twoside\cleardoublepage\else\clearpage\fi}
\newcommand{\CJKunderlinecolor}{\color{black}} % 颜色默认blue, 改为black
\newcommand{\fillinblank}[2]{\CJKunderline{\makebox[#1]{#2}}}
\newcommand{\makecover}{
\clearpagebyprint
\pagestyle{empty}
\begin{titlepage}
% 中文封面
\linespread{1}
\begin{flushleft}
{
\zihao{-4}
{\songti\cover@CI}\@CI\hfill{\songti\cover@secLevel}\@secLevel
\\
{\songti\cover@UDC}\@UDC
\\
}
\end{flushleft}
\linespread{1.5}
\vspace{10mm}
\begin{center}
{
\zihao{2}
{\textbf{\songti\cover@cSchool}}\\
\vspace{3mm}
{\textbf{\songti\cover@cThesis}}
}
\vfill
{
\zihao{2}
\linespread{1.3}\selectfont
\makebox[0pt]{
\begin{minipage}{18em}
\centering\heiti\@cTitle
\end{minipage}
}
}
\vfill
{
\zihao{3}
\linespread{1.75}\selectfont
\begin{tabular}{l@{\extracolsep{0.2em}}c}
{\songti\cover@grade} & \fillinblank{10em}{\@grade}
\\
{\songti\cover@author} & \fillinblank{10em}{\@author}
\\
{\songti\cover@cDiscipline} & \fillinblank{10em}{\@cDiscipline\fitDegree}
\\
{\songti\cover@cMajor} & \fillinblank{10em}{\@cMajor}
\\
{\songti\cover@cTutor} & \fillinblank{10em}{\@cTutor}
\end{tabular}
}
\vfill
{
\zihao{3}
{\songti\@cDate}
}
\end{center}
% 英文封面
\clearpagebyprint
\linespread{1}
\begin{flushleft}
\zihao{-4}
{\cover@eCI}\@CI
\\
{\cover@eUDC}\@UDC
\\
\end{flushleft}
\linespread{1.5}
\vspace{10mm}
\begin{center}
{
\zihao{-2}
{\cover@eSchool}\\
\vspace{3mm}
{
\ifdegreedoctor
{\cover@eThesisD}
\else
{\cover@eThesisM}
\fi
}
}
\vfill
{
\zihao{2}
\linespread{1.3}\selectfont
\makebox[0pt][c]{
\begin{minipage}[c]{23em}
\centering\@eTitle
\end{minipage}
}
}
\vfill
{
\zihao{3}
\linespread{1.75}\selectfont
\begin{tabular}{r@{\extracolsep{0.2em}}l}
{\cover@eGrade} & {\@gradeN}
\\
{\cover@eAuthor} & {\@eAuthor}
\\
{\cover@eDiscipline} & {\eDegree\@eDiscipline}
\\
{\cover@eMajor} & {\@eMajor}
\\
{\cover@eTutor} & {\@eTutor}
\end{tabular}
}
\vfill
{
\zihao{3}
{\@eDate}
}
\end{center}
% 加载学位论文版权使用授权书
\include{preface/copyright}
% 加载学位论文主要工作(贡献)声明
\ifdegreedoctor
\include{preface/statementDoctor}
\else
\include{preface/statementMaster}
\fi
\end{titlepage}
}
%-------------------------------------------------------------------------------
% 中、英文摘要格式定义
%-------------------------------------------------------------------------------
\newcommand{\baseabstract}[4]{
\chapter*{#1}
%\addcontentsline{toc}{chapter}{#1}
#3
\vspace{0.5cm}
{\noindent \zihao{-4}{#2}#4}
}
% 中文摘要
\newcommand{\cabstract}[2]{
\baseabstract{\other@cabstract}{\heiti\other@keywords}{#1}{#2}
}
% 英文摘要
\newcommand{\eabstract}[2]{
\baseabstract{\bf Abstract}{\bf Key words: }{#1}{#2}
}
%-------------------------------------------------------------------------------
% 文章、专利、项目列设计(参考哈工大模板)
%-------------------------------------------------------------------------------
% 定义新计数器
\newcounter{pubctr}
% 定义新环境
\newenvironment{publist}{
\begin{list}{[\arabic{pubctr}]} %%标签格式
{
\usecounter{pubctr}
\setlength{\leftmargin}{1.7em} % 左边界 \leftmargin =\itemindent + \labelwidth + \labelsep
\setlength{\itemindent}{0em} % 标号缩进量
\setlength{\labelsep}{0.5em} % 标号和列表项之间的距离,默认0.5em
\setlength{\rightmargin}{0em} % 右边界
\setlength{\topsep}{0ex} % 列表到上下文的垂直距离
\setlength{\parsep}{0ex} % 段落间距
\setlength{\itemsep}{0.5ex} % 标签间距
\setlength{\listparindent}{0pt} % 段落缩进量
}}
{\end{list}}
%-------------------------------------------------------------------------------
% 加载字符串配置文件
%-------------------------------------------------------------------------------
\AtEndOfClass{\input{swjtuThesis.cfg}}
\endinput
%% end of file `SWJTU_Thesis.cls'.