generated from pmichaillat/latex-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaper.sty
254 lines (179 loc) · 5.94 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
% ---- Select text fonts -----
% Make PDF searchable and copyable
\input{glyphtounicode}
\pdfgentounicode=1
% Select font encoding
\usepackage[T1]{fontenc}
% Text font
\usepackage{sourceserifpro}
% Monospaced font
\usepackage{sourcecodepro}
% URL font and management
\usepackage[hyphens]{url}
% ---- Select math fonts -----
% Symbol font
\usepackage{MnSymbol}
% 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}
% 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 ----
\usepackage{geometry}
% Top margin
\geometry{top=1in}
% Bottom margin
\geometry{bottom=1.2in}
% Side margins
\geometry{left=1.3in,right=1.3in}
% Placement of page number
\geometry{footskip=0.7in}
% ---- Adjust spacing ----
% Spacing between lines
\usepackage[onehalfspacing]{setspace}
% Spacing on lines
\usepackage{microtype}
% Spacing in text
\AtBeginDocument{\frenchspacing}
% ---- Select color scheme ----
\usepackage[x11names]{xcolor}
% ---- Format headers & footers ----
\usepackage{fancyhdr,xparse}
% Eliminate header line
\renewcommand{\headrule}{}
% Place centered page number at foot of regular pages
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\thepage}
% Place URL and publication information at foot of title page
\fancypagestyle{plain}{\fancyhf{}}
\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 ----
\usepackage{titling}
% Title
\pretitle{\begin{center}\bfseries\huge}
% Eliminate thanks mark
\renewcommand{\tamark}{}
\setlength{\thanksmarkwidth}{0em}
\setlength{\thanksmargin}{0em}
% Eliminate indentation in abstract
\usepackage{etoolbox}
\AtBeginEnvironment{titlepage}{\pagestyle{empty}\setlength{\parindent}{0pt}}
% ---- Format headings ----
\usepackage{titlesec}
% Section headings
\titleformat*{\section}{\centering\large\bfseries}
% Subsection headings
\titleformat*{\subsection}{\bfseries}
% Paragraph headings
\titleformat{\paragraph}[runin]{\itshape}{}{}{}[.]
% Heading numbers
\titlelabel{\thetitle.\quad}
% ---- Format theorems & proofs ----
\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}
% Reformat proof heading
\renewcommand{\proofname}{\upshape\scshape proof}
% ---- Format tables & figures ----
\usepackage{booktabs,graphicx}
% Enable rotation of tables & figures
\usepackage{rotating}
% Enable multiple rows in table
\usepackage{multirow}
% Allow small figures & tables to be on their own page
\renewcommand{\floatpagefraction}{0}
% Center figures & tables
\makeatletter\g@addto@macro\@floatboxreset\centering\makeatother
% Spacing in tables
\renewcommand{\arraystretch}{1.1}
% Font size in tables
\BeforeBeginEnvironment{tabular*}{\footnotesize}
% All captions
\usepackage{caption,subcaption}
\captionsetup{labelsep=period}
% Table captions
\captionsetup[table]{position=top}
\renewcommand{\tablename}{\textsc{table}}
% Figure captions
\renewcommand{\figurename}{\textsc{figure}}
% Subfigure captions
\captionsetup[sub]{labelformat=simple,labelsep=period,size=small}
\renewcommand{\thesubfigure}{\Alph{subfigure}}
% Create note for tables & figures
\newcommand{\note}[2][]{\parbox{\textwidth}{\footnotesize\vspace*{10pt}\textit{#1}#2}}
% ---- Format equations ----
% Tolerance for page breaks in multiline equations
\AtBeginDocument{\allowdisplaybreaks[1]}
% ---- Format lists ----
\usepackage{enumitem}
% Itemized lists
\setlist[itemize,1]{leftmargin=\parindent,label=\color{gray}{\upshape\textbullet}}
\setlist[itemize,2]{leftmargin=2\parindent,label=\color{gray}{\upshape\textendash}}
% Numbered lists
\setlist[enumerate,1]{leftmargin=\parindent,label=\color{gray}{\upshape\alph*.}}
\setlist[enumerate,2]{leftmargin=2\parindent,label=\color{gray}{\upshape\roman*.}}
% Eliminate extra spacing between items
\setlist{nosep}
% ---- Format bibliography ----
\usepackage{natbib}
% Author-year separation in citation
\setcitestyle{aysep={}}
% Font size
\renewcommand{\bibfont}{\small}
% Spacing between references
\setlength{\bibsep}{0pt}
% 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}