Reference numbered equations.

This commit is contained in:
orca 2024-01-21 21:20:35 +01:00
parent 121e5f7758
commit 0adad39a50
Signed by: orca
GPG Key ID: 6923B8DFED96A68A
2 changed files with 18 additions and 2 deletions

View File

@ -58,7 +58,8 @@
if name == "" {
math.equation(numbering: numbering-equation, block: true)[#body]
} else {
counter(math.equation).update(n => calc.max(0, n - 1))
math.equation(numbering: it => "(" + name + ")", block: true)[#body]
// Hacky.
let cmd = counter(math.equation).update(n => calc.max(0, n - 1))
math.equation(numbering: it => "(" + name + ")", block: true)[#body#place(left, cmd)]
}
}

View File

@ -31,6 +31,21 @@
set math.mat(delim: "[", row-gap: 0.65em, column-gap: 1em)
set math.vec(delim: "[", gap: 0.65em)
/* Show references to equations without leading text. */
show ref: it => {
let eq = math.equation
let el = it.element
if el != none and el.func() == eq {
numbering(
el.numbering,
..counter(eq).at(el.location())
)
} else {
it
}
}
/* Show headings like in asmart. */
show heading: it => {
set block(above: 1.8em, below: 1.2em)