summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-body.tex
blob: fd45d90821acf4b12c8f3fa3ad33e43b44997679 (plain)
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
% 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.


\begin{document}

% The titlepage

\pgfmathsetseed{1}
\newbox\mybox
{
  \parindent0pt
  \null
  \colorlet{mintgreen}{green!50!black!50}

  \thispagestyle{empty}
  \vskip3cm
  \vfill
  \hfil
  \begin{tikzpicture}[overlay]
    \coordinate (front) at (0,0);
    \coordinate (horizon) at (0,.31\paperheight);
    \coordinate (bottom) at (0,-.6\paperheight);
    \coordinate (sky) at (0,.57\paperheight);
    \coordinate (left) at (-.51\paperwidth,0);
    \coordinate (right) at (.51\paperwidth,0);

    \shade [bottom color=blue!30!black!10,top color=blue!30!black!50]
      ([yshift=-5mm]horizon -|  left) rectangle (sky -| right);
    \shade [bottom color=black!70!green!25,top color=black!70!green!10]
      (front -| left) -- (horizon -| left)
      decorate [decoration=random steps] { -- (horizon -| right) }
      -- (front -| right) -- cycle;
    \shade [top color=black!70!green!25,bottom color=black!25]
      ([yshift=-5mm-1pt]front -| left) rectangle ([yshift=1pt]front -| right);
    \fill [black!25] (bottom -| left) rectangle ([yshift=-5mm]front -| right);

    \def\nodeshadowed[#1]#2;{\node[scale=2,above,#1]{\global\setbox\mybox=\hbox{#2}\copy\mybox};
      \node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4]{\box\mybox};}

    \nodeshadowed [at={(-5,5  )},yslant=0.05] {\Huge Ti\textcolor{orange}{\emph{k}}Z};
    \nodeshadowed [at={( 0,5.3)}] {\huge \textcolor{mintgreen}{\&}};
    \nodeshadowed [at={( 5,5  )},yslant=-0.05] {\Huge \textsc{PGF}};
    \nodeshadowed [at={( 0,2  )}] {Manual for Version \pgftypesetversion};

    \foreach \where in {-9cm,9cm}
    {\nodeshadowed [at={(\where,5cm)}] {
    % TODO: Nesting tikzpictures is NOT supported
    \tikz \draw [green!20!black, rotate=90]
    [l-system={rule set={F -> FF-[-F+F]+[+F-F]}, axiom=F, order=4,
      step=2pt, randomize step percent=50, angle=30, randomize angle percent=5}]
    lindenmayer system;};}

    \foreach \i in {0.5,0.6,...,2}
      \fill [white,decoration=Koch snowflake,opacity=.9]
            [shift=(horizon),shift={(rand*11,rnd*7)},scale=\i]
            [double copy shadow={opacity=0.2,shadow xshift=0pt,shadow
              yshift=3*\i pt,fill=white,draw=none}]
        decorate {
          decorate {
            decorate {
              (0,0) -- ++(60:1) -- ++(-60:1) -- cycle
            }
          }
        };

  \node (left text) [text width=.5\paperwidth-2cm,below right,at={(-.5\paperwidth+1cm,-1.5cm)}]
  {
    \fontencoding{T1}
    \fontfamily{pcr}
    \def\textbraceleft{\char`\{}
    \def\textbraceright{\char`\}}
    \def\textbackslash{\char`\\}
    \begin{lstlisting}[basicstyle=\scriptsize\color{black},
                       keywordstyle=\bfseries\color{white},
                       identifierstyle=\bfseries\color{black},
                       keywords={tikzpicture,shade,fill,draw,path,node},
                       literate={-}{{-}}1]
\begin{tikzpicture}
  \coordinate (front) at (0,0);
  \coordinate (horizon) at (0,.31\paperheight);
  \coordinate (bottom) at (0,-.6\paperheight);
  \coordinate (sky) at (0,.57\paperheight);
  \coordinate (left) at (-.51\paperwidth,0);
  \coordinate (right) at (.51\paperwidth,0);

  \shade [bottom color=white,
          top color=blue!30!black!50]
              ([yshift=-5mm]horizon -|  left)
    rectangle (sky -| right);

  \shade [bottom color=black!70!green!25,
          top color=black!70!green!10]
    (front -| left) -- (horizon -| left)
    decorate [decoration=random steps] {
      -- (horizon -| right)  }
    -- (front -| right) -- cycle;

  \shade [top color=black!70!green!25,
         bottom color=black!25]
              ([yshift=-5mm-1pt]front -| left)
    rectangle ([yshift=1pt]front -| right);

  \fill [black!25]
              (bottom -| left)
    rectangle ([yshift=-5mm]front -| right);

  \def\nodeshadowed[#1]#2;{
    \node[scale=2,above,#1]{
      \global\setbox\mybox=\hbox{#2}
      \copy\mybox};
    \node[scale=2,above,#1,yscale=-1,
          scope fading=south,opacity=0.4]{\box\mybox};
  }
\end{lstlisting}
};

  \node (right text) [text width=.5\paperwidth-2cm,below right,at={(1cm,-1.5cm)}]
  {
    \fontencoding{T1}
    \fontfamily{pcr}
    \def\textbraceleft{\char`\{}
    \def\textbraceright{\char`\}}
    \def\textbackslash{\char`\\}
    \begin{lstlisting}[basicstyle=\scriptsize\color{black},
                       keywordstyle=\bfseries\color{white},
                       identifierstyle=\bfseries\color{black},
                       keywords={tikzpicture,shade,fill,draw,path,node},
                       literate={-}{{-}}1]
  \nodeshadowed [at={(-5,8  )},yslant=0.05]
    {\Huge Ti\textcolor{orange}{\emph{k}}Z};
  \nodeshadowed [at={( 0,8.3)}]
    {\huge \textcolor{green!50!black!50}{\&}};
  \nodeshadowed [at={( 5,8  )},yslant=-0.05]
    {\Huge \textsc{PGF}};
  \nodeshadowed [at={( 0,5  )}]
    {Manual for Version \pgftypesetversion};

  \foreach \where in {-9cm,9cm} {
    \nodeshadowed [at={(\where,5cm)}] { \tikz
      \draw [green!20!black, rotate=90,
             l-system={rule set={F -> FF-[-F+F]+[+F-F]},
               axiom=F, order=4,step=2pt,
               randomize step percent=50, angle=30,
               randomize angle percent=5}] l-system; }}

  \foreach \i in {0.5,0.6,...,2}
    \fill
      [white,opacity=\i/2,
       decoration=Koch snowflake,
       shift=(horizon),shift={(rand*11,rnd*7)},
       scale=\i,double copy shadow={
         opacity=0.2,shadow xshift=0pt,
         shadow yshift=3*\i pt,fill=white,draw=none}]
      decorate {
        decorate {
          decorate {
            (0,0)- ++(60:1) -- ++(-60:1) -- cycle
          } } };

   \node (left text) ...
   \node (right text) ...

   \fill [decorate,decoration={footprints,foot of=gnome},
          opacity=.5,brown]        (rand*8,-rnd*10)
     to [out=rand*180,in=rand*180] (rand*8,-rnd*10);
\end{tikzpicture}
  \end{lstlisting}
  };

  \fill [decorate,decoration=footprints,
         decoration={footprints,foot of=gnome},
         opacity=.5,brown]        (rand*8,-rnd*10)
    to [out=rand*180,in=rand*180] (rand*8,-rnd*10);
\end{tikzpicture}
\vfill
\vbox{}
\clearpage
}

{
  \vbox{}
  \vskip0pt plus 1fill
  Für meinen Vater, damit er noch viele schöne \TeX-Graphiken
  erschaffen kann.
  \vskip1em
  \hfill\emph{Till}
  \vskip0pt plus 3fill

  \parindent=0pt
  Copyright 2007 to 2013 by Till Tantau

  \medskip
  Permission is granted to copy, distribute and/or modify \emph{the
  documentation} under the terms of the \textsc{gnu} Free Documentation
  License, Version 1.2 or any later version published by the Free Software
  Foundation; with no Invariant Sections, no Front-Cover Texts, and no
  Back-Cover Texts. A copy of the license is included in the section entitled
  \textsc{gnu} Free Documentation License.

  \medskip
  Permission is granted to copy, distribute and/or modify \emph{the code of the
  package} under the terms of the \textsc{gnu} Public License, Version 2 or any
  later version published by the Free Software Foundation. A copy of the
  license is included in the section entitled \textsc{gnu} Public License.

  \medskip
  Permission is also granted to distribute and/or modify \emph{both the
  documentation and the code} under the conditions of the LaTeX Project Public
  License, either version 1.3 of this license or (at your option) any later
  version. A copy of the license is included in the section entitled \LaTeX\
  Project Public License.

  \vbox{}
  \clearpage
}


\title{\bfseries The \tikzname\ and {\Large PGF} Packages\\
  \large Manual for version \pgfversion\\[1mm]
\large\href{https://github.com/pgf-tikz/pgf}{\texttt{https://github.com/pgf-tikz/pgf}}}
\author{Till Tantau\footnote{Editor of this documentation. Parts of
    this documentation have been written by other authors as indicated
    in these parts or chapters and in Section~\ref{section-authors}.}\\
  \normalsize Institut für Theoretische Informatik\\[-1mm]
  \normalsize Universität zu Lübeck}

\maketitle
\label{table-of-contents}

\tableofcontents

\clearpage


\include{pgfmanual-en-introduction}



\part{Tutorials and Guidelines}

{\Large \emph{by Till Tantau}}

\bigskip
\noindent To help you get started with \tikzname, instead of a long
installation and configuration section, this manual starts with tutorials. They
explain all the basic and some of the more advanced features of the system,
without going into all the details. This part also contains some guidelines on
how you should proceed when creating graphics using \tikzname.

\vskip3cm

\begin{codeexample}[graphic=white,width=0pt]
\tikz \draw[thick,rounded corners=8pt]
  (0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0);
\end{codeexample}


\include{pgfmanual-en-tutorial}
\include{pgfmanual-en-tutorial-nodes}
\include{pgfmanual-en-tutorial-Euclid}
\include{pgfmanual-en-tutorial-chains}
\include{pgfmanual-en-tutorial-map}
\include{pgfmanual-en-guidelines}



\part{Installation and Configuration}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent This part explains how the system is installed. Typically, someone
has already done so for your system, so this part can be skipped; but if this
is not the case and you are the poor fellow who has to do the installation,
read the present part.


\vskip1cm

\begin{codeexample}[graphic=white,preamble={\usetikzlibrary{arrows.meta,automata,positioning,shadows}}]
\begin{tikzpicture}[->,>={Stealth[round]},shorten >=1pt,auto,node distance=2.8cm,on grid,semithick,
                    every state/.style={fill=red,draw=none,circular drop shadow,text=white}]

  \node[initial,state] (A)                    {$q_a$};
  \node[state]         (B) [above right=of A] {$q_b$};
  \node[state]         (D) [below right=of A] {$q_d$};
  \node[state]         (C) [below right=of B] {$q_c$};
  \node[state]         (E) [below=of D]       {$q_e$};

  \path (A) edge              node {0,1,L} (B)
            edge              node {1,1,R} (C)
        (B) edge [loop above] node {1,1,L} (B)
            edge              node {0,1,L} (C)
        (C) edge              node {0,1,L} (D)
            edge [bend left]  node {1,0,R} (E)
        (D) edge [loop below] node {1,1,R} (D)
            edge              node {0,1,R} (A)
        (E) edge [bend left]  node {1,0,R} (A);

   \node [right=1cm,text width=8cm] at (C)
   {
     The current candidate for the busy beaver for five states. It is
     presumed that this Turing machine writes a maximum number of
     $1$'s before halting among all Turing machines with five states
     and the tape alphabet $\{0, 1\}$. Proving this conjecture is an
     open research problem.
   };
\end{tikzpicture}
\end{codeexample}


\include{pgfmanual-en-installation}
\include{pgfmanual-en-license}
\include{pgfmanual-en-drivers}



\part{Ti\emph{k}Z ist \emph{kein} Zeichenprogramm}
\label{part-tikz}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent
\vskip3cm
\begin{codeexample}[graphic=white,preamble={\usetikzlibrary{angles,calc,quotes}}]
\begin{tikzpicture}[angle radius=.75cm]

  \node (A) at (-2,0)     [red,left]   {$A$};
  \node (B) at ( 3,.5)    [red,right]  {$B$};
  \node (C) at (-2,2)     [blue,left]  {$C$};
  \node (D) at ( 3,2.5)   [blue,right] {$D$};
  \node (E) at (60:-5mm)  [below]      {$E$};
  \node (F) at (60:3.5cm) [above]      {$F$};

  \coordinate (X) at (intersection cs:first line={(A)--(B)}, second line={(E)--(F)});
  \coordinate (Y) at (intersection cs:first line={(C)--(D)}, second line={(E)--(F)});

  \path
    (A) edge [red, thick]  (B)
    (C) edge [blue, thick] (D)
    (E) edge [thick]       (F)
      pic ["$\alpha$", draw, fill=yellow]   {angle = F--X--A}
      pic ["$\beta$",  draw, fill=green!30] {angle = B--X--F}
      pic ["$\gamma$", draw, fill=yellow]   {angle = E--Y--D}
      pic ["$\delta$", draw, fill=green!30] {angle = C--Y--E};

  \node at ($ (D)!.5!(B) $) [right=1cm,text width=6cm,rounded corners,fill=red!20,inner sep=1ex]
    {
      When we assume that $\color{red}AB$ and $\color{blue}CD$ are
      parallel, i.\,e., ${\color{red}AB} \mathbin{\|} \color{blue}CD$,
      then $\alpha = \gamma$ and $\beta = \delta$.
    };
\end{tikzpicture}
\end{codeexample}


\include{pgfmanual-en-tikz-design}
\include{pgfmanual-en-tikz-scopes}
\include{pgfmanual-en-tikz-coordinates}
\include{pgfmanual-en-tikz-paths}
\include{pgfmanual-en-tikz-actions}
\include{pgfmanual-en-tikz-arrows}
\include{pgfmanual-en-tikz-shapes}
\include{pgfmanual-en-tikz-pics}
\include{pgfmanual-en-tikz-graphs}
\include{pgfmanual-en-tikz-matrices}
\include{pgfmanual-en-tikz-trees}
\include{pgfmanual-en-tikz-plots}
\include{pgfmanual-en-tikz-transparency}
\include{pgfmanual-en-tikz-decorations}
\include{pgfmanual-en-tikz-transformations}
\include{pgfmanual-en-tikz-animations}



\part{Graph Drawing}
\label{part-gd}

{\Large \emph{by Till Tantau et al.}}

\bigskip
\noindent
\emph{Graph drawing algorithms} do the tough work of computing a layout of a
graph for you. \tikzname\ comes with powerful such algorithms, but you can also
implement new algorithms in the Lua programming language. \vskip1cm

\ifluatex
\begin{codeexample}[
    graphic=white,
    preamble={\usetikzlibrary{arrows.meta,graphs,graphdrawing}
\usegdlibrary{layered}}]
\tikz [nodes={text height=.7em, text depth=.2em,
              draw=black!20, thick, fill=white, font=\footnotesize},
       >={Stealth[round,sep]}, rounded corners, semithick]
  \graph [layered layout, level distance=1cm, sibling sep=.5em, sibling distance=1cm] {
    "5th Edition" -> { "6th Edition", "PWB 1.0" };
    "6th Edition" -> { "LSX" [>child anchor=45],  "1 BSD", "Mini Unix", "Wollongong", "Interdata" };
    "Interdata" -> { "Unix/TS 3.0", "PWB 2.0", "7th Edition" };
    "7th Edition" -> { "8th Edition", "32V", "V7M", "Ultrix-11", "Xenix", "UniPlus+" };
    "V7M" -> "Ultrix-11";
    "8th Edition" -> "9th Edition";
    "1 BSD" -> "2 BSD" -> "2.8 BSD" -> { "Ultrix-11", "2.9 BSD" };
    "32V" -> "3 BSD" -> "4 BSD" -> "4.1 BSD" -> { "4.2 BSD", "2.8 BSD", "8th Edition" };
    "4.2 BSD" -> { "4.3 BSD", "Ultrix-32" };
    "PWB 1.0" -> { "PWB 1.2" -> "PWB 2.0", "USG 1.0" -> { "CB Unix 1", "USG 2.0" }};
    "CB Unix 1" -> "CB Unix 2" -> "CB Unix 3" -> { "Unix/TS++", "PDP-11 Sys V" };
    { "USG 2.0" -> "USG 3.0", "PWB 2.0", "Unix/TS 1.0" } -> "Unix/TS 3.0";
    { "Unix/TS++", "CB Unix 3", "Unix/TS 3.0" } -> "TS 4.0" -> "System V.0" -> "System V.2" -> "System V.3";
  };
\end{codeexample}

\else
    You need to use Lua\TeX\ to typeset this part of the manual (and, also, to
    use algorithmic graph drawing).
\fi


\include{pgfmanual-en-gd-overview}
\include{pgfmanual-en-gd-usage-tikz}
\include{pgfmanual-en-gd-usage-pgf}
\include{pgfmanual-en-gd-trees}
\include{pgfmanual-en-gd-layered}
\include{pgfmanual-en-gd-force}
\include{pgfmanual-en-gd-circular}
\include{pgfmanual-en-gd-phylogenetics}
\include{pgfmanual-en-gd-edge-routing}
%
% XXX : disabled because of
% 1. compile-time dependencies which are hard to resolve
% 2. it is "hardly usable anyway" (TT)
%\include{pgfmanual-en-gd-ogdf}
\include{pgfmanual-en-gd-algorithm-layer}
\include{pgfmanual-en-gd-algorithms-in-c}
\include{pgfmanual-en-gd-display-layer}
\include{pgfmanual-en-gd-binding-layer}



\part{Libraries}
\label{part-libraries}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent
In this part the library packages are documented. They provide additional
predefined graphic objects like new arrow heads or new plot marks, but
sometimes also extensions of the basic \pgfname\ or \tikzname\ system. The
libraries are not loaded by default since many users will not need them.

\medskip
\noindent
\begin{codeexample}[graphic=white,preamble={\usetikzlibrary{arrows,trees}}]
\tikzset{
  ld/.style={level distance=#1},lw/.style={line width=#1},
  level 1/.style={ld=4.5mm, trunk,          lw=1ex ,sibling angle=60},
  level 2/.style={ld=3.5mm, trunk!80!leaf a,lw=.8ex,sibling angle=56},
  level 3/.style={ld=2.75mm,trunk!60!leaf a,lw=.6ex,sibling angle=52},
  level 4/.style={ld=2mm,   trunk!40!leaf a,lw=.4ex,sibling angle=48},
  level 5/.style={ld=1mm,   trunk!20!leaf a,lw=.3ex,sibling angle=44},
  level 6/.style={ld=1.75mm,leaf a,         lw=.2ex,sibling angle=40},
}
\pgfarrowsdeclare{leaf}{leaf}
  {\pgfarrowsleftextend{-2pt} \pgfarrowsrightextend{1pt}}
{
  \pgfpathmoveto{\pgfpoint{-2pt}{0pt}}
  \pgfpatharc{150}{30}{1.8pt}
  \pgfpatharc{-30}{-150}{1.8pt}
  \pgfusepathqfill
}

\newcommand{\logo}[5]
{
  \colorlet{border}{#1}
  \colorlet{trunk}{#2}
  \colorlet{leaf a}{#3}
  \colorlet{leaf b}{#4}
  \begin{tikzpicture}
    \scriptsize\scshape
    \draw[border,line width=1ex,yshift=.3cm,
          yscale=1.45,xscale=1.05,looseness=1.42]
      (1,0) to [out=90, in=0]    (0,1)  to [out=180,in=90]  (-1,0)
            to [out=-90,in=-180] (0,-1) to [out=0,  in=-90] (1,0) -- cycle;

    \coordinate (root) [grow cyclic,rotate=90]
    child {
      child [line cap=round] foreach \a in {0,1} {
        child foreach \b in {0,1} {
          child foreach \c in {0,1} {
            child foreach \d in {0,1} {
              child foreach \leafcolor in {leaf a,leaf b}
                { edge from parent [color=\leafcolor,-#5] }
        } } }
      } edge from parent [shorten >=-1pt,serif cm-,line cap=butt]
    };

    \node [align=center,below] at (0pt,-.5ex)
    { \textcolor{border}{T}heoretical \\ \textcolor{border}{C}omputer \\
      \textcolor{border}{S}cience };
  \end{tikzpicture}
}
\begin{minipage}{3cm}
  \logo{green!80!black}{green!25!black}{green}{green!80}{leaf}\\
  \logo{green!50!black}{black}{green!80!black}{red!80!green}{leaf}\\
  \logo{red!75!black}{red!25!black}{red!75!black}{orange}{leaf}\\
  \logo{black!50}{black}{black!50}{black!25}{}
\end{minipage}
\end{codeexample}


\include{pgfmanual-en-library-3d}
\include{pgfmanual-en-library-angles}
\include{pgfmanual-en-library-arrows}
\include{pgfmanual-en-library-automata}
\include{pgfmanual-en-library-babel}
\include{pgfmanual-en-library-backgrounds}
\include{pgfmanual-en-library-calc}
\include{pgfmanual-en-library-calendar}
\include{pgfmanual-en-library-chains}
\include{pgfmanual-en-library-circuits}
\include{pgfmanual-en-library-decorations}
\include{pgfmanual-en-library-er}
\include{pgfmanual-en-library-external}
\include{pgfmanual-en-library-fadings}
\include{pgfmanual-en-library-fit}
\include{pgfmanual-en-library-fixedpoint}
\include{pgfmanual-en-library-fpu}
\include{pgfmanual-en-library-lsystems}
\include{pgfmanual-en-library-math}
\include{pgfmanual-en-library-matrices}
\include{pgfmanual-en-library-mindmaps}
\include{pgfmanual-en-library-folding}
\include{pgfmanual-en-library-patterns}
\include{pgfmanual-en-library-perspective}
\include{pgfmanual-en-library-petri}
\include{pgfmanual-en-library-plot-handlers}
\include{pgfmanual-en-library-plot-marks}
\include{pgfmanual-en-library-profiler}
\include{pgfmanual-en-library-rdf}
\include{pgfmanual-en-library-shadings}
\include{pgfmanual-en-library-shadows}
\include{pgfmanual-en-library-shapes}
\include{pgfmanual-en-library-spy}
\include{pgfmanual-en-library-svg-path}
\include{pgfmanual-en-library-edges}
\include{pgfmanual-en-library-through}
\include{pgfmanual-en-library-trees}
\include{pgfmanual-en-library-turtle}
\include{pgfmanual-en-library-views}



\part{Data Visualization}
\label{part-dv}

{\Large \emph{by Till Tantau}}

\bigskip
\noindent

\begin{codeexample}[graphic=white,preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes=clean]
[
  visualize as smooth line=Gaussian,
  Gaussian={pin in data={text={$e^{-x^2}$},when=x is 1}}
]
data [format=function] {
  var x : interval [-7:7] samples 51;
  func y = exp(-\value x*\value x);
}
[
  visualize as scatter,
  legend={south east outside},
  scatter={
    style={mark=*,mark size=1.4pt},
    label in legend={text={
        $\sum_{i=1}^{10} x_i$, where $x_i \sim U(-1,1) $}}}
]
data [format=function] {
  var i : interval [0:1] samples 20;
  func y = 0;
  func x = (rand + rand + rand + rand + rand +
            rand + rand + rand + rand + rand);
};
\end{codeexample}


\include{pgfmanual-en-dv-introduction}
\include{pgfmanual-en-dv-main}
\include{pgfmanual-en-dv-formats}
\include{pgfmanual-en-dv-axes}
\include{pgfmanual-en-dv-visualizers}
\include{pgfmanual-en-dv-stylesheets}
\include{pgfmanual-en-dv-polar}
\include{pgfmanual-en-dv-backend}



\part{Utilities}
\label{part-utilities}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent
The utility packages are not directly involved in creating graphics, but you
may find them useful nonetheless. All of them either directly depend on
\pgfname\ or they are designed to work well together with \pgfname\ even though
they can be used in a stand-alone way.

\vskip2cm
\medskip
\noindent
\begin{codeexample}[graphic=white]
\begin{tikzpicture}[scale=2]
  \shade[top color=blue,bottom color=gray!50] (0,0) parabola (1.5,2.25) |- (0,0);
  \draw (1.05cm,2pt) node[above] {$\displaystyle\int_0^{3/2} \!\!x^2\mathrm{d}x$};

  \draw[help lines] (0,0) grid (3.9,3.9)
       [step=0.25cm]      (1,2) grid +(1,1);

  \draw[->] (-0.2,0) -- (4,0) node[right] {$x$};
  \draw[->] (0,-0.2) -- (0,4) node[above] {$f(x)$};

  \foreach \x/\xtext in {1/1, 1.5/1\frac{1}{2}, 2/2, 3/3}
    \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};

  \foreach \y/\ytext in {1/1, 2/2, 2.25/2\frac{1}{4}, 3/3}
    \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};

  \draw (-.5,.25) parabola bend (0,0) (2,4) node[below right] {$x^2$};
\end{tikzpicture}
\end{codeexample}


\include{pgfmanual-en-pgfkeys}
\include{pgfmanual-en-pgffor}
\include{pgfmanual-en-pgfcalendar}
\include{pgfmanual-en-pages}
\include{pgfmanual-en-xxcolor}
\include{pgfmanual-en-module-parser}



\part{Mathematical and Object-Oriented Engines}

{\Large \emph{by Mark Wibrow and Till Tantau}}


\bigskip
\noindent
\pgfname\ comes with two useful engines: One for doing mathematics, one for
doing object-oriented programming. Both engines can be used independently of
the main \pgfname.

The job of the mathematical engine is to support mathematical operations like
addition, subtraction, multiplication and division, using both integers and
non-integers, but also functions such as square-roots, sine, cosine, and
generate pseudo-random numbers. Mostly, you will use the mathematical
facilities of \pgfname\ indirectly, namely when you write a coordinate like
|(5cm*3,6cm/4)|, but the mathematical engine can also be used independently of
\pgfname\ and \tikzname.

The job of the object-oriented engine is to support simple object-oriented
programming in \TeX. It allows the definition of \emph{classes} (without
inheritance), \emph{methods}, \emph{attributes} and \emph{objects}.

\vskip1cm
\begin{codeexample}[graphic=white]
\pgfmathsetseed{1}
\foreach \col in {black,red,green,blue}
{
  \begin{tikzpicture}[x=10pt,y=10pt,ultra thick,baseline,line cap=round]
    \coordinate (current point) at (0,0);
    \coordinate (old velocity) at (0,0);
    \coordinate (new velocity) at (rand,rand);

    \foreach \i in {0,1,...,100}
    {
      \draw[\col!\i] (current point)
      .. controls ++([scale=-1]old velocity) and
                  ++(new velocity) .. ++(rand,rand)
         coordinate (current point);
      \coordinate (old velocity) at (new velocity);
      \coordinate (new velocity) at (rand,rand);
    }
  \end{tikzpicture}
}
\end{codeexample}


\include{pgfmanual-en-math-design}
\include{pgfmanual-en-math-parsing}
\include{pgfmanual-en-math-commands}
\include{pgfmanual-en-math-algorithms}
\include{pgfmanual-en-math-numberprinting}
\include{pgfmanual-en-oo}



\part{The Basic Layer}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent
\vskip1cm
\begin{codeexample}[graphic=white]
\begin{tikzpicture}
  \draw[gray,very thin] (-1.9,-1.9) grid (2.9,3.9)
          [step=0.25cm] (-1,-1) grid (1,1);
  \draw[blue] (1,-2.1) -- (1,4.1); % asymptote

  \draw[->] (-2,0) -- (3,0) node[right] {$x(t)$};
  \draw[->] (0,-2) -- (0,4) node[above] {$y(t)$};

  \foreach \pos in {-1,2}
    \draw[shift={(\pos,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\pos$};

  \foreach \pos in {-1,1,2,3}
    \draw[shift={(0,\pos)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\pos$};

  \fill (0,0) circle (0.064cm);
  \draw[thick,parametric,domain=0.4:1.5,samples=200]
    % The plot is reparameterised such that there are more samples
    % near the center.
    plot[id=asymptotic-example] function{(t*t*t)*sin(1/(t*t*t)),(t*t*t)*cos(1/(t*t*t))}
    node[right] {$\bigl(x(t),y(t)\bigr) = (t\sin \frac{1}{t}, t\cos \frac{1}{t})$};

  \fill[red] (0.63662,0) circle (2pt)
    node [below right,fill=white,yshift=-4pt] {$(\frac{2}{\pi},0)$};
\end{tikzpicture}
\end{codeexample}


\include{pgfmanual-en-base-design}
\include{pgfmanual-en-base-scopes}
\include{pgfmanual-en-base-points}
\include{pgfmanual-en-base-paths}
\include{pgfmanual-en-base-decorations}
\include{pgfmanual-en-base-actions}
\include{pgfmanual-en-base-arrows}
\include{pgfmanual-en-base-nodes}
\include{pgfmanual-en-base-matrices}
\include{pgfmanual-en-base-transformations}
\include{pgfmanual-en-base-patterns}
\include{pgfmanual-en-base-images}
\include{pgfmanual-en-base-external}
\include{pgfmanual-en-base-plots}
\include{pgfmanual-en-base-layers}
\include{pgfmanual-en-base-shadings}
\include{pgfmanual-en-base-transparency}
\include{pgfmanual-en-base-animations}
\include{pgfmanual-en-base-internalregisters}
\include{pgfmanual-en-base-quick}



\part{The System Layer}
\label{part-system}

{\Large \emph{by Till Tantau}}


\bigskip
\noindent
This part describes the low-level interface of \pgfname, called the
\emph{system layer}. This interface provides a complete abstraction of the
internals of the underlying drivers.

Unless you intend to port \pgfname\ to another driver or unless you intend to
write your own optimized frontend, you need not read this part.

In the following it is assumed that you are familiar with the basic workings of
the |graphics| package and that you know what \TeX-drivers are and how they
work.

\vskip1cm
\begin{codeexample}[graphic=white]
\begin{tikzpicture}
  [shorten >=1pt,->,
   vertex/.style={circle,fill=black!25,minimum size=17pt,inner sep=0pt}]

  \foreach \name/\x in {s/1, 2/2, 3/3, 4/4, 15/11, 16/12, 17/13, 18/14, 19/15, t/16}
    \node[vertex] (G-\name) at (\x,0) {$\name$};

  \foreach \name/\angle/\text in {P-1/234/5, P-2/162/6, P-3/90/7, P-4/18/8, P-5/-54/9}
    \node[vertex,xshift=6cm,yshift=.5cm] (\name) at (\angle:1cm) {$\text$};

  \foreach \name/\angle/\text in {Q-1/234/10, Q-2/162/11, Q-3/90/12, Q-4/18/13, Q-5/-54/14}
    \node[vertex,xshift=9cm,yshift=.5cm] (\name) at (\angle:1cm) {$\text$};

  \foreach \from/\to in {s/2,2/3,3/4,3/4,15/16,16/17,17/18,18/19,19/t}
    \draw (G-\from) -- (G-\to);

  \foreach \from/\to in {1/2,2/3,3/4,4/5,5/1,1/3,2/4,3/5,4/1,5/2}
    { \draw (P-\from) -- (P-\to); \draw (Q-\from) -- (Q-\to); }

  \draw (G-3) .. controls +(-30:2cm) and +(-150:1cm) .. (Q-1);
  \draw (Q-5) -- (G-15);
\end{tikzpicture}
\end{codeexample}


\include{pgfmanual-en-pgfsys-overview}
\include{pgfmanual-en-pgfsys-commands}
\include{pgfmanual-en-pgfsys-paths}
\include{pgfmanual-en-pgfsys-protocol}
\include{pgfmanual-en-pgfsys-animations}



\part{References and Index}

\vskip1cm
\begin{codeexample}[graphic=white]
\begin{tikzpicture}
  \draw[line width=0.3cm,color=red!30,line cap=round,line join=round] (0,0)--(2,0)--(2,5);
  \draw[help lines] (-2.5,-2.5) grid (5.5,7.5);
  \draw[very thick] (1,-1)--(-1,-1)--(-1,1)--(0,1)--(0,0)--
    (1,0)--(1,-1)--(3,-1)--(3,2)--(2,2)--(2,3)--(3,3)--
    (3,5)--(1,5)--(1,4)--(0,4)--(0,6)--(1,6)--(1,5)
    (3,3)--(4,3)--(4,5)--(3,5)--(3,6)
    (3,-1)--(4,-1);
  \draw[below left] (0,0) node(s){$s$};
  \draw[below left] (2,5) node(t){$t$};
  \fill (0,0) circle (0.06cm) (2,5) circle (0.06cm);
  \draw[->,rounded corners=0.2cm,shorten >=2pt]
    (1.5,0.5)-- ++(0,-1)-- ++(1,0)-- ++(0,2)-- ++(-1,0)-- ++(0,2)-- ++(1,0)--
    ++(0,1)-- ++(-1,0)-- ++(0,-1)-- ++(-2,0)-- ++(0,3)-- ++(2,0)-- ++(0,-1)--
    ++(1,0)-- ++(0,1)-- ++(1,0)-- ++(0,-1)-- ++(1,0)-- ++(0,-3)-- ++(-2,0)--
    ++(1,0)-- ++(0,-3)-- ++(1,0)-- ++(0,-1)-- ++(-6,0)-- ++(0,3)-- ++(2,0)--
    ++(0,-1)-- ++(1,0);
\end{tikzpicture}
\end{codeexample}

\printindex

%\typeout{Examples: \the\codeexamplecount}%
\end{document}


%%% Local Variables:
%%% mode: latex
%%% TeX-master: "~/pgf/doc/generic/pgf/version-for-luatex/en/pgfmanual"
%%% coding: iso-latin-1-unix
%%% End: