2024-10-22
Typst
I've encountered typst a while ago, and having used Latex for most of the real texts that I've had to write since starting university -- and struggling with it, quite a lot -- I've come to find it a welcome breath of fresh air.
Today marked the first day I've helped out someone on the internet with their own typst problem, and this seems to be as good a reason as any to start writing about my experiences.
Typst enum no-hang-indent
The unofficial IRC channel presented me with a problem
10/22 aedinius I'm trying to recreate this (probably with less space between the
number and body, but that's not the point of this)
https://i.imgur.com/UqlNrnU.png
aedinius I can't seem to get the body to wrap to the margin, it wants to keep
the entire body indented at whatever indent I set.
here's the image the link pointed to:
I was sure this couldn't be too hard, right?
Took me some time, but I figured it out in the end.
So if you're ever in the need for enums without their default hanging indentation, here's a show rule that achieves that:
#show enum: it => context {
let max = it.children.len() + it.start
let w = measure(
numbering(it.numbering, max)
).width
set par(
hanging-indent: -it.body-indent - w
)
it
}
This is what the result then looks like:
Hope it helps, and happy typsting :)