Skip to content

Commit 1ff44be

Browse files
committed
Footnotes in left column only
1 parent d594722 commit 1ff44be

File tree

5 files changed

+79
-46
lines changed

5 files changed

+79
-46
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
typst init @preview/accelerated-jacow:$VERSION
2525
cd accelerated-jacow
2626
ls -l
27+
grep "#import \"@preview/accelerated-jacow:$VERSION\"" *.typ
2728
typst compile *.typ
2829
ls -l
2930
- uses: actions/upload-artifact@v4

jacow.typ

Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232

3333
/// Helper for custom footnote symbols
3434
let titlenotenumbering(i) = {
35-
if i < 6 { ("*", "#", "§", "", "").at(i - 1) + " " }
36-
else { (i - 4)*"*" + " " }
35+
if i < 6 { ("*", "#", "§", "", "").at(i - 1)}
36+
else { (i - 4)*"*" }
3737
}
3838

3939
/// Capitalize all characters in the text, e.g. "THIS IS AN ALLCAPS HEADING"
@@ -71,7 +71,7 @@
7171

7272
// layout
7373

74-
set page(..{
74+
set page(columns: 2, ..{
7575
if paper-size == "a4" {
7676
(paper: "a4", margin: (top: 37mm, bottom: 19mm, x: 20mm))
7777
} else if paper-size == "us-letter" {
@@ -83,6 +83,8 @@
8383
}}
8484
)
8585

86+
set columns(gutter: 0.2in)
87+
8688
set text(
8789
font: "TeX Gyre Termes",
8890
size: 10pt
@@ -96,59 +98,89 @@
9698
)
9799

98100

99-
// TODO: footnotes should not span both columns, but be in left column only
101+
// Note: footnotes not working in parent scoped placement with two column mode.
102+
// See https://github.com/typst/typst/issues/1337#issuecomment-1565376701
103+
// As a workaround, we handle footnotes in the title area manually.
104+
// An alternative is to not use place and use "show: columns.with(2, gutter: 0.2in)" after the title area instead of "page(columns: 2)",
105+
// but then footnotes span the full page and not just the left column.
106+
//let titlefootnote(text) = { footnote(numbering: titlenotenumbering, text) }
107+
let footnotes = state("titlefootnotes", (:))
108+
let titlefootnote(text) = {
109+
footnotes.update(footnotes => {
110+
footnotes.insert(titlenotenumbering(footnotes.len()+1), text)
111+
footnotes
112+
})
113+
h(0pt, weak: true)
114+
context{super(footnotes.get().keys().at(-1))}
115+
}
116+
100117
show footnote.entry: set align(left)
101118
set footnote.entry(
119+
indent: 0em,
102120
separator: [
103121
#set align(left)
104-
#line(length: 20%, stroke: 0.5pt)
122+
#line(length: 40%, stroke: 0.5pt)
105123
]
106124
)
107125

108126

127+
place(
128+
top + center,
129+
scope: "parent",
130+
float: true,
131+
{
132+
133+
134+
/*
135+
* Title
136+
*/
137+
138+
set align(center)
139+
text(size: 14pt, weight: "bold", [
140+
#allcaps(title)
141+
#if funding != none { titlefootnote(funding) }
142+
])
143+
v(8pt)
144+
145+
146+
/*
147+
* Author list
148+
*/
149+
150+
text(size: 12pt, {
151+
let also_at = ();
152+
for aff in authors.map(a => a.affiliation.at(0)).dedup() {
153+
for auth in authors.filter(a => a.affiliation.at(0) == aff) {
154+
// author name with superscripts
155+
auth.name
156+
for aff2 in auth.affiliation.slice(1) {
157+
if aff2 not in also_at { also_at += (aff2,) }
158+
super(str(also_at.len()))
159+
}
160+
if "email" in auth { titlefootnote(auth.email) }
161+
", "
162+
}
163+
// primary affiliations
164+
affiliations.at(aff) + "\n"
165+
};
166+
// secondary affiliations
167+
for i in range(also_at.len()) {
168+
super(str(i + 1))
169+
"also at " + affiliations.at(also_at.at(i)) + "\n"
170+
};
171+
})
172+
v(1pt)
109173

110-
/*
111-
* Title
112-
*/
113174

114-
set align(center)
115-
text(size: 14pt, weight: "bold", [
116-
#allcaps(title)
117-
#if funding!=none{
118-
footnote(numbering: titlenotenumbering, funding)
119175
}
120-
])
121-
v(8pt)
122-
123-
176+
)
124177

125-
/*
126-
* Author list
127-
*/
128178

129-
text(size: 12pt, {
130-
let also_at = ();
131-
for aff in authors.map(a => a.affiliation.at(0)).dedup() {
132-
for auth in authors.filter(a => a.affiliation.at(0) == aff) {
133-
// author name with superscripts
134-
auth.name
135-
for aff2 in auth.affiliation.slice(1) {
136-
if aff2 not in also_at { also_at += (aff2,) }
137-
super(str(also_at.len()))
138-
}
139-
if "email" in auth {footnote(numbering: titlenotenumbering, auth.email)}
140-
", "
141-
}
142-
// primary affiliations
143-
affiliations.at(aff) + "\n"
144-
};
145-
// secondary affiliations
146-
for i in range(also_at.len()) {
147-
super(str(i + 1))
148-
"also at " + affiliations.at(also_at.at(i)) + "\n"
149-
};
150-
})
151-
v(8pt)
179+
context{
180+
for (symbol, text) in footnotes.get() {
181+
place(footnote(numbering: it => "", {super(symbol) + " " + text}))
182+
}
183+
}
152184

153185

154186

@@ -158,7 +190,7 @@
158190

159191
// paragraph
160192
set align(left)
161-
show: columns.with(2, gutter: 0.2in)
193+
//show: columns.with(2, gutter: 0.2in)
162194

163195

164196
// SECTION HEADINGS

template/paper.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*/
88

9-
#import "@preview/accelerated-jacow:0.1.0": jacow, eqnum
9+
#import "@preview/accelerated-jacow:0.1.1": jacow, eqnum
1010

1111
#show: paper => jacow(
1212
// Paper title

thumbnail.webp

100 KB
Loading

typst.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "accelerated-jacow"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
entrypoint = "jacow.typ"
55
description = "Paper template for conference proceedings in accelerator physics"
66
authors = ["Philipp Niedermayer <@eltos>"]

0 commit comments

Comments
 (0)