Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 15 down vote accepted

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

share|improve this answer
    
Hot Diggity. That's great. Thanks a lot. –  Bernhard May 9 '12 at 1:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.