Formatting of page numbers for scientific ducuments

I was always annouyed at the numbering for the document, so I’ve created some scripting, that correctly formats the page numbering, so that:

  • large roman numbers for the outline
  • arabic numbers for the main document
  • small roman numbers for the bibliography

The code I’ve written might not be the prettiest solution but it works.

// set normal counter for the bibliography pages
#set page(numbering: "1", footer: [
  #set align(center)
  #line(length: 100%)
  #context counter(page).display("I")
])

#outline(title: "Outline")
#pagebreak()

//reset counter, so that correct page numbering ist shown in outline
#counter(page).update(1)

// define counter for normal pages
#let normalpage = counter("normalpage")

// Footer for main text
#set page(footer: [
  #set align(center)
  #line(length: 100%)
  // increase counter on every page
  #normalpage.step()
  #context normalpage.display("1 / 1", both: true)
])

= Main text


#pagebreak()
// define counter for bibliography
#let bibpage = counter("bibpage")

// Footer for bibliographie
#set page(footer: [
  #set align(center)
  #line(length: 100%)
  // count up on every page
  #bibpage.step()
  #context bibpage.display("i")
])

#bibliography("lit.bib", title: "Bibliography", style: "ieee")

If you find any bugs or think that something can be improved, feel free to comment.

Hope this helps.

Minor style change: since the content of all footers enter markup mode (with []) but just invoke functions, you can omit the # by instead entering code mode (with {}):

// set normal counter for the bibliography pages
#set page(numbering: "1", footer: {
  set align(center)
  line(length: 100%)
  context counter(page).display("I")
})

#outline(title: "Outline")
#pagebreak()

//reset counter, so that correct page numbering ist shown in outline
#counter(page).update(1)

// define counter for normal pages
#let normalpage = counter("normalpage")

// Footer for main text
#set page(footer: {
  set align(center)
  line(length: 100%)
  // increase counter on every page
  normalpage.step()
  context normalpage.display("1 / 1", both: true)
})

= Main text


#pagebreak()
// define counter for bibliography
#let bibpage = counter("bibpage")

// Footer for bibliographie
#set page(footer: {
  set align(center)
  line(length: 100%)
  // count up on every page
  bibpage.step()
  context bibpage.display("i")
})

#bibliography("lit.bib", title: "Bibliography", style: "ieee")
2 Likes

That seems to be correct, though I think that seems to be the only “bug”, even if it’s less of a bug and rather a styling issue.