Repository navigation
Expand file tree
/
Copy pathamlpreprint.sty
More file actions
377 lines (335 loc) · 14.5 KB
/
Copy pathamlpreprint.sty
File metadata and controls
377 lines (335 loc) · 14.5 KB
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
%%%% amlpreprint: preprint style of the Applied Machine Learning Lab
%%%% https://appliedmachinelearning-lab.github.io/
%%%%
%%%% Derived from the TMLR style file (tmlr.sty), adapted by Hugo Larochelle
%%%% and Fabian Pedregosa from the ICLR stylefile Macros and borrowing from
%%%% the JMLR Macros, last edited January 2021 by Chris J. Maddison.
%%%% Original: https://github.com/JmlrOrg/tmlr-style-file (Apache-2.0)
%%%%
%%%% Changes with respect to tmlr.sty (November 2026):
%%%% - renamed to amlpreprint
%%%% - removed the TMLR review/accepted/preprint options; the document is
%%%% always typeset as a de-anonymized preprint without TMLR mentions
%%%% - options authoryear (default) and ieee (numeric citations, IEEEtran.bst),
%%%% and maxbibnames=N (names per reference before "et al.", default 10)
%%%% - table of contents works again (\addcontentsline is no longer disabled)
%%%% - compact author block (\author[marks]{name}, \affil, \email, \orcid) replaces
%%%% the \name/\addr/\email/\AND macros
%%%% - running header alternating authors (even pages) and title (odd
%%%% pages), overridable via \shortauthors and \shorttitle; the title page
%%%% uses the plain page style
%%%% - fonts: Palatino clone (newpx) for text and math, Helvetica clone
%%%% (TeX Gyre Heros) for sans serif; Latin Modern only for typewriter
%%%% - loads graphicx, booktabs, xcolor (table option) and caption (table
%%%% captions above tables); defines the colour-blind safe Paul Tol muted
%%%% palette (tolrose, tolindigo, ...) and uses it for hyperref link boxes
%%%% - \keywords command, printed below the abstract; PDF title, authors and
%%%% keywords are filled in from \title, \author and \keywords
%%%%
%%%% Licensed under the Apache License, Version 2.0 (see LICENSE).
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{amlpreprint}[2026/11/04 Applied Machine Learning Lab preprint style]
%%%%%%%% Options
%% authoryear (default) (Author, Year) citations, bibliography style amlpreprint.bst
%% ieee numeric IEEE citations [1], bibliography style IEEEtran.bst
%% maxbibnames=N at most N names per author/editor list in the
%% references, then "et al." (default 10, 0 = no limit)
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=aml, prefix=aml@}
\DeclareBoolOption[false]{ieee}
\DeclareComplementaryOption{authoryear}{ieee}
\DeclareStringOption[10]{maxbibnames}
\DeclareDefaultOption{\PackageWarning{amlpreprint}{Unknown option `\CurrentOption'}}
\ProcessKeyvalOptions*
% Change the overall width of the page. If these parameters are
% changed, they will require corresponding changes in the
% maketitle section.
%
\usepackage{eso-pic} % used by \AddToShipoutPicture
\RequirePackage{fancyhdr}
% Citations
\ifaml@ieee
\RequirePackage[sort&compress]{natbib}
\setcitestyle{numbers,square,comma}
\def\aml@bst{IEEEtran}
\else
\RequirePackage{natbib}
\setcitestyle{authoryear,round,citesep={;},aysep={,},yysep={;}}
\def\aml@bst{amlpreprint}
\fi
% \bibliographystyle{amlpreprint} selects the bibliography style matching the
% citation option; any other style name is used as given.
\let\aml@bibliographystyle\bibliographystyle
\def\aml@defaultbst{amlpreprint}
\renewcommand{\bibliographystyle}[1]{%
\def\aml@tmp{#1}%
\ifx\aml@tmp\aml@defaultbst\aml@bibliographystyle{\aml@bst}%
\else\aml@bibliographystyle{#1}\fi}
% Name limit in the references (maxbibnames). BibTeX only reads values from
% .bib files, so write a control entry to \jobname-bstctl.bib, add that file
% to \bibliography and cite the entry invisibly. It must be the first
% citation, as IEEEtran requires for @IEEEtranBSTCTL entries.
\newwrite\aml@ctlfile
\let\aml@bibliography\bibliography
\renewcommand{\bibliography}[1]{\aml@bibliography{\jobname-bstctl,#1}}
\AtBeginDocument{\if@filesw
\immediate\write\@auxout{\string\citation{aml-bstctl}}%
\immediate\openout\aml@ctlfile=\jobname-bstctl.bib\relax
\ifaml@ieee
\ifnum\aml@maxbibnames>\z@
\immediate\write\aml@ctlfile{@IEEEtranBSTCTL{aml-bstctl,
CTLuse_forced_etal = "yes",
CTLmax_names_forced_etal = "\aml@maxbibnames",
CTLnames_show_etal = "\aml@maxbibnames"}}%
\else
\immediate\write\aml@ctlfile{@IEEEtranBSTCTL{aml-bstctl,
CTLuse_forced_etal = "no"}}%
\fi
\else
\immediate\write\aml@ctlfile{@amlpreprintctl{aml-bstctl,
maxnames = "\aml@maxbibnames"}}%
\fi
\immediate\closeout\aml@ctlfile
\fi}
\usepackage[T1]{fontenc}
\usepackage{lmodern} % typewriter: Latin Modern Mono
% Serif and math: Palatino clone (TeX Gyre Pagella)
\usepackage{newpxtext,newpxmath}
% Sans serif: Helvetica clone (TeX Gyre Heros). newpxtext sets \qhv@scale so
% that its x-height matches Palatino.
\renewcommand{\sfdefault}{qhv}
% Figures and tables (booktabs rules, \rowcolor via xcolor's table option)
\RequirePackage{graphicx}
\RequirePackage{booktabs}
\RequirePackage[table]{xcolor}
% Table captions go above the table: put the caption skip below them
\RequirePackage{caption}
\captionsetup[table]{position=top}
% Colour-blind safe palette: Paul Tol's "muted" scheme
% (https://sronpersonalpages.nl/~pault/), in the order Tol recommends.
% Use these for all figures, e.g. matplotlib and TikZ.
\definecolor{tolrose}{HTML}{CC6677}
\definecolor{tolindigo}{HTML}{332288}
\definecolor{tolsand}{HTML}{DDCC77}
\definecolor{tolgreen}{HTML}{117733}
\definecolor{tolcyan}{HTML}{88CCEE}
\definecolor{tolwine}{HTML}{882255}
\definecolor{tolteal}{HTML}{44AA99}
\definecolor{tololive}{HTML}{999933}
\definecolor{tolpurple}{HTML}{AA4499}
\definecolor{tolpalegrey}{HTML}{DDDDDD} % bad / missing data
% hyperref is loaded after this package. At \begin{document}: recolour its
% link boxes with the palette and fill in the PDF title, authors and keywords
% from \title, \author and \keywords, unless they were set with \hypersetup.
\let\aml@notitle\@title
\AtBeginDocument{\@ifpackageloaded{hyperref}{%
\hypersetup{linkbordercolor=tolrose, citebordercolor=tolteal,
urlbordercolor=tolcyan}%
\pdfstringdefDisableCommands{\let\\\@empty\let\thanks\@gobble
\let\footnote\@gobble}%
\ifx\@pdftitle\@empty\ifx\@title\aml@notitle\else
\hypersetup{pdftitle={\@title}}\fi\fi
\ifx\@pdfauthor\@empty\hypersetup{pdfauthor={\aml@pdfauthors}}\fi
\ifx\@pdfkeywords\@empty\hypersetup{pdfkeywords={\aml@keywords}}\fi
}{}}
\renewcommand{\topfraction}{0.95} % let figure take up nearly whole page
\renewcommand{\textfraction}{0.05} % let figure take up nearly whole page
% Specify the dimensions of each page
\setlength{\paperheight}{11in}
\setlength{\paperwidth}{8.5in}
\oddsidemargin 0in % Note \oddsidemargin = \evensidemargin
\evensidemargin 0in
\marginparwidth 0.07 true in
\topmargin -0.625in
\addtolength{\headsep}{0.25in}
\textheight 9.0 true in % Height of text (including footnotes & figures)
\textwidth 6.5 true in % Width of text line.
\widowpenalty=10000
\clubpenalty=10000
\flushbottom \sloppy
% Table of contents: entries are paragraphs, so suppress the document-wide
% \parskip inside it to keep the list compact.
\let\aml@tableofcontents\tableofcontents
\renewcommand{\tableofcontents}{\begingroup\parskip\z@\aml@tableofcontents\endgroup}
% Title stuff, taken from deproc.
\def\maketitle{\par
\begingroup
\def\thefootnote{\fnsymbol{footnote}}
\def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}} % for perfect author
% name centering
% The footnote-mark was overlapping the footnote-text,
% added the following to fix this problem (MK)
\long\def\@makefntext##1{\parindent 1em\noindent
\hbox to1.8em{\hss $\m@th ^{\@thefnmark}$}##1}
\global\let\aml@savedtitle\@title
\@maketitle \@thanks
\thispagestyle{plain}
\endgroup
\setcounter{footnote}{0}
\let\maketitle\relax \let\@maketitle\relax
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax}
\newlength\aftertitskip \newlength\beforetitskip
\newlength\interauthorskip \newlength\aftermaketitskip
%% Changeable parameters.
\setlength\aftertitskip{0.3in plus 0.2in minus 0.2in}
\setlength\beforetitskip{0.05in plus 0.08in minus 0.08in}
\setlength\interauthorskip{0.08in plus 0.1in minus 0.1in}
\setlength\aftermaketitskip{0.3in plus 0.1in minus 0.1in}
%% Compact author block
%% \author[1,2]{First Author} one call per author, optional affiliation marks
%% \affil[1]{Institution, City, Country}
%% \email{first.author@example.com} corresponding author(s)
%% \orcid{0000-0000-0000-0000}
% Each list stores deferred calls (\aml@author{marks}{name}, ...) so that the
% title block and the running header can render them differently.
\def\aml@authors{}
\def\aml@affils{}
\def\aml@emails{}
\def\aml@orcids{}
\newcount\aml@nemails
\newcount\aml@norcids
\def\aml@pdfauthors{}
\renewcommand{\author}[2][]{%
\g@addto@macro\aml@authors{\aml@author{#1}{#2}}%
\ifx\aml@pdfauthors\@empty\gdef\aml@pdfauthors{#2}%
\else\g@addto@macro\aml@pdfauthors{, #2}\fi
\gdef\@author{\aml@authornames}}
\newcommand{\affil}[2][]{\g@addto@macro\aml@affils{\aml@affil{#1}{#2}}}
\newcommand{\email}[1]{\global\advance\aml@nemails\@ne
\g@addto@macro\aml@emails{\aml@email{#1}}}
\newcommand{\orcid}[1]{\global\advance\aml@norcids\@ne
\g@addto@macro\aml@orcids{\aml@orcid{#1}}}
% Labels in front of the email and ORCID lines (singular/plural)
\def\aml@emailname{Corresponding author}
\def\aml@emailsname{Corresponding authors}
\def\aml@orcidname{ORCID iD}
\def\aml@orcidsname{ORCID iDs}
% Link if hyperref is loaded (it is loaded after this package)
\def\aml@link#1#2{\ifdefined\href\href{#1}{\texttt{#2}}\else\texttt{#2}\fi}
% Render a list, putting \aml@sep between consecutive entries
\def\aml@sep{}
\def\aml@nextsep#1{\aml@sep\gdef\aml@sep{#1}}
\def\aml@mark#1{\if\relax\detokenize{#1}\relax\else\textsuperscript{#1}\fi}
\def\aml@authornames{\begingroup
\gdef\aml@sep{}%
\def\aml@author##1##2{\aml@nextsep{, }##2}%
\let\thanks\@gobble \let\footnote\@gobble
\aml@authors\endgroup}
\def\aml@authorblock{%
{\normalsize\bfseries\raggedright
\gdef\aml@sep{}%
\def\aml@author##1##2{\aml@nextsep{, }\mbox{##2\aml@mark{##1}}}%
\aml@authors\par}%
\ifx\aml@affils\@empty\else
{\small\parskip\z@\vskip 0.5ex
\def\aml@affil##1##2{\noindent\aml@mark{##1}##2\par}%
\aml@affils}%
\fi
{\small\parskip\z@
\ifnum\numexpr\aml@nemails+\aml@norcids\relax>\z@\vskip 0.75em\fi
\ifx\aml@emails\@empty\else
\noindent\ifnum\aml@nemails>\@ne\aml@emailsname\else\aml@emailname\fi:
\gdef\aml@sep{}%
\def\aml@email##1{\aml@nextsep{, }\aml@link{mailto:##1}{##1}}%
\aml@emails\par
\fi
\ifx\aml@orcids\@empty\else
\noindent\ifnum\aml@norcids>\@ne\aml@orcidsname\else\aml@orcidname\fi:
\gdef\aml@sep{}%
\def\aml@orcid##1{\aml@nextsep{, }\aml@link{https://orcid.org/##1}{##1}}%
\aml@orcids\par
\fi}}
%% Running header: authors on even pages, title on odd pages
%% \shorttitle{...} overrides the title in the header
%% \shortauthors{...} overrides the author list in the header
\def\aml@savedtitle{}
\def\aml@shorttitle{}
\def\aml@shortauthors{}
\newcommand{\shorttitle}[1]{\gdef\aml@shorttitle{#1}}
\newcommand{\shortauthors}[1]{\gdef\aml@shortauthors{#1}}
\def\aml@runninghead{{\small\itshape
\def\\{\unskip\space\ignorespaces}%
\let\thanks\@gobble \let\footnote\@gobble
\ifodd\value{page}%
\ifx\aml@shorttitle\@empty\aml@savedtitle\else\aml@shorttitle\fi
\else
\ifx\aml@shortauthors\@empty\aml@authornames\else\aml@shortauthors\fi
\fi}}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\aml@runninghead}
% Title
\def\@maketitle{\vbox{\hsize\textwidth
{\LARGE\bf\sffamily \@title\par}\vskip \aftertitskip
\aml@authorblock
\vskip 0.3in minus 0.1in}}
\renewenvironment{abstract}{\vskip.075in\centerline{\large\bf\sffamily
Abstract}\vspace{0.5ex}\begin{quote}}{\par\end{quote}\aml@printkeywords\vskip 1ex}
%% Keywords, printed below the abstract at full text width and used as PDF
%% keywords
%% \keywords{Keyword1, Keyword2, ...} (before \end{abstract})
\def\aml@keywords{}
\newcommand{\keywords}[1]{\gdef\aml@keywords{#1}}
\def\aml@printkeywords{%
\ifx\aml@keywords\@empty\else
\par\noindent{\sffamily\bfseries\itshape Keywords}\quad
\gdef\aml@sep{}%
\@for\aml@kw:=\aml@keywords\do{%
\aml@nextsep{\unskip\nobreak\enspace$\cdot$\enspace}\ignorespaces\aml@kw}%
\fi}
% sections with less space
\def\section{\@startsection {section}{1}{\z@}{-2.0ex plus
-0.5ex minus -.2ex}{1.5ex plus 0.3ex
minus0.2ex}{\large\bf\raggedright\sffamily}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-1.8ex plus
-0.5ex minus -.2ex}{0.8ex plus .2ex}{\normalsize\bf\raggedright\sffamily}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-1.5ex
plus -0.5ex minus -.2ex}{0.5ex plus
.2ex}{\normalsize\bf\raggedright\sffamily}}
\def\paragraph{\@startsection{paragraph}{4}{\z@}{1.5ex plus
0.5ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection{subparagraph}{5}{\z@}{1.5ex plus
0.5ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subsubsubsection{\vskip
5pt{\noindent\normalsize\rm\raggedright\sffamily}}
% Footnotes
\footnotesep 6.65pt %
\skip\footins 9pt plus 4pt minus 2pt
\def\footnoterule{\kern-3pt \hrule width 12pc \kern 2.6pt }
\setcounter{footnote}{0}
% Lists and paragraphs
\parindent 0pt
\topsep 4pt plus 1pt minus 2pt
\partopsep 1pt plus 0.5pt minus 0.5pt
\itemsep 2pt plus 1pt minus 0.5pt
\parsep 2pt plus 1pt minus 0.5pt
\parskip .5pc
%\leftmargin2em
\leftmargin3pc
\leftmargini\leftmargin \leftmarginii 2em
\leftmarginiii 1.5em \leftmarginiv 1.0em \leftmarginv .5em
%\labelsep \labelsep 5pt
\def\@listi{\leftmargin\leftmargini}
\def\@listii{\leftmargin\leftmarginii
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
\topsep 2pt plus 1pt minus 0.5pt
\parsep 1pt plus 0.5pt minus 0.5pt
\itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii\advance\labelwidth-\labelsep
\topsep 1pt plus 0.5pt minus 0.5pt
\parsep \z@ \partopsep 0.5pt plus 0pt minus 0.5pt
\itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
\labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
\labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
\labelwidth\leftmarginvi\advance\labelwidth-\labelsep}
\abovedisplayskip 7pt plus2pt minus5pt%
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip 0pt plus3pt%
\belowdisplayshortskip 4pt plus3pt minus3pt%
\def\toptitlebar{\hrule height4pt\vskip .25in\vskip-\parskip}
\def\bottomtitlebar{\vskip .29in\vskip-\parskip\hrule height1pt\vskip
.09in} %