2

The following code tries to put a vphantom around a definition environment in a Beamer document but it does not compile properly.

\documentclass{beamer}
\usepackage{mathtools}
\begin{document}
\begin{frame}
 Before 
 \begin{definition}
  inside
 \end{definition}
 after
\end{frame}
\begin{frame}
 Before
 \vphantom{
  \begin{definition}
   inside
  \end{definition}
 }
 after
\end{frame}
\end{document}

The two frames created during the failed compilation are

good

and

bad

What is going wrong?

  • I what does this have to do with mathtools? – daleif Jun 05 '14 at 21:05
  • Is \visible<#>{\begin{definition}...\end{definition}} and option for you? If you don't want to create overlays, why not use vskip? – Herr K. Jun 05 '14 at 21:09
  • You can't use paragraphs in \vphantom – egreg Jun 05 '14 at 21:09
  • @KevinC What is the difference between \visible and \only? What would the solution be using overlays? I don't want to use \vskip because the space I want to add depends on specific content. – Tyson Williams Jun 05 '14 at 21:24
  • @daleif Oh, I thought \phantom was a mathtools command. – Tyson Williams Jun 05 '14 at 21:31
  • 1
    @TysonWilliams: \visible<#>{<content>} saves the space of <content>; whereas \only<#>{<content>} doesn't save the space. – Herr K. Jun 05 '14 at 21:33
  • @KevinC Oh, sorry...I meant what is the difference between \visible and onslide? – Tyson Williams Jun 05 '14 at 21:34
  • 1
    @TysonWilliams: \visible is not affected by transparency settings, but \onslide (or similarly \uncover) is. For example, if you have set \setbeamercovered{transparent}, then that's going to make the content in \onslide (faintly) visible, but content in \visible will stay invisible. – Herr K. Jun 05 '14 at 21:46
  • @TysonWilliams nope, I think that even comes from the TeX core – daleif Jun 06 '14 at 06:37

2 Answers2

1

In a comment, @egreg said that the \phantom family of commands can't accept a paragraph. Therefore, one way to fix the compilation error is to wrap a \parbox around the paragraph. Then \phantom and similar commands work as expected again.

cfr
  • 198,882
0

Personnaly I couldn't reach any compilation success with \phantom & \xxxbox{} as I have blocks & itemizes & beamer commands (\item<x>) in the code I want to hide.

On problem with \visible is that if there are beamer commands like \item<x> or \onslide<x> inside the section you want to hide, they will be taken into consideration and you will end up with an invisible part, but that spreads on multiple overlays.

In my case the problem is I want to show the beginning of a slide, then show "stage whisper" slides, then come back where I stopped on the slide to continue.

If anyone has a solution...

For the moment, I have 2 copies of the slide in my .tex file, both with all the content.

  • The first copy has the end parts inside an \invisible{xxx}, which does not show the content but creates too much overlays.
  • The second, with the whole content but is xs in my \onslide<x> that are offset so that the first part of the slide is shown directly.
  • 2
    Welcome to tex.sx. What you have here is a new problem, and it's not really likely to be seen here, since this question is old. Please ask a new question, and refer to this one, being specific about why it doesn't work. – barbara beeton Mar 10 '21 at 14:54