How to put different page numbering in multi-page outline?

Hi, I’ve setup a page numbering like - 1 - but I’d want it to stay like the default numbering inside the outline.
I’ve found a solution using state, and it almost works perfectly BUT when the outline is spread on multiple pages, the page numbering (on the bottom of the page where the outline starts) stays the default one.

The original solution I’ve found set the in-outline state to true for the entire outline. I’ve tried to change it to true only inside outline entries but it didn’t changed anything :/

I’ve recreated the problem in a minimal file : (also available here : Typst)

#let in-outline = state("in-outline", false)

#set page(height: 120pt)

#set page(numbering: (..n) => context {
  if in-outline.get() {
    numbering("1", n.at(0))
  } else {
    numbering("- 1 -", n.at(0))
  }
})

#show outline.entry: it => {
  in-outline.update(true)
  it
  in-outline.update(false)
}

#block(height: 40pt)

#outline()

= #lorem(5)
= #lorem(5)

Code Result :

Desired behavior :

Does someone here has an idea how to fix this ?

Hi. This is a duplicate of How to change the format of page numbers only in the outline (and skip the first few pages) - #3 by Andrew.

Just use

#set page(footer: context align(center)[\- #counter(page).display() -])

or something similar.

1 Like