[Tex/LaTex] Mindmap tikzpicture in beamer (reveal step by step)

beamermindmapstikz-pgf

I want to include a tikzpicture (mindmap) in beamer and I want the children to appear one after the other.

So I use \visible but it don't works — also not with \pause command. I get errors regarding forgotten semicolons. When I insert semicolons, not all of the mindmap is created.

Is there an easy way to realize that?

\begin{frame}
\frametitle{Charakteristika}
\begin{tikzpicture}[mindmap, concept color=gray!50, font=\sf, text=white]

  \tikzstyle{level 1 concept}+=[font=\sf, sibling angle=90,level distance = 30mm]

 \visible<1->{
  \node[concept,scale=0.7] {Ged├Ąchtnis}
    [clockwise from=135]}
      \visible<2->{
        child[concept color=orange]{ node[concept,scale=0.7]{Musik} } }
      \visible<3->{
        child[concept color=orange]{ node[concept,scale=0.7]{Kunst} } }
      \visible<4->{
        child[concept color=orange]{ node[concept,scale=0.7]{Mathematik} } }
      \visible<5->{
        child[concept color=orange]{ node[concept,scale=0.7]{Seltenere} } };

\end{tikzpicture}

\end{frame}

Best Answer

This answer has led to the aobs-tikz package by Claudio Fiandrino, which provides extended versions of the concepts below.

Here is a less hacky alternative to the answer given by Claudio:

In conjunction with TikZ, I have almost stopped completely to use beamer's overlay commands (\visible<>, \only<>, and so on). Instead I always draw all elements, but hide them on the slides they should not appear. To specify the visibility, I use a visible on=<...> TikZ style as follows:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees,shadows}
\begin{document}

  % Keys to support piece-wise uncovering of elements in TikZ pictures:
  % \node[visible on=<2->](foo){Foo}
  % \node[visible on=<{2,4}>](bar){Bar}   % put braces around comma expressions
  %
  % 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 plus that coordinate (foo) is always available.
  %
  % 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},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }

\begin{frame}
\frametitle{Charakteristika}
\begin{tikzpicture}[mindmap, concept color=gray!50, font=\sf, text=white]

  \tikzstyle{level 1 concept}+=[font=\sf, sibling angle=90,level distance = 30mm]

  \node[concept,scale=0.7] {Ged├Ąchtnis}
    [clockwise from=135]
        child[concept color=orange, visible on=<2->]{ node[concept,scale=0.7]{Musik} } 
        child[concept color=orange, visible on=<3->]{ node[concept,scale=0.7]{Kunst} } 
        child[concept color=orange, visible on=<4->]{ node[concept,scale=0.7]{Mathematik} } 
        child[concept color=orange, visible on=<5->]{ node[concept,scale=0.7]{Seltenere} };

\end{tikzpicture}

\end{frame}

\end{document}

visible on=< ovspec > is implemented by applying the style invisible on all slides that are not contained in ovspec. The default implementation of invisible just sets opacity=0; however, this can be overwritten, so other kinds of "invsibility" can easily be installed (dimming, gray filling, ...).

Note: If overspec itself contains a comma, either it or the complete argument has to be put inside curly braces (like in, visible on=<{1,3-4,8}> or visible on={<1,3-4,8>}) in order to not confuse the pgfkeys parser.

This approach (besides being, IMHO, much better readable) also has another advantage: All named elements (especially nodes) are always there, so you can use them for coordinate calculations even on slides they are not visible. Moreover, the tikzpicture always has the complete size, preventing the frequently asked issue of "jumping images".

animation

Related Question