How to increase heading level in an included document?

I am working on a project where I have a single file which includes a bunch of other typst files, is there a way to increase by one the depth of the included files to avoid 4,5 levels deep in the included files? This would also enable me to export the included files singularly in a nicer way

Hey @eduard! I’ve moved your post to the Questions category, which is more appropriate for your request. I’ve also updated your post title according to our guidelines: How to post in the Questions category

For future question posts, please ensure they are posted in the Questions category, and also make sure your title is a question you’d ask to a friend about Typst. :wink:

1 Like

You may update the heading.offset property to bump headings’ levels (the final level is equal to heading.depth + heading.offset, where depth is the amount of =, and the offset defaults to 0):

#let chapter = heading.with(level: 1)  // not affected by offset
#set heading(offset: 1)  // globally increase offset

#chapter[Chapter title]
#include "file.typ"

#chapter[Other chapter title]
= Section

#[
  // Update offset just for this file
  #set heading(offset: 2)
  #include "otherfile.typ"
]

There is a more complete example here: How to define a new highest header while keeping the others the same? - #3 by PgBiel

1 Like

Thank you! It never occurred to me that heading had an “offset” parameter. Typst is so nice

1 Like