Debian Codegraph @

texmf-dist/doc/generic/pgf/pgfmanual-en-main-body.tex

raw
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 \begin{document}
12
13 % The titlepage
14
15 \pgfmathsetseed{1}
16 \newbox\mybox
17 {
18 \parindent0pt
19 \null
20 \colorlet{mintgreen}{green!50!black!50}
21
22 \thispagestyle{empty}
23 \vskip3cm
24 \vfill
25 \hfil
26 \begin{tikzpicture}[overlay]
27 \coordinate (front) at (0,0);
28 \coordinate (horizon) at (0,.31\paperheight);
29 \coordinate (bottom) at (0,-.6\paperheight);
30 \coordinate (sky) at (0,.57\paperheight);
31 \coordinate (left) at (-.51\paperwidth,0);
32 \coordinate (right) at (.51\paperwidth,0);
33
34 \shade [bottom color=blue!30!black!10,top color=blue!30!black!50]
35 ([yshift=-5mm]horizon -| left) rectangle (sky -| right);
36 \shade [bottom color=black!70!green!25,top color=black!70!green!10]
37 (front -| left) -- (horizon -| left)
38 decorate [decoration=random steps] { -- (horizon -| right) }
39 -- (front -| right) -- cycle;
40 \shade [top color=black!70!green!25,bottom color=black!25]
41 ([yshift=-5mm-1pt]front -| left) rectangle ([yshift=1pt]front -| right);
42 \fill [black!25] (bottom -| left) rectangle ([yshift=-5mm]front -| right);
43
44 \def\nodeshadowed[#1]#2;{\node[scale=2,above,#1]{\global\setbox\mybox=\hbox{#2}\copy\mybox};
45 \node[scale=2,above,#1,yscale=-1,scope fading=south,opacity=0.4]{\box\mybox};}
46
47 \nodeshadowed [at={(-5,5 )},yslant=0.05] {\Huge Ti\textcolor{orange}{\emph{k}}Z};
48 \nodeshadowed [at={( 0,5.3)}] {\huge \textcolor{mintgreen}{\&}};
49 \nodeshadowed [at={( 5,5 )},yslant=-0.05] {\Huge \textsc{PGF}};
50 \nodeshadowed [at={( 0,2 )}] {Manual for Version \pgftypesetversion};
51
52 \foreach \where in {-9cm,9cm}
53 {\nodeshadowed [at={(\where,5cm)}] {
54 % TODO: Nesting tikzpictures is NOT supported
55 \tikz \draw [green!20!black, rotate=90]
56 [l-system={rule set={F -> FF-[-F+F]+[+F-F]}, axiom=F, order=4,
57 step=2pt, randomize step percent=50, angle=30, randomize angle percent=5}]
58 lindenmayer system;};}
59
60 \foreach \i in {0.5,0.6,...,2}
61 \fill [white,decoration=Koch snowflake,opacity=.9]
62 [shift=(horizon),shift={(rand*11,rnd*7)},scale=\i]
63 [double copy shadow={opacity=0.2,shadow xshift=0pt,shadow
64 yshift=3*\i pt,fill=white,draw=none}]
65 decorate {
66 decorate {
67 decorate {
68 (0,0) -- ++(60:1) -- ++(-60:1) -- cycle
69 }
70 }
71 };
72
73 \node (left text) [text width=.5\paperwidth-2cm,below right,at={(-.5\paperwidth+1cm,-1.5cm)}]
74 {
75 \fontencoding{T1}
76 \fontfamily{pcr}
77 \def\textbraceleft{\char`\{}
78 \def\textbraceright{\char`\}}
79 \def\textbackslash{\char`\\}
80 \begin{lstlisting}[basicstyle=\scriptsize\color{black},
81 keywordstyle=\bfseries\color{white},
82 identifierstyle=\bfseries\color{black},
83 keywords={tikzpicture,shade,fill,draw,path,node},
84 literate={-}{{-}}1]
85 \begin{tikzpicture}
86 \coordinate (front) at (0,0);
87 \coordinate (horizon) at (0,.31\paperheight);
88 \coordinate (bottom) at (0,-.6\paperheight);
89 \coordinate (sky) at (0,.57\paperheight);
90 \coordinate (left) at (-.51\paperwidth,0);
91 \coordinate (right) at (.51\paperwidth,0);
92
93 \shade [bottom color=white,
94 top color=blue!30!black!50]
95 ([yshift=-5mm]horizon -| left)
96 rectangle (sky -| right);
97
98 \shade [bottom color=black!70!green!25,
99 top color=black!70!green!10]
100 (front -| left) -- (horizon -| left)
101 decorate [decoration=random steps] {
102 -- (horizon -| right) }
103 -- (front -| right) -- cycle;
104
105 \shade [top color=black!70!green!25,
106 bottom color=black!25]
107 ([yshift=-5mm-1pt]front -| left)
108 rectangle ([yshift=1pt]front -| right);
109
110 \fill [black!25]
111 (bottom -| left)
112 rectangle ([yshift=-5mm]front -| right);
113
114 \def\nodeshadowed[#1]#2;{
115 \node[scale=2,above,#1]{
116 \global\setbox\mybox=\hbox{#2}
117 \copy\mybox};
118 \node[scale=2,above,#1,yscale=-1,
119 scope fading=south,opacity=0.4]{\box\mybox};
120 }
121 \end{lstlisting}
122 };
123
124 \node (right text) [text width=.5\paperwidth-2cm,below right,at={(1cm,-1.5cm)}]
125 {
126 \fontencoding{T1}
127 \fontfamily{pcr}
128 \def\textbraceleft{\char`\{}
129 \def\textbraceright{\char`\}}
130 \def\textbackslash{\char`\\}
131 \begin{lstlisting}[basicstyle=\scriptsize\color{black},
132 keywordstyle=\bfseries\color{white},
133 identifierstyle=\bfseries\color{black},
134 keywords={tikzpicture,shade,fill,draw,path,node},
135 literate={-}{{-}}1]
136 \nodeshadowed [at={(-5,8 )},yslant=0.05]
137 {\Huge Ti\textcolor{orange}{\emph{k}}Z};
138 \nodeshadowed [at={( 0,8.3)}]
139 {\huge \textcolor{green!50!black!50}{\&}};
140 \nodeshadowed [at={( 5,8 )},yslant=-0.05]
141 {\Huge \textsc{PGF}};
142 \nodeshadowed [at={( 0,5 )}]
143 {Manual for Version \pgftypesetversion};
144
145 \foreach \where in {-9cm,9cm} {
146 \nodeshadowed [at={(\where,5cm)}] { \tikz
147 \draw [green!20!black, rotate=90,
148 l-system={rule set={F -> FF-[-F+F]+[+F-F]},
149 axiom=F, order=4,step=2pt,
150 randomize step percent=50, angle=30,
151 randomize angle percent=5}] l-system; }}
152
153 \foreach \i in {0.5,0.6,...,2}
154 \fill
155 [white,opacity=\i/2,
156 decoration=Koch snowflake,
157 shift=(horizon),shift={(rand*11,rnd*7)},
158 scale=\i,double copy shadow={
159 opacity=0.2,shadow xshift=0pt,
160 shadow yshift=3*\i pt,fill=white,draw=none}]
161 decorate {
162 decorate {
163 decorate {
164 (0,0)- ++(60:1) -- ++(-60:1) -- cycle
165 } } };
166
167 \node (left text) ...
168 \node (right text) ...
169
170 \fill [decorate,decoration={footprints,foot of=gnome},
171 opacity=.5,brown] (rand*8,-rnd*10)
172 to [out=rand*180,in=rand*180] (rand*8,-rnd*10);
173 \end{tikzpicture}
174 \end{lstlisting}
175 };
176
177 \fill [decorate,decoration=footprints,
178 decoration={footprints,foot of=gnome},
179 opacity=.5,brown] (rand*8,-rnd*10)
180 to [out=rand*180,in=rand*180] (rand*8,-rnd*10);
181 \end{tikzpicture}
182 \vfill
183 \vbox{}
184 \clearpage
185 }
186
187 {
188 \vbox{}
189 \vskip0pt plus 1fill
190 Für meinen Vater, damit er noch viele schöne \TeX-Graphiken
191 erschaffen kann.
192 \vskip1em
193 \hfill\emph{Till}
194 \vskip0pt plus 3fill
195
196 \parindent=0pt
197 Copyright 2007 to 2013 by Till Tantau
198
199 \medskip
200 Permission is granted to copy, distribute and/or modify \emph{the
201 documentation} under the terms of the \textsc{gnu} Free Documentation
202 License, Version 1.2 or any later version published by the Free Software
203 Foundation; with no Invariant Sections, no Front-Cover Texts, and no
204 Back-Cover Texts. A copy of the license is included in the section entitled
205 \textsc{gnu} Free Documentation License.
206
207 \medskip
208 Permission is granted to copy, distribute and/or modify \emph{the code of the
209 package} under the terms of the \textsc{gnu} Public License, Version 2 or any
210 later version published by the Free Software Foundation. A copy of the
211 license is included in the section entitled \textsc{gnu} Public License.
212
213 \medskip
214 Permission is also granted to distribute and/or modify \emph{both the
215 documentation and the code} under the conditions of the LaTeX Project Public
216 License, either version 1.3 of this license or (at your option) any later
217 version. A copy of the license is included in the section entitled \LaTeX\
218 Project Public License.
219
220 \vbox{}
221 \clearpage
222 }
223
224
225 \title{\bfseries The \tikzname\ and {\Large PGF} Packages\\
226 \large Manual for version \pgfversion\\[1mm]
227 \large\href{https://github.com/pgf-tikz/pgf}{\texttt{https://github.com/pgf-tikz/pgf}}}
228 \author{Till Tantau\footnote{Editor of this documentation. Parts of
229 this documentation have been written by other authors as indicated
230 in these parts or chapters and in Section~\ref{section-authors}.}\\
231 \normalsize Institut für Theoretische Informatik\\[-1mm]
232 \normalsize Universität zu Lübeck}
233
234 \maketitle
235 \label{table-of-contents}
236
237 \tableofcontents
238
239 \clearpage
240
241
242 \include{pgfmanual-en-introduction}
243
244
245
246 \part{Tutorials and Guidelines}
247
248 {\Large \emph{by Till Tantau}}
249
250 \bigskip
251 \noindent To help you get started with \tikzname, instead of a long
252 installation and configuration section, this manual starts with tutorials. They
253 explain all the basic and some of the more advanced features of the system,
254 without going into all the details. This part also contains some guidelines on
255 how you should proceed when creating graphics using \tikzname.
256
257 \vskip3cm
258
259 \begin{codeexample}[graphic=white,width=0pt]
260 \tikz \draw[thick,rounded corners=8pt]
261 (0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0);
262 \end{codeexample}
263
264
265 \include{pgfmanual-en-tutorial}
266 \include{pgfmanual-en-tutorial-nodes}
267 \include{pgfmanual-en-tutorial-Euclid}
268 \include{pgfmanual-en-tutorial-chains}
269 \include{pgfmanual-en-tutorial-map}
270 \include{pgfmanual-en-guidelines}
271
272
273
274 \part{Installation and Configuration}
275
276 {\Large \emph{by Till Tantau}}
277
278
279 \bigskip
280 \noindent This part explains how the system is installed. Typically, someone
281 has already done so for your system, so this part can be skipped; but if this
282 is not the case and you are the poor fellow who has to do the installation,
283 read the present part.
284
285
286 \vskip1cm
287
288 \begin{codeexample}[graphic=white,preamble={\usetikzlibrary{arrows.meta,automata,positioning,shadows}}]
289 \begin{tikzpicture}[->,>={Stealth[round]},shorten >=1pt,auto,node distance=2.8cm,on grid,semithick,
290 every state/.style={fill=red,draw=none,circular drop shadow,text=white}]
291
292 \node[initial,state] (A) {$q_a$};
293 \node[state] (B) [above right=of A] {$q_b$};
294 \node[state] (D) [below right=of A] {$q_d$};
295 \node[state] (C) [below right=of B] {$q_c$};
296 \node[state] (E) [below=of D] {$q_e$};
297
298 \path (A) edge node {0,1,L} (B)
299 edge node {1,1,R} (C)
300 (B) edge [loop above] node {1,1,L} (B)
301 edge node {0,1,L} (C)
302 (C) edge node {0,1,L} (D)
303 edge [bend left] node {1,0,R} (E)
304 (D) edge [loop below] node {1,1,R} (D)
305 edge node {0,1,R} (A)
306 (E) edge [bend left] node {1,0,R} (A);
307
308 \node [right=1cm,text width=8cm] at (C)
309 {
310 The current candidate for the busy beaver for five states. It is
311 presumed that this Turing machine writes a maximum number of
312 $1$'s before halting among all Turing machines with five states
313 and the tape alphabet $\{0, 1\}$. Proving this conjecture is an
314 open research problem.
315 };
316 \end{tikzpicture}
317 \end{codeexample}
318
319
320 \include{pgfmanual-en-installation}
321 \include{pgfmanual-en-license}
322 \include{pgfmanual-en-drivers}
323
324
325
326 \part{Ti\emph{k}Z ist \emph{kein} Zeichenprogramm}
327 \label{part-tikz}
328
329 {\Large \emph{by Till Tantau}}
330
331
332 \bigskip
333 \noindent
334 \vskip3cm
335 \begin{codeexample}[graphic=white,preamble={\usetikzlibrary{angles,calc,quotes}}]
336 \begin{tikzpicture}[angle radius=.75cm]
337
338 \node (A) at (-2,0) [red,left] {$A$};
339 \node (B) at ( 3,.5) [red,right] {$B$};
340 \node (C) at (-2,2) [blue,left] {$C$};
341 \node (D) at ( 3,2.5) [blue,right] {$D$};
342 \node (E) at (60:-5mm) [below] {$E$};
343 \node (F) at (60:3.5cm) [above] {$F$};
344
345 \coordinate (X) at (intersection cs:first line={(A)--(B)}, second line={(E)--(F)});
346 \coordinate (Y) at (intersection cs:first line={(C)--(D)}, second line={(E)--(F)});
347
348 \path
349 (A) edge [red, thick] (B)
350 (C) edge [blue, thick] (D)
351 (E) edge [thick] (F)
352 pic ["$\alpha$", draw, fill=yellow] {angle = F--X--A}
353 pic ["$\beta$", draw, fill=green!30] {angle = B--X--F}
354 pic ["$\gamma$", draw, fill=yellow] {angle = E--Y--D}
355 pic ["$\delta$", draw, fill=green!30] {angle = C--Y--E};
356
357 \node at ($ (D)!.5!(B) $) [right=1cm,text width=6cm,rounded corners,fill=red!20,inner sep=1ex]
358 {
359 When we assume that $\color{red}AB$ and $\color{blue}CD$ are
360 parallel, i.\,e., ${\color{red}AB} \mathbin{\|} \color{blue}CD$,
361 then $\alpha = \gamma$ and $\beta = \delta$.
362 };
363 \end{tikzpicture}
364 \end{codeexample}
365
366
367 \include{pgfmanual-en-tikz-design}
368 \include{pgfmanual-en-tikz-scopes}
369 \include{pgfmanual-en-tikz-coordinates}
370 \include{pgfmanual-en-tikz-paths}
371 \include{pgfmanual-en-tikz-actions}
372 \include{pgfmanual-en-tikz-arrows}
373 \include{pgfmanual-en-tikz-shapes}
374 \include{pgfmanual-en-tikz-pics}
375 \include{pgfmanual-en-tikz-graphs}
376 \include{pgfmanual-en-tikz-matrices}
377 \include{pgfmanual-en-tikz-trees}
378 \include{pgfmanual-en-tikz-plots}
379 \include{pgfmanual-en-tikz-transparency}
380 \include{pgfmanual-en-tikz-decorations}
381 \include{pgfmanual-en-tikz-transformations}
382 \include{pgfmanual-en-tikz-animations}
383
384
385
386 \part{Graph Drawing}
387 \label{part-gd}
388
389 {\Large \emph{by Till Tantau et al.}}
390
391 \bigskip
392 \noindent
393 \emph{Graph drawing algorithms} do the tough work of computing a layout of a
394 graph for you. \tikzname\ comes with powerful such algorithms, but you can also
395 implement new algorithms in the Lua programming language. \vskip1cm
396
397 \ifluatex
398 \begin{codeexample}[
399 graphic=white,
400 preamble={\usetikzlibrary{arrows.meta,graphs,graphdrawing}
401 \usegdlibrary{layered}}]
402 \tikz [nodes={text height=.7em, text depth=.2em,
403 draw=black!20, thick, fill=white, font=\footnotesize},
404 >={Stealth[round,sep]}, rounded corners, semithick]
405 \graph [layered layout, level distance=1cm, sibling sep=.5em, sibling distance=1cm] {
406 "5th Edition" -> { "6th Edition", "PWB 1.0" };
407 "6th Edition" -> { "LSX" [>child anchor=45], "1 BSD", "Mini Unix", "Wollongong", "Interdata" };
408 "Interdata" -> { "Unix/TS 3.0", "PWB 2.0", "7th Edition" };
409 "7th Edition" -> { "8th Edition", "32V", "V7M", "Ultrix-11", "Xenix", "UniPlus+" };
410 "V7M" -> "Ultrix-11";
411 "8th Edition" -> "9th Edition";
412 "1 BSD" -> "2 BSD" -> "2.8 BSD" -> { "Ultrix-11", "2.9 BSD" };
413 "32V" -> "3 BSD" -> "4 BSD" -> "4.1 BSD" -> { "4.2 BSD", "2.8 BSD", "8th Edition" };
414 "4.2 BSD" -> { "4.3 BSD", "Ultrix-32" };
415 "PWB 1.0" -> { "PWB 1.2" -> "PWB 2.0", "USG 1.0" -> { "CB Unix 1", "USG 2.0" }};
416 "CB Unix 1" -> "CB Unix 2" -> "CB Unix 3" -> { "Unix/TS++", "PDP-11 Sys V" };
417 { "USG 2.0" -> "USG 3.0", "PWB 2.0", "Unix/TS 1.0" } -> "Unix/TS 3.0";
418 { "Unix/TS++", "CB Unix 3", "Unix/TS 3.0" } -> "TS 4.0" -> "System V.0" -> "System V.2" -> "System V.3";
419 };
420 \end{codeexample}
421
422 \else
423 You need to use Lua\TeX\ to typeset this part of the manual (and, also, to
424 use algorithmic graph drawing).
425 \fi
426
427
428 \include{pgfmanual-en-gd-overview}
429 \include{pgfmanual-en-gd-usage-tikz}
430 \include{pgfmanual-en-gd-usage-pgf}
431 \include{pgfmanual-en-gd-trees}
432 \include{pgfmanual-en-gd-layered}
433 \include{pgfmanual-en-gd-force}
434 \include{pgfmanual-en-gd-circular}
435 \include{pgfmanual-en-gd-phylogenetics}
436 \include{pgfmanual-en-gd-edge-routing}
437 %
438 % XXX : disabled because of
439 % 1. compile-time dependencies which are hard to resolve
440 % 2. it is "hardly usable anyway" (TT)
441 %\include{pgfmanual-en-gd-ogdf}
442 \include{pgfmanual-en-gd-algorithm-layer}
443 \include{pgfmanual-en-gd-algorithms-in-c}
444 \include{pgfmanual-en-gd-display-layer}
445 \include{pgfmanual-en-gd-binding-layer}
446
447
448
449 \part{Libraries}
450 \label{part-libraries}
451
452 {\Large \emph{by Till Tantau}}
453
454
455 \bigskip
456 \noindent
457 In this part the library packages are documented. They provide additional
458 predefined graphic objects like new arrow heads or new plot marks, but
459 sometimes also extensions of the basic \pgfname\ or \tikzname\ system. The
460 libraries are not loaded by default since many users will not need them.
461
462 \medskip
463 \noindent
464 \begin{codeexample}[graphic=white,preamble={\usetikzlibrary{arrows,trees}}]
465 \tikzset{
466 ld/.style={level distance=#1},lw/.style={line width=#1},
467 level 1/.style={ld=4.5mm, trunk, lw=1ex ,sibling angle=60},
468 level 2/.style={ld=3.5mm, trunk!80!leaf a,lw=.8ex,sibling angle=56},
469 level 3/.style={ld=2.75mm,trunk!60!leaf a,lw=.6ex,sibling angle=52},
470 level 4/.style={ld=2mm, trunk!40!leaf a,lw=.4ex,sibling angle=48},
471 level 5/.style={ld=1mm, trunk!20!leaf a,lw=.3ex,sibling angle=44},
472 level 6/.style={ld=1.75mm,leaf a, lw=.2ex,sibling angle=40},
473 }
474 \pgfarrowsdeclare{leaf}{leaf}
475 {\pgfarrowsleftextend{-2pt} \pgfarrowsrightextend{1pt}}
476 {
477 \pgfpathmoveto{\pgfpoint{-2pt}{0pt}}
478 \pgfpatharc{150}{30}{1.8pt}
479 \pgfpatharc{-30}{-150}{1.8pt}
480 \pgfusepathqfill
481 }
482
483 \newcommand{\logo}[5]
484 {
485 \colorlet{border}{#1}
486 \colorlet{trunk}{#2}
487 \colorlet{leaf a}{#3}
488 \colorlet{leaf b}{#4}
489 \begin{tikzpicture}
490 \scriptsize\scshape
491 \draw[border,line width=1ex,yshift=.3cm,
492 yscale=1.45,xscale=1.05,looseness=1.42]
493 (1,0) to [out=90, in=0] (0,1) to [out=180,in=90] (-1,0)
494 to [out=-90,in=-180] (0,-1) to [out=0, in=-90] (1,0) -- cycle;
495
496 \coordinate (root) [grow cyclic,rotate=90]
497 child {
498 child [line cap=round] foreach \a in {0,1} {
499 child foreach \b in {0,1} {
500 child foreach \c in {0,1} {
501 child foreach \d in {0,1} {
502 child foreach \leafcolor in {leaf a,leaf b}
503 { edge from parent [color=\leafcolor,-#5] }
504 } } }
505 } edge from parent [shorten >=-1pt,serif cm-,line cap=butt]
506 };
507
508 \node [align=center,below] at (0pt,-.5ex)
509 { \textcolor{border}{T}heoretical \\ \textcolor{border}{C}omputer \\
510 \textcolor{border}{S}cience };
511 \end{tikzpicture}
512 }
513 \begin{minipage}{3cm}
514 \logo{green!80!black}{green!25!black}{green}{green!80}{leaf}\\
515 \logo{green!50!black}{black}{green!80!black}{red!80!green}{leaf}\\
516 \logo{red!75!black}{red!25!black}{red!75!black}{orange}{leaf}\\
517 \logo{black!50}{black}{black!50}{black!25}{}
518 \end{minipage}
519 \end{codeexample}
520
521
522 \include{pgfmanual-en-library-3d}
523 \include{pgfmanual-en-library-angles}
524 \include{pgfmanual-en-library-arrows}
525 \include{pgfmanual-en-library-automata}
526 \include{pgfmanual-en-library-babel}
527 \include{pgfmanual-en-library-backgrounds}
528 \include{pgfmanual-en-library-calc}
529 \include{pgfmanual-en-library-calendar}
530 \include{pgfmanual-en-library-chains}
531 \include{pgfmanual-en-library-circuits}
532 \include{pgfmanual-en-library-decorations}
533 \include{pgfmanual-en-library-er}
534 \include{pgfmanual-en-library-external}
535 \include{pgfmanual-en-library-fadings}
536 \include{pgfmanual-en-library-fit}
537 \include{pgfmanual-en-library-fixedpoint}
538 \include{pgfmanual-en-library-fpu}
539 \include{pgfmanual-en-library-lsystems}
540 \include{pgfmanual-en-library-math}
541 \include{pgfmanual-en-library-matrices}
542 \include{pgfmanual-en-library-mindmaps}
543 \include{pgfmanual-en-library-folding}
544 \include{pgfmanual-en-library-patterns}
545 \include{pgfmanual-en-library-perspective}
546 \include{pgfmanual-en-library-petri}
547 \include{pgfmanual-en-library-plot-handlers}
548 \include{pgfmanual-en-library-plot-marks}
549 \include{pgfmanual-en-library-profiler}
550 \include{pgfmanual-en-library-rdf}
551 \include{pgfmanual-en-library-shadings}
552 \include{pgfmanual-en-library-shadows}
553 \include{pgfmanual-en-library-shapes}
554 \include{pgfmanual-en-library-spy}
555 \include{pgfmanual-en-library-svg-path}
556 \include{pgfmanual-en-library-edges}
557 \include{pgfmanual-en-library-through}
558 \include{pgfmanual-en-library-trees}
559 \include{pgfmanual-en-library-turtle}
560 \include{pgfmanual-en-library-views}
561
562
563
564 \part{Data Visualization}
565 \label{part-dv}
566
567 {\Large \emph{by Till Tantau}}
568
569 \bigskip
570 \noindent
571
572 \begin{codeexample}[graphic=white,preamble={\usetikzlibrary{datavisualization.formats.functions}}]
573 \tikz \datavisualization [scientific axes=clean]
574 [
575 visualize as smooth line=Gaussian,
576 Gaussian={pin in data={text={$e^{-x^2}$},when=x is 1}}
577 ]
578 data [format=function] {
579 var x : interval [-7:7] samples 51;
580 func y = exp(-\value x*\value x);
581 }
582 [
583 visualize as scatter,
584 legend={south east outside},
585 scatter={
586 style={mark=*,mark size=1.4pt},
587 label in legend={text={
588 $\sum_{i=1}^{10} x_i$, where $x_i \sim U(-1,1) $}}}
589 ]
590 data [format=function] {
591 var i : interval [0:1] samples 20;
592 func y = 0;
593 func x = (rand + rand + rand + rand + rand +
594 rand + rand + rand + rand + rand);
595 };
596 \end{codeexample}
597
598
599 \include{pgfmanual-en-dv-introduction}
600 \include{pgfmanual-en-dv-main}
601 \include{pgfmanual-en-dv-formats}
602 \include{pgfmanual-en-dv-axes}
603 \include{pgfmanual-en-dv-visualizers}
604 \include{pgfmanual-en-dv-stylesheets}
605 \include{pgfmanual-en-dv-polar}
606 \include{pgfmanual-en-dv-backend}
607
608
609
610 \part{Utilities}
611 \label{part-utilities}
612
613 {\Large \emph{by Till Tantau}}
614
615
616 \bigskip
617 \noindent
618 The utility packages are not directly involved in creating graphics, but you
619 may find them useful nonetheless. All of them either directly depend on
620 \pgfname\ or they are designed to work well together with \pgfname\ even though
621 they can be used in a stand-alone way.
622
623 \vskip2cm
624 \medskip
625 \noindent
626 \begin{codeexample}[graphic=white]
627 \begin{tikzpicture}[scale=2]
628 \shade[top color=blue,bottom color=gray!50] (0,0) parabola (1.5,2.25) |- (0,0);
629 \draw (1.05cm,2pt) node[above] {$\displaystyle\int_0^{3/2} \!\!x^2\mathrm{d}x$};
630
631 \draw[help lines] (0,0) grid (3.9,3.9)
632 [step=0.25cm] (1,2) grid +(1,1);
633
634 \draw[->] (-0.2,0) -- (4,0) node[right] {$x$};
635 \draw[->] (0,-0.2) -- (0,4) node[above] {$f(x)$};
636
637 \foreach \x/\xtext in {1/1, 1.5/1\frac{1}{2}, 2/2, 3/3}
638 \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
639
640 \foreach \y/\ytext in {1/1, 2/2, 2.25/2\frac{1}{4}, 3/3}
641 \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
642
643 \draw (-.5,.25) parabola bend (0,0) (2,4) node[below right] {$x^2$};
644 \end{tikzpicture}
645 \end{codeexample}
646
647
648 \include{pgfmanual-en-pgfkeys}
649 \include{pgfmanual-en-pgffor}
650 \include{pgfmanual-en-pgfcalendar}
651 \include{pgfmanual-en-pages}
652 \include{pgfmanual-en-xxcolor}
653 \include{pgfmanual-en-module-parser}
654
655
656
657 \part{Mathematical and Object-Oriented Engines}
658
659 {\Large \emph{by Mark Wibrow and Till Tantau}}
660
661
662 \bigskip
663 \noindent
664 \pgfname\ comes with two useful engines: One for doing mathematics, one for
665 doing object-oriented programming. Both engines can be used independently of
666 the main \pgfname.
667
668 The job of the mathematical engine is to support mathematical operations like
669 addition, subtraction, multiplication and division, using both integers and
670 non-integers, but also functions such as square-roots, sine, cosine, and
671 generate pseudo-random numbers. Mostly, you will use the mathematical
672 facilities of \pgfname\ indirectly, namely when you write a coordinate like
673 |(5cm*3,6cm/4)|, but the mathematical engine can also be used independently of
674 \pgfname\ and \tikzname.
675
676 The job of the object-oriented engine is to support simple object-oriented
677 programming in \TeX. It allows the definition of \emph{classes} (without
678 inheritance), \emph{methods}, \emph{attributes} and \emph{objects}.
679
680 \vskip1cm
681 \begin{codeexample}[graphic=white]
682 \pgfmathsetseed{1}
683 \foreach \col in {black,red,green,blue}
684 {
685 \begin{tikzpicture}[x=10pt,y=10pt,ultra thick,baseline,line cap=round]
686 \coordinate (current point) at (0,0);
687 \coordinate (old velocity) at (0,0);
688 \coordinate (new velocity) at (rand,rand);
689
690 \foreach \i in {0,1,...,100}
691 {
692 \draw[\col!\i] (current point)
693 .. controls ++([scale=-1]old velocity) and
694 ++(new velocity) .. ++(rand,rand)
695 coordinate (current point);
696 \coordinate (old velocity) at (new velocity);
697 \coordinate (new velocity) at (rand,rand);
698 }
699 \end{tikzpicture}
700 }
701 \end{codeexample}
702
703
704 \include{pgfmanual-en-math-design}
705 \include{pgfmanual-en-math-parsing}
706 \include{pgfmanual-en-math-commands}
707 \include{pgfmanual-en-math-algorithms}
708 \include{pgfmanual-en-math-numberprinting}
709 \include{pgfmanual-en-oo}
710
711
712
713 \part{The Basic Layer}
714
715 {\Large \emph{by Till Tantau}}
716
717
718 \bigskip
719 \noindent
720 \vskip1cm
721 \begin{codeexample}[graphic=white]
722 \begin{tikzpicture}
723 \draw[gray,very thin] (-1.9,-1.9) grid (2.9,3.9)
724 [step=0.25cm] (-1,-1) grid (1,1);
725 \draw[blue] (1,-2.1) -- (1,4.1); % asymptote
726
727 \draw[->] (-2,0) -- (3,0) node[right] {$x(t)$};
728 \draw[->] (0,-2) -- (0,4) node[above] {$y(t)$};
729
730 \foreach \pos in {-1,2}
731 \draw[shift={(\pos,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\pos$};
732
733 \foreach \pos in {-1,1,2,3}
734 \draw[shift={(0,\pos)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\pos$};
735
736 \fill (0,0) circle (0.064cm);
737 \draw[thick,parametric,domain=0.4:1.5,samples=200]
738 % The plot is reparameterised such that there are more samples
739 % near the center.
740 plot[id=asymptotic-example] function{(t*t*t)*sin(1/(t*t*t)),(t*t*t)*cos(1/(t*t*t))}
741 node[right] {$\bigl(x(t),y(t)\bigr) = (t\sin \frac{1}{t}, t\cos \frac{1}{t})$};
742
743 \fill[red] (0.63662,0) circle (2pt)
744 node [below right,fill=white,yshift=-4pt] {$(\frac{2}{\pi},0)$};
745 \end{tikzpicture}
746 \end{codeexample}
747
748
749 \include{pgfmanual-en-base-design}
750 \include{pgfmanual-en-base-scopes}
751 \include{pgfmanual-en-base-points}
752 \include{pgfmanual-en-base-paths}
753 \include{pgfmanual-en-base-decorations}
754 \include{pgfmanual-en-base-actions}
755 \include{pgfmanual-en-base-arrows}
756 \include{pgfmanual-en-base-nodes}
757 \include{pgfmanual-en-base-matrices}
758 \include{pgfmanual-en-base-transformations}
759 \include{pgfmanual-en-base-patterns}
760 \include{pgfmanual-en-base-images}
761 \include{pgfmanual-en-base-external}
762 \include{pgfmanual-en-base-plots}
763 \include{pgfmanual-en-base-layers}
764 \include{pgfmanual-en-base-shadings}
765 \include{pgfmanual-en-base-transparency}
766 \include{pgfmanual-en-base-animations}
767 \include{pgfmanual-en-base-internalregisters}
768 \include{pgfmanual-en-base-quick}
769
770
771
772 \part{The System Layer}
773 \label{part-system}
774
775 {\Large \emph{by Till Tantau}}
776
777
778 \bigskip
779 \noindent
780 This part describes the low-level interface of \pgfname, called the
781 \emph{system layer}. This interface provides a complete abstraction of the
782 internals of the underlying drivers.
783
784 Unless you intend to port \pgfname\ to another driver or unless you intend to
785 write your own optimized frontend, you need not read this part.
786
787 In the following it is assumed that you are familiar with the basic workings of
788 the |graphics| package and that you know what \TeX-drivers are and how they
789 work.
790
791 \vskip1cm
792 \begin{codeexample}[graphic=white]
793 \begin{tikzpicture}
794 [shorten >=1pt,->,
795 vertex/.style={circle,fill=black!25,minimum size=17pt,inner sep=0pt}]
796
797 \foreach \name/\x in {s/1, 2/2, 3/3, 4/4, 15/11, 16/12, 17/13, 18/14, 19/15, t/16}
798 \node[vertex] (G-\name) at (\x,0) {$\name$};
799
800 \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}
801 \node[vertex,xshift=6cm,yshift=.5cm] (\name) at (\angle:1cm) {$\text$};
802
803 \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}
804 \node[vertex,xshift=9cm,yshift=.5cm] (\name) at (\angle:1cm) {$\text$};
805
806 \foreach \from/\to in {s/2,2/3,3/4,3/4,15/16,16/17,17/18,18/19,19/t}
807 \draw (G-\from) -- (G-\to);
808
809 \foreach \from/\to in {1/2,2/3,3/4,4/5,5/1,1/3,2/4,3/5,4/1,5/2}
810 { \draw (P-\from) -- (P-\to); \draw (Q-\from) -- (Q-\to); }
811
812 \draw (G-3) .. controls +(-30:2cm) and +(-150:1cm) .. (Q-1);
813 \draw (Q-5) -- (G-15);
814 \end{tikzpicture}
815 \end{codeexample}
816
817
818 \include{pgfmanual-en-pgfsys-overview}
819 \include{pgfmanual-en-pgfsys-commands}
820 \include{pgfmanual-en-pgfsys-paths}
821 \include{pgfmanual-en-pgfsys-protocol}
822 \include{pgfmanual-en-pgfsys-animations}
823
824
825
826 \part{References and Index}
827
828 \vskip1cm
829 \begin{codeexample}[graphic=white]
830 \begin{tikzpicture}
831 \draw[line width=0.3cm,color=red!30,line cap=round,line join=round] (0,0)--(2,0)--(2,5);
832 \draw[help lines] (-2.5,-2.5) grid (5.5,7.5);
833 \draw[very thick] (1,-1)--(-1,-1)--(-1,1)--(0,1)--(0,0)--
834 (1,0)--(1,-1)--(3,-1)--(3,2)--(2,2)--(2,3)--(3,3)--
835 (3,5)--(1,5)--(1,4)--(0,4)--(0,6)--(1,6)--(1,5)
836 (3,3)--(4,3)--(4,5)--(3,5)--(3,6)
837 (3,-1)--(4,-1);
838 \draw[below left] (0,0) node(s){$s$};
839 \draw[below left] (2,5) node(t){$t$};
840 \fill (0,0) circle (0.06cm) (2,5) circle (0.06cm);
841 \draw[->,rounded corners=0.2cm,shorten >=2pt]
842 (1.5,0.5)-- ++(0,-1)-- ++(1,0)-- ++(0,2)-- ++(-1,0)-- ++(0,2)-- ++(1,0)--
843 ++(0,1)-- ++(-1,0)-- ++(0,-1)-- ++(-2,0)-- ++(0,3)-- ++(2,0)-- ++(0,-1)--
844 ++(1,0)-- ++(0,1)-- ++(1,0)-- ++(0,-1)-- ++(1,0)-- ++(0,-3)-- ++(-2,0)--
845 ++(1,0)-- ++(0,-3)-- ++(1,0)-- ++(0,-1)-- ++(-6,0)-- ++(0,3)-- ++(2,0)--
846 ++(0,-1)-- ++(1,0);
847 \end{tikzpicture}
848 \end{codeexample}
849
850 \printindex
851
852 %\typeout{Examples: \the\codeexamplecount}%
853 \end{document}
854
855
856 %%% Local Variables:
857 %%% mode: latex
858 %%% TeX-master: "pgfmanual"
859 %%% End: