In beamer, how to use \pause inside \only

This is due to the way that \pause works. As beamer processes a frame, it has an internal counter beamerpauses which it uses to work out what the current "logical" slide is. This is for use when you want to specify an overlaid command without referring to a specific slide, which is useful if you don't know (or haven't yet decided) what the specific slide number is. It is used when you have things like \item<+-> or \alert<.(1)>. It is incremented according to strict rules: basically, you need a + in the overlay. It is not incremented by things like \alert<3-4>. This is useful as it allows you to have a "main flow" (using +) and some things outside it, using explicit specifications.

Now the punchline. \pause is the same as \onslide<+->. So it uses the beamerpauses counter and increments it. But all those \onlys don't. Moreover, when the overlay specification for \only is not matched, it throws away its contents without processing it. So those \pauses inside \onlys are not processed when the overlay is not matched.

Let's consider what happens on slide 5.

\begin{frame}
\frametitle{An example}
\only<1>{% not present on slide 5
insert a picture for instance
}
\pause % on slide 5
\only<2-3>{% not on slide 5
\begin{itemize}
\item here is my first remark
\pause % not on slide 5
\item and here is my second
\end{itemize}
}
\only<4>{ % not on slide 5
insert a 2nd picture
}
\pause % on slide 5
\only<5-6>{ % on slide 5
\begin{itemize}
\item bla bla bla
\pause % on slide 5
\item ...
\end{itemize}
}
\end{frame}

Thus we are left with the following, and I'll count beamerpauses:

\begin{frame}
\frametitle{An example} % beamerpauses = 1
\pause % beamerpauses = 2
\pause % beamerpauses = 3
\begin{itemize}
\item bla bla bla
\pause % beamerpauses = 4
\item ...
\end{itemize}
\end{frame}

But we're on slide 5, so all of those pauses are considered as "dealt with" meaning that on slide 5, the entire contents are typeset.

There are various ways to fix this, but the simplest is to avoid mixing these two methods of specifying what goes on slides. Use \pause for the main flow and only use specific specifications for things outside the main flow. If all else fails, you can always manually set beamerpauses with a \setcounter{beamerpauses}{5}, for example.


I don't have my LaTeX here, but this ought to work. You have to rewrite each \pause to proper <n-m> syntax.

\begin{frame}
\frametitle{An example}
\only<1>{
insert a picture for instance
}
\only<2-3>{
\begin{itemize}
\item<2-3> here is my first remark
\item<3-3> and here is my second
\end{itemize}
}
\only<4>{
insert a 2nd picture
}
\only<5-6>{
\begin{itemize}
\item<5-6> bla bla bla
\item<6-6> ...
\end{itemize}
}
\end{frame}

Tags:

Beamer

Pause