12

I have several blocks in a slide:

\begin{block}{block 1}
  block 1
\end{block}
\begin{block}{block 2}
  block 2
\end{block}
\begin{block}{block 2}
  block 2
\end{block}

Does anyone know how to overlay them so as to show them block by block by left-clicking mouse?

1
  • 2
    \pause between blocks maybe? Or do want them on top of each other? Your question is not very specific to that regard.
    – hakaze
    Aug 15, 2012 at 13:56

2 Answers 2

23

Three ways (depending on how you want them to appear, there might be other possibilities):

\documentclass{beamer}

\begin{document}
\begin{frame}
\onslide<+->{\begin{block}{block 1}
  block 1
\end{block}}
\onslide<+->{\begin{block}{block 2}
  block 2
\end{block}}
\onslide<+->{\begin{block}{block 3}
  block 3
\end{block}}
\end{frame}

\begin{frame}
\only<1>{\begin{block}{block 1}
  block 1
\end{block}}
\only<2>{\begin{block}{block 2}
  block 2
\end{block}}
\only<3>{\begin{block}{block 3}
  block 3
\end{block}}
\end{frame}

\begin{frame}
\begin{block}{block 1}
  block 1
\end{block}\pause
\begin{block}{block 2}
  block 2
\end{block}\pause
\begin{block}{block 3}
  block 3
\end{block}
\end{frame}

\end{document}
3
  • Thanks, what is the difference between the 1st and the 3rd solutions?
    – SoftTimur
    Aug 15, 2012 at 14:15
  • 1
    @SoftTimur \pause and \onslide behave differently when used inside environments (in my little example there will be no difference since the commands were not used inside environments). The beamer documentation contains the details. Aug 15, 2012 at 22:45
  • 1
    I found Solution 2 to be the best substitute for block transition animations. It has a lot of use cases while preparing slides. Thanks!
    – Dexter
    Jul 31, 2013 at 21:12
2

There is also a shorter version which makes use of beamer block being overlay aware: \begin{block}<only@1>{title}...

MWE:

\documentclass{beamer}

\usetheme{Warsaw}

\begin{document}
    
\begin{frame}
\begin{block}<only@1->{block 1}
  block 1
\end{block}
\begin{block}<2->{block 2}
  block 2
\end{block}
\begin{block}<3->{block 2}
  block 2
\end{block}

\end{frame} 
    
\end{document}

enter image description here

3

You must log in to answer this question.

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