-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNPUthesis.cls
279 lines (258 loc) · 7.02 KB
/
NPUthesis.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
% !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{NPUthesis}[2013/05/31 2.0.0 NPU Thesis Template]
%------待解决------
%chapter不另起一页,直接接在上文的后面。
%------待解决------
%------chstyle------
\newif\ifchsstyle\chsstyletrue
\DeclareOption{chsstyle}{\chsstyletrue}
\DeclareOption{nochsstyle}{\chsstylefalse}
%------chstyle------
%------print------
\newif\ifprint\printfalse
\newif\ifdprint\dprintfalse
\DeclareOption{noprint}{\dprintfalse\printfalse}
\DeclareOption{print}{\printtrue}
\DeclareOption{dprint}{\dprinttrue\printtrue}
\ProcessOptions\relax
\ifdprint\relax\else
\PassOptionsToClass{openany}{book}
\fi
%------print------
\LoadClass[a4paper, 12pt]{book}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{ctexcap}}
\ExecuteOptions{noprint,chsstyle} %默认参数
\ProcessOptions\relax
%------中文支持------
\RequirePackage[noindent,nocap,UTF8]{ctexcap}
%----字体名
\RequirePackage{ifpdf,ifxetex}
\ifpdf
\newcommand{\nwpulogo}{\heiti}
\else
\newCJKfontfamily{\nwpulogo}{nwpulogo}
\fi
%------中文支持------
%------行距------
\linespread{1.25}
\addtolength{\parskip}{.3em}
%------行距------
%------页面设置------
\ifdprint
\newcommand{\GeoOptions}{left=3.75cm, right=2.75cm, top=3cm, bottom=3cm}
\else
\newcommand{\GeoOptions}{left=2.75cm, right=2.75cm, top=3cm, bottom=3cm}
\fi
\RequirePackage[\GeoOptions]{geometry}
%------页面设置------
%------页眉页脚------
\RequirePackage{fancyhdr}
%----清除设置----
\pagestyle{fancyplain}
\fancyhf{}
%----清除设置----
%----页眉划线----
%\renewcommand{\headrulewidth}{\textwidth}
%\renewcommand{\headwidth}{.5pt}
\newcommand{\makeheadrule}{%
\makebox[0pt][l]{\rule[.7\baselineskip]{\headwidth}{0.5pt}}%
%\rule[0.85\baselineskip]{\headwidth}{1.5pt}\vskip-.8\baselineskip
}
\makeatletter
\renewcommand{\headrule}{%
{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\makeheadrule}}
\makeatother
%----页眉划线----
%----眉脚内容----
\pagestyle{fancy}
\fancyhf{}
\ifchsstyle
\chead{\zihao{5}{\nwpulogo{}西北工业大学}~\heiti{}本科毕业设计论文}
\else
\chead{\small Northwestern Polytechnic University Bachelor Thesis}
\fi
\cfoot{--{~\thepage~}--}
%----眉脚内容----
%------页眉页脚------
%------数学支持------
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{amsbsy}
\RequirePackage{bm}
\RequirePackage{mathrsfs}
\newcommand*{\me}{\ensuremath{\mathrm{e}}} %自然对数的底
\newcommand*{\mi}{\ensuremath{\mathrm{i}}} %虚数单位
\newcommand*{\dif}{\ensuremath{\,\mathrm{d}}} %微分算子
\DeclareMathAlphabet{\mathsfsl}{OT1}{cmss}{m}{sl}
\newcommand*{\VEC}[1]{\ensuremath{\boldsymbol{#1}}} %向量
\newcommand*{\MATRIX}[1]{\ensuremath{\mathsfsl{#1}}} %矩阵名称
\newcommand*{\TENSOR}[1]{\ensuremath{\mathsfsl{#1}}} %张量名称
\newcommand*{\HUA}[1]{\ensuremath{\mathscr{{#1}}}} %输出花体字母
\newcommand*{\SHUANG}[1]{\ensuremath{\mathbb{{#1}}}} %输出双线字母
\numberwithin{equation}{chapter} %公式编号随section变化
\renewcommand{\theequation}{\thechapter{}--\arabic{equation}}
%------数学支持------
%------图表支持------
\RequirePackage{graphicx}
%----图档搜索路径----
\graphicspath{{figures/}{figure/}{pictures/}{picture/}{pic/}{pics/}}
%----图档搜索路径----
\RequirePackage{booktabs}
%%----表格行距----
%\renewcommand\arraystretch{1.3}
%%----表格行距----
%----编号----
\RequirePackage{amsmath}
\numberwithin{figure}{chapter}
\renewcommand{\thefigure}{\thechapter{}--\arabic{figure}}
\numberwithin{table}{chapter}
\renewcommand{\thetable}{\thechapter{}--\arabic{table}}
%----编号----
%----不浮动----
\makeatletter
\newcommand{\figcaption}{\def\@captype{figure}\caption}
\newcommand{\tabcaption}{\def\@captype{table}\caption}
\makeatother
%----不浮动----
%------图表支持------
%------交叉引用------
\RequirePackage{hyperref}
\hypersetup{unicode}
\hypersetup{colorlinks=true}
\hypersetup{linkcolor=black}
\ifprint
\hypersetup{allcolors=black}
\else\relax\fi
%------交叉引用------
%------参考文献------
\newcommand{\upcite}[1]{\textsuperscript{\cite{#1}}}
%------参考文献------
%------摘要环境------
\newcommand\enabstractname{ABSTRACT}
\newcommand\enkeywordsname{Key words}
\newcommand\enkeywords[1]{\vspace{1cm}\noindent{\bfseries\zihao{-4}\enkeywordsname: }#1}
\newenvironment{enabstract}{%
\newpage
\centering
\begin{minipage}{\textwidth}
% \centerline{\zihao{-3}\bfseries\enabstractname}
\chapter*{\enabstractname}
\addcontentsline{toc}{chapter}{\enabstractname}
\vspace{.3cm}
\centering
\begin{minipage}{\textwidth}
\setlength{\parindent}{1.2em}
}{
\end{minipage}
\end{minipage}
\clearpage
}
\newcommand\cnabstractname{摘\quad要}
\newcommand\cnkeywordsname{关键词}
\newcommand\cnkeywords[1]{\vspace{1cm}\noindent{\bfseries\zihao{-4}\cnkeywordsname: }#1}
\newenvironment{cnabstract}{%
\newpage
\centering
\begin{minipage}{\textwidth}
% \centerline{\zihao{-3}\bfseries\cnabstractname}
\chapter*{\cnabstractname}
\addcontentsline{toc}{chapter}{\cnabstractname}
\vspace{.3cm}
\centering
\begin{minipage}[c]{\textwidth}
\setlength{\parindent}{2em}
\zihao{-4}
}{
\end{minipage}
\end{minipage}
\clearpage
}
%------摘要环境------
%------中文风格------
\ifchsstyle
%----标题与日期----
\CTEXoptions[figurename={图},tablename={表},bibname={参考文献},contentsname={目\quad{}录}]
\CTEXoptions[today=small]
%----标题与日期----
%----章节样式----
%--chapter
\CTEXsetup[name={第,章}]{chapter}
\CTEXsetup[number={\chinese{chapter}}]{chapter}
\CTEXsetup[format={\centering}]{chapter}
\CTEXsetup[nameformat={\bfseries\zihao{3}}]{chapter}
\CTEXsetup[titleformat={\bfseries\zihao{3}}]{chapter}
\CTEXsetup[aftername={\quad}]{chapter}
\CTEXsetup[beforeskip={10pt}]{chapter}
\CTEXsetup[afterskip={10pt}]{chapter}
%--section
%\CTEXsetup[name={$\S$\,,}]{section}
\CTEXsetup[format={\bfseries\flushleft\zihao{4}}]{section}
%--subsection
\CTEXsetup[format={\bfseries\flushleft\zihao{-4}}]{subsection}
%--subsubsection
\CTEXsetup[format={\flushleft\zihao{-4}}]{subsubsection}
%--appendix
\CTEXsetup[name={附录~}]{appendix}
\CTEXsetup[number={\Alph{chapter}}]{appendix}
%----章节样式----
%----首行缩进----
\RequirePackage{indentfirst}
%----首行缩进----
\else\relax\fi
%------中文风格------
%------封面------
\input{NPUthesis-front-cover.def}
%------封面------
%------声明------
\input{NPUthesis-statement.def}
%------声明------
%------Make------
\newcommand{\maketitlepagestatement}{%
\maketitlepage
\thispagestyle{empty}
~
\vfill\eject
\thispagestyle{empty}
\makestatement
\vfill\eject
\thispagestyle{empty}
~
\vfill\eject
\setcounter{page}{1}
}
\newcommand{\maketableofcontents}{%
\pagenumbering{Roman}
\tableofcontents
\ifdprint
\cleardoublepage
\else
\clearpage
\fi
\pagenumbering{arabic}\setcounter{page}{1}
}
%------Make------
\endinput
%------载入宏包------
%--中文支持
ctex
%--页面设置
geometry
%--页眉页脚
fancyhdr
%--数学支持
amsmath
amsfonts
amsthm
amssymb
amsbsy
bm
mathrsfs
%--图表
graphicx
booktabs
amsmath
%------载入宏包------