How can I stop numbering slides in the appendix using Polylux 0.4?

Hi all,

I am a recent convert trying to replicate my standard LaTeX beamer template in Typst using Polylux (0.4). One thing that has been giving me a headache is how to stop incrementing the (logical) slide counter once I reach the appendix. Is there any good way to do this?

The specific behaviour I want to achieve is to have an appendix at the end of my slide deck in which slides are not numbered and do not count towards the total number of slides (because I use “Slide X out of Y”-style page numbering on my main slides).

My best shot so far has been to define an #appendix function as follows:

#let appendix(content) = {
  // do not show page numbers (or any footer at all) in the appendix
  set page(
    footer: none
  )

  // revert the slide number increase to the first appendix slide
  counter("logical-slide").update(n => n - 1)

  // prevent the slide counter from increasing with each new slide
  show pagebreak: it => context {
      counter("logical-slide").update(n => n - 1)
    }
    it
  }

  content
}

This works well in static mode, but as soon as I add animations, I run into trouble because, obviously, a pagebreak happens between each subslide as well, so the logical slide counter decreases by too much.

Does anyone know of a better way to prevent the slide counter from incrementing? Or of an entirely different way to store the total number of logical slides up to the appendix, and access them in the footer?

Cheers,

Joscha

You can create a label to indicate the start of the appendix and then read the value of the counter("logical-slide") at the location of the label. If you are already adding labels to your headings, you can use the last heading before the appendix or the first heading in the appendix. If that is not an option, you can use metadata to indicate the start of the appendix as shown in the code below.

#let page-footer = context [
  Slide #toolbox.slide-number out of #counter("logical-slide").at(<start-of-appendix>).at(0)
]

#set page(footer: page-footer)

#slide[Something]
#slide[in the main]
#slide[part of the]
#slide[presentation]

#metadata("This is the start of the appendix") <start-of-appendix>
#set page(footer: none)

#slide[Some slides...]
#slide[in the appendix]
1 Like

Ah, yes, that makes perfect sense! Thank you, that is a much more straightforward solution than a hacky page count decrementer.