Skip to content

Commit f6c225f

Browse files
committed
Automatically number labeled equation
1 parent a772cb3 commit f6c225f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

jacow.typ

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,21 @@
267267
show link: it => text(font: "DejaVu Sans Mono", size: 7.2pt, it)
268268

269269

270+
// automatically number labeled equation
271+
show: body => {
272+
for elem in body.children {
273+
if elem.func() == math.equation and elem.block and "label" in elem.fields() {
274+
set math.equation(numbering: "(1)")
275+
elem
276+
} else {
277+
elem
278+
}
279+
}
280+
}
281+
282+
270283
body
271284

272285

273286
}
274287

275-
// numbered equations
276-
#let eqnum(eq) = math.equation(block: true, numbering: "(1)", eq)

template/paper.typ

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*/
88

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

1111
#show: paper => jacow(
1212
// Paper title
@@ -49,12 +49,12 @@ Typst @typst is a great, modern and blazingly fast typesetting system focussed o
4949
This paper template is based on the JACoW paper preparation guide @jacowguide.
5050
It showcases common elements, like an equation:
5151
$ e^("i" pi) + 1 = 0 $
52-
This equation has a number for it to be referenced
53-
#eqnum($
52+
This equation can be referenced
53+
$
5454
sum_(k=0)^n k
5555
&= 1 + 2 + ... + n \
5656
&= (n(n+1)) / 2
57-
$) <eq:thesum>
57+
$ <eq:thesum>
5858

5959
To reference elements, use @eq:thesum, @fig:writer or @table:xydata.
6060
Make sure to use the long form at the #underline[beginning] of a sentence.

0 commit comments

Comments
 (0)