Hi,
I wanted to make my show rules for headings more elegant and flexible. The idea is to apply most settings generic and with parameters. And then after some experimenting (and code golfing ) I ended with this:
#let number_headings = 9
#show heading: it => {
let text_size = text.size + (number_headings - it.level) * 0.25em // 11pt or text.size
text(size: text_size)[#it]
text(size: 11pt)[#text_size] // only for debugging
}
#for level in range(number_headings, 0, step: -1) {
heading(level: level)[Heading #level]
}
My idea to use text.size
instead of 11pt
is to make headings more responsive in terms of the default font size. This is true for all headings, except level 1 and 2. The font size is 15.4 and 13.2 pt there.
Is this intentional? Did I miss something? Am I holding it wrong? Is there a pattern (like a pythonic way in Python) for these kinds of use cases?
Thank you a lot!