This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
XDBAthesis.cls
458 lines (419 loc) · 15.8 KB
/
XDBAthesis.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
%% This program is a LaTeX class file for bachelor thesis template
%% of Xidian university , built with the CTeX 2.9.0, writen with
%% WinEdt 6.0.
%%
%% Copyright \copyright\ 2010 Xue-Jilong @ xidian
%% $Xue-Jilong [email protected], v0.2, 2011/04/01$
%%
%% This library is free software; you can redistribute it and/or
%% modify it under the terms of the GNU Lesser General Public
%% License as published by the Free Software Foundation; either
%% version 2.1 of the License, or (at your option) any later version.
%%
%% This library is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%% Lesser General Public License for more details.
%%
%% You should have received a copy of the GNU Lesser General Public
%% License along with this library; if not, write to the Free Software
%% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
%% ----------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{XDBAthesis}[2011/03/20 v0.1 XDBAthesis document class]
\newif\ifXDBA@typeinfo \XDBA@typeinfotrue
\DeclareOption{notypeinfo}{\XDBA@typeinfofalse}
\newif\ifXDBA@dvips \XDBA@dvipsfalse
\newif\ifXDBA@master \XDBA@masterfalse
\newif\ifXDBA@bachelor \XDBA@bachelortrue
\DeclareOption{dvips}{\XDBA@dvipstrue}
\DeclareOption{dvipdfm}{\XDBA@dvipsfalse}
\DeclareOption{pdftex}{\XDBA@dvipsfalse}
\DeclareOption{xetex}{\XDBA@dvipsfalse}
\DeclareOption{master}{\XDBA@mastertrue\XDBA@bachelorfalse}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions
% 2.4版本以上的fontspec需要在定义字体时设置字号,触发\CTEXsetfont。
% CTEX包中设置中文字体的命令要早于\CTEX@spaceChar的定义,而可能使用
% \CTEX@spaceChar的宏\CTEXsetfont则在\CTEX@spaceChar之前定义。详细
% 见issue #12。
% 这只是一个临时的补丁,需要等待CTEX推出2.0版本。
\expandafter\def\csname CTEX@spaceChar\endcsname{\hspace{1em}}
\LoadClass[cs4size,a4paper,fancyhdr,fntef]{ctexbook}[2005/11/25]
\ifXDBA@bachelor
%% set line spacing 1.5times,1.24*14.5=18pt
\renewcommand{\baselinestretch}{1.62}
\else
\setlength{\baselineskip}{20pt}
\setlength{\jot}{-2pt}
\fi
% breaks long urls
\PassOptionsToPackage{hyphens}{url}
% fix bullet for xetex with adobe font
%\ifxetex
%\renewcommand{\labelitemi}{\LARGE$\textbullet$}
%\fi
% set equation numer as (1-5)
\renewcommand{\theequation}{\thechapter-\arabic{equation}}
%% check pdfTeX mode
\RequirePackage{ifpdf}
%% check XeLaTeX mode
\RequirePackage{ifxetex}
%% math packages
\RequirePackage{amsmath,amsthm,amsfonts,amssymb,bm}
%% modify caption
\RequirePackage[font=small,labelsep=space]{caption}
%% modity tabs
\RequirePackage{booktabs,tabularx}
%% graphics packages
\RequirePackage{graphicx}
%% sort and compress citations
\RequirePackage[square,sort&compress,numbers,super]{natbib}
%% for dashedUnderline
\RequirePackage{ulem}
%% packages and settings depend on PDF mode
\ifpdf % We're running pdfTeX in PDF mode
\RequirePackage[pdftex]{hyperref}
\DeclareGraphicsExtensions{.pdf,.eps,.mps,.jpg,.png}
\else % We're not running pdfTeX, or running pdfTeX in DVI mode
\ifXDBA@dvips
\RequirePackage[dvips]{hyperref}
\RequirePackage{psfrag}
\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}} % GBK -> Unicode
\fi
\ifxetex
\RequirePackage{hyperref}
\else
\RequirePackage[dvipdfm]{hyperref}
\fi
\DeclareGraphicsExtensions{.eps,.ps,.mps,.pdf,.jpg,.png}
\fi
\hypersetup{CJKbookmarks,%
bookmarksnumbered,%
plainpages=false,%
%colorlinks,
%citecolor=black,
%filecolor=black,
%linkcolor=black,
%urlcolor=black,
hidelinks,
pdfstartview=FitH }
\ifxetex
\RequirePackage[T1]{fontenc}
\fi
\AtEndOfPackage{\makeatletter\input{XDBAthesis.cfg}\makeatother}
\RequirePackage{times} % set english fonts to Times New Roman
%% set margin with left:3cm,right:2cm,up:3cm,down:2cm
\oddsidemargin 1.46 true cm
\evensidemargin -0.54 true cm
\topmargin -0.54 true cm
\headheight 12.9pt
\headsep 17.3527pt
\textheight 24.7 true cm
\textwidth 15 true cm
\footskip 0 cm
\parskip 0.5ex plus 0.25ex minus 0.25ex
%\makeatletter
%\def\tagform@#1{\maketag@@@{\ignorespaces[#1]\unskip\@@italiccorr}}
%\makeatother
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
%\thispagestyle{empty}
\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\renewcommand{\floatpagefraction}{0.80}
\bibliographystyle{plain}
\newcommand\XDBAspace{\protect\CTEX@spaceChar\protect\CTEX@spaceChar}
\newcommand\XDBAquad{\protect\CTEX@spaceChar}
\def\XDBA@getfileinfo#1 #2 #3\relax#4\relax{%
\def\XDBAfiledate{#1}%
\def\XDBAfileversion{#2}%
\def\XDBAfileinfo{#3}}%
%this paragraph maybe confused, i didn't understand
\expandafter\ifx\csname [email protected]\endcsname\relax
\edef\reserved@a{\csname ver@ctextemp_XDBAthesis.cls\endcsname}
\else
\edef\reserved@a{\csname [email protected]\endcsname}
\fi
\expandafter\XDBA@getfileinfo\reserved@a\relax? ? \relax\relax
%% define the underline
\def\XDBA@underline[#1]#2{%
\underline{\hbox to #1{\hfill#2\hfill}}}
\def\XDBAunderline{\@ifnextchar[\XDBA@underline\underline}
\def\XDBA@dashuline[#1]#2{%
\dashuline{\hbox to #1{\hfill#2\hfill}}}
\def\XDBAdashuline{\@ifnextchar[\XDBA@dashuline\dashuline}
%% define the bookface
\newcommand\schoolnumber[1]{\def\XDBA@value@schoolnumber{#1}}
\renewcommand\title[2]{\def\XDBA@value@title{#1} \def\XDBA@value@resttitle{#2}}
\newcommand\major[1]{\def\XDBA@value@major{#1}}
\renewcommand\author[1]{\def\XDBA@value@author{#1}}
\newcommand\advisor[1]{\def\XDBA@value@advisor{#1}}
\ifXDBA@bachelor
\newcommand\class[1]{\def\XDBA@value@class{#1}}
\newcommand\college[1]{\def\XDBA@value@college{#1}}
\else
\newcommand\entitle[2]{\def\XDBA@value@entitle{#1} \def\XDBA@value@enresttitle{#2}}
\newcommand\identifier[1]{\def\XDBA@value@identifier{#1}}
\newcommand\classnumber[1]{\def\XDBA@value@classnumber{#1}}
\newcommand\classification[1]{\def\XDBA@value@classification{#1}}
\newcommand\majorclass[1]{\def\XDBA@value@majorclass{#1}}
\renewcommand\date[1]{\def\XDBA@value@date{#1}}
\fi
\renewcommand\maketitle{%
\cleardoublepage
\thispagestyle{empty}
\ifXDBA@bachelor
\begin{flushright}
\bfseries\songti\zihao{-4}
\XDBA@label@class~ \XDBAunderline[100pt]{\XDBA@value@class}\\
\XDBA@label@schoolnumber~ \XDBAunderline[100pt]{\XDBA@value@schoolnumber}
\end{flushright}
\begin{center}
\vskip \stretch{2}
\includegraphics[width=9cm]{xd1}
\vskip \stretch{1}
{\heiti\zihao{0}\ziju{0.25} \XDBA@label@thesis}
\vskip \stretch{2}
\includegraphics[width=5cm]{xd2}
\vskip \stretch{2}
\heiti\zihao{3} \XDBA@label@title~ \XDBAunderline[250pt]{~\XDBA@value@title~}
\vskip \stretch{0.5}
\XDBAspace\XDBAspace~\XDBAunderline[250pt]{~\XDBA@value@resttitle}
\vskip \stretch{0.5}
\heiti\zihao{3} \XDBA@label@college~
\songti\zihao{-3}\XDBAunderline[250pt]{~\XDBA@value@college~}
\vskip \stretch{0.5}
\heiti\zihao{3} \XDBA@label@major~
\songti\zihao{-3}\XDBAunderline[250pt]{~\XDBA@value@major~}
\vskip \stretch{0.5}
\heiti\zihao{3} \XDBA@label@author~
\songti\zihao{-3}\XDBAunderline[250pt]{~\XDBA@value@author~}
\vskip \stretch{0.5}
\heiti\zihao{3} \XDBA@label@advisor~
\songti\zihao{-3}\XDBAunderline[250pt]{~\XDBA@value@advisor~}
\end{center}
\fi
\ifXDBA@master
\setlength{\baselineskip}{24pt}
{ \bfseries\heiti\zihao{5}\noindent
\XDBA@label@identifier\XDBAdashuline[4.45cm]{\XDBA@value@identifier}\hspace*{1cm}
\XDBA@label@schoolnumber\XDBAdashuline[4.45cm]{\XDBA@value@schoolnumber}\\
\XDBA@label@classnumber\XDBAdashuline[4.45cm]{\XDBA@value@classnumber}\hspace*{1cm}
\XDBA@label@classification\XDBAdashuline[4.45cm]{\XDBA@value@classification}
\vskip \stretch{15}\bfseries\heiti\zihao{4}
\noindent\makebox[3.08cm][s]{\XDBA@label@title}\songti\XDBAdashuline[11.88cm]{\XDBA@value@title}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{}\XDBAdashuline[11.88cm]{\XDBA@value@resttitle}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{}\XDBAdashuline[11.88cm]{\XDBA@value@entitle}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{}\XDBAdashuline[11.88cm]{\XDBA@value@enresttitle}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{\heiti\zihao{4} \XDBA@label@author}
\songti\zihao{4}\XDBAdashuline[2.50cm]{\XDBA@value@author~}
\makebox[4.45cm][s]{\heiti\zihao{4} \XDBA@label@advisor}
\songti\zihao{4}\XDBAdashuline[4.46cm]{\XDBA@value@advisor~}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{\heiti\zihao{4} \XDBA@label@majorclass}
\songti\zihao{4}\XDBAdashuline[2.54cm]{\XDBA@value@majorclass}
\makebox[2.54cm][s]{\heiti\zihao{4} \XDBA@label@major}
\songti\zihao{4}\XDBAdashuline[6.3cm]{\XDBA@value@major~}
\vskip \stretch{0.3}
\noindent\makebox[3.08cm][s]{\heiti\zihao{4} \XDBA@label@date}
\kaishu\zihao{4}\XDBAdashuline[11.68cm]{\XDBA@value@date~}
\vskip \stretch{0.3}
\makebox[1cm]{}
\setlength{\baselineskip}{20pt}
}
\fi
\clearpage
\if@twoside
\thispagestyle{empty}
\ifXDBA@typeinfo
\vspace*{\stretch{1}}
\begin{footnotesize}
{\bfseries\noindent Contributers:}
\begin{description}
\item[HaoChen] write the statement page
\item[Olorin183795] bug report
\item[yzg3307] bug report
\end{description}
\noindent
Author by Xue-Jilong ( [email protected] ) and Justin-Wong ( [email protected] )\\
Typeset by \LaTeXe{} and \CTeX{} and provide for Bachelor Thesis of Xidian University. \\
The first page will not appear in your final thesis paper. Take it easy for this copyright footnote. :-)
\end{footnotesize}
\fi
\cleardoublepage
\fi
}
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyhead{} % clear all header fields
\fancyhead[C]{\songti\zihao{5} \leftmark}
\fancyhead[LE,RO]{\songti\zihao{-5} ~\thepage~}
\renewcommand{\headrulewidth}{0.75 pt}%
}
\fancypagestyle{content}{%
\fancyhf{}
\fancyhead[CO]{\songti\zihao{5} \nouppercase \leftmark}
\fancyhead[CE]{\songti\zihao{5} \nouppercase {\XDBA@value@title\XDBA@value@resttitle}}
\fancyhead[LE,RO]{\songti\zihao{-5} ~\thepage~}
\renewcommand{\headrulewidth}{0.75pt}%
}
\fancypagestyle{tableOfContent}{%
\fancyhf{}
\fancyhead[CO]{\songti\zihao{5} \nouppercase \leftmark}
\fancyhead[CE]{\songti\zihao{5} \nouppercase \leftmark}
\fancyhead[LE,RO]{\songti\zihao{-5} ~\thepage~}
\renewcommand{\headrulewidth}{0.75pt}%
}
\fancypagestyle{front}{%
\fancyhf{}
\fancyhead{}
\fancyhead[C]{\songti\zihao{5} \leftmark}
\fancyhead[LE,RO]{}
\renewcommand{\headrulewidth}{0.75pt}%
}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CE]{\songti\zihao{5} \leftmark}
\fancyhead[LE,RO]{\songti\zihao{-5} ~\thepage~}
\renewcommand{\headrulewidth}{0.75 pt}%
\newenvironment{abstract}
{\NCchapter{\heiti\zihao{3} \XDBA@label@abstract}{\XDBA@label@abstract}}
{\pagestyle{front}\thispagestyle{front}}
\newcommand\keywords[1]{%
\vspace{2ex}\noindent{\heiti\zihao{-4} \XDBA@label@keywords} \heiti\zihao{-4}#1}
\newenvironment{englishabstract}
{\NCSchapter{\bfseries\zihao{3} \XDBA@label@englishabstract}{\XDBA@label@englishabstract}}
{\pagestyle{front}\thispagestyle{front}}
\newcommand\englishkeywords[1]{%
\vspace{2ex}\noindent{\bfseries\zihao{-4} \XDBA@label@englishkeywords} \bfseries\zihao{-4}#1}
\renewcommand\tableofcontents{%
\setcounter{page}{1}
\pagestyle{tableOfContent}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\NCchapter{\contentsname}{\contentsname}%
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
\thispagestyle{plain}
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
\addtocontents{toc}{\let\string\XDBA@spaceChar\relax}
\newcommand\NCSchapter[2]{%
\renewcommand{\chapter}{\if@openright\clearpage\else\clearpage\fi
\global\@topnum\z@ \@afterindentfalse \secdef\@chapter\@schapter}
\if@mainmatter%
\@mainmatterfalse%
\chapter*{#1} \chaptermark{#2}%
\@mainmattertrue%
\else
\chapter*{#1}\chaptermark{#2}%
\fi
}
\newcommand\NCchapter[2]{%
\if@mainmatter%
\@mainmatterfalse%
\chapter*{#1} \chaptermark{#2}%
\@mainmattertrue%
\else
\chapter*{#1}\chaptermark{#2}%
\fi
}
\newcommand\Nchapter[1]{%
\if@mainmatter%
\@mainmatterfalse%
\chapter[#1]{#1}%
\@mainmattertrue%
\else
\chapter[#1]{#1}%
\fi
}
\def\@dottedtocline#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{#4}\nobreak
\leaders\hbox{$\m@th\mkern 1.5mu\cdot\mkern 1.5mu$}\hfill
\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
\par}%
\fi}
\renewcommand*\l@part[2]{%
\ifnum \c@tocdepth >-2\relax
\addpenalty{-\@highpenalty}%
\addvspace{2.25em \@plus\p@}%
\setlength\@tempdima{3em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
{\leavevmode
\large \bfseries #1
\leaders\hbox{$\m@th\mkern 1.5mu\cdot\mkern 1.5mu$}
\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
\nobreak
\global\@nobreaktrue
\everypar{\global\@nobreakfalse\everypar{}}%
\endgroup
\fi}
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries\songti\zihao{-4}
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak
\leaders\hbox{$\m@th\mkern 1.5mu\cdot\mkern 1.5mu$}
\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\renewenvironment{thebibliography}[1]
{\Nchapter{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\renewenvironment{thanks}
{\Nchapter{\XDBA@label@thanks}}
{}
\setcounter{secnumdepth}{4}
\newtheoremstyle{break}% name
{}% Space above, empty = `usual value'
{}% Space below
{\itshape}% Body font
{}% Indent amount (empty = no indent, \parindent = para indent)
{\bfseries}% Thm head font
{.}% Punctuation after thm head
{\newline}% Space after thm head: \newline = linebreak
{}% Thm head spec
\endinput
%%
%% End of file `XDBAthesis.cls'.