Compare commits
2 Commits
6a763ea918
...
15786007fc
Author | SHA1 | Date |
---|---|---|
orca | 15786007fc | |
orca | 23d963609c |
|
@ -3,6 +3,9 @@
|
|||
// We need the name of our environments.
|
||||
#import "constants.typ": *
|
||||
|
||||
/* Hides a command in text. */
|
||||
#let hide-cmd(cmd) = [#place(right, cmd)]
|
||||
|
||||
/* Emphasize a block by placing it in a decorated rectangle. */
|
||||
#let block-emph(body, way: "") = {
|
||||
let outset = 5pt
|
||||
|
@ -25,20 +28,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)
|
||||
let cmd = 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]
|
||||
return if emphasis == "bold" {
|
||||
block-emph(way: decoration)[#hide-cmd(cmd)*#id #number#name.* #body]
|
||||
} else if emphasis == "italics" {
|
||||
block-emph(way: decoration)[_#id #name._ #body]
|
||||
block-emph(way: decoration)[#hide-cmd(cmd)_#id #number#name._ #body]
|
||||
} else {
|
||||
block-emph(way: decoration)[#id #name. #body]
|
||||
block-emph(way: decoration)[#hide-cmd(cmd)#id #number#name. #body]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,6 @@
|
|||
math.equation(numbering: numbering-equation, block: true)[#body]
|
||||
} else {
|
||||
let cmd = counter(math.equation).update(n => calc.max(0, n - 1))
|
||||
math.equation(numbering: it => "(" + name + ")", block: true)[#body#place(right, cmd)]
|
||||
math.equation(numbering: it => "(" + name + ")", block: true)[#body#hide-cmd(cmd)]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue