本地修改 \tikzset

本地修改 \tikzset

我想组合两个不同的\tikzset。第一个是默认的。例如

% 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}

在此处输入图片描述

第二个是它的变体,可在此处找到如何仅为 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}

仅绘制边框。

在此处输入图片描述

假设我想要一个文档(例如一个 Beamer 演示文稿;一张幻灯片包含带有颜色的思维导图,另一张幻灯片包含只有边框的思维导图),我该如何在本地进行修改\tikzset?非常感谢!

答案1

根据建议,您可以tikzpicture单独使用每个投影仪幻灯片。

该样式作为选项传递给 tikzpicture。

这是代码。

\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} 

投影仪幻灯片看起来如下:

在此处输入图片描述

答案2

\tikzset tikzpicture如果使用得当,这就是将样式定义放在选项中或至少放在组中的要点,例如这个答案其中包含了蒂尔·坦陶的思想。

这里只是一个小补充,说有overlay-beamer-styles库可以让你避免绘制两次思维导图。如果你不想在第二张幻灯片上填充节点,只需说

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

等等。因此,如果您在思维导图中更改了某些内容,则只需更改一次即可。

\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}

在此处输入图片描述

相关内容