How to make outlines with headings in different languages than the document's main language?

My article is written in one language, of course it has headings in this language and an outline, but I also need to write one more outline in another language. However, the article does not have a title in the other language, and the original outline will be disturbed when it is written separately. Is there any way to handle this? I’ve been trying to fully customizing an outline page but no results.
Thanks in advance.

Do you just want the outline in the other language to have a different title (heading)? Or is there more that you need to translate compared to the outline in the original language?

I would like all the contents of outline in original language be translated. My point is how to make an outline contains headings does not show in the paper. Because obviously there can’t be two language headings in the doc. I know I can fake an outline in the other language with manually updated.

What I have tried:

  • Using a form like metadata[= heading] <heading-en> to hide behind the headings in the article, and rendering the outlines uniformly via selectors.
  • Customize an outline function to accept multilingual headings, but only display one in the text, and record the position in the text so that you can generate links
  • Manually faking an outline

Okay, I think I understood your requirements now. The easiest approach I found is to use a function for the heading body where you define the title in each language you need. This function will then select the correct title based on the text language in the current context. If you then create the “other” outline with a different text language, the other titles will automatically be selected. This approach is similar to the short and long captions for figures here.

#let multi-heading(..titles) = context titles.named().at(text.lang)

// This is not necessary, it just shows that the regular heading functionality is not affected.
#set heading(numbering: "1.") 

= #multi-heading(en: "My Title", de: "Mein Titel", fr: "Mon Titre")

#outline()

#{
  set text(lang: "de")
  outline()
}

#{
  set text(lang: "fr")
  outline()
}

2 Likes

Thanks a lot! This is amazing! I’ve been stuck with it for two days. Never thought creating a function for heading. Many thanks again!