if you use it.body your heading is no longer surrounded by a block, so it can’t be sticky anymore. You need to either use it directly or surround your heading manually with a block again.
#show heading.where(level: 2): set align(center)
#show heading.where(level: 2): it => block({
v(1.5em)
text(
size: 12pt,
weight:"regular",
)[#smallcaps[#it.body]]
})
Didn’t see that one coming.
It definitely works with #it. So thank you very much, problem solved !
I have a pretty noob question, though : what are the pros and cons of using #it or #it.body ?
I must admit I mostly used #it.body because I’d seen many people use it, without questioning the implications much.
it is the element itself, in this case the full heading (and the name it is just a convention). If you hover over it in the Typst web application or in Tinymist you can see it’s content.