I was trying to have arabic numerals for the main part of the document and roman numerals for the appendix. I would also like to include the numbers of pages of the main part in the footer.
#let main-numbering(..n) = context {
numbering("1 | 1", n.at(0), ..counter(page).at(<appendix>))
}
#let footer = context [
#h(1fr)
#counter(page).display()
#h(1fr)
]
#set page(paper: "a8", footer: footer, numbering: main-numbering)
/* Main Content here */
= Chapter One
#lorem(20)
#metadata("end of main content") <appendix>
#set page(numbering: "I")
#counter(page).update(1)
#pagebreak()
/* Appendix Here */
= Appendix 1
My appendix
Now from the looks of it, this works reasonably well. However, if I add a outline, the total number of main pages now appear in in a outline as well :(
Is it possible to fix this? Before I added the appendix, I used to use #counter(page).display("1 | 1", both: true) which worked very well. But I canโt seem to apply both in this case.
Does this work for you? I remove the total number from page.numbering, and add the logic to page.footer.
#set page(numbering: "1", footer: context {
set align(center)
if page.numbering == "1" {
// Show the total number of pages when the main content.
numbering("1 | 1", ..counter(page).get(), ..counter(page).at(<appendix>))
} else {
// But not for the appendix.
counter(page).display()
}
})
#set page(width: 20em, height: auto, margin: 4em)
#set page(numbering: "i")
#outline()
#set page(numbering: "1", footer: context {
set align(center)
if page.numbering == "1" {
// Show the total number of pages when the main content.
numbering("1 | 1", ..counter(page).get(), ..counter(page).at(<appendix>))
} else {
// But not for the appendix.
counter(page).display()
}
})
#counter(page).update(1)
/* Main Content here */
= Chapter One <chapter>
#lorem(20)
#pagebreak()
== Section
See #ref(<chapter>, form: "page").
#metadata("end of main content") <appendix>
#set page(numbering: "I")
#counter(page).update(1)
/* Appendix Here */
= Appendix 1
My appendix