Added ability to reference math environments.

Resolves #2.
This commit is contained in:
orca 2024-02-03 21:14:33 +01:00
parent bfd8039ca2
commit c917938ba8
Signed by: orca
GPG Key ID: 6923B8DFED96A68A
2 changed files with 17 additions and 4 deletions

View File

@ -31,14 +31,17 @@
let cmd = current-counter.step()
let number = counter(heading).display() + current-counter.display()
let figure-name = if name == "" { [#number] } else { [#number (#name)] }
let math-figure(body) = figure(supplement: none, kind: id, numbering: it => figure-name, body)
let name = if name == "" { [] } else { [ (#name)] }
return if emphasis == "bold" {
block-emph(way: decoration)[#hide-cmd(cmd)*#id #number#name.* #body]
math-figure(block-emph(way: decoration)[#hide-cmd(cmd)*#id #number#name.* #body])
} else if emphasis == "italics" {
block-emph(way: decoration)[#hide-cmd(cmd)_#id #number#name._ #body]
math-figure(block-emph(way: decoration)[#hide-cmd(cmd)_#id #number#name._ #body])
} else {
block-emph(way: decoration)[#hide-cmd(cmd)#id #number#name. #body]
math-figure(block-emph(way: decoration)[#hide-cmd(cmd)#id #number#name. #body])
}
}

View File

@ -16,7 +16,7 @@
"unknown"
})
import "constants.typ": lang, outline-title, abstract-title
import "constants.typ": *
set page(paper: "a4", margin: (x: 1.8cm, y: 2.6cm), numbering: "1")
@ -36,6 +36,16 @@
set math.equation(supplement: none)
/* Show math figures as normal text. */
show figure.where(kind: proposition-id): it => it.body
show figure.where(kind: lemma-id): it => it.body
show figure.where(kind: theorem-id): it => it.body
show figure.where(kind: corollary-id): it => it.body
show figure.where(kind: definition-id): it => it.body
show figure.where(kind: remark-id): it => it.body
show figure.where(kind: example-id): it => it.body
show figure.where(kind: proof-id): it => it.body
/* Show headings like in amsart. */
show heading: it => {
set block(above: 1.8em, below: 1.2em)