hey! i’m writing a small math library which includes this snippet:
#let theorem_impl(type, caption, body) = {
align(
center,
figure(
caption: figure.caption(
position: top,
caption,
),
kind: lower(type),
supplement: type,
box(
fill: rgb("#eee"),
stroke: 1pt + rgb("000"),
inset: 5pt,
body,
),
),
)
}
#let theorem(caption: [], body) = theorem_impl(
"Theorem",
caption,
body,
)
#let proposition(caption: [], body) = theorem_impl(
"Proposition",
caption,
body,
)
#let lemma(caption: [], body) = theorem_impl(
"Lemma",
caption,
body,
)
i was curious if there’s a manner by which to label the three derivative functions dynamically via a loop, as opposed to manually defining each of them, as the naive solution:
#for theorem-type in ([Theorem], [Proposition], [Lemma]) {
let theorem-type(caption: [], body) = theorem_impl(
type,
caption,
body,
)
}
did not seem to work. thanks!