Imporved modularity of math-block.

This commit is contained in:
orca 2024-02-01 01:04:30 +01:00
parent 6a763ea918
commit 23d963609c
Signed by: orca
GPG Key ID: 6923B8DFED96A68A
1 changed files with 6 additions and 9 deletions

View File

@ -25,20 +25,17 @@
/* The `name` named variable allows us to give a name to be displayed instead of the numbers. */
#let math-block(body, name: "", id: "", emphasis: "bold", decoration: "fill") = {
let current-counter = counter(id)
current-counter.step()
let name = if name == "" {
current-counter.step()
counter(heading).display() + current-counter.display()
} else {
"(" + name + ")"
}
let number = counter(heading).display() + current-counter.display()
let name = if name == "" { [] } else { [ (#name)] }
if emphasis == "bold" {
block-emph(way: decoration)[*#id #name.* #body]
block-emph(way: decoration)[*#id #number#name.* #body]
} else if emphasis == "italics" {
block-emph(way: decoration)[_#id #name._ #body]
block-emph(way: decoration)[_#id #number#name._ #body]
} else {
block-emph(way: decoration)[#id #name. #body]
block-emph(way: decoration)[#id #number#name. #body]
}
}