53

I'm trying to continue the numbering of examples in enumerate environments in beamer. For example, I'd like one slide to feature

  1. Foo
  2. Bar

and the next slide

  1. Zip
  2. Yadda

My strategy so far has been to define a counter that saves the enumerate counter at the end of the first environment and can then be queried to set the enumerate counter at the start of the second enumerate environment. (This is essentially the proposal also found at How to Continue Enumerate Across Columns in Beamer)

That works wonderfully so long as I don't try to uncover elements of the slide sequentially. The problem, of course, is that as each of the pdf-pages that make up the slide is created, the counter is advanced. Here's a MWE.

\documentclass{beamer}

\setbeamercovered{highly dynamic}

\newcounter{saveenumi}
\newcommand{\seti}{\setcounter{saveenumi}{\value{enumi}}}
\newcommand{\conti}{\setcounter{enumi}{\value{saveenumi}}}


\begin{document}

\begin{frame}[<+->]
  \begin{enumerate}
  \item foo
  \item bar%
    \seti
  \end{enumerate}
\end{frame}

\begin{frame}[<+->]
  \begin{enumerate}
    \conti
  \item zip
  \item yadda%
    \seti
  \end{enumerate}
\end{frame}

\end{document}

As the second slide is progressively uncovered (pages 3 and 4 of the resulting PDF), the counter at the beginning of the enumerate environment is advanced each time. So page 3 of the PDF has the right numbering, (3) and (4) respectively, while the fully revealed page has the wrong numbering. Pictures follow:

on one of the slides

Page3

on the following one

Page4

3 Answers 3

58

Use \resetcounteronoverlays to ensure that your counter is automatically reset on subsequent slides of a frame:

\resetcounteronoverlays{saveenumi}

A complete example using your code:

\documentclass{beamer}
\setbeamercovered{highly dynamic}

\newcounter{saveenumi}
\newcommand{\seti}{\setcounter{saveenumi}{\value{enumi}}}
\newcommand{\conti}{\setcounter{enumi}{\value{saveenumi}}}

\resetcounteronoverlays{saveenumi}

\begin{document}

\begin{frame}[<+->]
  \begin{enumerate}
  \item foo
  \item bar%
    \seti
  \end{enumerate}
\end{frame}

\begin{frame}[<+->]
  \begin{enumerate}
    \conti
  \item zip
  \item yadda%
    \seti
  \end{enumerate}
\end{frame}

\end{document}

enter image description here

enter image description here

1
5

Try resetting the enumi counter in the new list, like \setcounter{enumi}{5} to initiate with 6.

1
4

An option I've found that works is to use itemize and put numbers in square brackets. For example

\begin{itemize}
    \item[1] foo
    \item[2] bar
\end{itemize}

And just start another itemize on the next slide with the next number in square brackets.

1
  • That would overwrite the enumerate item template set with beamer. It is a practical workaround only if you want each item to be a simple number. Jun 2, 2020 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .