It’s quite hacky and hard-coded but i only use one kind of theorem “box” so it’s fine for me, for sure it’s possible to code it more elegantly but I don’t have time for that right know.
#let mythmbox(
identifier,
head,
..blockargs,
supplement: auto,
padding: (top: 0.8em, bottom: 0em),
namefmt: x => [(#x)],
titlefmt: strong,
bodyfmt: x => x,
separator: [#h(0.1em):#h(0.2em)],
base: "heading",
base_level: none,
) = {
if supplement == auto {
supplement = head
}
let boxfmt(name, number, body, title: auto, ..blockargs_individual) = {
if not name == none {
name = [ #namefmt(name)]
} else {
name = []
}
if title == auto {
title = head
}
if not number == none {
title += " " + number
}
title = titlefmt(title)
body = bodyfmt(body)
pad(..padding, block(
breakable: false,
fill: none,
width: 100%,
radius: 0pt,
stroke: (thickness: 0.5pt, paint: black),
inset: 1.2em,
place(top, dx: -5pt, dy: -20pt, block(
fill: white,
inset: (x: 5pt, y: 5pt),
stroke: 0pt,
)[
#text(font: sansfont)[*#title* #name]
])
+ body,
))
}
return thmenv(identifier, base, base_level, boxfmt).with(
supplement: supplement,
)
}
#let theorem = mythmbox("theorem", "Theorem", base_level: 2)