# Beamerpauses counter reset between environments inside an overlay?

I was reading the answer to this question Mixing overprint with blocks of enumerations

[I recopy the code so you dont' have to follow the link]

\documentclass{beamer}
\usetheme{Warsaw}

\begin{document}

\begin{frame}{Test}
\begin{center}
text before
\pause
\begin{overlayarea}{\textwidth}{3.3cm}
\only<2-3>{%
\begin{block}{Some title here}
\begin{enumerate}[<+->]
\item One
\item Two
\end{enumerate}
\end{block}}
\only<4-7>{%
\begin{block}{Some title here}
\begin{enumerate}[<+(2)->]
\item CHicken
\item Duck
\item Rooster
\end{enumerate}
\end{block}}
\end{overlayarea}
text after
\end{center}
\end{frame}

\end{document}


and I noticed the use of a number between parentheses in the default incremented overlay specification in the second enumerate environment. (see the presence of [<+(2)->]) Only then will the items of the second numbered list in the overlayarea environment be uncovered incrementally.

Why is that needed ? It seems to imply that beamerpauses is reset between the enumerate environments ? Or is it reset between the only commands in the overlay environment?

Isnt that a nasty behaviour? Because it is as if you are supposed to keep track yourself of beamerpauses. The usefulness of [<+->] is lost then, isn't it ?

-

The apparently odd phenomenon can be explained examining the following simple example:

\documentclass{beamer}

\newcommand\showpauses{The value of beamerpauses at this point in slide \insertpagenumber\ is: \thebeamerpauses}

\begin{document}

\begin{frame}{Test}
\only<1-2>{\par\showpauses%
\begin{enumerate}[<+->]
\item One \showpauses
\item Two \showpauses
\end{enumerate}
}
\only<3>{\par\showpauses}
\end{frame}

\end{document}


After processing the document you'll have a three slide presentation showing the value of the beamerpauses counter at different stages.

Up to slide two, everything goes as one would expect: at the end of the enumerate on slide two the value of beamerpauses is three; however, on slide three, beamerpauses is 1. Why happened this? Well, because the overlay specification for \only was 1-2, so everything happening on slides 1 and 2 will occur only for those slides; in particular, the stepping of beamerpauses produced by the enumerate will have effect only for slides one and two. In the third slide, which is not under the effect of the \only, the counter beamerpauses will have the value that it had before.

Is this showing something wrong with beamer? I don't think so; after all, the expected meaning of \only is to keep things under its scope only for the specified slides.

If you use <1-> (or <1-3>) instead of <1-2> in the above example, as in

\documentclass{beamer}

\newcommand\showpauses{The value of beamerpauses at this point in slide \insertpagenumber\ is: \thebeamerpauses}

\begin{document}

\begin{frame}{Test}
\only<1->{\par\showpauses%
\begin{enumerate}[<+->]
\item One \showpauses
\item Two \showpauses
\end{enumerate}
}
\only<3>{\par\showpauses}
\end{frame}


you'll see that now on slide three the counter has the value three, because the third slide is under the scope of \only.

The "dirty" manual increment of the counter in the original example was simply due to the special effect the OP wanted to achieve. Perhaps this same effect could be achieved in another way, without manual intervention?

-
That sounds feasible. Learned something about the internals of beamer. Thx. It is rather tricky thus to rely too much on the [<+->] ! –  Mathias Vanwolleghem Apr 13 '13 at 14:12