-
Notifications
You must be signed in to change notification settings - Fork 9
/
oucart.cls
executable file
·148 lines (127 loc) · 3.66 KB
/
oucart.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{oucart}[2015/05/20 OUC Undergraduate Thesis Template]
\LoadClass[11pt,a4paper]{article}
\newif\iflangcn
\newif\iflangen
\DeclareOption{cn}{\langcntrue}
\DeclareOption{en}{\langentrue}
\ProcessOptions\relax
\RequirePackage{ctex}
\RequirePackage{CJKutf8}
% Windows用户使用以下字体配置
\setCJKmainfont{SimSun}[AutoFakeBold] %用于实现字体加粗
\setCJKsansfont{SimHei}
\setCJKmonofont{FangSong}
% macOS用户使用以下字体配置
%\setCJKmainfont[BoldFont=STHeiti,ItalicFont=STKaiti]{STSong}
%\setCJKsansfont[BoldFont=STHeiti]{STXihei}
%\setCJKmonofont{STFangsong}
\RequirePackage{amsmath}
\RequirePackage{booktabs}
\RequirePackage{caption}
\RequirePackage{graphicx}
\RequirePackage{setspace}
\RequirePackage{subfigure}
\RequirePackage{titlesec}
\RequirePackage{titletoc}
\RequirePackage{ulem}
% 页边距设置
\RequirePackage{geometry}
\linespread{1.35}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\RequirePackage{assets/cover}
\RequirePackage{assets/abstractkeywords}
\RequirePackage{assets/signature}
\RequirePackage{assets/gbt7714}
% ``目录'', ``参考文献''样式
\iflangcn
\renewcommand{\contentsname}{\centerline{\zihao{3}{\heiti{目$\qquad$录}}}}
\renewcommand{\refname}{\centerline{参考文献}}
\fi
\iflangen
\renewcommand{\contentsname}{\centerline{\zihao{3}{\heiti{Contents}}}}
\renewcommand{\refname}{\centerline{References}}
\fi
% 调整页边距
\geometry{top=2.54cm,bottom=2.54cm,left=3cm,right=3cm}
\makeatletter
% 修改引用标记为上角标
\def\@cite#1#2{\textsuperscript{[{#1\if@tempswa , #2\fi}]}}
% 定义基本信息
\newcommand*{\entitle}[1]{
\def\@entitle{#1}
}
\newcommand*{\advisor}[1]{
\def\@advisor{#1}
}
\newcommand*{\studentid}[1]{
\def\@studentid{#1}
}
\newcommand*{\department}[2]{
\def\@college{#1}
\def\@department{#2}
}
\lhead{}
\rhead{}
\chead{\small{\@title}} % 页眉
\makeatother
% 修改标题样式
\titleformat{\section}
{\zihao{3}\heiti\raggedright}
{\arabic{section}.}{1em}
{}
\titleformat{\subsection}
{\zihao{4}\heiti\raggedright}
{\arabic{section}.\arabic{subsection}}{1em}
{}
\titleformat{\subsubsection}
{\zihao{4}\heiti\raggedright}
{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}{1em}
{}
% 修改目录样式
\titlecontents{section}
[10mm]
{\zihao{4}\songti}
{\contentslabel{1em}}
{}
{\titlerule*{.}\contentspage}
\titlecontents{subsection}
[17mm]
{\zihao{-4}\songti}
{\contentslabel{2em}}
{}
{\titlerule*{.}\contentspage}
\titlecontents{subsubsection}
[25mm]
{\zihao{-4}\songti}
{\contentslabel{3em}}
{}
{\titlerule*{.}\contentspage}
% 为了把致谢和参考文献放入目录
\titlecontents{nonumbersection}
[4.6mm]
{\zihao{-4}\songti}
{\contentslabel{0em}}
{}
{\titlerule*{.}\contentspage}
% 修改部分页眉样式
\fancypagestyle{zhabstract}{
\chead{\small{摘\ \ \ 要}}
}
\fancypagestyle{enabstract}{
\chead{\small{Abstract}}
}
\fancypagestyle{tableofcontents}{
\chead{\small{目\ \ \ 录}}
}
% 图、表、公式样式
\captionsetup{figurewithin=section}
\captionsetup{tablewithin=section}
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand\thefigure{\arabic{section}-\arabic{figure}}
\renewcommand\thetable{\arabic{section}-\arabic{table}}
\renewcommand{\labelenumi}{(\theenumi)}
\renewcommand{\captionfont}{\zihao{5}\heiti}
\numberwithin{equation}{section}