1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
|
% Copyright 2019 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\section{Tutorial: A Lecture Map for Johannes}
In this tutorial we explore the tree and mind map mechanisms of \tikzname.
Johannes is quite excited: For the first time he will be teaching a course all
by himself during the upcoming semester! Unfortunately, the course is not on
his favorite subject, which is of course Theoretical Immunology, but on
Complexity Theory, but as a young academic Johannes is not likely to complain
too loudly. In order to help the students get a general overview of what is
going to happen during the course as a whole, he intends to draw some kind of
tree or graph containing the basic concepts. He got this idea from his old
professor who seems to be using these ``lecture maps'' with some success.
Independently of the success of these maps, Johannes thinks they look quite
neat.
\subsection{Problem Statement}
Johannes wishes to create a lecture map with the following features:
%
\begin{enumerate}
\item It should contain a tree or graph depicting the main concepts.
\item It should somehow visualize the different lectures that will be
taught. Note that the lectures are not necessarily the same as the
concepts since the graph may contain more concepts than will be
addressed in lectures and some concepts may be addressed during more
than one lecture.
\item The map should also contain a calendar showing when the individual
lectures will be given.
\item The aesthetical reasons, the whole map should have a visually nice
and information-rich background.
\end{enumerate}
As always, Johannes will have to include the right libraries and set up the
environment. Johannes is going to use the |mindmap| library and since he wishes
to show a calendar, he will also need the |calendar| library. In order to put
something on a background layer, it seems like a good idea to also include the
|backgrounds| library.
\subsection{Introduction to Trees}
The first choice Johannes must make is whether he will organize the concepts as
a tree, with root concepts and concept branches and leaf concepts, or as a
general graph. The tree implicitly organizes the concepts, while a graph is
more flexible. Johannes decides to compromise: Basically, the concepts will be
organized as a tree. However, he will selectively add connections between
concepts that are related, but which appear on different levels or branches of
the tree.
Johannes starts with a tree-like list of concepts that he feels are important
in Computational Complexity:
%
\begin{itemize}
\item Computational Problems
\begin{itemize}\itemsep=0pt\parskip=0pt
\item Problem Measures
\item Problem Aspects
\item Problem Domains
\item Key Problems
\end{itemize}
\item Computational Models
\begin{itemize}\itemsep=0pt\parskip=0pt
\item Turing Machines
\item Random-Access Machines
\item Circuits
\item Binary Decision Diagrams
\item Oracle Machines
\item Programming in Logic
\end{itemize}
\item Measuring Complexity
\begin{itemize}\itemsep=0pt\parskip=0pt
\item Complexity Measures
\item Classifying Complexity
\item Comparing Complexity
\item Describing Complexity
\end{itemize}
\item Solving Problems
\begin{itemize}\itemsep=0pt\parskip=0pt
\item Exact Algorithms
\item Randomization
\item Fixed-Parameter Algorithms
\item Parallel Computation
\item Partial Solutions
\item Approximation
\end{itemize}
\end{itemize}
Johannes will surely need to modify this list later on, but it looks good as a
first approximation. He will also need to add a number of subtopics (like
\emph{lots} of complexity classes under the topic ``classifying complexity''),
but he will do this as he constructs the map.
Turning the list of topics into a \tikzname-tree is easy, in principle. The
basic idea is that a node can have \emph{children}, which in turn can have
children of their own, and so on. To add a child to a node, Johannes can simply
write |child {|\meta{node}|}| right after a node. The \meta{node} should, in
turn, be the code for creating a node. To add another node, Johannes can use
|child| once more, and so on. Johannes is eager to try out this construct and
writes down the following:
%
\begin{codeexample}[]
\tikz
\node {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child { node {Problem Domains} }
child { node {Key Problems} }
}
child { node {Computational Models}
child { node {Turing Machines} }
child { node {Random-Access Machines} }
child { node {Circuits} }
child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {Programming in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {Approximation} }
};
\end{codeexample}
Well, that did not quite work out as expected (although, what, exactly, did one
expect?). There are two problems:
%
\begin{enumerate}
\item The overlap of the nodes is due to the fact that \tikzname\ is not
particularly smart when it comes to placing child nodes. Even though
it is possible to configure \tikzname\ to use rather clever placement
methods, \tikzname\ has no way of taking the actual size of the child
nodes into account. This may seem strange but the reason is that the
child nodes are rendered and placed one at a time, so the size of the
last node is not known when the first node is being processed. In
essence, you have to specify appropriate level and sibling node
spacings ``by hand''.
\item The standard computer-science-top-down rendering of a tree is
rather ill-suited to visualizing the concepts. It would be better to
either rotate the map by ninety degrees or, even better, to use some
sort of circular arrangement.
\end{enumerate}
Johannes redraws the tree, but this time with some more appropriate options
set, which he found more or less by trial-and-error:
%
\begin{codeexample}[
preamble={\usetikzlibrary{trees}},
render instead={
\tikz [font=\footnotesize,
grow=right, level 1/.style={sibling distance=6em},
level 2/.style={sibling distance=1em}, level distance=5cm]
\node {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} } child { node {Problem Aspects} }
child { node {Problem Domains} } child { node {Key Problems} }
}
child { node {Computational Models}
child { node {Turing Machines} } child { node {Random-Access Machines} }
child { node {Circuits} } child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} } child { node {Programming in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} } child { node {Classifying Complexity} }
child { node {Comparing Complexity} } child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} } child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} } child { node {Parallel Computation} }
child { node {Partial Solutions} } child { node {Approximation} }
};
},
]
\tikz [font=\footnotesize,
grow=right, level 1/.style={sibling distance=6em},
level 2/.style={sibling distance=1em}, level distance=5cm]
\node {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
... % as before
\end{codeexample}
Still not quite what Johannes had in mind, but he is getting somewhere.
For configuring the tree, two parameters are of particular importance: The
|level distance| tells \tikzname\ the distance between (the centers of) the
nodes on adjacent levels or layers of a tree. The |sibling distance| is, as the
name suggests, the distance between (the centers of) siblings of the tree.
You can globally set these parameters for a tree by simply setting them
somewhere before the tree starts, but you will typically wish them to be
different for different levels of the tree. In this case, you should set styles
like |level 1| or |level 2|. For the first level of the tree, the |level 1|
style is used, for the second level the |level 2| style, and so on. You can
also set the sibling and level distances only for certain nodes by passing
these options to the |child| command as options. (Note that the options of a
|node| command are local to the node and have no effect on the children. Also
note that it is possible to specify options that do have an effect on the
children. Finally note that specifying options for children ``at the right
place'' is an arcane art and you should peruse
Section~\ref{section-tree-options} on a rainy Sunday afternoon, if you are
really interested.)
The |grow| key is used to configure the direction in which a tree grows. You
can change growth direction ``in the middle of a tree'' simply by changing this
key for a single child or a whole level. By including the |trees| library you
also get access to additional growth strategies such as a ``circular'' growth:
%
\begin{codeexample}[
preamble={\usetikzlibrary{trees}},
render instead={
\tikz [text width=2.7cm, align=flush center,
grow cyclic,
level 1/.style={level distance=2.5cm,sibling angle=90},
level 2/.style={text width=2cm, font=\footnotesize, level distance=3cm,sibling angle=30}]
\node[font=\bfseries] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} } child { node {Problem Aspects} }
child { node {Problem Domains} } child { node {Key Problems} }
}
child { node {Computational Models}
child { node {Turing Machines} } child { node {Random-Access Machines} }
child { node {Circuits} } child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} } child { node {Programming in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} } child { node {Classifying Complexity} }
child { node {Comparing Complexity} } child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} } child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} } child { node {Parallel Computation} }
child { node {Partial Solutions} } child { node {Approximation} }
};
},
]
\tikz [text width=2.7cm, align=flush center,
grow cyclic,
level 1/.style={level distance=2.5cm,sibling angle=90},
level 2/.style={text width=2cm, font=\footnotesize, level distance=3cm,sibling angle=30}]
\node[font=\bfseries] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
... % as before
\end{codeexample}
Johannes is pleased to learn that he can access and manipulate the nodes of the
tree like any normal node. In particular, he can name them using the |name=|
option or the |(|\meta{name}|)| notation and he can use any available shape or
style for the trees nodes. He can connect trees later on using the normal
|\draw (some node) -- (another node);| syntax. In essence, the |child| command
just computes an appropriate position for a node and adds a line from the child
to the parent node.
\subsection{Creating the Lecture Map}
Johannes now has a first possible layout for his lecture map. The next step is
to make it ``look nicer''. For this, the |mindmap| library is helpful since it
makes a number of styles available that will make a tree look like a nice
``mind map'' or ``concept map''.
The first step is to include the |mindmap| library, which Johannes already did.
Next, he must add one of the following options to a scope that will contain the
lecture map: |mindmap| or |large mindmap| or |huge mindmap|. These options all
have the same effect, except that for a |large mindmap| the predefined font
size and node sizes are somewhat larger than for a standard |mindmap| and for a
|huge mindmap| they are even larger. So, a |large mindmap| does not necessarily
need to have a lot of concepts, but it will need a lot of paper.
The second step is to add the |concept| option to every node that will, indeed,
be a concept of the mindmap. The idea is that some nodes of a tree will be real
concepts, while other nodes might just be ``simple children''. Typically, this
is not the case, so you might consider saying |every node/.style=concept|.
The third step is to set up the sibling \emph{angle} (rather than a sibling
distance) to specify the angle between sibling concepts.
%
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap}},
render instead={
\tikz [mindmap, every node/.style=concept, concept color=black!20,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\node [root concept] {Computational Complexity} % root
child { node {\hbox to 2cm{Computational\hss} Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child { node {Problem Domains} }
child { node {Key Problems} }
}
child { node {\hbox to 2cm{Computational\hss} Models}
child { node {Turing Machines} }
child { node {Random-Access Machines} }
child { node {Circuits} }
child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {\hbox to1.5cm{Programming\hss} in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {\hbox to 1.5cm{Randomization\hss}} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {\hbox to1.5cm{Approximation\hss}} }
};
},
]
\tikz [mindmap, every node/.style=concept, concept color=black!20,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\node [root concept] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
... % as before
\end{codeexample}
When Johannes typesets the above map, \TeX\ (rightfully) starts complaining
about several overfull boxes and, indeed, words like ``Randomization'' stretch
out beyond the circle of the concept. This seems a bit mysterious at first
sight: Why does \TeX\ not hyphenate the word? The reason is that \TeX\ will
never hyphenate the first word of a paragraph because it starts looking for
``hyphenatable'' letters only after a so-called glue. In order to have \TeX\
hyphenate these single words, Johannes must use a bit of evil trickery: He
inserts a |\hskip0pt| before the word. This has no effect except for inserting
an (invisible) glue before the word and, thereby, allowing \TeX\ to hyphenate
the first word also. Since Johannes does not want to add |\hskip0pt| inside
each node, he uses the |execute at begin node| option to make \tikzname\ insert
this text with every node.
%
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap}},
render instead={
\begin{tikzpicture}
[mindmap,
every node/.style={concept, execute at begin node=\hskip0pt},
concept color=black!20,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\clip (-1,2) rectangle ++ (-4,5);
\node [root concept] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child { node {Problem Domains} }
child { node {Key Problems} }
}
child { node {Computational Models}
child { node {Turing Machines} }
child { node {Random-Access Machines} }
child { node {Circuits} }
child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {Programming in Logic} }
}
child { node {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child { node {Describing Complexity} }
}
child { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {Approximation} }
};
\end{tikzpicture}
},
]
\begin{tikzpicture}
[mindmap,
every node/.style={concept, execute at begin node=\hskip0pt},
concept color=black!20,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\clip (-1,2) rectangle ++ (-4,5);
\node [root concept] {Computational Complexity} % root
child { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
... % as before
\end{tikzpicture}
\end{codeexample}
In the above example a clipping was used to show only part of the lecture map,
in order to save space. The same will be done in the following examples, we
return to the complete lecture map at the end of this tutorial.
Johannes is now eager to colorize the map. The idea is to use different colors
for different parts of the map. He can then, during his lectures, talk about
the ``green'' or the ``red'' topics. This will make it easier for his students
to locate the topic he is talking about on the map. Since ``computational
problems'' somehow sounds ``problematic'', Johannes chooses red for them, while
he picks green for the ``solving problems''. The topics ``measuring
complexity'' and ``computational models'' get more neutral colors; Johannes
picks orange and blue.
To set the colors, Johannes must use the |concept color| option, rather than
just, say, |node [fill=red]|. Setting just the fill color to |red| would,
indeed, make the node red, but it would \emph{just} make the node red and not
the bar connecting the concept to its parent and also not its children. By
comparison, the special |concept color| option will not only set the color of
the node and its children, but it will also (magically) create appropriate
shadings so that the color of a parent concept smoothly changes to the color of
a child concept.
For the root concept Johannes decides to do something special: He sets the
concept color to black, sets the line width to a large value, and sets the fill
color to white. The effect of this is that the root concept will be encircled
with a thick black line and the children are connected to the central concept
via bars.
%
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap}},
render instead={
\begin{tikzpicture}
[mindmap,
every node/.style={concept, execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black},
text=white,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\clip (0,-1) rectangle ++(4,5);
\node [root concept] {Computational Complexity} % root
child [concept color=red] { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child { node {Problem Domains} }
child { node {Key Problems} }
}
child [concept color=blue] { node {Computational Models}
child { node {Turing Machines} }
child { node {Random-Access Machines} }
child { node {Circuits} }
child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {Programming in Logic} }
}
child [concept color=orange] { node {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child { node {Describing Complexity} }
}
child [concept color=green!50!black] { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {Approximation} }
};
\end{tikzpicture}
},
]
\begin{tikzpicture}
[mindmap,
every node/.style={concept, execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black, fill=white, line width=1ex, text=black},
text=white,
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90},
level 2/.append style={level distance=3cm,sibling angle=45}]
\clip (0,-1) rectangle ++(4,5);
\node [root concept] {Computational Complexity} % root
child [concept color=red] { node {Computational Problems}
child { node {Problem Measures} }
... % as before
}
child [concept color=blue] { node {Computational Models}
child { node {Turing Machines} }
... % as before
}
child [concept color=orange] { node {Measuring Complexity}
child { node {Complexity Measures} }
... % as before
}
child [concept color=green!50!black] { node {Solving Problems}
child { node {Exact Algorithms} }
... % as before
};
\end{tikzpicture}
\end{codeexample}
Johannes adds three finishing touches: First, he changes the font of the main
concepts to small caps. Second, he decides that some concepts should be
``faded'', namely those that are important in principle and belong on the map,
but which he will not talk about in his lecture. To achieve this, Johannes
defines four styles, one for each of the four main branches. These styles (a)
set up the correct concept color for the whole branch and (b) define the
|faded| style appropriately for this branch. Third, he adds a
|circular drop shadow|, defined in the |shadows| library, to the concepts, just
to make things look a bit more fancy.
%
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap,shadows}},
render instead={
\begin{tikzpicture}[mindmap]
\begin{scope}[
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\node [root concept] {Computational Complexity} % root
child [computational problems] { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child [faded] { node {Problem Domains} }
child { node {Key Problems} }
}
child [computational models] { node {Computational Models}
child { node {Turing Machines} }
child [faded] { node {Random-Access Machines} }
child { node {Circuits} }
child [faded] { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {Programming in Logic} }
}
child [measuring complexity] { node {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child [faded] { node {Describing Complexity} }
}
child [solving problems] { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {Approximation} }
};
\end{scope}
\end{tikzpicture}
},
]
\begin{tikzpicture}[mindmap]
\begin{scope}[
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black, fill=white, line width=1ex, text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\node [root concept] {Computational Complexity} % root
child [computational problems] { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child [faded] { node {Problem Domains} }
child { node {Key Problems} }
}
child [computational models] { node {Computational Models}
child { node {Turing Machines} }
child [faded] { node {Random-Access Machines} }
...
\end{scope}
\end{tikzpicture}
\end{codeexample}
\subsection{Adding the Lecture Annotations}
Johannes will give about a dozen lectures during the course ``computational
complexity''. For each lecture he has compiled a (short) list of learning
targets that state what knowledge and qualifications his students should
acquire during this particular lecture (note that learning targets are not the
same as the contents of a lecture). For each lecture he intends to put a little
rectangle on the map containing these learning targets and the name of the
lecture, each time somewhere near the topic of the lecture. Such ``little
rectangles'' are called ``annotations'' by the |mindmap| library.
In order to place the annotations next to the concepts, Johannes must assign
names to the nodes of the concepts. He could rely on \tikzname's automatic
naming of the nodes in a tree, where the children of a node named |root| are
named |root-1|, |root-2|, |root-3|, and so on. However, since Johannes is not
sure about the final order of the concepts in the tree, it seems better to
explicitly name all concepts of the tree in the following manner:
%
\begin{codeexample}[code only]
\node [root concept] (Computational Complexity) {Computational Complexity}
child [computational problems] { node (Computational Problems) {Computational Problems}
child { node (Problem Measures) {Problem Measures} }
child { node (Problem Aspects) {Problem Aspects} }
child [faded] { node (Problem Domains) {Problem Domains} }
child { node (Key Problems) {Key Problems} }
}
...
\end{codeexample}
The |annotation| style of the |mindmap| library mainly sets up a rectangular
shape of appropriate size. Johannes configures the style by defining
|every annotation| appropriately.
%
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap,shadows}},
render instead={
\begin{tikzpicture}[mindmap]
\clip (-5.25,-3) rectangle ++ (4,5);
\begin{scope}[
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\node [root concept] (Computational Complexity) {Computational Complexity} % root
child [computational problems] { node (Computational Problems) {Computational Problems}
child { node (Problem Measures) {Problem Measures} }
child { node (Problem Aspects) {Problem Aspects} }
child [faded] { node (Problem Domains) {Problem Domains} }
child { node (Key Problems) {Key Problems} }
}
child [computational models] { node (Computational Models) {Computational Models}
child { node (Turing Machines) {Turing Machines} }
child [faded] { node (Random-Access Machines) {Random-Access Machines} }
child { node (Circuits) {Circuits} }
child [faded] { node (Binary Decision Diagrams) {Binary Decision Diagrams} }
child { node (Oracle Machines) {Oracle Machines} }
child { node (Programming in Logic) {Programming in Logic} }
}
child [measuring complexity] { node (Measuring Complexity) {Measuring Complexity}
child { node (Complexity Measures) {Complexity Measures} }
child { node (Classifying Complexity) {Classifying Complexity} }
child { node (Comparing Complexity) {Comparing Complexity} }
child [faded] { node (Describing Complexity) {Describing Complexity} }
}
child [solving problems] { node (Solving Problems) {Solving Problems}
child { node (Exact Algorithms) {Exact Algorithms} }
child { node (Randomization) {Randomization} }
child { node (Fixed-Parameter Algorithms) {Fixed-Parameter Algorithms} }
child { node (Parallel Computation) {Parallel Computation} }
child { node (Partial Solutions) {Partial Solutions} }
child { node (Approximation) {Approximation} }
};
\end{scope}
\begin{scope}[every annotation/.style={fill=black!40}]
\node [annotation, above] at (Computational Problems.north) {
Lecture 1: Computational Problems
\begin{itemize}
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
\end{itemize}
};
\end{scope}
\end{tikzpicture}
},
]
\begin{tikzpicture}[mindmap]
\clip (-5,-5) rectangle ++ (4,5);
\begin{scope}[
every node/.style={concept, circular drop shadow, ...}] % as before
\node [root concept] (Computational Complexity) ... % as before
\end{scope}
\begin{scope}[every annotation/.style={fill=black!40}]
\node [annotation, above] at (Computational Problems.north) {
Lecture 1: Computational Problems
\begin{itemize}
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
\end{itemize}
};
\end{scope}
\end{tikzpicture}
\end{codeexample}
Well, that does not yet look quite perfect. The spacing or the |{itemize}| is
not really appropriate and the node is too large. Johannes can configure these
things ``by hand'', but it seems like a good idea to define a macro that will
take care of these things for him. The ``right'' way to do this is to define a
|\lecture| macro that takes a list of key--value pairs as argument and produces
the desired annotation. However, to keep things simple, Johannes' |\lecture|
macro simply takes a fixed number of arguments having the following meaning:
The first argument is the number of the lecture, the second is the name of the
lecture, the third are positioning options like |above|, the fourth is the
position where the node is placed, the fifth is the list of items to be shown,
and the sixth is a date when the lecture will be held (this parameter is not
yet needed, we will, however, need it later on).
%
% TODOsp: codeexamples: redo `\lecture` definition*s* when `preamble` can be emptied
\begin{codeexample}[code only]
\def\lecture#1#2#3#4#5#6{
\node [annotation, #3, scale=0.65, text width=4cm, inner sep=2mm] at (#4) {
Lecture #1: \textcolor{orange}{\textbf{#2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
#5
\endlist
};
}
\end{codeexample}
% TODOsp: codeexamples: this definition can most likely be deleted,
% because it is moved to the `pre` key in the `codeexamples`
\def\lecture#1#2#3#4#5#6{
\node [annotation, #3, scale=0.65, text width=4cm, inner sep=2mm] at (#4) {
Lecture #1: \textcolor{orange}{\textbf{#2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
#5
\endlist
};
}
\begin{codeexample}[
preamble={\usetikzlibrary{mindmap,shadows}},
pre={ % !!! replace all `##x` with `#x`
\def\lecture##1##2##3##4##5##6{
\node [annotation, ##3, scale=0.65, text width=4cm, inner sep=2mm] at (##4) {
Lecture ##1: \textcolor{orange}{\textbf{##2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
##5
\endlist
};
}},
render instead={
\begin{tikzpicture}[mindmap,every annotation/.style={fill=white}]
\clip (-5.25,-3) rectangle ++ (4,5);
\begin{scope}[
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\node [root concept] (Computational Complexity) {Computational Complexity} % root
child [computational problems] { node (Computational Problems) {Computational Problems}
child { node (Problem Measures) {Problem Measures} }
child { node (Problem Aspects) {Problem Aspects} }
child [faded] { node (problem Domains) {Problem Domains} }
child { node (Key Problems) {Key Problems} }
}
child [computational models] { node (Computational Models) {Computational Models}
child { node (Turing Machines) {Turing Machines} }
child [faded] { node (Random-Access Machines) {Random-Access Machines} }
child { node (Circuits) {Circuits} }
child [faded] { node (Binary Decision Diagrams) {Binary Decision Diagrams} }
child { node (Oracle Machines) {Oracle Machines} }
child { node (Programming in Logic) {Programming in Logic} }
}
child [measuring complexity] { node (Measuring Complexity) {Measuring Complexity}
child { node (Complexity Measures) {Complexity Measures} }
child { node (Classifying Complexity) {Classifying Complexity} }
child { node (Comparing Complexity) {Comparing Complexity} }
child [faded] { node (Describing Complexity) {Describing Complexity} }
}
child [solving problems] { node (Solving Problems) {Solving Problems}
child { node (Exact Algorithms) {Exact Algorithms} }
child { node (Randomization) {Randomization} }
child { node (Fixed-Parameter Algorithms) {Fixed-Parameter Algorithms} }
child { node (Parallel Computation) {Parallel Computation} }
child { node (Partial Solutions) {Partial Solutions} }
child { node (Approximation) {Approximation} }
};
\end{scope}
\lecture{1}{Computational Problems}{above,xshift=-3mm}{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\end{tikzpicture}
},
]
\begin{tikzpicture}[mindmap,every annotation/.style={fill=white}]
\clip (-5,-5) rectangle ++ (4,5);
\begin{scope}[
every node/.style={concept, circular drop shadow, ... % as before
\node [root concept] (Computational Complexity) ... % as before
\end{scope}
\lecture{1}{Computational Problems}{above,xshift=-3mm}
{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\end{tikzpicture}
\end{codeexample}
In the same fashion Johannes can now add the other lecture annotations.
Obviously, Johannes will have some trouble fitting everything on a single
A4-sized page, but by adjusting the spacing and some experimentation he can
quickly arrange all the annotations as needed.
\subsection{Adding the Background}
Johannes has already used colors to organize his lecture map into four regions,
each having a different color. In order to emphasize these regions even more
strongly, he wishes to add a background coloring to each of these regions.
Adding these background colors turns out to be more tricky than Johannes would
have thought. At first sight, what he needs is some sort of ``color wheel''
that is blue in the lower right direction and then changes smoothly to orange
in the upper right direction and then to green in the upper left direction and
so on. Unfortunately, there is no easy way of creating such a color wheel
shading (although it can be done, in principle, but only at a very high cost,
see page~\pageref{shading-color-wheel} for an example).
Johannes decides to do something a bit more basic: He creates four large
rectangles, one for each of the four quadrants around the central concept, each
colored with a light version of the quadrant. Then, in order to ``smooth'' the
change between adjacent rectangles, he puts four shadings on top of them.
Since these background rectangles should go ``behind'' everything else,
Johannes puts all his background stuff on the |background| layer.
In the following code, only the central concept is shown to save some space:
%
\begin{codeexample}[preamble={\usetikzlibrary{backgrounds,mindmap,shadows}}]
\begin{tikzpicture}[
mindmap,
concept color=black,
root concept/.append style={
concept,
circular drop shadow,
fill=white, line width=1ex,
text=black, font=\large\scshape}
]
\clip (-1.5,-5) rectangle ++(4,10);
\node [root concept] (Computational Complexity) {Computational Complexity};
\begin{pgfonlayer}{background}
\clip (-1.5,-5) rectangle ++(4,10);
\colorlet{upperleft}{green!50!black!25}
\colorlet{upperright}{orange!25}
\colorlet{lowerleft}{red!25}
\colorlet{lowerright}{blue!25}
% The large rectangles:
\fill [upperleft] (Computational Complexity) rectangle ++(-20,20);
\fill [upperright] (Computational Complexity) rectangle ++(20,20);
\fill [lowerleft] (Computational Complexity) rectangle ++(-20,-20);
\fill [lowerright] (Computational Complexity) rectangle ++(20,-20);
% The shadings:
\shade [left color=upperleft,right color=upperright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,20);
\shade [left color=lowerleft,right color=lowerright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,-20);
\shade [top color=upperleft,bottom color=lowerleft]
([yshift=-1cm]Computational Complexity) rectangle ++(-20,2);
\shade [top color=upperright,bottom color=lowerright]
([yshift=-1cm]Computational Complexity) rectangle ++(20,2);
\end{pgfonlayer}
\end{tikzpicture}
\end{codeexample}
\subsection{Adding the Calendar}
Johannes intends to plan his lecture rather carefully. In particular, he
already knows when each of his lectures will be held during the course.
Naturally, this does not mean that Johannes will slavishly follow the plan and
he might need longer for some subjects than he anticipated, but nevertheless he
has a detailed plan of when which subject will be addressed.
Johannes intends to share this plan with his students by adding a calendar to
the lecture map. In addition to serving as a reference on which particular day
a certain topic will be addressed, the calendar is also useful to show the
overall chronological order of the course.
In order to add a calendar to a \tikzname\ graphic, the |calendar| library is
most useful. The library provides the |\calendar| command, which takes a large
number of options and which can be configured in many ways to produce just
about any kind of calendar imaginable. For Johannes' purposes, a simple
|day list downward| will be a nice option since it produces a list of days that
go ``downward''.
%
\begin{codeexample}[
leave comments,
preamble={\usetikzlibrary{calendar}},
]
\tiny
\begin{tikzpicture}
\calendar [day list downward,
name=cal,
dates=2009-04-01 to 2009-04-14]
if (weekend)
[black!25];
\end{tikzpicture}
\end{codeexample}
Using the |name| option, we gave a name to the calendar, which will allow us to
reference the nodes that make up the individual days of the calendar later on.
For instance, the rectangular node containing the |1| that represents April
1st, 2009, can be referenced as |(cal-2009-04-01)|. The |dates| option is used
to specify an interval for which the calendar should be drawn. Johannes will
need several months in his calendar, but the above example only shows two weeks
to save some space.
Note the |if (weekend)| construct. The |\calendar| command is followed by
options and then by |if|-statements. These |if|-statements are checked for each
day of the calendar and when a date passes this test, the options or the code
following the |if|-statement is executed. In the above example, we make weekend
days (Saturdays and Sundays, to be precise) lighter than normal days. (Use your
favorite calendar to check that, indeed, April 5th, 2009, is a Sunday.)
As mentioned above, Johannes can reference the nodes that are used to typeset
days. Recall that his |\lecture| macro already got passed a date, which we did
not use, yet. We can now use it to place the lecture's title next to the date
when the lecture will be held:
%
\begin{codeexample}[code only]
\def\lecture#1#2#3#4#5#6{
% As before:
\node [annotation, #3, scale=0.65, text width=4cm, inner sep=2mm] at (#4) {
Lecture #1: \textcolor{orange}{\textbf{#2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
#5
\endlist
};
% New:
\node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
\end{codeexample}
\def\lecture#1#2#3#4#5#6{
\node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
Johannes can now use this new |\lecture| command as follows (in the example,
only the new part of the definition is used):
%
\begin{codeexample}[
preamble={\usetikzlibrary{calendar}},
pre={ % !!! replace all `##x` with `#x`
\def\lecture##1##2##3##4##5##6{
\node [anchor=base west] at (cal-##6.base east) {\textcolor{orange}{\textbf{##2}}};
}},
]
\tiny
\begin{tikzpicture}
\calendar [day list downward,
name=cal,
dates=2009-04-01 to 2009-04-14]
if (weekend)
[black!25];
% As before:
\lecture{1}{Computational Problems}{above,xshift=-3mm}
{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\end{tikzpicture}
\end{codeexample}
As a final step, Johannes needs to add a few more options to the calendar
command: He uses the |month text| option to configure how the text of a month
is rendered (see Section~\ref{section-calender} for details) and then typesets
the month text at a special position at the beginning of each month.
%
\begin{codeexample}[
leave comments,
preamble={\usetikzlibrary{calendar}},
pre={ % !!! replace all `##x` with `#x`
\def\lecture##1##2##3##4##5##6{
\node [anchor=base west] at (cal-##6.base east) {\textcolor{orange}{\textbf{##2}}};
}},
]
\tiny
\begin{tikzpicture}
\calendar [day list downward,
month text=\%mt\ \%y0,
month yshift=3.5em,
name=cal,
dates=2009-04-01 to 2009-05-01]
if (weekend)
[black!25]
if (day of month=1) {
\node at (0pt,1.5em) [anchor=base west] {\small\tikzmonthtext};
};
\lecture{1}{Computational Problems}{above,xshift=-3mm}
{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\lecture{2}{Computational Models}{above,xshift=-3mm}
{Computational Models.north}{
\item Knowledge of Turing machines
\item Being able to compare the computational power of different
models
}{2009-04-15}
\end{tikzpicture}
\end{codeexample}
\subsection{The Complete Code}
Putting it all together, Johannes gets the following code:
First comes the definition of the |\lecture| command:
%
\begin{codeexample}[code only]
\def\lecture#1#2#3#4#5#6{
% As before:
\node [annotation, #3, scale=0.65, text width=4cm, inner sep=2mm, fill=white] at (#4) {
Lecture #1: \textcolor{orange}{\textbf{#2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
#5
\endlist
};
% New:
\node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
\end{codeexample}
This is followed by the main mindmap setup\dots
%
\begin{codeexample}[code only]
\noindent
\begin{tikzpicture}
\begin{scope}[
mindmap,
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\end{codeexample}
%
\dots and contents:
%
\begin{codeexample}[code only]
\node [root concept] (Computational Complexity) {Computational Complexity} % root
child [computational problems] { node [yshift=-1cm] (Computational Problems) {Computational Problems}
child { node (Problem Measures) {Problem Measures} }
child { node (Problem Aspects) {Problem Aspects} }
child [faded] { node (problem Domains) {Problem Domains} }
child { node (Key Problems) {Key Problems} }
}
child [computational models] { node [yshift=-1cm] (Computational Models) {Computational Models}
child { node (Turing Machines) {Turing Machines} }
child [faded] { node (Random-Access Machines) {Random-Access Machines} }
child { node (Circuits) {Circuits} }
child [faded] { node (Binary Decision Diagrams) {Binary Decision Diagrams} }
child { node (Oracle Machines) {Oracle Machines} }
child { node (Programming in Logic) {Programming in Logic} }
}
child [measuring complexity] { node [yshift=1cm] (Measuring Complexity) {Measuring Complexity}
child { node (Complexity Measures) {Complexity Measures} }
child { node (Classifying Complexity) {Classifying Complexity} }
child { node (Comparing Complexity) {Comparing Complexity} }
child [faded] { node (Describing Complexity) {Describing Complexity} }
}
child [solving problems] { node [yshift=1cm] (Solving Problems) {Solving Problems}
child { node (Exact Algorithms) {Exact Algorithms} }
child { node (Randomization) {Randomization} }
child { node (Fixed-Parameter Algorithms) {Fixed-Parameter Algorithms} }
child { node (Parallel Computation) {Parallel Computation} }
child { node (Partial Solutions) {Partial Solutions} }
child { node (Approximation) {Approximation} }
};
\end{scope}
\end{codeexample}
%
Now comes the calendar code:
%
\begin{codeexample}[code only]
\tiny
\calendar [day list downward,
month text=\%mt\ \%y0,
month yshift=3.5em,
name=cal,
at={(-.5\textwidth-5mm,.5\textheight-1cm)},
dates=2009-04-01 to 2009-06-last]
if (weekend)
[black!25]
if (day of month=1) {
\node at (0pt,1.5em) [anchor=base west] {\small\tikzmonthtext};
};
\end{codeexample}
%
The lecture annotations:
%
\begin{codeexample}[code only]
\lecture{1}{Computational Problems}{above,xshift=-5mm,yshift=5mm}{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\lecture{2}{Computational Models}{above left}
{Computational Models.west}{
\item Knowledge of Turing machines
\item Being able to compare the computational power of different
models
}{2009-04-15}
\end{codeexample}
%
Finally, the background:
%
\begin{codeexample}[code only]
\begin{pgfonlayer}{background}
\clip[xshift=-1cm] (-.5\textwidth,-.5\textheight) rectangle ++(\textwidth,\textheight);
\colorlet{upperleft}{green!50!black!25}
\colorlet{upperright}{orange!25}
\colorlet{lowerleft}{red!25}
\colorlet{lowerright}{blue!25}
% The large rectangles:
\fill [upperleft] (Computational Complexity) rectangle ++(-20,20);
\fill [upperright] (Computational Complexity) rectangle ++(20,20);
\fill [lowerleft] (Computational Complexity) rectangle ++(-20,-20);
\fill [lowerright] (Computational Complexity) rectangle ++(20,-20);
% The shadings:
\shade [left color=upperleft,right color=upperright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,20);
\shade [left color=lowerleft,right color=lowerright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,-20);
\shade [top color=upperleft,bottom color=lowerleft]
([yshift=-1cm]Computational Complexity) rectangle ++(-20,2);
\shade [top color=upperright,bottom color=lowerright]
([yshift=-1cm]Computational Complexity) rectangle ++(20,2);
\end{pgfonlayer}
\end{tikzpicture}
\end{codeexample}
The next page shows the resulting lecture map in all its glory (it
would be somewhat more glorious, if there were more lecture
annotations, but you should get the idea).
\def\lecture#1#2#3#4#5#6{
% As before:
\node [annotation, #3, scale=0.65, text width=4cm, inner sep=2mm, fill=white] at (#4) {
Lecture #1: \textcolor{orange}{\textbf{#2}}
\list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt
\parskip=0pt\labelwidth=8pt\leftmargin=8pt
\itemindent=0pt\labelsep=2pt}
#5
\endlist
};
% New:
\node [anchor=base west] at (cal-#6.base east) {\textcolor{orange}{\textbf{#2}}};
}
\noindent
\begin{tikzpicture}
\begin{scope}[
mindmap,
every node/.style={concept, circular drop shadow,execute at begin node=\hskip0pt},
root concept/.append style={
concept color=black,
fill=white, line width=1ex,
text=black, font=\large\scshape},
text=white,
computational problems/.style={concept color=red,faded/.style={concept color=red!50}},
computational models/.style={concept color=blue,faded/.style={concept color=blue!50}},
measuring complexity/.style={concept color=orange,faded/.style={concept color=orange!50}},
solving problems/.style={concept color=green!50!black,faded/.style={concept color=green!50!black!50}},
grow cyclic,
level 1/.append style={level distance=4.5cm,sibling angle=90,font=\scshape},
level 2/.append style={level distance=3cm,sibling angle=45,font=\scriptsize}]
\node [root concept] (Computational Complexity) {Computational Complexity} % root
child [computational problems] { node [yshift=-1cm] (Computational Problems) {Computational Problems}
child { node (Problem Measures) {Problem Measures} }
child { node (Problem Aspects) {Problem Aspects} }
child [faded] { node (problem Domains) {Problem Domains} }
child { node (Key Problems) {Key Problems} }
}
child [computational models] { node [yshift=-1cm] (Computational Models) {Computational Models}
child { node (Turing Machines) {Turing Machines} }
child [faded] { node (Random-Access Machines) {Random-Access Machines} }
child { node (Circuits) {Circuits} }
child [faded] { node (Binary Decision Diagrams) {Binary Decision Diagrams} }
child { node (Oracle Machines) {Oracle Machines} }
child { node (Programming in Logic) {Programming in Logic} }
}
child [measuring complexity] { node [yshift=1cm] (Measuring Complexity) {Measuring Complexity}
child { node (Complexity Measures) {Complexity Measures} }
child { node (Classifying Complexity) {Classifying Complexity} }
child { node (Comparing Complexity) {Comparing Complexity} }
child [faded] { node (Describing Complexity) {Describing Complexity} }
}
child [solving problems] { node [yshift=1cm] (Solving Problems) {Solving Problems}
child { node (Exact Algorithms) {Exact Algorithms} }
child { node (Randomization) {Randomization} }
child { node (Fixed-Parameter Algorithms) {Fixed-Parameter Algorithms} }
child { node (Parallel Computation) {Parallel Computation} }
child { node (Partial Solutions) {Partial Solutions} }
child { node (Approximation) {Approximation} }
};
\end{scope}
\tiny
\calendar [day list downward,
month text=\%mt\ \%y0,
month yshift=3.5em,
name=cal,
at={(-.5\textwidth-5mm,.5\textheight-1cm)},
dates=2009-04-01 to 2009-06-last]
if (weekend)
[black!25]
if (day of month=1) {
\node at (0pt,1.5em) [anchor=base west] {\small\tikzmonthtext};
};
\lecture{1}{Computational Problems}{above,xshift=-5mm,yshift=5mm}{Computational Problems.north}{
\item Knowledge of several key problems
\item Knowledge of problem encodings
\item Being able to formalize problems
}{2009-04-08}
\lecture{2}{Computational Models}{above left}
{Computational Models.west}{
\item Knowledge of Turing machines
\item Being able to compare the computational power of different
models
}{2009-04-15}
\begin{pgfonlayer}{background}
\clip[xshift=-1cm] (-.5\textwidth,-.5\textheight) rectangle ++(\textwidth,\textheight);
\colorlet{upperleft}{green!50!black!25}
\colorlet{upperright}{orange!25}
\colorlet{lowerleft}{red!25}
\colorlet{lowerright}{blue!25}
% The large rectangles:
\fill [upperleft] (Computational Complexity) rectangle ++(-20,20);
\fill [upperright] (Computational Complexity) rectangle ++(20,20);
\fill [lowerleft] (Computational Complexity) rectangle ++(-20,-20);
\fill [lowerright] (Computational Complexity) rectangle ++(20,-20);
% The shadings:
\shade [left color=upperleft,right color=upperright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,20);
\shade [left color=lowerleft,right color=lowerright]
([xshift=-1cm]Computational Complexity) rectangle ++(2,-20);
\shade [top color=upperleft,bottom color=lowerleft]
([yshift=-1cm]Computational Complexity) rectangle ++(-20,2);
\shade [top color=upperright,bottom color=lowerright]
([yshift=-1cm]Computational Complexity) rectangle ++(20,2);
\end{pgfonlayer}
\end{tikzpicture}
|