5

I want to combine two different \tikzset. The first one is the default one. For instance

% Author: Till Tantau
% Source: The PGF/TikZ manual
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
  \path[mindmap,concept color=black,text=white]
    node[concept] {Computer Science}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {practical}
      [clockwise from=90]
      child { node[concept] {algorithms} }
      child { node[concept] {data structures} }
      child { node[concept] {pro\-gramming languages} }
      child { node[concept] {software engineer\-ing} }
    }  
    child[concept color=blue] {
      node[concept] {applied}
      [clockwise from=-30]
      child { node[concept] {databases} }
      child { node[concept] {WWW} }
    }
    child[concept color=red] { node[concept] {technical} }
    child[concept color=orange] { node[concept] {theoretical} };
\end{tikzpicture}\end{document}

enter image description here

The second one is its variation found here How to draw only the border for the nodes in TikZ Mindmap?

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\tikzset{concept/.append style={fill={none}}}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}
  \path[mindmap,concept color=black,text=black]
    node[concept] {Computer Science}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {practical}
      [clockwise from=90]
      child { node[concept] {algorithms} }
      child { node[concept] {data structures} }
      child { node[concept] {pro\-gramming languages} }
      child { node[concept] {software engineer\-ing} }
    }  
    child[concept color=blue] {
      node[concept] {applied}
      [clockwise from=-30]
      child { node[concept] {databases} }
      child { node[concept] {WWW} }
    }
    child[concept color=red] { node[concept] {technical} }
    child[concept color=orange] { node[concept] {theoretical} };
\end{tikzpicture}
\end{document}

which just draws the border.

enter image description here

Say that I want to have a single document (for instance a beamer presentation; one slide with the mind map with colors, another slide with the mind map with just the border), how can I modify locally \tikzset? Thanks a lot!

Dimitris
  • 1,405
  • Why not two tikzpictures in two slides. – subham soni Apr 28 '19 at 13:57
  • @subhamsoni Each slide will contain a different \tikzset ? – Dimitris Apr 28 '19 at 14:01
  • \tikzset is like a template. It helps in reducing code. Your requirement is to have 2 different mindmaps in two slides. So two tikzpictures with different options should be sufficient. I don't understand why you want to modify locally. – subham soni Apr 28 '19 at 14:05
  • Could provide more insight? Where should I add concept/.append style={fill={none}}? Sorry but I cannot figure out. – Dimitris Apr 28 '19 at 14:09

2 Answers2

7

As suggested, you can use tikzpicture separately for each beamer slide.

The style is passed as an option to the tikzpicture.

Here is the code.

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\begin{document}
\pagestyle{empty}
\begin{frame}
\begin{tikzpicture}[scale=0.7,transform shape]
  \path[mindmap,concept color=black,text=white]
    node[concept] {Computer Science}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {practical}
      [clockwise from=90]
      child { node[concept] {algorithms} }
      child { node[concept] {data structures} }
      child { node[concept] {pro\-gramming languages} }
      child { node[concept] {software engineer\-ing} }
    }
    child[concept color=blue] {
      node[concept] {applied}
      [clockwise from=-30]
      child { node[concept] {databases} }
      child { node[concept] {WWW} }
    }
    child[concept color=red] { node[concept] {technical} }
    child[concept color=orange] { node[concept] {theoretical} };
\end{tikzpicture}
\end{frame}
\begin{frame}
\begin{tikzpicture}[concept/.append style={fill={none}},scale=0.7,transform shape]
  \path[mindmap,concept color=black,text=black]
    node[concept] {Computer Science}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {practical}
      [clockwise from=90]
      child { node[concept] {algorithms} }
      child { node[concept] {data structures} }
      child { node[concept] {pro\-gramming languages} }
      child { node[concept] {software engineer\-ing} }
    }
    child[concept color=blue] {
      node[concept] {applied}
      [clockwise from=-30]
      child { node[concept] {databases} }
      child { node[concept] {WWW} }
    }
    child[concept color=red] { node[concept] {technical} }
    child[concept color=orange] { node[concept] {theoretical} };
\end{tikzpicture}
\end{frame}
\end{document} 

The beamer slides would look like this:

enter image description here

subham soni
  • 9,673
7

\tikzset is local if used properly, that's the main point of putting the style definitions in the options of a tikzpicture or at least in a group, see e.g. this answer which contains Till Tantau's thoughts.

This pot here is just a small addendum to say that there exists the overlay-beamer-styles library which allows you to avoid drawing the mindmap twice. If you do not want to fill the nodes on the second slide, just say

alt=<2>{concept/.append style={fill={none}}}

and so on. So if you change something in your mindmap you only need to change it once.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{mindmap,trees,overlay-beamer-styles}
\begin{document}
\begin{frame}
\begin{tikzpicture}[scale=0.7,transform shape,
alt=<2>{concept/.append style={fill={none}}}]
  \path[mindmap,concept color=black,text=white,alt=<2>{text=black}]
    node[concept] {Computer Science}
    [clockwise from=0]
    child[concept color=green!50!black] {
      node[concept] {practical}
      [clockwise from=90]
      child { node[concept] {algorithms} }
      child { node[concept] {data structures} }
      child { node[concept] {pro\-gramming languages} }
      child { node[concept] {software engineer\-ing} }
    }
    child[concept color=blue] {
      node[concept] {applied}
      [clockwise from=-30]
      child { node[concept] {databases} }
      child { node[concept] {WWW} }
    }
    child[concept color=red] { node[concept] {technical} }
    child[concept color=orange] { node[concept] {theoretical} };
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here