5

So, the following question was sent to the beamer mailing list, and after spending over an hour trying to answer what I thought would be a trivial question, I figured I might as well put the answer here. (I'm going to feel very silly if this turns out to be a duplicate.) The idea is that you start with something like this:

\documentclass{beamer}
\let\Tiny\tiny
\setbeamertemplate{navigation symbols}{}
\begin{document}
\frame{
\begin{itemize}
\only<1> {
\item Foo
\item Bar
}
\only<2> {
\item I replace Foo
\item I replace Bar
\item I am new!
}
\end{itemize}
}
\end{document}

Now, since they are of different sizes, this makes the itemize jump around on the slide. We need some grouping of the items that reserves space for the contents of the largest group.

4
  • What if "I replace Foo" takes up two lines?
    – quazgar
    Feb 9 at 11:53
  • I don't understand the question. If it takes up two lines then it... takes up 2 lines
    – Mark
    Feb 9 at 17:38
  • I mean, if in <1> it was Foo\\second line, and in <2> still only one line, does the solution still work?
    – quazgar
    Feb 13 at 10:13
  • I believe both posted solutions still work. Try and see!
    – Mark
    Feb 14 at 17:07

2 Answers 2

6

It is definitely possible to use only one itemize environment in this case. You could simply replace Foo and Bar using the \alt command. In my opinion the resulting code is also easier to read. Here is an example:

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\frame{
\begin{itemize}
\item\alt<1>{Foo}{I replace Foo}
\item\alt<1>{Bar}{I replace Bar}
\item<2> I am new!
\end{itemize}
}
\end{document}

OUTPUT:

beamer_overlay_itemize

1
  • You are right, this is way better!
    – Mark
    Apr 20, 2016 at 18:20
5

It turns out that this works:

\documentclass{beamer}
\let\Tiny\tiny
\setbeamertemplate{navigation symbols}{}
\begin{document}
\frame{
\begin{overprint}
\onslide<1>
\begin{itemize}
\item Foo
\item Bar
\end{itemize}
\onslide<2>
\begin{itemize}
\item I replace Foo
\item I replace Bar
\item I am new!
\end{itemize}
\end{overprint}
}
\end{document}

This looks pretty simple (to me). What's surprising is the other simple looking solutions that fail. (For instance, just try doing this using a single itemize environment.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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