39

I've discovered that you can \pause within a tikzpicture, which works well until I switched the theme to one with a footline.

I've created a "test case" that illustrates the problem.

\documentclass{beamer}
\providecommand\thispdfpagelabel[1]{} % Not sure what this does but our installation requires it.
\usepackage{tikz}
\usetheme{Madrid} % Has a footline.

\begin{document}
  \begin{frame}
    \frametitle{test}
    \begin{tikzpicture}
      \node at (0, 1) {Hello};
      \pause
      \node at (0, 0) {World};
    \end{tikzpicture}
  \end{frame}
\end{document}

This creates two slides, but the footline is only drawn on the second (the headline/title appears on both). Is there anything I can do about this?

4
  • 1
    Ouch! A bit of testing shows that putting a \pause inside a tikzpicture really messes up the pausing. As an interim solution, you could use the \node<overlay specification> syntax or one of the other methods of hiding/revealing stuff in beamer. But a plain \pause really does seem to be specially weird. Jun 24, 2011 at 9:47
  • I wouldn't use pause, but I've had no problem with \onslide and friends...
    – Seamus
    Jun 24, 2011 at 9:53
  • 1
    Is this the same problem as in tex.stackexchange.com/questions/10871/…?
    – Caramdir
    Jun 24, 2011 at 10:06
  • Yes, it looks like the same problem.
    – Bristol
    Jun 24, 2011 at 10:40

3 Answers 3

21

I think the problem is that \pause isn't smart enough. The footline appears in the following:

\documentclass{beamer}
\providecommand\thispdfpagelabel[1]{} % Not sure what this does but our installation requires it.
\usepackage{tikz}
\usetheme{Madrid} % Has a footline.

\begin{document}
  \begin{frame}
    \frametitle{test}
    \begin{tikzpicture}
      \node at (0, 1) {Hello};
\onslide<2->{\node at (0, 0) {World};}
    \end{tikzpicture}
  \end{frame}
\end{document}

That is, if you put your text to appear on the second slide in a \onslide<2->{} it will work. Or for a little more automation, use \onslide<+->{} which automatically increments things.

Not quite as intuitive as the pause command, but it does allow you more control...

1
  • 3
    I'll use \onslide<+-> then, thanks. At least I don't have to number things manually that way.
    – Bristol
    Jun 24, 2011 at 10:43
39

I just stumbled over this issue and found another work-around that does not require nesting lots of paused elements in braces: Add \onslide<1-> at the end of the tikzpicture environment (strangely it does not work if you put it after the environment):

\documentclass{beamer}
\providecommand\thispdfpagelabel[1]{} % Not sure what this does but our installation requires it.
\usepackage{tikz}
\usetheme{Madrid} % Has a footline.

\begin{document}
  \begin{frame}
    \frametitle{test}
    \begin{tikzpicture}
      \node at (0, 1) {Hello};
      \pause
      \node at (0, 0) {World};
      \onslide<1->
    \end{tikzpicture}
  \end{frame}
\end{document}
4
  • 1
    Why does it work, and is this safe to use?
    – Unapiedra
    Jun 10, 2013 at 15:31
  • 4
    It seems that \pause affects „stuff after it“, where „stuff“ seems to range too far than intended. A \onslide<1-> delimits the effect of the previous pause, and as it selects all overlays, makes sure that the following stuff is executed always. I believe this is safe. Jun 10, 2013 at 15:44
  • I had this problem when using \pause inside displaymath, but I couldn't get this solution to work adequately in that cause. Either the footnote appeared only in transitions outside the displaymath or only inside the displaymath, but not both. The only way I could get it to work was with Seamus's solution.
    – gablin
    Nov 27, 2015 at 9:34
  • 1
    This \onslide<1-> trick works perfectly with the tcolorbox package's environments as well, so thanks. May 20, 2017 at 10:36
1

No guarantees that this won't break something else, but you could try this patch:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Madrid} 
\AtEndEnvironment{tikzpicture}{\onslide<1->}
\begin{document}
  \begin{frame}
    \frametitle{test}
    \begin{tikzpicture}
      \node at (0, 1) {Hello};
      \pause
      \node at (0, 0) {World};
    \end{tikzpicture}
  \end{frame}
\end{document}

You must log in to answer this question.

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