-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcucthesis.cls
437 lines (322 loc) · 12.2 KB
/
cucthesis.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
% Author: Yang Liu
% Email: [email protected]
% License: LaTeX Project Public License v1.3c
% Date: May 08, 2021
\ProvidesClass{cucthesis}[2021/05/08 v0.22 Thesis Class of Communication University of China]
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\RequirePackage{calc}
\SetupKeyvalOptions{family=CUC, prefix=CUC@, setkeys=\kvsetkeys}
\newcommand{\ckv}[1]{\kvsetkeys{CUC}{#1}}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessKeyvalOptions*\relax
\LoadClass{article}
% 设置纸张格式
\RequirePackage[
a4paper,
left=2.5cm,right=2.3cm,top=2.3cm,bottom=2.74cm,
headheight=10cm,
headsep=0.3cm,footskip=0.65cm]{geometry}
\setlength{\headsep}{0.6cm}
\RequirePackage{amsthm,amsmath,amssymb,indentfirst,booktabs,multicol,multirow,xcolor,graphicx,fancyhdr,hologo}
% 设置目录与引用的超链接(需要编译多次)
\RequirePackage{hyperref}
\hypersetup{
pdfborder={0 0 0},
colorlinks=false,linkcolor={blue},urlcolor={blue},filecolor={blue},citecolor={blue},
linktoc=all,
}
%%%%%%%%%%%%%%%%%%%%%% 字体与段落 %%%%%%%%%%%%%%%%%%%%%%
\PassOptionsToPackage{no-math}{fontspec}
\RequirePackage[UTF8,scheme=plain]{ctex}
\setmainfont{Times New Roman}
% 1.5倍行距
% https://github.com/TheNetAdmin/zjuthesis/issues/125
\linespread{1.50}\selectfont
% 段落缩进2字符
\setlength\parindent{2\ccwd}
%%%%%%%%%%%%%%%%%%%%%% 引用格式 %%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{gbt7714}
\bibliographystyle{gbt7714-numerical}
\setlength{\bibsep}{0.0pt}
\def\bibfont{\zihao{5}}
\renewcommand\refname{参考文献}
\renewcommand\figurename{图}
\renewcommand\tablename{表}
\RequirePackage{caption}
\DeclareCaptionLabelSeparator{onespace}{~~}
\captionsetup[table]{skip=8pt,labelsep=onespace}
\captionsetup[figure]{skip=8pt,labelsep=onespace}
\renewcommand{\captionfont}{\songti\zihao{5}}
% 图表与公式编号
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
\renewcommand{\thefigure}{\arabic{section}-\arabic{figure}}
\renewcommand{\thetable}{\arabic{section}-\arabic{table}}
\renewcommand{\theequation}{\arabic{section}-\arabic{equation}}
\renewcommand{\appendix}{
\renewcommand\figurename{附图}
\renewcommand\tablename{附表}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\thetable}{\arabic{table}}
}
%\setlength{\belowcaptionskip}{0.5\ccwd}
%\setlength{\abovecaptionskip}{0.5\ccwd}
%%%%%%%%%%%%%%%%%%%%%% code style %%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{listings}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\lstdefinestyle{defaultstyle}{
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breaklines=true,
keepspaces=true,
tabsize=2,
frame=single,
}
\lstset{style=defaultstyle}
%%%%%%%%%%%%%%%%%%%%%% 摘要与关键词 %%%%%%%%%%%%%%%%%%%%%%
% 中文摘要命令
\renewenvironment{abstract}{
\clearpage\phantomsection
\begin{center}
% \vspace*{-10pt}
\vspace*{1.5cm}
\zihao{3}\heiti{\myTitleCH}
\vspace*{1cm}
\zihao{-3}\textbf{\heiti{摘~~~要}}
\vspace{8pt}
\end{center}
\begin{spacing}{1.7}\songti
\addcontentsline{toc}{section}{摘~~~要}
\zihao{-4}\ignorespaces
}{\end{spacing}}{\clearpage}
\newcommand{\keywords}[1]{\noindent\heiti{~\\[1\baselineskip]关键词:}\songti\zihao{-4} #1}
\newcommand{\maketitleEN}{
\zihao{-2}\textbf{\heiti\thesisTitleEN}
\vspace{2\ccwd}
\zihao{4}\yourNameEN
\vspace{1.5\ccwd}
}
\RequirePackage{setspace,titlesec,zhnumber,titletoc}
% 英文摘要命令
\newenvironment{abstractEN}{
\clearpage\phantomsection
\begin{center}
\vspace*{2cm}
\MakeUppercase{
% \maketitleEN % Extra command
\zihao{3}\textit{\myTitleEN}
}
\vspace*{1.5cm}
\zihao{4}\textbf{\heiti{ABSTRACT}}
\vspace{8pt}
\end{center}
\addcontentsline{toc}{section}{ABSTRACT}
\begin{spacing}{1.7}
\zihao{-4}\ignorespaces
}{\end{spacing}}
\newcommand{\keywordsEN}[1]{\noindent{\textbf{~\\[0.5\baselineskip]KEYWORDS:} }\textit{#1}}
%%%%%%%%%%%%%%%%%%%%%% 章节标题样式 %%%%%%%%%%%%%%%%%%%%%%
% 设置中文的标题样式
% \renewcommand{\thesection}{\zhnum{section}}
% \renewcommand{\thesubsection}{\zhnum{subsection}}
% \renewcommand{\thesection}{\section}
% \renewcommand{\thesubsection}{\subsection}
% \renewcommand{\thesubsubsection}{\arabic{subsubsection}}
\newcommand{\sectionbreak}{\clearpage}
\titleformat{\section}[block]{\vspace*{-5pt} \zihao{3} \heiti}
{\thesection}{2pt}{\vspace{8pt}}
\titleformat{\subsection}{\vspace*{-5pt} \zihao{4} \heiti}
{\thesubsection}{5pt}{}
\titleformat{\subsubsection}{\vspace*{-5pt} \zihao{-4} \heiti}
{\thesubsubsection}{5pt}{}
%%%%%%%%%%%%%%%%%%%%%% 目录样式 %%%%%%%%%%%%%%%%%%%%%%
\renewcommand\contentsname{\centerline{\zihao{3}{目~~~~录}}\vspace{0.8cm}}
\titlecontents{section}[0pt]{\bfseries \songti \zihao{4}}
{\thecontentslabel~}{}
{\titlerule*[0.7em]{.}\contentspage}
\titlecontents{subsection}[0\ccwd]{\heiti \zihao{-4}}
{\thecontentslabel~~}{}
{\titlerule*[0.9em]{.}\contentspage}
\titlecontents{subsubsection}[0\ccwd]{\songti \zihao{-4}}
{\thecontentslabel~~}{}
{\titlerule*[0.7em]{.}\contentspage}
%%%%%%%%%%%%%%%%%%%%%% 命令封装 %%%%%%%%%%%%%%%%%%%%%%
\newenvironment{references}{\clearpage\phantomsection\addcontentsline{toc}{section}{参考文献}}{\clearpage}
\fancypagestyle{CUCThesisMain}{
\fancyhf{}
\cfoot{\songti\zihao{-5}{\thepage}}
\renewcommand{\headrulewidth}{0pt}
}
% \titleformat{\section}[block]{\vspace*{-24pt} \centering \zihao{3} \heiti}
% {\thesection、}{0pt}{\vspace{1pt}}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\newcommand{\contentpage}{
\begin{spacing}{1.5}
\tableofcontents
\end{spacing}
\titleformat{\section}[block]{\vspace*{-5pt} \zihao{3} \heiti}
{\thesection }{4pt}{\vspace{8pt}}
\clearpage
% 设置页眉
\fancyhead{}
\fancyhf[EHR]{\zihao{-5}\ziju{0.08}\songti{\leftmark}}
\fancyhf[OHL]{\zihao{-5}\ziju{0.08}\songti{中国传媒大学本科毕业论文}}
\renewcommand{\headrulewidth}{1.0pt}
\pagenumbering{arabic}
\setcounter{page}{1}
}
\newcommand{\nonumsection}[1]{
\clearpage\phantomsection
\section*{#1}
\stepcounter{section}
\addcontentsline{toc}{section}{#1}
}
% 解决英文标题过长的问题,线的粗度设置为1pt
\RequirePackage{adjustbox}
\newlength\myheight
\newcommand\Mysavedprevdepth{}%
\newcommand\UnderlineCentered[3]{%
\begin{adjustbox}{minipage=[t]{\dimexpr#1\relax},gstore totalheight=\myheight,margin=0pt}%
\centering\leavevmode#3\par\xdef\Mysavedprevdepth{\the\prevdepth}%
\end{adjustbox}%
\hspace*{-\dimexpr#1\relax}%
\begin{adjustbox}{minipage=[t][\myheight]{\dimexpr#1\relax},margin=0pt}%
\vphantom{Eg}\lower\dimexpr#2\relax\hbox to\hsize{\leaders\hrule height 1pt\hfill\kern0pt}\par
\kern-\dimexpr#2\relax
\xleaders\vbox to\baselineskip {\vfill\hbox{\lower\dimexpr#2\relax\hbox to\hsize{\leaders\hrule height 1pt\hfill\kern0pt}}\kern-\dimexpr#2\relax}\vfill
\kern\Mysavedprevdepth
\end{adjustbox}%
}%
%%%%%%%%%%%%%%%%%%%%%% 封面 %%%%%%%%%%%%%%%%%%%%%%
\newcommand{\dunderline}[3][-6pt]{{
\setbox0=\hbox{#3}
\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}
}}
\newcommand{\infobox}[2]{
\hspace{2.3cm}\songti\zihao{4}\selectfont{#1~\textbf{\dunderline{1pt}{\makebox[7cm][c]{#2}}}}
}
\newcommand{\coverpage}{
\begin{titlepage}
\vspace*{-3pt}
\noindent
\zihao{-4}\songti{
分类号:\dunderline{0.6pt}{\makebox[4cm][c]{\hphantom{空白}}}\hfill \hfill
单位代码:\dunderline{0.6pt}{\makebox[4.5cm][c]{10033}}
}
\vspace*{0.5cm}
\noindent
\zihao{-4}\songti{
密\hphantom{空}级:\dunderline{0.6pt}{\makebox[4cm][c]{\hphantom{空白}}}\hfill \hfill
学\hphantom{空}\hphantom{空}号:\dunderline{0.6pt}{\makebox[4.5cm][c] {\studentID}}
}
\vspace*{2\ccwd}
\begin{figure}[h]
\centering
\includegraphics[width=10cm]{imgs/title.png}
% \caption{}
% \label{fig:title}
\end{figure}
\centering
\zihao{2}\songti{本科毕业论文}
\vspace{0.2cm}
\begin{figure}[h]
\centering
\includegraphics[width=2.8cm]{imgs/logo2.png}
% \caption{}
% \label{fig:title}
\end{figure}
% \zihao{-2}\textbf{\heiti\thesisTitle}
% \vspace{0.5cm}
\flushleft
\noindent
\zihao{3}\songti{
\textbf{中文论文题目:\dunderline{1pt}{\makebox[12cm][c]{\myTitleCH}}}
}
\flushleft
\vspace{0.7cm}
% 7pt 为下划线高度设置,根据中文论文题目的距离设置的
\noindent
\zihao{3}\songti{
\textbf{英文论文题目:\UnderlineCentered{12cm}{7pt}{\myTitleEN}}}
\vspace{0.5cm}
\begin{spacing}{2}
% \infobox{学\hphantom{空白}院}{\myDept}
% \infobox{专\hphantom{空白}业}{\myMajor}
% \infobox{班\hphantom{空白}级}{\myClass}
% \infobox{姓\hphantom{空白}名}{\myName}
% \infobox{指导教师}{\myMentor}
\infobox{申请人姓名:}{\myName}
\infobox{指导教师\hphantom{空}:}{\myMentor}
\infobox{专业名称\hphantom{空}:}{\myMajor}
\infobox{研究方向\hphantom{空}:}{\myClass}
\infobox{所在学院\hphantom{空}:}{\myDept}
\end{spacing}
\vspace{0.9cm}
% \centering
% \zihao{-2}\ziju{0.5}\textbf{\songti{中国传媒大学}}
% \zihao{-2}\ziju{0.5}\textbf{\songti{\zhtoday}}
\centering
\zihao{-3}\textbf{\songti{论文提交日期\dunderline{1pt}\disdate}}
\end{titlepage}
\pagestyle{CUCThesisMain}
\pagenumbering{Roman}
\setcounter{page}{1}
}
%%%%%%%%%%%%%%%%%%%%%% 独创性声明 %%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\statement}{
\clearpage\phantomsection
% \vspace*{-10pt}
% \vspace*{0cm}
\centerline{
\zihao{-2}\songti{中国传媒大学本科生毕业论文独创性声明}
}
\vspace*{1.5cm}
% \noindent
\zihao{-4}
\songti{
本人声明所呈交的毕业论文是本人在导师指导下进行的研究工作及取得的研究成果。除了文中特别加以标注和致谢的地方外,论文中不包含其他人已经发表或撰写过的研究成果,也不包含为获得\textbf{\dunderline{1pt}{中国传媒大学}}或其他教育机构的学位或证书而使用过的材料。与我一同工作的同志对本研究所做的任何贡献均已在论文中作了明确的说明并表示谢意。
}
\vspace{2cm}
\noindent
\zihao{-4}
\songti{
毕业论文作者签名:\makebox[3cm][c]{} 签字日期: \makebox[2cm][c]{}年 \makebox[1cm][c]{}月 \makebox[1cm][c]{}日
}
\vspace{2.2cm}
\centerline{
\zihao{-2}\songti{毕业论文版权使用授权书}
}
\vspace*{2cm}
\zihao{-4}
\songti{
本毕业论文作者完全了解 \textbf{\dunderline{1pt}{中国传媒大学}}有权保留并向国家有关部门或机构送交本论文的复印件和磁盘,允许论文被查阅和借阅。本人授权\textbf{\dunderline{1pt}{中国传媒大学}} 可以将毕业论文的全部或部分内容编入有关数据库进行检索和传播,可以采用影印、缩印或扫描等复制手段保存、汇编毕业论文。
}
\zihao{-4}
\songti{
(保密的毕业论文在解密后适用本授权书)
}
\vspace{1.5cm}
\noindent
\zihao{-4}
\songti{
毕业论文作者签名:\makebox[4cm][c]{} 指导教师签名: \makebox[3cm][c]{}
}
\vspace{1cm}
\noindent
\zihao{-4}
\songti{
签字日期: \makebox[1.3cm][c]{}年 \makebox[0.7cm][c]{}月 \makebox[0.7cm][c]{}日
\makebox[1.6cm][c]{}
签字日期: \makebox[1.3cm][c]{}年 \makebox[0.7cm][c]{}月 \makebox[0.7cm][c]{}日
}
\zihao{-4}\ignorespaces
{\clearpage}
}