16

I'm using Beamer to create a presentation with animations (overlays). However, I'd like to disable the animations in some of the slides.

Why? Because I'm including a quite complicated TikZ drawing with animations (that I used in some other presentation), and now I want to show only the final result (i.e. with no overlays).

I know I could edit the TikZ code, removing all the "uncover", but then I would have to maintain two versions of the same drawing (one for the static one and another one for the animated one).

Using the "handout" option would not work, since that would disable ALL the overlays, and I only want to disable SOME of them.

Any suggestion?

  • If you use standalone class to produce your TikZ animation you can include any of its slides in your new presentation with \includegraphics[page=...]{...}. – Ignasi Oct 17 '13 at 9:40
  • 1
    Yes, though that would imply modifying my source TikZ code, which I want to avoid. I would like to have my TikZ code without any preamble (only \begin{tikzpicture}...\end{tikzpicture} and use \input{myfigure} in any of my latex files. And then include some command like \beamerdisableoverlays (note this is just the command I'm looking for, I don't know whether it exists) if I don't want the animation to be enabled. – Didac Busquets Oct 17 '13 at 10:02
  • 3
    \begin{frame}<overlay spec> will restrict the complete frame to the slides given in the overlay spec. Just enter the last step of your TikZ image and you are done. – Daniel Oct 17 '13 at 10:16
  • @Daniel, that makes it! An even if you don't know how many steps your animation has, you can put a high enough number (e.g. 9999) and you get the correct behaviour. – Didac Busquets Oct 17 '13 at 12:49
  • Now back at a real computer, I have turned my comment into an answer. – Daniel Oct 17 '13 at 14:13
13

This is easily possible by providing an overlay specification to the frame command or environment:

\frame< ov-spec >{%
   ... many animation steps ...
}

will restrict the slides of the frame to those steps of your animation that match ov-spec. To just show the last slide, insert the number of the last step – or, if you don't know it, a ridiculously large number:

\frame<4711>{%
   ... many animation steps ...
}

Complete MWE:

% http://tex.stackexchange.com/questions/139260
\documentclass{beamer}
\usepackage{tikz}

% Keys to support piece-wise uncovering of elements in TikZ pictures:
% \node[visible on=<2->](foo){Foo}
% 
% see: http://tex.stackexchange.com/questions/55806
%
% Internally works by setting opacity=0 when invisible, which has the 
% adavantage (compared to \node<2->(foo){Foo} that the node is always there, hence
% always consumes space and (foo) is always available for coordinate calculations.
%
% The actual command that implements the invisibility can be overriden
% by altering the style invisible. For instance \tikzsset{invisible/.style={opacity=0.2}}
% would dim the "invisible" parts. Alternatively, the color might be set to white, if the
% output driver does not support transparencies (e.g., PS) 
%
\tikzset{
  invisible/.style={opacity=0},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} 
  },
  visible on/.style={alt=#1{}{invisible}},
}

\begin{document}

% constrained to last slide of frame
\begin{frame}<3>{Only last step}
  \begin{tikzpicture}[every node/.style={fill=red!30, draw=red}]
    \node{Foo}
      child[visible on=<2->]{node {Bar}}
      child[visible on=<3->]{node {Baz}}
    ;  
  \end{tikzpicture}
\end{frame}

% show every slide of frame
\begin{frame}{Uncovering piecewise}
  \begin{tikzpicture}[every node/.style={fill=red!30, draw=red}]
    \node{Foo}
      child[visible on=<2->]{node {Bar}}
      child[visible on=<3->]{node {Baz}}
    ;  
  \end{tikzpicture}
\end{frame}

\end{document}
|improve this answer|||||

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.