How to create an outline where certain entries do not linebreak?

I would like to create an outline like this:

I tried the following:

#set text(size: 12pt)
#set heading(numbering: "1.")
#show outline.entry.where(level: 1): set text(size: 1.5em, weight: "bold")
#show outline.entry.where(level: 1): set block(above: 6mm, below: 4mm)
#show outline.entry.where(level: 2): it => box(
  link(
    it.location(),
    [#it.prefix() #it.body() (#it.page()). #h(2mm)]
  )
)

#outline(title: none)

= #lorem(5)
== #lorem(4)
== #lorem(3)
== #lorem(10)
== #lorem(1)

= #lorem(2)
== #lorem(2)
== #lorem(2)
== #lorem(3)
== #lorem(6)

Ok. But I have (at least) two problems:

  • The indentation is broken.
  • The words do not wrap.

Please help me. I have no idea what I am doing.

There is an open issue, https://github.com/typst/typst/issues/6965 that requests run-in lists for footnotes and points out that such run-in lists are valuable elsewhere.

Your outline issue is exactly the problem I had in mind when I commented there.

1 Like