How can I continue frontmatter numbering in backmatter?

Hey there,

Is there any possibility to continue the numbering of the frontmatter also in the backmatter? Lets say I got the last page in the frontmatter as IV, then I write my main part with Arabic Numbering and when I switch to the Backmatter I want to continue with V.
I know that I can update the page counter with counter(page).update(5) but I want to make it dynamically if something changes in the frontmatter, for example the outline.

It is probably a very simple solution like everything in Typst, but as a beginner coming from LaTeX, you don’t always think as straightforward as Typst :smile:

Thanks in advance

You can look at the package anti-matter – Typst Universe.

If you don’t want to use a package, then a simple PoC would be

#let frontmatter(body) = {
    set page(numbering: "i")
    body
}
#let mainmatter(body) = {
    set page(numbering: "1")
    context counter("antimatter").update(counter(page).get())
    body
}
#let backmatter(body) = {
    set page(numbering: "i")
    context counter(page).update(counter("antimatter").get())
    body    
}

#show: frontmatter
#lorem(100)
#pagebreak()
#lorem(100)

#show: mainmatter
#lorem(100)
#pagebreak()
#lorem(100)

#show: backmatter
#lorem(100)
#pagebreak()
#lorem(100)

1 Like

thank you very much, this is exactly what I was looking for