I have a template toc
#let toc(title, subtitle: none, short: none, date: none, note: none, body) = [
#context if not state("included", false).get() [
...
] else [
#heading([
#if subtitle != none {
subtitle
} else {
title
}
])
]
#show: show-target(paged: doc => {
set page(
header: context [
...
],
footer: context [
...
],
)
body
})
...
#body
]
My main document looks like:
#import "/typst-utils/main.typ": *
#show: style
#show: toc.with("Test", short: "Test", date: "2025-10-10", subtitle: "Gesamtdokument")
#context state("included", false).update(true)
#context include "Include1.typ"
#context include "Include2.typ"
#context state("included", false).update(false)
#show: sources
And my included files like:
#import "/typst-utils/main.typ": *
#show: style
#show: toc.with("Include1", subtitle: "Include1", short: "Short")
Include1
#show: sources
The generated file is attached. As one can see the heading of the files (Includedx) takes a whole page, as it counts towards "Gesamtdokument" (top right is the file)