You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read a page's numbering by physical page number #9077
A script can read a page's numbering only through location.page-numbering(), so it needs a locatable element on that page. Pages with nothing locatable on them can't be read: a page a paragraph only runs on to, the blank left by pagebreak(to: "odd"), a page of a shape alone, or text set in a block, grid or place without a paragraph break. Typst's own folio isn't locatable either. A script therefore can't tell a numbered page from an unnumbered one, although the introspector already stores every page's numbering.
#setpage(width: 6cm, height: 4cm, numbering: "1")
Text
#pagebreak()
#lorem(30) // runs on to page 3#page(numbering: none)[#rect()] // page 4, unnumbered#setpage(numbering: "i")
#counter(page).update(1)
Index
Pages 3 (numbered 3) and 4 (unnumbered) both have nothing locatable, so they look the same to a script. The only workaround is a context in every page's header, footer or background, which a package can't add without overriding the user's page settings, and which a page can turn off with header: none.
Possible API
A function giving a page's numbering (and supplement) by physical page number, or
a way to get a location for a page, on which page-numbering() already works.
Related: #1321 (page properties on locations), #2722 (empty pages), #8387 (PDF page labels missing for numbering functions).
Use Case
A package that builds a book's catalogue record needs its page sequences (xii, 310 p., [3] p. of plates).
Activity