# [Tex/LaTex] Beamer: temporarily disable overlays

animationsbeameroverlays

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?

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}