Skip to content

Curstom slide numbers #530

Open
Open

Description

@inventionate

Thanks for the great tool. I'm currently trying to implement custom slide numbering (the title page and overview should not count and horizontal and vertical slides should be displayed specifically). With the option to set a custom generator, it works great (as mentioned in https://revealjs.com/slide-numbers/). Unfortunately, I had to adapt the Pandoc template and lose some quarto possibilities. Is there an easier / better way to set a custom slide number generator?

I want to specify something like this instead of slideNumber: 'c/t':

 slideNumber: slide => {
              return [ '<span>' + (Reveal.getIndices( slide ).h - 1) + '</span><span>[' + (Reveal.getIndices( slide ).v + 1) + ']</span>'];
        }

Activity

  1. jjallaire commented on Apr 5, 2022

    @jjallaire
    Collaborator

    Unfortunately using JS to specify a custom slideNumber currently doesn't survive the transformation from YAML to reveal. You could consider using the standard h/v style numbering format along with "uncounted" slides: https://quarto.org/docs/presentations/revealjs/advanced.html#uncounted-slides

  2. inventionate commented on Apr 5, 2022

    @inventionate
    Author

    Thank you, I have already tried that, but unfortunately is not purposeful. I am trying to achieve this representation:

    Bildschirmfoto 2022-04-05 um 14 10 59

    The first number should correspond to the numbers of the overview. So horizontally it is only counted from slide 3 on and should start with 1.

    I hope that Quarto will make it easier to configure Reveal in the future. Until then, I'm using an adapted Pandoc default template, and I'll see if there is a better variant (as soon as I have the time).

    Thanks for the quick reply, anyway!

  3. added this to the Future milestone on Jun 8, 2022
  4. added
    revealjs
    enhancement
    on Jul 18, 2023
  5. added
    themes
    on Mar 29, 2025
  6. mcanouil commented on Jul 14, 2025

    @mcanouil
    Collaborator

    If you need/want to overtake completely, you can do so directly using Reveal.js

    (I only took the code shared with no testing)

    ---
    format:
      revealjs:
        include-after-body:
          - text: |
              <script type="text/javascript">
                Reveal.addEventListener('ready', function() {
                  Reveal.configure({
                    slideNumber: slide => {
                      return ['<span>' + (Reveal.getIndices(slide).h - 1) + '</span><span>[' + (Reveal.getIndices(slide).v + 1) + ']</span>'];
                    }
                  });
                });
              </script>
    ---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrevealjsthemes

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions