-
Notifications
You must be signed in to change notification settings - Fork 73
/
paper.sty
281 lines (199 loc) · 6.77 KB
/
paper.sty
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
% ---- Select text fonts -----
% Make PDF searchable and copyable
\input{glyphtounicode}
\pdfgentounicode=1
% Select font encoding
\usepackage[T1]{fontenc}
% Select text font
\usepackage{sourceserifpro}
% Select monospaced font
\usepackage{sourcecodepro}
% Select URL font
\usepackage[hyphens]{url}
% ---- Select math fonts -----
% Select symbol font
\usepackage{MnSymbol}
% Select calligraphic and blackboard-bold fonts
\usepackage[cal=euler,bb=fourier]{mathalpha}
% Enable bold math characters
\newcommand{\hmmax}{0} % Avoid "Too many math alphabets" error
\newcommand{\bmmax}{0} % Avoid "Too many math alphabets" error
\usepackage{bm}
% Select font for Roman letters, Greek letters, digits, and punctuation
\usepackage[italic,eulergreek,nolessnomore,noparenthesis,noplusnominus,noequal,nohbar]{mathastext}
% Correct spacing around certain Roman letters
\MTsetmathskips{f}{3mu}{0mu}
\MTsetmathskips{y}{2mu}{0mu}
\MTsetmathskips{p}{2mu}{0mu}
\MTsetmathskips{j}{2mu}{0mu}
% ---- Adjust page layout ----
% Customize page dimensions
\usepackage{geometry}
% Set top margin
\geometry{top=1in}
% Set bottom margin
\geometry{bottom=1.2in}
% Set side margins
\geometry{left=1.3in,right=1.3in}
% Set placement of page number
\geometry{footskip=0.7in}
% ---- Adjust spacing ----
% Set spacing between lines
\usepackage[onehalfspacing]{setspace}
% Set spacing on lines
\usepackage{microtype}
% Set spacing in text
\AtBeginDocument{\frenchspacing}
% ---- Select color scheme ----
\usepackage[x11names]{xcolor}
% ---- Format header and footer ----
% Customize headers and footers
\usepackage{fancyhdr}
% Activate custom header and footer
\pagestyle{fancy}
% Eliminate header line
\renewcommand{\headrule}{}
% Clear header and footer
\fancyhf{}
\fancypagestyle{plain}{\fancyhf{}}
% Place centered page number at foot of regular pages
\fancyfoot[C]{\thepage}
% Define custom commands with complex argument specifications
\usepackage{xparse}
% Place URL and publication information at foot of title page
\NewDocumentCommand{\available}{o g}{%
\fancypagestyle{plain}{\fancyfoot[C]{\color{gray}\footnotesize%
\IfValueT{#1}{Published in \emph{#1}\;\textbullet\;}%
Available at \url{#2}}}}
% ---- Format title page ----
% Customize title, author, and date
\usepackage{titling}
% Format title
\pretitle{\begin{center}\bfseries\Huge}
% Eliminate thanks mark
\renewcommand{\tamark}{}
\setlength{\thanksmarkwidth}{0em}
\setlength{\thanksmargin}{0em}
% Enable advanced programming features
\usepackage{etoolbox}
% Eliminate indentation in abstract
\AtBeginEnvironment{titlepage}{\pagestyle{empty}\setlength{\parindent}{0pt}}
% ---- Format section headings ----
% Customize section headings
\usepackage{titlesec}
% Format section headings
\titleformat*{\section}{\centering\large\bfseries}
% Format subsection headings
\titleformat*{\subsection}{\bfseries}
% Format paragraph headings
\titleformat{\paragraph}[runin]{\itshape}{}{}{}[.]
% Add period after heading numbers
\titlelabel{\thetitle.\quad}
% ---- Format theorems and proofs ----
% Enhance theorem environments
\usepackage{amsthm}
% Define theorem style
\newtheoremstyle{paper}{}{}{\itshape}{}{\scshape}{.}{0.5em}{}
% Apply theorem style
\theoremstyle{paper}
% Define theorems
\newtheorem{theorem}{theorem}
\newtheorem{proposition}{proposition}
\newtheorem{lemma}{lemma}
\newtheorem{corollary}{corollary}
\newtheorem{definition}{definition}
\newtheorem{assumption}{assumption}
\newtheorem{remark}{remark}
% Format proof heading
\renewcommand{\proofname}{\upshape\scshape proof}
% ---- Format figures and tables ----
% Include graphics
\usepackage{graphicx}
% Enhance table formatting
\usepackage{booktabs}
% Enable rotation of tables and figures
\usepackage{rotating}
% Enable multiple rows in table
\usepackage{multirow}
% Allow small figures and tables to be on their own page
\renewcommand{\floatpagefraction}{0}
% Center figures and tables
\makeatletter\g@addto@macro\@floatboxreset\centering\makeatother
% Adjust spacing in tables
\renewcommand{\arraystretch}{1.1}
% Set font size in tables
\BeforeBeginEnvironment{tabular*}{\footnotesize}
% Write "table" and "figure" in small caps
\renewcommand{\tablename}{\textsc{table}}
\renewcommand{\figurename}{\textsc{figure}}
% Customize captions and subcaptions
\usepackage{caption,subcaption}
% Format captions
\captionsetup{labelsep=period}
% Place table captions above table
\captionsetup[table]{position=top}
% Format subcaptions
\captionsetup[sub]{labelformat=simple,labelsep=period,size=small}
% Write figure sublabels in Roman caps
\renewcommand{\thesubfigure}{\Alph{subfigure}}
% Create note for tables and figures
\NewDocumentCommand{\note}{o g}{%
\parbox{\textwidth}{\footnotesize\vspace*{10pt}%
\IfValueT{#1}{\textit{#1}:\quad}%
#2}}
% ---- Format equations ----
% Set tolerance for page breaks in multiline equations
\AtBeginDocument{\allowdisplaybreaks[1]}
% ---- Format lists ----
% Customize lists
\usepackage{enumitem}
% Format itemized lists
\setlist[itemize,1]{leftmargin=\parindent,label=\color{gray}{\upshape\textbullet}} % First level
\setlist[itemize,2]{leftmargin=2\parindent,label=\color{gray}{\upshape\textendash}} % Second level
% Format numbered lists
\setlist[enumerate,1]{leftmargin=\parindent,label=\color{gray}{\upshape\alph*.}} % First level
\setlist[enumerate,2]{leftmargin=2\parindent,label=\color{gray}{\upshape\roman*.}} % Second level
% Eliminate extra spacing between items
\setlist{nosep}
% ---- Format bibliography ----
% Enhance bibliography
\usepackage{natbib}
% Eliminate author-year separation in citations
\setcitestyle{aysep={}}
% Set font size in bibliography
\renewcommand{\bibfont}{\small}
% Set spacing between references
\setlength{\bibsep}{0pt}
% Set indentation of references
\setlength{\bibhang}{\parindent}
% ---- Format appendix ----
\AfterEndEnvironment{thebibliography}{
%
% Reset counters
\setcounter{theorem}{0}
\setcounter{proposition}{0}
\setcounter{lemma}{0}
\setcounter{corollary}{0}
\setcounter{definition}{0}
\setcounter{assumption}{0}
\setcounter{remark}{0}
\setcounter{table}{0}
\setcounter{figure}{0}
\setcounter{equation}{0}
%
% Add "A" in front of labels
\renewcommand{\thetheorem}{A\arabic{theorem}}
\renewcommand{\theproposition}{A\arabic{proposition}}
\renewcommand{\thelemma}{A\arabic{lemma}}
\renewcommand{\thecorollary}{A\arabic{corollary}}
\renewcommand{\thedefinition}{A\arabic{definition}}
\renewcommand{\theassumption}{A\arabic{assumption}}
\renewcommand{\theremark}{A\arabic{remark}}
\renewcommand{\thetable}{A\arabic{table}}
\renewcommand{\thefigure}{A\arabic{figure}}
\renewcommand{\theequation}{A\arabic{equation}}
%
% Add "Appendix" in front of section label
\titleformat{\section}{\centering\large\bfseries}{Appendix~\thesection.}{1em}{}}
% ---- Enable hyperlinks ----
\usepackage[pdftex,hidelinks,hypertexnames=false,pdfpagemode=UseNone,pdfdisplaydoctitle=true]{hyperref}