1
- # Numbering
1
+ # Math Numbering
2
2
## Number by current heading
3
3
4
4
> See also built-in numbering in [ math package section] ( ../../packages/math.md#theorems )
5
5
6
6
``` typ
7
- /// author: laurmaedje
7
+ /// original author: laurmaedje
8
8
#set heading(numbering: "1.")
9
9
10
10
// reset counter at each chapter
11
+ // if you want to change the number of displayed
12
+ // section numbers, change the level there
11
13
#show heading.where(level:1): it => {
12
14
counter(math.equation).update(0)
13
15
it
14
16
}
15
17
16
18
#set math.equation(numbering: n => {
17
- let h1 = counter(heading).get().first()
18
- numbering("(1.1)", h1, n)
19
+ numbering("(1.1)", counter(heading).get().first(), n)
20
+ // if you want change the number of number of displayed
21
+ // section numbers, modify it this way:
22
+ /*
23
+ let count = counter(heading).get()
24
+ let h1 = count.first()
25
+ let h2 = count.at(1, default: 0)
26
+ numbering("(1.1.1)", h1, h2, n)
27
+ */
19
28
})
20
29
30
+
21
31
= Section
22
32
== Subsection
23
33
24
- $ 5 + 3 = 8 $
34
+ $ 5 + 3 = 8 $ <a>
25
35
$ 5 + 3 = 8 $
26
36
27
37
= New Section
28
38
== Subsection
29
39
$ 5 + 3 = 8 $
30
40
== Subsection
31
- $ 5 + 3 = 8 $
41
+ $ 5 + 3 = 8 $ <b>
42
+
43
+ Mentioning @a and @b.
32
44
```
33
45
34
46
## Number only labeled equations
@@ -38,7 +50,10 @@ $ 5 + 3 = 8 $
38
50
#show math.equation:it => {
39
51
if it.fields().keys().contains("label"){
40
52
math.equation(block: true, numbering: "(1)", it)
41
- // change your numbering style in `numbering`
53
+ // Don't forget to change your numbering style in `numbering`
54
+ // to the one you actually want to use.
55
+ //
56
+ // Note that you don't need to #set the numbering now.
42
57
} else {
43
58
it
44
59
}
@@ -54,8 +69,10 @@ $ dif/(dif x)(A(t)+B(x))=dif/(dif x)A(t)+dif/(dif x)B(t) $ <ep-3>
54
69
``` typ
55
70
// author: gijsleb
56
71
#show math.equation:it => {
57
- if it.has("label"){
58
- math.equation(block:true, numbering: "(1)", it)
72
+ if it.has("label") {
73
+ // Don't forget to change your numbering style in `numbering`
74
+ // to the one you actually want to use.
75
+ math.equation(block: true, numbering: "(1)", it)
59
76
} else {
60
77
it
61
78
}
@@ -65,6 +82,8 @@ $ dif/(dif x)(A(t)+B(x))=dif/(dif x)A(t)+dif/(dif x)B(t) $ <ep-3>
65
82
let el = it.element
66
83
if el != none and el.func() == math.equation {
67
84
link(el.location(), numbering(
85
+ // don't forget to change the numbering according to the one
86
+ // you are actually using (e.g. section numbering)
68
87
"(1)",
69
88
counter(math.equation).at(el.location()).at(0) + 1
70
89
))
@@ -73,9 +92,9 @@ $ dif/(dif x)(A(t)+B(x))=dif/(dif x)A(t)+dif/(dif x)B(t) $ <ep-3>
73
92
}
74
93
}
75
94
76
- $ sum_x^2 $
95
+ $ sum_x^2 $
77
96
$ dif/(dif x)(A(t)+B(x))=dif/(dif x)A(t)+dif/(dif x)B(t) $ <ep-2>
78
- $ sum_x^2 $
97
+ $ sum_x^2 $
79
98
$ dif/(dif x)(A(t)+B(x))=dif/(dif x)A(t)+dif/(dif x)B(t) $ <ep-3>
80
99
In @ep-2 and @ep-3 we see equations
81
100
```
0 commit comments