-
Notifications
You must be signed in to change notification settings - Fork 6
/
iclr2025.typ
418 lines (372 loc) · 10.4 KB
/
iclr2025.typ
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
/**
* iclr2025.typ
*/
#let std-bibliography = bibliography // Due to argument shadowing.
#let font-family = ("Times New Roman", "CMU Serif", "Latin Modern Roman",
"New Computer Modern", "Times", "Serif")
#let font-family-sans = ("Nimbus Sans", "CMU Sans Serif", "Latin Modern Sans",
"New Computer Modern Sans", "Sans")
#let font-family-mono = ("CMU Typewriter Text", "Latin Modern Mono",
"New Computer Modern Mono", "Mono")
#let font-family-link = ("Courier New", "Nimbus Mono PS") + font-family-mono
#let font-size = (
normal: 10pt,
small: 9pt,
footnote: 8pt,
script: 7pt,
tiny: 5pt,
large: 12pt,
Large: 14.4pt,
LARGE: 17pt,
huge: 20pt,
Huge: 25pt,
)
/*
* Customized text elements.
*/
#let header-title = (
[Under review as a conference paper at ICLR 2025],
[Published as a conference paper at ICLR 2025], // accepted
)
#let author-anon = [*Anonymous authors*\ Paper under double-blind review]
/**
* Ruler definition.
*/
#let lineno = counter("lineno")
#let lineno-fmt(numb, width: 3) = {
let value = str(numb)
let prefix-len = width - value.len()
let prefix = ""
for _ in range(prefix-len) {
prefix = prefix + "0"
}
return prefix + value
}
#let ruler-color = rgb(70%, 70%, 70%)
#let ruler-style = body => {
set text(size: 8pt, font: font-family-sans, weight: "bold", fill: ruler-color)
set par(leading: 6.22pt)
body
}
#let xruler(side, dx, dy, width, height, offset, num-lines) = {
let alignment = if side == left {
right
} else {
left
}
let numbs = range(0, num-lines).map(ix => {
let anchor = lineno.step()
let index = lineno-fmt(offset + ix)
return [#anchor#index]
})
let ruler = block(width: width, height: height, spacing: 0pt, {
show: ruler-style
set align(alignment)
numbs.join([\ ])
})
return place(left + top, dx: dx, dy: dy, ruler)
}
#let make-ruler(
num-lines: 54,
margin: auto,
width: auto,
height: 8.875in,
gap: 30pt,
) = locate(loc => {
let margin = if margin == auto {
(top: 1in - 0.5pt + 9.5pt, left: 1.75in - 1em, right: 1.75in) // ICLR 2025 defaults.
} else {
margin
}
let width = if width == auto {
(left: margin.left - gap, right: margin.right - gap)
} else {
width
}
// Only left ruler.
let dx = 0pt
let dy = margin.top
let offset = lineno.get().at(0)
xruler(left, dx, dy, width.left, height, offset, num-lines)
})
#let ruler = make-ruler() // Default CVPR 2022 ruler.
#let make-title(title) = {
align(left, {
v(0.5pt)
v(0.3pt)
set text(size: 17.28pt)
set par(leading: 8.4pt)
smallcaps(title)
})
}
#let make-author-block(authors) = {
assert(
"names" in authors,
message: "Missing mandatory field `names` in author specification.")
let author_names = authors.names.join([, ], last: [ & ])
let lines = ([*#author_names*], )
if "affilation" in authors {
lines.push(authors.affilation)
}
if "address" in authors {
lines.push(authors.address)
}
if "email" in authors {
lines.push(link(authors.email, raw(authors.email)))
}
block(width: 100%, spacing: 0pt, lines.join([\ ]))
}
#let make-authors(authors, accepted) = {
v(14.7pt)
if accepted != none and not accepted {
set par(first-line-indent: 0pt)
author-anon
} else {
// We use *-like footnote markers in author section.
set footnote(numbering: "*")
authors
.map(make-author-block)
.join(v(22pt, weak: true))
v(3pt)
// Thus we should reset footnote counter at the end of authors section.
counter(footnote).update(0)
}
v(27.95pt)
}
#let make-abstract(abstract) = {
set block(spacing: 0pt)
v(0.075in, weak: true)
block(width: 100%, {
set align(center)
set text(size: font-size.large)
smallcaps[Abstract]
})
v(16.4pt)
pad(left: 0.5in, right: 0.5in, {
set text(size: 10pt)
set par(leading: 4.35pt)
abstract
})
v(3.8pt, weak: false)
}
/**
* Utility routine to convert authors (array of content) to authors (array of
* strings).
*
* https://github.com/jgm/pandoc/blob/0e92d9483ce55ca2dc3a7a2d12897ac0e25f4dbd/test/writer.typst
*/
#let content-to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(content-to-string).at(0)
} else if content.has("body") {
content-to-string(content.body)
} else if content == [ ] {
" "
}
}
/**
* iclr2025 - Template for International Conference on Learning Representations
* (ICLR) 2025.
*
* Args:
* title: Paper title.
* authors: Tuple of author objects and affilation dictionary.
* keywords: Publication keywords (used in PDF metadata).
* date: Creation date (used in PDF metadata).
* abstract: Paper abstract.
* bibliography: Bibliography content. If it is not specified then there is
* not reference section.
* appendix: Content to append after bibliography section.
* accepted: Valid values are `none`, `false`, and `true`. Missing value
* (`none`) is designed to prepare arxiv publication. Default is `false`.
* id: Submission identifier.
*/
#let iclr2025(
title: [],
authors: (),
keywords: (),
date: auto,
abstract: [],
bibliography: none,
appendix: none,
accepted: false,
id: none,
body,
) = {
let meta-authors = if accepted == none or accepted {
authors.map(it => it.names.map(content-to-string)).join()
} else {
()
}
set document(
title: title,
author: meta-authors,
keywords: keywords,
date: date)
set page(
paper: "us-letter",
margin: (left: 1.5in, right: 1.5in, top: 1in + 9.5pt, bottom: 1in - 9.5pt),
background: if accepted != none and not accepted {
ruler // Rullers on sides.
},
header-ascent: 32.9pt + 9.5pt,
header: {
set block(spacing: 3.7pt)
set text(size: font-size.normal)
set align(left)
let header-text = if accepted == none {
[]
} else if not accepted {
header-title.at(0)
} else if accepted {
header-title.at(1)
}
block(header-text)
line(length: 100%, stroke: 0.4pt)
},
footer-descent: 23.5pt, // Visually perfect.
footer: locate(loc => {
let ix = counter(page).at(loc).first()
return align(center, text(size: font-size.normal, [#ix]))
}),
)
set text(font: font-family, size: font-size.normal)
set par(justify: true, leading: 4.3pt)
show par: set block(spacing: 10pt) // \topsep + \parskip + \partopsep
show raw: set text(font: font-family-mono, size: font-size.normal)
// Configure heading appearence and numbering.
set heading(numbering: "1.1")
show heading: set text(font: font-family, weight: "regular")
show heading: it => {
// Create the heading numbering.
let number = if it.numbering != none {
counter(heading).display(it.numbering)
}
// Render section with such names without numbering as level 3 heading.
let unnumbered = (
[Broader Impact Statement],
[Author Contributions],
[Acknowledgments],
)
let level = it.level
let prefix = [#number ]
if unnumbered.any(name => name == it.body) {
level = 2
prefix = []
}
// TODO(@daskol): Use styles + measure to estimate ex.
set align(left)
let gap = h(1em, weak: true)
if level == 1 {
text(size: font-size.large, context {
let ex = measure(smallcaps[x]).height
v(2 * ex + 5pt, weak: true)
smallcaps[#prefix#gap#it.body]
v(1.5 * ex + 5pt, weak: true) // 1.5ex + \topsep + \partopsep
})
} else if level == 2 {
text(size: font-size.normal, context {
let ex = measure(smallcaps[x]).height
v(1.8 * ex + 7pt, weak: true)
smallcaps[#prefix#gap#it.body]
v(0.8 * ex + 8.5pt, weak: true)
})
} else if level == 3 {
text(size: font-size.normal, context {
let ex = measure(smallcaps[x]).height
v(1.5 * ex + 7pt, weak: true)
smallcaps[#prefix#gap#it.body]
v(0.5 * ex + 9.5pt, weak: true)
})
} else if level == 4 {
text(size: font-size.normal, {
v(5pt, weak: true) // Visually perfect.
smallcaps[#prefix#gap#it.body]
})
}
}
// Configure footnote (almost default).
show footnote.entry: set text(size: font-size.small)
set footnote.entry(
separator: line(length: 2in, stroke: 0.35pt),
clearance: 6.65pt,
gap: 0.40em,
indent: 12pt)
// All captions either centered or aligned to the left.
show figure.caption: set align(left)
// Configure figures.
show figure.where(kind: image): set figure.caption(position: bottom)
show figure.where(kind: image): set figure(gap: 16pt)
show figure.where(kind: image): it => {
let render() = {
set align(center)
it.body
v(it.gap, weak: true)
block(spacing: 0pt, {
it.caption
})
}
if it.placement == none {
render()
} else {
place(it.placement, float: true,
block(width: 100%, spacing: 0pt, render()))
}
}
// Configure tables.
show figure.where(kind: table): set figure.caption(position: top)
show figure.where(kind: table): set figure(gap: 6pt)
show figure.where(kind: table): it => {
let render() = {
set align(center)
block(spacing: 0pt, {
it.caption
})
v(it.gap, weak: true)
it.body
}
if it.placement == none {
render()
} else {
place(it.placement, float: true,
block(width: 100%, spacing: 0pt, render()))
}
}
// Configure numbered lists.
set enum(indent: 2.4em, spacing: 0.9em)
show enum: set block(above: 1.63em)
// Configure bullet lists.
set list(indent: 2.4em, spacing: 0.9em, marker: ([•], [‣], [⁃]))
show list: set block(above: 1.63em)
// Configure math numbering and referencing.
set math.equation(numbering: "(1)", supplement: [])
show ref: it => {
let eq = math.equation
let el = it.element
if el != none and el.func() == eq {
let numb = numbering(
"1",
..counter(eq).at(el.location())
)
let content = link(el.location(), numb)
[(#content)]
} else {
it
}
}
make-title(title)
make-authors(authors, accepted)
make-abstract(abstract)
body
if bibliography != none {
set std-bibliography(title: [References], style: "iclr.csl")
bibliography
}
if appendix != none {
set heading(numbering: "A.1")
counter(heading).update(0)
appendix
}
}