The title generated by outline
is left-aligned by default. What’s the proper way to center it?
My attempts
Test code
#set page(width: 240pt, margin: 15pt, height: auto)
// #set .. or #show ...
#outline()
= Heading
Method A
The naive method:
#set outline(title: align(center)[Contents])
But no effect:
Method B
From How to center `outline` title? · typst/typst · Discussion #2004 · GitHub in 2023:
#show outline: it => {
show heading: set align(center)
it
}
It works, but is it still relevant today? Are there any side effects?
Method C
After checking the source code, I realize that outline.title
will be put inside a heading
, and come up with the following.
#set outline(title: block(width: 100%, align(center)[Contents]))
Is it suitable to put block
and align
in a heading
?