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?

9
  • I what does this have to do with mathtools?
    – daleif
    Jun 5, 2014 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 5, 2014 at 21:09
  • You can't use paragraphs in \vphantom
    – egreg
    Jun 5, 2014 at 21:09
  • 1
    @TysonWilliams: \visible<#>{<content>} saves the space of <content>; whereas \only<#>{<content>} doesn't save the space.
    – Herr K.
    Jun 5, 2014 at 21:33
  • 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 5, 2014 at 21:46

2 Answers 2

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.

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.
1
  • 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. Mar 10, 2021 at 14:54

You must log in to answer this question.

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