3

I want to achieve similar effect to this: Updating picture after \pause but I want to change the previously displayed block.

\documentclass{beamer}
\usetheme{Warsaw}


\begin{document}

\begin{frame}
  \begin{block}<1>{Example of Cloze style question}
    \underline{\ \ \ \ \ \ \ \ }  is the man, who invented dynamite. \\
  \end{block}
  \begin{block}<2>{Example of Cloze style question}
    \textbf{Nobel}  is the man, who invented dynamite.
  \end{block}
\end{frame}
\end{document}

I want to display the first box, with the underline gap and after pause, I want the second box to appear in the place of the first box. I know, I can just create multiple frames, but there is more stuff on the slide and I want to know, if there is a more elegant way to change something already displayed.

4
  • Welcome! Please help us to help you and provide a minimal working example with fully compilable code, starting with \documentclass{...}, ending with \end{document} and in between the code illustrating your problem. Its seldomly straight forward to guess, which packages people have used to obtain a certain output. – JMP Apr 25 '16 at 10:44
  • Yeah, sorry. I will edit it in a minute! – fulaphex Apr 25 '16 at 10:46
  • \only<1>{blabla} and \only<2>{blub} might help – samcarter_is_at_topanswers.xyz Apr 25 '16 at 10:49
  • It actually did help, thanks :) I hope I will be able to solve all the problems with it – fulaphex Apr 25 '16 at 10:58
4

If you use the overlay as an argument of the block, the vertical alignment of the blocks will not be the same.

your example:

\documentclass{beamer}
\usetheme{Warsaw}


\begin{document}

\begin{frame}
  \begin{block}<1>{Example of Cloze style question}
    \underline{\ \ \ \ \ \ \ \ }  is the man, who invented dynamite. \\
  \end{block}
  \begin{block}<2>{Example of Cloze style question}
    \textbf{Nobel}  is the man, who invented dynamite.
  \end{block}
\end{frame}
\end{document}

enter image description here


With \only you can replace the text

\documentclass{beamer}
\usetheme{Warsaw}


\begin{document}

    \begin{frame}
        \begin{block}{Example of Cloze style question}
            \only<+>{\underline{\phantom{Nobel}}} 
            \only<+->{\textbf{Nobel}}  
            is the man, who invented dynamite.
        \end{block}
    \end{frame}
\end{document}

enter image description here


Bonus:

With \underline{\phantom{Nobel}} you will get a line of the length of "Nobel".

4
  • Wow, your solution is so clean. Thank you very much! – fulaphex Apr 25 '16 at 20:34
  • May I also know, if there is an easy way to compile the LaTeX code in the question/answer and attach rendered pictures? – fulaphex Apr 26 '16 at 14:39
  • @Fulaphex Unfortunately not. There are tools which make it easy to copy code from the question, e.g. addons.mozilla.org/en-GB/firefox/addon/copy-code/?src=api. My usual workflow is then to compile it on my computer, make a screenshot and copy the modified code into the answer and upload the screenshot. – samcarter_is_at_topanswers.xyz Apr 26 '16 at 15:16
  • Then I appreciate the effort even more. Thanks! – fulaphex Apr 26 '16 at 15:34

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.