How to customize the body of an outline entry?

Hi @jkunimune,

the problem is it.fill, which is a repeat element and takes the full space. You can restrict it with box(width: 1fr, it.fill) to the available space on the line.

#outline(title: [Default Contents])

#show outline.entry: it => link(
  it.element.location(),
  it.indented(
    it.prefix(),
    it.body() + sym.space + box(width: 1fr, it.fill) + sym.space + sym.wj + it.page()
  ),
)

#outline(title: [Imitated Contents])

= a really really really long loooooooooooooooooooooooooooooooooong maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanaa

I added sym.wj to prevent the page number from standing alone in a newline.

2 Likes