Hi, for my report I need to number the first pages in Roman numerals, and the following ones in Arabic numerals. I’ve tried the following model, but when I switch to Arabic numbering, the total number of pages in the Roman section is incorrect (for example, III/II instead of II/II).
Here is my snippet:
#set page(width: 6cm, height: 3cm, footer-descent: 0pt, margin: 4mm)
#set pagebreak(weak: true)
#set page(numbering: "I/I")
= I First Roman section
#pagebreak()
= II Second Roman section
#pagebreak()
= III Last Roman section
#pagebreak()
#counter(page).update(1)
#set page(numbering: "1/1")
= 1 First Arabic section
#pagebreak()
= 2 Second Arabic section
The total number of pages seems to use the final value of the page counter in the document. By default you would therefore share the total page number between the Roman-numbered pages and the Arabic-numbered pages.
You can use a label at the end of the Roman-numbered pages as a reference point. The page counter at the label location will then give you the total number of pages.
In the rule for the Arabic numbers you are using the format "1/2" which will always use two as total number of pages. I’m not sure whether that is intentional? In any case the “2” in the numbering was not related to the Roman number 2 for the total page count. This was simply caused by the two pages with Arabic numbers at the end of your document.
#set page(width: 6cm, height: 3cm, footer-descent: 0pt, margin: 4mm)
#set pagebreak(weak: true)
#let roman-numbering(..n) = context {
numbering("I/I", n.at(0), counter(page).at(<last-roman-page>).at(0))
}
#set page(numbering: roman-numbering)
= I First Roman section
#pagebreak()
= II Second Roman section
#pagebreak()
= III Last Roman section
#metadata("last-roman-page") <last-roman-page>
#pagebreak()
#counter(page).update(1)
#set page(numbering: "1/1")
= 1 First Arabic section
#pagebreak()
= 2 Second Arabic section
#set page(width: 6cm, height: 3cm, footer-descent: 0pt, margin: 4mm)
#set pagebreak(weak: true)
#set page(numbering: (..n) => context {
numbering("I/I", n.at(0), ..counter(page).at(<last-roman-page>))
})
= I First Roman section
#pagebreak()
= II Second Roman section
#pagebreak()
= III Last Roman section
#metadata("last-roman-page") <last-roman-page>
#pagebreak()
#counter(page).update(1)
#set page(numbering: "1/1")
= 1 First Arabic section
#pagebreak()
= 2 Second Arabic section
P.S. I’ve looked at the 2 posts and was confused why I see what I’ve written just a moment ago, but don’t see my post. I thought it got removed or something. But apparently it’s a completely new topic and the one I was thinking about is How to use Arabic and Roman page numbers in one document? - #5 by Andrew.