| 1 |
% Copyright 2019 by Till Tantau |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
|
| 11 |
\section{Mindmap Drawing Library} |
| 12 |
|
| 13 |
\begin{tikzlibrary}{mindmap} |
| 14 |
This packages provides styles for drawing mindmap diagrams. |
| 15 |
\end{tikzlibrary} |
| 16 |
|
| 17 |
|
| 18 |
\subsection{Overview} |
| 19 |
|
| 20 |
This library is intended to make the creation of mindmaps or concept maps |
| 21 |
easier. A \emph{mindmap} is a graphical representation of a concept together |
| 22 |
with related concepts and annotations. Mindmaps are, essentially, trees, |
| 23 |
possibly with a few extra edges added, but they are usually drawn in a special |
| 24 |
way: The root concept is placed in the middle of the page and is drawn as a |
| 25 |
huge circle, ellipse, or cloud. The related concepts then ``leave'' this root |
| 26 |
concept via branch-like tendrils. |
| 27 |
|
| 28 |
The |mindmap| library of \tikzname\ produces mindmaps that look a bit different |
| 29 |
from the standard mindmaps: While the big root concept is still a circle, |
| 30 |
related concepts are also depicted as (smaller) circles. The related concepts |
| 31 |
are linked to the root concept via organic-looking connections. The overall |
| 32 |
effect is visually rather pleasing, but readers may not immediately think of a |
| 33 |
mindmap when they see a picture created with this library. |
| 34 |
|
| 35 |
Although it is not strictly necessary, you will usually create mindmaps using |
| 36 |
\tikzname's tree mechanism and some of the styles and macros of the package |
| 37 |
work best when used inside trees. However, it is still possible and sometimes |
| 38 |
necessary to treat parts of a mindmap as a graph with arbitrary edges and this |
| 39 |
is also possible. |
| 40 |
|
| 41 |
|
| 42 |
\subsection{The Mindmap Style} |
| 43 |
|
| 44 |
Every mindmap should be put in a scope or a picture where the |mindmap| style |
| 45 |
is used. This style installs some internal settings. |
| 46 |
|
| 47 |
\begin{stylekey}{/tikz/mindmap} |
| 48 |
Use this style with all pictures or at least scopes that contain a mindmap. |
| 49 |
It installs a whole bunch of settings that are useful for drawing mindmaps. |
| 50 |
% |
| 51 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 52 |
\tikz[mindmap,concept color=red!50] |
| 53 |
\node [concept] {Root concept} |
| 54 |
child[grow=right] {node[concept] {Child concept}}; |
| 55 |
\end{codeexample} |
| 56 |
% |
| 57 |
The sizes of concepts are predefined in such a way that a medium-size |
| 58 |
mindmap will fit on an A4 page (more or less). |
| 59 |
% |
| 60 |
\begin{stylekey}{/tikz/every mindmap} |
| 61 |
This style is included by the |mindmap| style. Change this style to add |
| 62 |
special settings to your mindmaps. |
| 63 |
% |
| 64 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 65 |
\tikz[large mindmap,concept color=red!50] |
| 66 |
\node [concept] {Root concept} |
| 67 |
child[grow=right] {node[concept] {Child concept}}; |
| 68 |
\end{codeexample} |
| 69 |
\end{stylekey} |
| 70 |
|
| 71 |
\paragraph{Remark:} |
| 72 |
Note that |mindmap| redefines |font| sizes and |sibling angle| depending on |
| 73 |
the current concept level (i.e.\ inside of |level 1 concept|, |
| 74 |
|level 2 concept| etc.). Thus, if you need to redefine these variables, use |
| 75 |
|
| 76 |
|level 1 concept/.append style={font=\small}| |
| 77 |
|
| 78 |
\noindent or |
| 79 |
|
| 80 |
|level 2 concept/.append style={sibling distance=90}| |
| 81 |
|
| 82 |
\noindent \emph{after} the |mindmap| style. |
| 83 |
\end{stylekey} |
| 84 |
|
| 85 |
\begin{stylekey}{/tikz/small mindmap} |
| 86 |
This style includes the |mindmap| style, but additionally changes the |
| 87 |
default size of concepts, fonts and distances so that a medium-sized |
| 88 |
mindmap will fit on an A5 page (A5 pages are half as large as A4 pages). |
| 89 |
Mindmaps with |small mindmap| will also fit onto a standard frame of the |
| 90 |
|beamer| package. |
| 91 |
\end{stylekey} |
| 92 |
|
| 93 |
\begin{stylekey}{/tikz/large mindmap} |
| 94 |
This style includes the |mindmap| style, but additionally changes the |
| 95 |
default size of concepts, fonts and distances so that a medium-sized |
| 96 |
mindmap will fit on an A3 page (A3 pages are twice as large as A4 pages). |
| 97 |
\end{stylekey} |
| 98 |
|
| 99 |
\begin{stylekey}{/tikz/huge mindmap} |
| 100 |
This style causes concepts to be even bigger and it is best used with A2 |
| 101 |
paper and above. |
| 102 |
\end{stylekey} |
| 103 |
|
| 104 |
|
| 105 |
\subsection{Concepts Nodes} |
| 106 |
|
| 107 |
The basic entities of mindmaps are called \emph{concepts} in \tikzname. A |
| 108 |
concept is a node of style |concept| and it must be circular for some of the |
| 109 |
connection macros to work. |
| 110 |
|
| 111 |
|
| 112 |
\subsubsection{Isolated Concepts} |
| 113 |
|
| 114 |
The following styles influence how isolated concepts are rendered: |
| 115 |
|
| 116 |
\begin{stylekey}{/tikz/concept} |
| 117 |
This style should be used with all nodes that are concepts, although some |
| 118 |
styles like |extra concept| install this style automatically. |
| 119 |
|
| 120 |
Basically, this style makes the concept node circular and installs a |
| 121 |
uniform color called |concept color|, see below. Additionally, the style |
| 122 |
|every concept| is called. |
| 123 |
% |
| 124 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 125 |
\tikz[mindmap,concept color=red!50] \node [concept] {Some concept}; |
| 126 |
\end{codeexample} |
| 127 |
|
| 128 |
\begin{stylekey}{/tikz/every concept} |
| 129 |
In order to change the appearance of concept nodes, you should change |
| 130 |
this style. Note, however, that the color of a concept should be |
| 131 |
uniform for some of the connection bar stuff to work, so you should not |
| 132 |
change the color or the draw/fill state of concepts using this option. |
| 133 |
It is mostly useful for changing the text color and font. |
| 134 |
\end{stylekey} |
| 135 |
|
| 136 |
\begin{key}{/tikz/concept color=\meta{color}} |
| 137 |
This option tells \tikzname\ which color should be used for filling and |
| 138 |
stroking concepts. The difference between this option and just setting |
| 139 |
|every concept| to the desired color is that this option allows |
| 140 |
\tikzname\ to keep track of the colors used for concepts. This is |
| 141 |
important when you \emph{change} the color between two connected |
| 142 |
concepts. In this case, \tikzname\ can automatically create a shading |
| 143 |
that provides a smooth transition between the old and the new concept |
| 144 |
color; we will come back to this in the next section. |
| 145 |
\end{key} |
| 146 |
\end{stylekey} |
| 147 |
|
| 148 |
\begin{stylekey}{/tikz/extra concept} |
| 149 |
This style is intended for concepts that are not part of the ``mindmap |
| 150 |
tree'', but stand beside it. Typically, they will have a subdued color or |
| 151 |
be smaller. In order to have these concepts appear in a uniform way and in |
| 152 |
order to indicate in the code that these concepts are additional, you can |
| 153 |
use this style. |
| 154 |
% |
| 155 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 156 |
\begin{tikzpicture}[mindmap,concept color=blue!80] |
| 157 |
\node [concept] {Root concept}; |
| 158 |
\node [extra concept] at (10,0) {extra concept}; |
| 159 |
\end{tikzpicture} |
| 160 |
\end{codeexample} |
| 161 |
% |
| 162 |
\begin{stylekey}{/tikz/every extra concept} |
| 163 |
Change this style to change the appearance of extra concepts. |
| 164 |
\end{stylekey} |
| 165 |
\end{stylekey} |
| 166 |
|
| 167 |
|
| 168 |
\subsubsection{Concepts in Trees} |
| 169 |
|
| 170 |
As pointed out earlier, \tikzname\ assumes that your mindmap is built using the |
| 171 |
|child| facilities of \tikzname. There are numerous options that influence how |
| 172 |
concepts are rendered at the different levels of a tree. |
| 173 |
|
| 174 |
\begin{stylekey}{/tikz/root concept} |
| 175 |
This style is used for the roots of mindmap trees. By adding something to |
| 176 |
this, you can change how the root of a mindmap will be rendered. |
| 177 |
% |
| 178 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 179 |
\tikz |
| 180 |
[root concept/.append style={concept color=blue!80,minimum size=3.5cm}, |
| 181 |
mindmap] |
| 182 |
\node [concept] {Root concept}; |
| 183 |
\end{codeexample} |
| 184 |
|
| 185 |
Note that styles like |large mindmap| redefine these styles, so you should |
| 186 |
add something to this style only inside the picture. |
| 187 |
\end{stylekey} |
| 188 |
|
| 189 |
\begin{stylekey}{/tikz/level 1 concept} |
| 190 |
The |mindmap| style adds this style to the |level 1| style. This means that |
| 191 |
the first level children of a mindmap tree will use this style. |
| 192 |
% |
| 193 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 194 |
\tikz |
| 195 |
[root concept/.append style={concept color=blue!80}, |
| 196 |
level 1 concept/.append style={concept color=red!50}, |
| 197 |
mindmap] |
| 198 |
\node [concept] {Root concept} |
| 199 |
child[grow=30] {node[concept] {child}} |
| 200 |
child[grow=0 ] {node[concept] {child}}; |
| 201 |
\end{codeexample} |
| 202 |
\end{stylekey} |
| 203 |
|
| 204 |
\begin{stylekey}{/tikz/level 2 concept} |
| 205 |
Works like |level 1 concept|, only for second level children. |
| 206 |
\end{stylekey} |
| 207 |
|
| 208 |
\begin{stylekey}{/tikz/level 3 concept} |
| 209 |
Works like |level 1 concept|. |
| 210 |
\end{stylekey} |
| 211 |
|
| 212 |
\begin{stylekey}{/tikz/level 4 concept} |
| 213 |
Works like |level 1 concept|. Note that there are no fifth and higher level |
| 214 |
styles, you need to modify |level 5| directly in such cases. |
| 215 |
\end{stylekey} |
| 216 |
|
| 217 |
\begin{key}{/tikz/concept color=\meta{color}} |
| 218 |
We saw already that this option is used to change the color of concepts. We |
| 219 |
now have a look at its effect when used on child nodes of a concept. |
| 220 |
Normally, this option simply changes the color of the children. However, |
| 221 |
when the option is given as an option to the |child| operation (and not to |
| 222 |
the |node| operation and also not as an option to all children via the |
| 223 |
|level 1| style), \tikzname\ will smoothly change the concept color from |
| 224 |
the parent's color to the color of the child concept. |
| 225 |
|
| 226 |
Here is an example: |
| 227 |
% |
| 228 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 229 |
\tikz[mindmap,concept color=blue!80] |
| 230 |
\node [concept] {Root concept} |
| 231 |
child[concept color=red,grow=30] {node[concept] {Child concept}} |
| 232 |
child[concept color=orange,grow=0] {node[concept] {Child concept}}; |
| 233 |
\end{codeexample} |
| 234 |
|
| 235 |
In order to have a concept color which changes with the hierarchy level, a |
| 236 |
tiny bit of magic is needed: |
| 237 |
% FIXME: is this a bug in the software!? The root concept is black!? |
| 238 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 239 |
\tikz[mindmap,text=white, |
| 240 |
root concept/.style={concept color=blue}, |
| 241 |
level 1 concept/.append style= |
| 242 |
{every child/.style={concept color=blue!50}}] |
| 243 |
\node [concept] {Root concept} |
| 244 |
child[grow=30] {node[concept] {child}} |
| 245 |
child[grow=0 ] {node[concept] {child}}; |
| 246 |
\end{codeexample} |
| 247 |
% |
| 248 |
\end{key} |
| 249 |
|
| 250 |
|
| 251 |
\subsection{Connecting Concepts} |
| 252 |
|
| 253 |
\subsubsection{Simple Connections} |
| 254 |
|
| 255 |
The easiest way to connect two concepts is to draw a line between them. In |
| 256 |
order to give such lines a consistent appearance, it is recommendable to use |
| 257 |
the following style when drawing such lines: |
| 258 |
|
| 259 |
\begin{stylekey}{/tikz/concept connection} |
| 260 |
This style can be used for lines between two concepts. Feel free to |
| 261 |
redefine this style. |
| 262 |
\end{stylekey} |
| 263 |
|
| 264 |
A problem arises when you need to connect concepts after the main mindmap has |
| 265 |
been drawn. In this case you will want the connection lines to lie |
| 266 |
\emph{behind} the main mindmap. However, you can draw the lines only after the |
| 267 |
coordinates of the concepts have been determined. In this case you should place |
| 268 |
the connecting lines on a background layer as in the following example: |
| 269 |
|
| 270 |
\begin{codeexample}[preamble={\usetikzlibrary{backgrounds,mindmap}}] |
| 271 |
\begin{tikzpicture} |
| 272 |
[root concept/.append style={concept color=blue!20,minimum size=2cm}, |
| 273 |
level 1 concept/.append style={sibling angle=45}, |
| 274 |
mindmap] |
| 275 |
\node [concept] {Root concept} |
| 276 |
[clockwise from=45] |
| 277 |
child { node[concept] (c1) {child}} |
| 278 |
child { node[concept] (c2) {child}} |
| 279 |
child { node[concept] (c3) {child}}; |
| 280 |
\begin{pgfonlayer}{background} |
| 281 |
\draw [concept connection] (c1) edge (c2) |
| 282 |
edge (c3) |
| 283 |
(c2) edge (c3); |
| 284 |
\end{pgfonlayer} |
| 285 |
\end{tikzpicture} |
| 286 |
\end{codeexample} |
| 287 |
|
| 288 |
|
| 289 |
\subsubsection{The Circle Connection Bar Decoration} |
| 290 |
|
| 291 |
Instead of a simple line between two concepts, you can also add a bar between |
| 292 |
the two nodes that has slightly organic ends. These bars are also used by |
| 293 |
default as the edges from parents in the mindmap tree. |
| 294 |
|
| 295 |
For the drawing of the bars a special decoration is used, which is defined in |
| 296 |
the |mindmap| library: |
| 297 |
|
| 298 |
\begin{decoration}{circle connection bar} |
| 299 |
This decoration can be used to connect two circles. The start of the |
| 300 |
to-be-decorated path should lie on the border of the first circle, the end |
| 301 |
should lie on the border of the second circle. The following two decoration |
| 302 |
keys should be initialized with the sizes of the circles: |
| 303 |
% |
| 304 |
\begin{itemize} |
| 305 |
\item |start radius| |
| 306 |
\item |end radius| |
| 307 |
\end{itemize} |
| 308 |
% |
| 309 |
Furthermore, the following two decoration keys influence the decoration: |
| 310 |
% |
| 311 |
\begin{itemize} |
| 312 |
\item |amplitude| |
| 313 |
\item |angle| |
| 314 |
\end{itemize} |
| 315 |
% |
| 316 |
The decoration turns a straight line into a path that starts on the border |
| 317 |
of the first circle at the specified angle relative to the line connecting |
| 318 |
the centers of the circles. The path then changes into a rectangle whose |
| 319 |
thickness is given by the amplitude. Finally, the path ends with the same |
| 320 |
angles on the second circle. |
| 321 |
|
| 322 |
Here is an example that should make this clearer: |
| 323 |
% |
| 324 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 325 |
\begin{tikzpicture} |
| 326 |
[decoration={start radius=1cm,end radius=.5cm,amplitude=2mm,angle=30}] |
| 327 |
\fill[blue!20] (0,0) circle (1cm); |
| 328 |
\fill[red!20] (2.5,0) circle (.5cm); |
| 329 |
|
| 330 |
\filldraw [draw=red,fill=black, |
| 331 |
decorate,decoration=circle connection bar] (1,0) -- (2,0); |
| 332 |
\end{tikzpicture} |
| 333 |
\end{codeexample} |
| 334 |
|
| 335 |
As can be seen, the decorated path consists of three parts and is not |
| 336 |
really useful for drawing. However, if you fill the decorated path only, |
| 337 |
and if you use the same color as for the circles, the result is better. |
| 338 |
% |
| 339 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 340 |
\begin{tikzpicture} |
| 341 |
[blue!50,decoration={start radius=1cm, |
| 342 |
end radius=.5cm,amplitude=2mm,angle=30}] |
| 343 |
\fill (0,0) circle (1cm); |
| 344 |
\fill (2.5,0) circle (.5cm); |
| 345 |
|
| 346 |
\fill [decorate,decoration=circle connection bar] (1,0) -- (2,0); |
| 347 |
\end{tikzpicture} |
| 348 |
\end{codeexample} |
| 349 |
|
| 350 |
In the above example you may notice the small white line between the |
| 351 |
circles and the decorated path. This is due to rounding errors. |
| 352 |
Unfortunately, for larger distances, the errors can accumulate quite |
| 353 |
strongly, especially since \tikzname\ and \TeX\ are not very good at |
| 354 |
computing square roots. For this reason, it is a good idea to make the |
| 355 |
circles slightly larger to cover up such problems. When using nodes of |
| 356 |
shape |circle|, you can just add the |draw| option with a |line width| of |
| 357 |
one or two points (for very large distances you may need line width up to |
| 358 |
4pt). |
| 359 |
% |
| 360 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 361 |
\begin{tikzpicture} |
| 362 |
[blue!50,decoration={start radius=1cm, |
| 363 |
end radius=.5cm,amplitude=2mm,angle=30}] |
| 364 |
\fill (0,0) circle (1cm+1pt); |
| 365 |
\fill (2.4,0) circle (.5cm+1pt); |
| 366 |
|
| 367 |
\fill [decorate,decoration=circle connection bar] (1,0) -- (1.9,0); |
| 368 |
\end{tikzpicture} |
| 369 |
\end{codeexample} |
| 370 |
|
| 371 |
% FIXME: this paragraph appears to be deprecated: |
| 372 |
%Note the slightly strange |outer sep=0pt|. This is needed so that |
| 373 |
%the decorated path lies on the border of the filled circle, not on the |
| 374 |
%border of the stroked circle (which is slightly larger and this |
| 375 |
%slightly larger size is exactly what we wish to use to cover up the |
| 376 |
%rounding errors). |
| 377 |
\end{decoration} |
| 378 |
|
| 379 |
|
| 380 |
\subsubsection{The Circle Connection Bar To-Path} |
| 381 |
|
| 382 |
The |circle connection bar| decoration is a bit complicated to use. Especially |
| 383 |
specifying the radii is quite bothersome (the amplitude and the angle can be |
| 384 |
set once and for all). For this reason, the |mindmap| library defines a special |
| 385 |
to-path that performs the necessary computations for you. |
| 386 |
|
| 387 |
\begin{stylekey}{/tikz/circle connection bar} |
| 388 |
This style installs a rather involved to-path. Unlike normal to-paths, this |
| 389 |
path requires that the start and the target of the to-path are named nodes |
| 390 |
of shape |circle| -- if this is not the case, this path will produce |
| 391 |
errors. |
| 392 |
|
| 393 |
Assuming that the start and the target are circles, the to-path will first |
| 394 |
compute the radii of these circles (by measuring the distance from the |
| 395 |
|center| anchor to some anchor on the border) and will set the |
| 396 |
|start circle| keys accordingly. Next, the |fill| option is set to the |
| 397 |
|concept color| while |draw=none| is set. The decoration is set to |
| 398 |
|circle connection bar|. Finally, the following style is included: |
| 399 |
% |
| 400 |
\begin{stylekey}{/tikz/every circle connection bar} |
| 401 |
Redefine this style to change the appearance of circle connection bar |
| 402 |
to-paths. |
| 403 |
\end{stylekey} |
| 404 |
% |
| 405 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 406 |
\begin{tikzpicture}[concept color=blue!50,blue!50,outer sep=0pt] |
| 407 |
\node (n1) at (0,0) [circle,minimum size=2cm,fill,draw,thick] {}; |
| 408 |
\node (n2) at (2.5,0) [circle,minimum size=1cm,fill,draw,thick] {}; |
| 409 |
|
| 410 |
\path (n1) to[circle connection bar] (n2); |
| 411 |
\end{tikzpicture} |
| 412 |
\end{codeexample} |
| 413 |
% |
| 414 |
Note that it is not a good idea to have more than one |to| operation |
| 415 |
together with the option |circle connection bar| in a single |\path|. Use |
| 416 |
the |edge| operation, instead, for creating multiple connections and this |
| 417 |
operation creates a new scope for each edge. |
| 418 |
\end{stylekey} |
| 419 |
|
| 420 |
In a mindmap we sometimes want colors to change from one concept color to |
| 421 |
another. Then, the connection bar should, ideally, consist of a smooth |
| 422 |
transition between these two colors. Getting this right using shadings is a bit |
| 423 |
tricky if you try this ``by hand'', so the |mindmap| library provides a |
| 424 |
special option for facilitating this procedure. |
| 425 |
|
| 426 |
\begin{key}{/tikz/circle connection bar switch color=|from (|\meta{first color}|) to (|\meta{second color}|)|} |
| 427 |
This style works similarly to the |circle connection bar|. The only |
| 428 |
difference is that instead of filling the path with a single color a |
| 429 |
shading is used. |
| 430 |
% |
| 431 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 432 |
\begin{tikzpicture}[outer sep=0pt] |
| 433 |
\node (n1) at (0,0) [circle,minimum size=2cm,fill,draw,thick,red] {}; |
| 434 |
\node (n2) at (30:2.5) [circle,minimum size=1cm,fill,draw,thick,blue] {}; |
| 435 |
|
| 436 |
\path (n1) to[circle connection bar switch color=from (red) to (blue)] (n2); |
| 437 |
\end{tikzpicture} |
| 438 |
\end{codeexample} |
| 439 |
% |
| 440 |
\end{key} |
| 441 |
|
| 442 |
|
| 443 |
\subsubsection{Tree Edges} |
| 444 |
|
| 445 |
Most of the time, concepts in a mindmap are connected automatically when the |
| 446 |
mindmap is built as a tree. The reason is that the |mindmap| installs a |
| 447 |
|circle connection bar| path as the |edge from parent path|. Also, the |
| 448 |
|mindmap| option takes care of things like setting the correct |draw| and |
| 449 |
|outer sep| settings and some other stuff. |
| 450 |
|
| 451 |
In detail, the |mindmap| option sets the |edge from parent path| to a path that |
| 452 |
uses the to-path |circle connection bar| to connect the parent node and the |
| 453 |
child node. The |concept color| option (locally) changes this by using |
| 454 |
|circle connection bar switch color| instead with the from-color set to the old |
| 455 |
(parent's) concept color and the to-color set to the new (child's) concept |
| 456 |
color. This means that when you provide the |concept color| option to a |child| |
| 457 |
command, the color will change from the parent's concept color to the specified |
| 458 |
color. |
| 459 |
|
| 460 |
Let us now build a tree that way. Please note that we pass the |concept color| |
| 461 |
to the respective |child| and not to a |node| under it. |
| 462 |
% |
| 463 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 464 |
\begin{tikzpicture} |
| 465 |
\path[mindmap,concept color=black,text=white] |
| 466 |
node[concept] {Computer Science} |
| 467 |
[clockwise from=0] |
| 468 |
% note that `sibling angle' can only be defined in |
| 469 |
% `level 1 concept/.append style={}' |
| 470 |
child[concept color=green!50!black] { |
| 471 |
node[concept] {practical} |
| 472 |
[clockwise from=90] |
| 473 |
child { node[concept] {algorithms} } |
| 474 |
child { node[concept] {data structures} } |
| 475 |
child { node[concept] {pro\-gramming languages} } |
| 476 |
child { node[concept] {software engineer\-ing} } |
| 477 |
} |
| 478 |
% note that the `concept color' is passed to the `child'(!) |
| 479 |
child[concept color=blue] { |
| 480 |
node[concept] {applied} |
| 481 |
[clockwise from=-30] |
| 482 |
child { node[concept] {databases} } |
| 483 |
child { node[concept] {WWW} } |
| 484 |
} |
| 485 |
child[concept color=red] { node[concept] {technical} } |
| 486 |
child[concept color=orange] { node[concept] {theoretical} }; |
| 487 |
\end{tikzpicture} |
| 488 |
\end{codeexample} |
| 489 |
|
| 490 |
|
| 491 |
\subsection{Adding Annotations} |
| 492 |
|
| 493 |
An \emph{annotation} is some text outside a mindmap that, unlike an extra |
| 494 |
concept, simply explains something in the mindmap. The following style is |
| 495 |
mainly intended to help readers of the code see that a node in an annotation |
| 496 |
node. |
| 497 |
|
| 498 |
\begin{stylekey}{/tikz/annotation} |
| 499 |
This style indicates that a node is an annotation node. It includes the |
| 500 |
style |every annotation|, which allows you to change this style in a |
| 501 |
convenient fashion. |
| 502 |
% |
| 503 |
\begin{codeexample}[preamble={\usetikzlibrary{mindmap}}] |
| 504 |
\begin{tikzpicture} |
| 505 |
[mindmap,concept color=blue!80, |
| 506 |
every annotation/.style={fill=red!20}] |
| 507 |
\node [concept] (root) {Root concept}; |
| 508 |
|
| 509 |
\node [annotation,right] at (root.east) |
| 510 |
{The root concept is, in general, the most important concept.}; |
| 511 |
\end{tikzpicture} |
| 512 |
\end{codeexample} |
| 513 |
% |
| 514 |
\begin{stylekey}{/tikz/every annotation} |
| 515 |
This style is included by |annotation|. |
| 516 |
\end{stylekey} |
| 517 |
\end{stylekey} |
| 518 |
|
| 519 |
|
| 520 |
%%% Local Variables: |
| 521 |
%%% mode: latex |
| 522 |
%%% TeX-master: "pgfmanual-pdftex-version" |
| 523 |
%%% End: |