How can I have a linebreak in a section title, but not in outline?

I would like to have a linebreak in the title of one of the sections, but I donโ€™t want this linebreak in the document outline, is there a way to do that?

#set heading(numbering: "1.")

I want a linebreak here ๐Ÿ‘‡
= This is a \ test

But I don't want a linebreak here ๐Ÿ‘‡
#outline()

One possibility would be to apply a show rule on outline.entry that basically stops linebreaks from showing up, though I am not completely sure if this could maybe introduce any side effects:

#set heading(numbering: "1.")
#show outline.entry: it => {
  show linebreak: none
  it
}

#outline()

= This is a \ test

Applying this show rule to outline itself doesnโ€™t work, as it internally also uses line breaks for separating the entries, which would then also disappear.

1 Like

Thatโ€™s a nice solution, but is there a solution that also removes the linebreak in the PDF metadata (in the embedded outline of the PDF)?

As far as I can tell, line breaks are already automatically removed from the PDF metadata, so there is nothing else to be done.

1 Like

Wonderful then, have a nice day!