pgfmanual

715
Tik Z Tik Z & & PGF PGF Manual for Version .cvs Manual for Version .cvs \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}; } \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}

Upload: giselle-azevedo

Post on 04-Mar-2015

59 views

Category:

Documents


4 download

TRANSCRIPT

Manual for Version .cvs

\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 - | rectangle (sky - | right);

\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={(rand11,rnd7)}, 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] (rand8,-rnd10) to [out=rand180,in=rand180] (rand8,-rnd10); \end{tikzpicture}

left)

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

FGP

svc. noisreV rof launaM

&

Z kiT

Tik Z

&

PGF

Fr meinen Vater, damit er noch viele schne TEX-Graphiken erschaen kann. u o Till

Copyright 2007 by Till Tantau Permission is granted to copy, distribute and/or modify the documentation under the terms of the 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 gnu Free Documentation License. Permission is granted to copy, distribute and/or modify the code of the package under the terms of the 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 gnu Public License. Permission is also granted to distribute and/or modify 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 A later version. A copy of the license is included in the section entitled L TEX Project Public License.

2

The Tik Z and PGF PackagesManual for version 2.00-cvs http://sourceforge.net/projects/pgf Till TantauInstitut fr Theoretische Informatik u Universitt zu Lbeck a u

June 2, 2009

Contents1 Introduction 1.1 Structure of the System . . . . . . . . . . . 1.2 Comparison with Other Graphics Packages 1.3 Utility Packages . . . . . . . . . . . . . . . 1.4 How to Read This Manual . . . . . . . . . 1.5 Authors and Acknowledgements . . . . . . 1.6 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 19 20 20 21 21 21

I

Tutorials and Guidelines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2223 23 23 23 24 24 25 25 26 26 27 27 28 28 29 30 30 31 31 32 33 34 34 35 36

2 Tutorial: A Picture for Karls Students 2.1 Problem Statement . . . . . . . . . . . . . . . . . 2.2 Setting up the Environment . . . . . . . . . . . . A 2.2.1 Setting up the Environment in L TEX . . . 2.2.2 Setting up the Environment in Plain TEX 2.2.3 Setting up the Environment in ConTEXt . 2.3 Straight Path Construction . . . . . . . . . . . . . 2.4 Curved Path Construction . . . . . . . . . . . . . 2.5 Circle Path Construction . . . . . . . . . . . . . . 2.6 Rectangle Path Construction . . . . . . . . . . . . 2.7 Grid Path Construction . . . . . . . . . . . . . . . 2.8 Adding a Touch of Style . . . . . . . . . . . . . . 2.9 Drawing Options . . . . . . . . . . . . . . . . . . 2.10 Arc Path Construction . . . . . . . . . . . . . . . 2.11 Clipping a Path . . . . . . . . . . . . . . . . . . . 2.12 Parabola and Sine Path Construction . . . . . . . 2.13 Filling and Drawing . . . . . . . . . . . . . . . . . 2.14 Shading . . . . . . . . . . . . . . . . . . . . . . . 2.15 Specifying Coordinates . . . . . . . . . . . . . . . 2.16 Intersecting Paths . . . . . . . . . . . . . . . . . . 2.17 Adding Arrow Tips . . . . . . . . . . . . . . . . . 2.18 Scoping . . . . . . . . . . . . . . . . . . . . . . . . 2.19 Transformations . . . . . . . . . . . . . . . . . . . 2.20 Repeating Things: For-Loops . . . . . . . . . . . 2.21 Adding Text . . . . . . . . . . . . . . . . . . . . .

Editor of this documentation. Parts of this documentation have been written by other authors as indicated in these parts or chapters and in Section 1.5.

3

3 Tutorial: A Petri-Net for Hagen 3.1 Problem Statement . . . . . . . . . . . . . . . . . 3.2 Setting up the Environment . . . . . . . . . . . . A 3.2.1 Setting up the Environment in L TEX . . . 3.2.2 Setting up the Environment in Plain TEX 3.2.3 Setting up the Environment in ConTEXt . 3.3 Introduction to Nodes . . . . . . . . . . . . . . . 3.4 Placing Nodes Using the At Syntax . . . . . . . . 3.5 Using Styles . . . . . . . . . . . . . . . . . . . . . 3.6 Node Size . . . . . . . . . . . . . . . . . . . . . . 3.7 Naming Nodes . . . . . . . . . . . . . . . . . . . . 3.8 Placing Nodes Using Relative Placement . . . . . 3.9 Adding Labels Next to Nodes . . . . . . . . . . . 3.10 Connecting Nodes . . . . . . . . . . . . . . . . . . 3.11 Adding Labels Next to Lines . . . . . . . . . . . . 3.12 Adding the Snaked Line and Multi-Line Text . . 3.13 Using Layers: The Background Rectangles . . . . 3.14 The Complete Code . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . .

40 40 40 40 40 41 41 42 42 43 43 44 44 45 47 48 49 49 51 51 51 52 52 54 55 56 56 57 58 59 59 61 63 64 64 65 66 67 68 68 68 71 75 76 77 79 83 83 83 84 84 85 85 88

4 Tutorial: Euclids Amber Version of the Elements 4.1 Book I, Proposition I . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Setting up the Environment . . . . . . . . . . . . . . . 4.1.2 The Line AB . . . . . . . . . . . . . . . . . . . . . . . 4.1.3 The Circle Around A . . . . . . . . . . . . . . . . . . . 4.1.4 The Intersection of the Circles . . . . . . . . . . . . . . 4.1.5 The Complete Code . . . . . . . . . . . . . . . . . . . . 4.2 Book I, Proposition II . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Using Partway Calculations for the Construction of D 4.2.2 Intersecting a Line and a Circle . . . . . . . . . . . . . 4.2.3 The Complete Code . . . . . . . . . . . . . . . . . . . . 5 Tutorial: Putting a Diagram in Chains 5.1 Styling the Nodes . . . . . . . . . . . . . . . . . . . . 5.2 Aligning the Nodes Using Positioning Options . . . . 5.3 Aligning the Nodes Using Matrices . . . . . . . . . . 5.4 Using Chains . . . . . . . . . . . . . . . . . . . . . . 5.4.1 Creating a Simple Chain . . . . . . . . . . . . 5.4.2 Branching and Joining a Chain . . . . . . . . 5.4.3 Chaining Together Already Positioned Nodes 5.4.4 Combined Use of Matrices and Chains . . . . 6 Tutorial: A Lecture Map for Johannes 6.1 Problem Statement . . . . . . . . . . 6.2 Introduction to Trees . . . . . . . . . 6.3 Creating the Lecture Map . . . . . . 6.4 Adding the Lecture Annotations . . . 6.5 Adding the Background . . . . . . . . 6.6 Adding the Calendar . . . . . . . . . 6.7 The Complete Code . . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

7 Guidelines on Graphics 7.1 Planning the Time Needed for the Creation of Graphics 7.2 Workow for Creating a Graphic . . . . . . . . . . . . . 7.3 Linking Graphics With the Main Text . . . . . . . . . . 7.4 Consistency Between Graphics and Text . . . . . . . . . 7.5 Labels in Graphics . . . . . . . . . . . . . . . . . . . . . 7.6 Plots and Charts . . . . . . . . . . . . . . . . . . . . . . 7.7 Attention and Distraction . . . . . . . . . . . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

4

II

Installation and Conguration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9091 91 91 91 91 92 92 92 92 93 93 93 93 94 96 96 96 96 97 98 99 99 99 100 100 100 100 101 101 101 102 102 102 104 104 104 104 104 105 105 106 106 106 106 106 107 107 107 108 109 110

8 Installation 8.1 Package and Driver Versions . . . . . . . . . . . . . 8.2 Installing Prebundled Packages . . . . . . . . . . . 8.2.1 Debian . . . . . . . . . . . . . . . . . . . . . 8.2.2 MiKTeX . . . . . . . . . . . . . . . . . . . . 8.3 Installation in a texmf Tree . . . . . . . . . . . . . 8.3.1 Installation that Keeps Everything Together 8.3.2 Installation that is TDS-Compliant . . . . . 8.4 Updating the Installation . . . . . . . . . . . . . . .

9 Licenses and Copyright 9.1 Which License Applies? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 The GNU Public License, Version 2 . . . . . . . . . . . . . . . . . . . . . . 9.2.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.2 Terms and Conditions For Copying, Distribution and Modication 9.2.3 No Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A 9.3 The L TEX Project Public License, Version 1.3c 2006-05-20 . . . . . . . . . 9.3.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.2 Denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.3 Conditions on Distribution and Modication . . . . . . . . . . . . . 9.3.4 No Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.5 Maintenance of The Work . . . . . . . . . . . . . . . . . . . . . . . 9.3.6 Whether and How to Distribute Works under This License . . . . . 9.3.7 Choosing This License or Another License . . . . . . . . . . . . . . 9.3.8 A Recommendation on Modication Without Distribution . . . . . 9.3.9 How to Use This License . . . . . . . . . . . . . . . . . . . . . . . . 9.3.10 Derived Works That Are Not Replacements . . . . . . . . . . . . . 9.3.11 Important Recommendations . . . . . . . . . . . . . . . . . . . . . 9.4 GNU Free Documentation License, Version 1.2, November 2002 . . . . . . 9.4.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.2 Applicability and denitions . . . . . . . . . . . . . . . . . . . . . . 9.4.3 Verbatim Copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.4 Copying in Quantity . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.5 Modications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.6 Combining Documents . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.7 Collection of Documents . . . . . . . . . . . . . . . . . . . . . . . . 9.4.8 Aggregating with independent Works . . . . . . . . . . . . . . . . . 9.4.9 Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.10 Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4.11 Future Revisions of this License . . . . . . . . . . . . . . . . . . . . 9.4.12 Addendum: How to use this License for your documents . . . . . . 10 Input and Output Formats 10.1 Supported Input Formats . . . . . . . . . A 10.1.1 Using the L TEX Format . . . . . 10.1.2 Using the Plain TEX Format . . . 10.1.3 Using the ConTEXt Format . . . 10.2 Supported Output Formats . . . . . . . . 10.2.1 Selecting the Backend Driver . . 10.2.2 Producing PDF Output . . . . . 10.2.3 Producing PostScript Output . . 10.2.4 Producing HTML / SVG Output 10.2.5 Producing Perfectly Portable DVI

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

III

Tik Z ist kein Zeichenprogramm

111

5

11 Design Principles 11.1 Special Syntax For Specifying Points . . . 11.2 Special Syntax For Path Specications . . 11.3 Actions on Paths . . . . . . . . . . . . . . 11.4 Key-Value Syntax for Graphic Parameters 11.5 Special Syntax for Specifying Nodes . . . . 11.6 Special Syntax for Specifying Trees . . . . 11.7 Grouping of Graphic Parameters . . . . . 11.8 Coordinate Transformation System . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

112 112 112 112 113 113 113 114 114 115 115 115 115 117 117 118 118 118 119 119 119 120 122 122 122 122 125 126 128 129 129 129 130 132 132 132 133 133 134 134 135 136 137 138 139 139 139 139 140 140 140 141 143 143 145 146

12 Hierarchical Structures: Package, Environments, Scopes, 12.1 Loading the Package and the Libraries . . . . . . . . . . . 12.2 Creating a Picture . . . . . . . . . . . . . . . . . . . . . . . 12.2.1 Creating a Picture Using an Environment . . . . . 12.2.2 Creating a Picture Using a Command . . . . . . . . 12.2.3 Adding a Background . . . . . . . . . . . . . . . . . 12.3 Using Scopes to Structure a Picture . . . . . . . . . . . . . 12.3.1 The Scope Environment . . . . . . . . . . . . . . . 12.3.2 Shorthand for Scope Environments . . . . . . . . . 12.3.3 Using Scopes Inside Paths . . . . . . . . . . . . . . 12.4 Using Graphic Options . . . . . . . . . . . . . . . . . . . . 12.4.1 How Graphic Options Are Processed . . . . . . . . 12.4.2 Using Styles to Manage How Pictures Look . . . . 13 Specifying Coordinates 13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . 13.2 Coordinate Systems . . . . . . . . . . . . . . . . . . . 13.2.1 Canvas, XYZ, and Polar Coordinate Systems 13.2.2 Barycentric Systems . . . . . . . . . . . . . . 13.2.3 Node Coordinate System . . . . . . . . . . . . 13.2.4 Tangent Coordinate Systems . . . . . . . . . . 13.2.5 Dening New Coordinate Systems . . . . . . . 13.3 Coordinates at Intersections . . . . . . . . . . . . . . 13.3.1 Intersections of Perpendicular Lines . . . . . . 13.3.2 Intersections of Arbitrary Paths . . . . . . . . 13.4 Relative and Incremental Coordinates . . . . . . . . . 13.4.1 Specifying Relative Coordinates . . . . . . . . 13.4.2 Relative Coordinates and Scopes . . . . . . . 13.5 Coordinate Calculations . . . . . . . . . . . . . . . . 13.5.1 The General Syntax . . . . . . . . . . . . . . . 13.5.2 The Syntax of Factors . . . . . . . . . . . . . 13.5.3 The Syntax of Partway Modiers . . . . . . . 13.5.4 The Syntax of Distance Modiers . . . . . . . 13.5.5 The Syntax of Projection Modiers . . . . . . 14 Syntax for Path Specications 14.1 The Move-To Operation . . . . . . . 14.2 The Line-To Operation . . . . . . . . 14.2.1 Straight Lines . . . . . . . . . 14.2.2 Horizontal and Vertical Lines 14.3 The Curve-To Operation . . . . . . . 14.4 The Cycle Operation . . . . . . . . . 14.5 The Rectangle Operation . . . . . . . 14.6 Rounding Corners . . . . . . . . . . . 14.7 The Circle and Ellipse Operations . . 14.8 The Arc Operation . . . . . . . . . . 14.9 The Grid Operation . . . . . . . . . . 14.10 The Parabola Operation . . . . . . . 14.11 The Sine and Cosine Operation . . .

and Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . . 6

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

14.12 14.13 14.14 14.15 14.16 14.17 14.18

The The The The The The The

SVG Operation . . . . . . . Plot Operation . . . . . . . To Path Operation . . . . . Let Operation . . . . . . . Scoping Operation . . . . . Node and Edge Operations PGF-Extra Operation . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

146 147 147 149 151 151 151 153 153 154 154 155 156 157 157 159 160 160 161 162 162 163 164 165 166 168 170 170 170 172 172 175 176 176 176 176 180 180 180 181 182 186 186 187 187 190 191 194 194 196 196 197 197

15 Actions on Paths 15.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.2 Specifying a Color . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3 Drawing a Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.3.1 Graphic Parameters: Line Width, Line Cap, and Line Join 15.3.2 Graphic Parameters: Dash Pattern . . . . . . . . . . . . . 15.3.3 Graphic Parameters: Draw Opacity . . . . . . . . . . . . . 15.3.4 Graphic Parameters: Arrow Tips . . . . . . . . . . . . . . 15.3.5 Graphic Parameters: Double Lines and Bordered Lines . . 15.4 Filling a Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1 Graphic Parameters: Fill Pattern . . . . . . . . . . . . . . 15.4.2 Graphic Parameters: Interior Rules . . . . . . . . . . . . . 15.4.3 Graphic Parameters: Fill Opacity . . . . . . . . . . . . . . 15.5 Generalized Filling: Using Arbitrary Pictures to Fill a Path . . . 15.6 Shading a Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.7 Establishing a Bounding Box . . . . . . . . . . . . . . . . . . . . . 15.8 Clipping and Fading (Soft Clipping) . . . . . . . . . . . . . . . . . 15.9 Doing Multiple Actions on a Path . . . . . . . . . . . . . . . . . . 15.10 Decorating and Morphing a Path . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . .

16 Nodes and Edges 16.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2 Nodes and Their Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.1 Predened Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.2.2 Common Options: Separations, Margins, Padding and Border Rotation 16.3 Multi-Part Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4 The Node Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.1 Text Parameters: Color and Opacity . . . . . . . . . . . . . . . . . . . 16.4.2 Text Parameters: Font . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.4.3 Text Parameters: Alignment and Width for Multi-Line Text . . . . . . 16.4.4 Text Parameters: Height and Depth of Text . . . . . . . . . . . . . . . 16.5 Positioning Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5.1 Positioning Nodes Using Anchors . . . . . . . . . . . . . . . . . . . . . 16.5.2 Basic Placement Options . . . . . . . . . . . . . . . . . . . . . . . . . . 16.5.3 Advanced Placement Options . . . . . . . . . . . . . . . . . . . . . . . 16.5.4 Arranging Nodes Using a Chains and Matrices . . . . . . . . . . . . . . 16.6 Fitting Nodes to a Set of Coordinates . . . . . . . . . . . . . . . . . . . . . . . 16.7 Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.8 Placing Nodes on a Line or Curve Explicitly . . . . . . . . . . . . . . . . . . . 16.9 Placing Nodes on a Line or Curve Implicitly . . . . . . . . . . . . . . . . . . . 16.10 The Label and Pin Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16.11 Connecting Nodes: Using Nodes as Coordinates . . . . . . . . . . . . . . . . . 16.12 Connecting Nodes: Using the Edge Operation . . . . . . . . . . . . . . . . . . 16.13 Referencing Nodes Outside the Current Pictures . . . . . . . . . . . . . . . . . 16.13.1 Referencing a Node in a Dierent Picture . . . . . . . . . . . . . . . . 16.13.2 Referencing the Current Page Node Absolute Positioning . . . . . . . 16.14 Late Code and Late Options . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

7

17 Matrices and Alignment 17.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 17.2 Matrices are Nodes . . . . . . . . . . . . . . . . . . . . . 17.3 Cell Pictures . . . . . . . . . . . . . . . . . . . . . . . . . 17.3.1 Alignment of Cell Pictures . . . . . . . . . . . . . 17.3.2 Setting and Adjusting Column and Row Spacing 17.3.3 Cell Styles and Options . . . . . . . . . . . . . . . 17.4 Anchoring a Matrix . . . . . . . . . . . . . . . . . . . . . 17.5 Considerations Concerning Active Characters . . . . . . 17.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Making Trees Grow 18.1 Introduction to the Child Operation . . . . 18.2 Child Paths and the Child Nodes . . . . . 18.3 Naming Child Nodes . . . . . . . . . . . . 18.4 Specifying Options for Trees and Children 18.5 Placing Child Nodes . . . . . . . . . . . . 18.5.1 Basic Idea . . . . . . . . . . . . . . 18.5.2 Default Growth Function . . . . . . 18.5.3 Missing Children . . . . . . . . . . 18.5.4 Custom Growth Functions . . . . . 18.6 Edges From the Parent Node . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

199 199 199 200 200 201 203 205 206 206 210 210 211 211 212 213 213 214 216 217 218 220 220 220 221 221 221 223 225 226 231 231 231 233 233 235 237 237 239 239 241 242 243 243 244 246 246 246 247 250

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

19 Plots of Functions 19.1 When Should One Use Tik Z for Generating Plots? . . . 19.2 The Plot Path Operation . . . . . . . . . . . . . . . . . . 19.3 Plotting Points Given Inline . . . . . . . . . . . . . . . . 19.4 Plotting Points Read From an External File . . . . . . . 19.5 Plotting a Function . . . . . . . . . . . . . . . . . . . . . 19.6 Plotting a Function Using Gnuplot . . . . . . . . . . . . 19.7 Placing Marks on the Plot . . . . . . . . . . . . . . . . . 19.8 Smooth Plots, Sharp Plots, Jump Plots, Comb Plots and 20 Transparency 20.1 Overview . . . . . . . . . . . . 20.2 Specifying a Uniform Opacity 20.3 Fadings . . . . . . . . . . . . . 20.3.1 Creating Fadings . . . 20.3.2 Fading a Path . . . . . 20.3.3 Fading a Scope . . . . 20.4 Transparency Groups . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bar Plots

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

21 Decorated Paths 21.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Decorating a Subpath Using the Decorate Path Command . . . . . . 21.3 Decorating a Complete Path . . . . . . . . . . . . . . . . . . . . . . . 21.4 Adjusting Decorations . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.1 Positioning Decorations Relative to the To-Be-Decorate Path 21.4.2 Starting and Ending Decorations Early or Late . . . . . . . . 22 Transformations 22.1 The Dierent Coordinate Systems . . . 22.2 The XY- and XYZ-Coordinate Systems 22.3 Coordinate Transformations . . . . . . 22.4 Canvas Transformations . . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

IV

Libraries

252

8

23 Arrow Tip Library 23.1 Mathematical Arrow Tips . . . . . . . . 23.2 Triangular Arrow Tips . . . . . . . . . . 23.3 Barbed Arrow Tips . . . . . . . . . . . . 23.4 Bracket-Like Arrow Tips . . . . . . . . . 23.5 Circle, Diamond and Square Arrow Tips 23.6 Serif-Like Arrow Tips . . . . . . . . . . . 23.7 Partial Arrow Tips . . . . . . . . . . . . 23.8 Line Caps . . . . . . . . . . . . . . . . . 23.9 Spacing Tips . . . . . . . . . . . . . . . . 24 Automata Drawing Library 24.1 Drawing Automata . . . . . . . . 24.2 States With and Without Output 24.3 Initial and Accepting States . . . 24.4 Examples . . . . . . . . . . . . . . 25 Background Library

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

253 253 253 253 254 254 254 254 254 254 255 255 256 256 258 260 263 263 270 270 270 271 271 273 276 280 280 280 281 284 284 286 286 286 287 287 288 288 289 289 291 292 293 294 296 296 298 299 300 302 304 304 307 307

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

26 Calendar Library 26.1 Calendar Command . . . . . . . . . . . . . . 26.1.1 Creating a Simple List of Days . . . 26.1.2 Adding a Month Label . . . . . . . . 26.1.3 Creating a Week List Arrangement . 26.1.4 Creating a Month List Arrangement 26.2 Arrangements . . . . . . . . . . . . . . . . . 26.3 Month Labels . . . . . . . . . . . . . . . . . 26.4 Examples . . . . . . . . . . . . . . . . . . . . 27 Chains 27.1 Overview . . . . . . . . . . . . . . 27.2 Starting and Continuing a Chain 27.3 Nodes on a Chain . . . . . . . . . 27.4 Joining Nodes on a Chain . . . . 27.5 Branches . . . . . . . . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

28 Circuit Libraries 28.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.1.1 A First Example . . . . . . . . . . . . . . . . . . . . . . . . 28.1.2 Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.1.3 Symbol Graphics . . . . . . . . . . . . . . . . . . . . . . . . 28.1.4 Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.2 The Base Circuit Library . . . . . . . . . . . . . . . . . . . . . . . . 28.2.1 Symbol Size . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.2.2 Declaring New Symbols . . . . . . . . . . . . . . . . . . . . . 28.2.3 Pointing Symbols in the Right Direction . . . . . . . . . . . 28.2.4 Info Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.2.5 Declaring and Using Annotations . . . . . . . . . . . . . . . 28.2.6 Theming Symbols . . . . . . . . . . . . . . . . . . . . . . . . 28.3 Logical Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.2 Symbols: The Gates . . . . . . . . . . . . . . . . . . . . . . 28.3.3 Implementation: The Logic Gates Shape Library . . . . . . 28.3.4 Implementation: The US-Style Logic Gates Shape Library . 28.3.5 Implementation: The IEC-Style Logic Gates Shape Library 28.4 Electrical Engineering Circuits . . . . . . . . . . . . . . . . . . . . . 28.4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.4.2 Symbols: Indicating Current Directions . . . . . . . . . . . . 28.4.3 Symbols: Basic Elements . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . .

9

28.4.4 28.4.5 28.4.6 28.4.7 28.4.8 28.4.9

Symbols: Diodes . . Symbols: Contacts . Units . . . . . . . . . Annotations . . . . . Implementation: The Implementation: The

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . EE-Symbols Shape Library . IEC-Style EE-Symbols Shape

. . . . . . . . . . . . . . . . . . . . . . . . . Library

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

307 308 308 308 308 310 316 316 317 317 318 320 323 323 323 327 328 329 333 335

29 Decoration Library 29.1 Overview and Common Options . . . . . . . . . . . 29.2 Path Morphing Decorations . . . . . . . . . . . . . 29.2.1 Decorations Producing Straight Line Paths . 29.2.2 Decorations Producing Curved Line Paths . 29.3 Path Replacing Decorations . . . . . . . . . . . . . 29.4 Marking Decorations . . . . . . . . . . . . . . . . . 29.4.1 Overview . . . . . . . . . . . . . . . . . . . . 29.5 Arbitrary Markings . . . . . . . . . . . . . . . . . . 29.5.1 Arrow Tip Markings . . . . . . . . . . . . . 29.5.2 Footprint Markings . . . . . . . . . . . . . . 29.5.3 Shape Background Markings . . . . . . . . . 29.6 Text Decorations . . . . . . . . . . . . . . . . . . . 29.7 Fractal Decorations . . . . . . . . . . . . . . . . . . 30 Entity-Relationship 30.1 Entities . . . . . 30.2 Relationships . 30.3 Attributes . . . Diagram . . . . . . . . . . . . . . . . . . Drawing . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

Library 337 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 339 339 339 339 339 341 343 343 346 347 347 347 348 349

31 Externalization Library 31.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Requirements . . . . . . . . . . . . . . . . . . . . . 31.3 A word about ConTEXt and plain TEX . . . . . . . 31.4 Externalizing graphics . . . . . . . . . . . . . . . . 31.4.1 Customizing the Generated File Names . . . 31.4.2 Remaking Figures or Skipping Figures . . . 31.4.3 Customizing the Externalization . . . . . . . 31.5 Using external graphics without pgf installed . . . 31.6 Externalization and bounding box restrictions . . . 31.7 eps Graphics . . . . . . . . . . . . . . . . . . . . . 31.8 Interoperability with the basic layer externalization 32 Fading Library 33 Fitting Library

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

34 Fixed Point Arithmetic Library 352 34.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 34.2 Using Fixed Point Arithmetic in PGF and Tik Z . . . . . . . . . . . . . . . . . . . . . . . . . 352 35 Floating Point Unit Library 35.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.3 Comparison to the xed point arithmetics library . . . . . . . . 35.4 Command Reference and Programmers Manual . . . . . . . . . 35.4.1 Floatspecic commands . . . . . . . . . . . . . . . . . . 35.4.2 Replacement commands . . . . . . . . . . . . . . . . . . 35.4.3 Accessing the Original Math Routines for Programmers 354 354 354 355 355 355 360 361

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

10

36 Lindenmayer System Drawing Library 36.1 Overview . . . . . . . . . . . . . . . . 36.1.1 Declaring L-systems . . . . . . 36.2 Using Lindenmayer Systems . . . . . 36.2.1 Using L-Systems in PGF . . . 36.2.2 Using L-Systems in Tik Z . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

362 362 362 364 364 365

37 Matrix Library 367 37.1 Matrices of Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 37.2 End-of-Lines and End-of-Row Characters in Matrices of Nodes . . . . . . . . . . . . . . . . . 368 37.3 Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 38 Mindmap Drawing Library 38.1 Overview . . . . . . . . . . . . . . 38.2 The Mindmap Style . . . . . . . . 38.3 Concepts Nodes . . . . . . . . . . 38.3.1 Isolated Concepts . . . . . 38.3.2 Concepts in Trees . . . . . 38.4 Connecting Concepts . . . . . . . 38.4.1 Simple Connections . . . . 38.4.2 The Circle Connection Bar 38.4.3 The Circle Connection Bar 38.4.4 Tree Edges . . . . . . . . . 38.5 Adding Annotations . . . . . . . . 39 Paper Folding Diagrams Library 371 371 371 372 372 373 375 375 376 377 378 379 380

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Decoration To-Path . . . . . . . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

40 Pattern Library 384 40.1 Form-Only Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 40.2 Inherently Colored Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 41 Petri-Net Drawing Library 41.1 Places . . . . . . . . . . 41.2 Transitions . . . . . . . . 41.3 Tokens . . . . . . . . . . 41.4 Examples . . . . . . . . . 42 Plot 42.1 42.2 42.3 42.4 42.5 Handler Library Curve Plot Handlers . Constant Plot Handlers Comb Plot Handlers . Bar Plot Handlers . . . Mark Plot Handler . . 385 385 385 386 388 390 390 391 392 393 395 398 399 402 402 402 403 403 403 404

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

43 Plot Mark Library 44 Shadings Library 45 Shadow Library 45.1 Overview . . . . . . . . . . . . . . . . . . 45.2 The General Shadow Option . . . . . . . 45.3 Shadows for Arbitrary Paths and Shapes 45.3.1 Drop Shadows . . . . . . . . . . . 45.3.2 Copy Shadows . . . . . . . . . . . 45.4 Shadows for Special Paths and Nodes . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

11

46 Shape Library 46.1 Overview . . . . . . . . . . . . . . 46.2 Predened Shapes . . . . . . . . . 46.3 Geometric Shapes . . . . . . . . . 46.4 Symbol Shapes . . . . . . . . . . 46.5 Arrow Shapes . . . . . . . . . . . 46.6 Shapes with Multiple Text Parts . 46.7 Callout Shapes . . . . . . . . . . 46.8 Miscellaneous Shapes . . . . . . . 47 SVG-Path Library 48 To Path Library 48.1 Straight Lines 48.2 Move-Tos . . . 48.3 Curves . . . . 48.4 Loops . . . . . 49 Through Library

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

406 406 406 407 422 429 435 441 445 451 452 452 452 452 455 457

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

50 Tree Library 458 50.1 Growth Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 50.2 Edges From Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 51 Turtle Graphics Library 461

V

Data Visualization

463

52 Introduction to Data Visualization 464 52.1 Concept: Data Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 52.2 Concept: Visualization Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 53 Creating a Data Visualization 53.1 Overview . . . . . . . . . . . . . . . . . 53.2 Concepts . . . . . . . . . . . . . . . . . 53.3 Usage (Tik Z) . . . . . . . . . . . . . . 53.4 Reference: . . . . . . . . . . . . . . . . 53.5 Advanced: Data Visualization Objects 54 Providing Data for a Data Visualization 54.1 Overview . . . . . . . . . . . . . . . . . 54.2 Concepts . . . . . . . . . . . . . . . . . 54.3 Reference: Standard Formats . . . . . 54.4 Advanced: The Data Parsing Process . 54.5 Advanced: Dening New Formats . . . 466 466 466 466 466 466 467 467 467 467 470 471

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

VI

Utilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

476477 477 477 477 478 479 480 481 482 482

55 Key Management 55.1 Introduction . . . . . . . . . . . . . . . . . . . . . 55.1.1 Comparison to Other Packages . . . . . . 55.1.2 Quick Guide to Using the Key Mechanism 55.2 The Key Tree . . . . . . . . . . . . . . . . . . . . 55.3 Setting Keys . . . . . . . . . . . . . . . . . . . . . 55.3.1 Default Arguments . . . . . . . . . . . . . 55.3.2 Keys That Execute Commands . . . . . . 55.3.3 Keys That Store Values . . . . . . . . . . 55.3.4 Keys That Are Handled . . . . . . . . . .

12

55.4

55.5 55.6

55.3.5 Keys That Are Unknown . . . . . . . . . . . . 55.3.6 Search Paths And Handled Keys . . . . . . . Key Handlers . . . . . . . . . . . . . . . . . . . . . . 55.4.1 Handlers for Path Management . . . . . . . . 55.4.2 Setting Defaults . . . . . . . . . . . . . . . . . 55.4.3 Dening Key Codes . . . . . . . . . . . . . . . 55.4.4 Dening Styles . . . . . . . . . . . . . . . . . 55.4.5 Dening Value-, Macro-, If- and Choice-Keys 55.4.6 Expanding Values . . . . . . . . . . . . . . . . 55.4.7 Handlers for Testing Keys . . . . . . . . . . . 55.4.8 Handlers for Key Inspection . . . . . . . . . . Error Keys . . . . . . . . . . . . . . . . . . . . . . . . Key ltering . . . . . . . . . . . . . . . . . . . . . . . 55.6.1 Starting with an example . . . . . . . . . . . . 55.6.2 Setting lters . . . . . . . . . . . . . . . . . . 55.6.3 Handlers for unprocessed keys . . . . . . . . . 55.6.4 Family support . . . . . . . . . . . . . . . . . 55.6.5 Other key lters . . . . . . . . . . . . . . . . . 55.6.6 Programmer Interface . . . . . . . . . . . . . . 55.6.7 Dening own lters or lter handlers . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

483 484 484 485 486 487 488 489 491 491 492 492 493 493 493 495 495 497 497 498 499 504 504 504 505 506 507 507 510 510 511 513 516 517 518

56 Repeating Things: The Foreach Statement 57 Date and Calendar Utility Macros 57.1 Handling Dates . . . . . . . . . . . . . . 57.1.1 Conversions Between Date Types 57.1.2 Checking Dates . . . . . . . . . . 57.1.3 Typesetting Dates . . . . . . . . . 57.1.4 Localization . . . . . . . . . . . . 57.2 Typesetting Calendars . . . . . . . . . . 58 Page 58.1 58.2 58.3 58.4 Management Basic Usage . . . . . . . The Predened Layouts . Dening a Layout . . . . Creating Logical Pages .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

59 Extended Color Support 60 Parser Module

VII

Mathematical and Object-Oriented Engines

519

61 Design Principles 520 61.1 Loading the Mathematical Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 61.2 Layers of the Mathematical Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 61.3 Eciency and Accuracy of the Mathematical Engine . . . . . . . . . . . . . . . . . . . . . . 520 62 Evaluating Mathematical Expressions 521 62.1 Commands for Parsing Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 63 Syntax for mathematical expressions 63.1 Operators . . . . . . . . . . . . . . . . . 63.2 Functions . . . . . . . . . . . . . . . . . . 63.2.1 Basic arithmetic functions . . . . 63.2.2 Rounding functions . . . . . . . . 63.2.3 Trigonometric functions . . . . . 63.2.4 Comparison and logical functions 63.2.5 Pseudo-random functions . . . . . 522 522 524 525 527 528 529 531

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

13

63.2.6 Base conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 63.2.7 Miscellaneous functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 64 Additional Mathematical Commands 64.1 Basic arithmetic functions . . . . . 64.2 Comparison and logical functions . 64.3 Pseudo-Random Numbers . . . . . 64.4 Base Conversion . . . . . . . . . . . 534 534 534 534 535 536

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

65 Customising the Mathematical Engine

66 Number Printing 538 66.1 Changing display styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 67 Object-Oriented Programming 67.1 Overview . . . . . . . . . . . . . . . . . 67.2 A Running Example: The Stamp Class 67.3 Classes . . . . . . . . . . . . . . . . . . 67.4 Objects . . . . . . . . . . . . . . . . . . 67.5 Methods . . . . . . . . . . . . . . . . . 67.6 Attributes . . . . . . . . . . . . . . . . 67.7 Identities . . . . . . . . . . . . . . . . . 67.8 The Signal Class . . . . . . . . . . . . . 67.9 Implementation Notes . . . . . . . . . 544 544 544 544 545 546 547 549 550 551

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

VIII

The Basic Layer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

552553 553 553 554 554 555 555 555 555 556 556 557 557 557 557 559 562 564 564 564 564 565 566 566 567 568 569 569 569 570

68 Design Principles 68.1 Core and Modules . . . . . . . . . . . . . . . . . . 68.2 Communicating with the Basic Layer via Macros 68.3 Path-Centered Approach . . . . . . . . . . . . . . 68.4 Coordinate Versus Canvas Transformations . . . .

69 Hierarchical Structures: Package, Environments, Scopes, 69.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69.1.1 The Hierarchical Structure of the Package . . . . . 69.1.2 The Hierarchical Structure of Graphics . . . . . . . 69.2 The Hierarchical Structure of the Package . . . . . . . . . 69.2.1 The Core Package . . . . . . . . . . . . . . . . . . . 69.2.2 The Modules . . . . . . . . . . . . . . . . . . . . . 69.2.3 The Library Packages . . . . . . . . . . . . . . . . . 69.3 The Hierarchical Structure of the Graphics . . . . . . . . . 69.3.1 The Main Environment . . . . . . . . . . . . . . . . 69.3.2 Graphic Scope Environments . . . . . . . . . . . . 69.3.3 Inserting Text and Images . . . . . . . . . . . . . . 70 Specifying Coordinates 70.1 Overview . . . . . . . . . . . . . . . . . . . . . . 70.2 Basic Coordinate Commands . . . . . . . . . . . 70.3 Coordinates in the XY-Coordinate System . . . 70.4 Three Dimensional Coordinates . . . . . . . . . 70.5 Building Coordinates From Other Coordinates . 70.5.1 Basic Manipulations of Coordinates . . . 70.5.2 Points Traveling along Lines and Curves 70.5.3 Points on Borders of Objects . . . . . . . 70.5.4 Points on the Intersection of Lines . . . 70.5.5 Points on the Intersection of Two Circles 70.5.6 Points on the Intersection of Two Paths 70.6 Extracting Coordinates . . . . . . . . . . . . . . 14

and Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

70.7

Internals of How Point Commands Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570 572 572 572 573 573 574 574 577 577 578 578 579 579 580 582 582 582 582 583 584 588 588 591 592 593 593 595 595 596 596 596 596 597 597 597 598 599 599 600 600 600 600 601 601 601 601 602 606 607 608

71 Constructing Paths 71.1 Overview . . . . . . . . . . . . . . . . . . . . . 71.2 The Move-To Path Operation . . . . . . . . . 71.3 The Line-To Path Operation . . . . . . . . . . 71.4 The Curve-To Path Operations . . . . . . . . 71.5 The Close Path Operation . . . . . . . . . . . 71.6 Arc, Ellipse and Circle Path Operations . . . 71.7 Rectangle Path Operations . . . . . . . . . . . 71.8 The Grid Path Operation . . . . . . . . . . . . 71.9 The Parabola Path Operation . . . . . . . . . 71.10 Sine and Cosine Path Operations . . . . . . . 71.11 Plot Path Operations . . . . . . . . . . . . . . 71.12 Rounded Corners . . . . . . . . . . . . . . . . 71.13 Internal Tracking of Bounding Boxes for Paths 72 Decorations 72.1 Overview . . . . . . . . . . . . . . . 72.2 Decoration Automata . . . . . . . . 72.2.1 The Dierent Paths . . . . . 72.2.2 Segments and States . . . . 72.3 Declaring Decorations . . . . . . . . 72.3.1 Predened Decorations . . . 72.4 Using Decorations . . . . . . . . . . 72.5 Meta-Decorations . . . . . . . . . . 72.5.1 Declaring Meta-Decorations 72.5.2 Predened Meta-decorations 72.5.3 Using Meta-Decorations . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . and Pictures

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

73 Using Paths 73.1 Overview . . . . . . . . . . . . . . . . . . . . 73.2 Stroking a Path . . . . . . . . . . . . . . . . 73.2.1 Graphic Parameter: Line Width . . . 73.2.2 Graphic Parameter: Caps and Joins . 73.2.3 Graphic Parameter: Dashing . . . . . 73.2.4 Graphic Parameter: Stroke Color . . 73.2.5 Graphic Parameter: Stroke Opacity . 73.2.6 Graphic Parameter: Arrows . . . . . 73.2.7 Inner Lines . . . . . . . . . . . . . . . 73.3 Filling a Path . . . . . . . . . . . . . . . . . 73.3.1 Graphic Parameter: Interior Rule . . 73.3.2 Graphic Parameter: Filling Color . . 73.3.3 Graphic Parameter: Fill Opacity . . 73.4 Clipping a Path . . . . . . . . . . . . . . . . 73.5 Using a Path as a Bounding Box . . . . . . 74 Arrow Tips 74.1 Overview . . . . . . . . . . . . . . . . 74.1.1 When Does PGF Draw Arrow 74.1.2 Meta-Arrow Tips . . . . . . . 74.2 Declaring an Arrow Tip Kind . . . . 74.3 Declaring a Derived Arrow Tip Kind 74.4 Using an Arrow Tip Kind . . . . . . 74.5 Predened Arrow Tip Kinds . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . Tips? . . . . . . . . . . . . . . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

15

75 Nodes and Shapes 75.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75.1.1 Creating and Referencing Nodes . . . . . . . . . . . 75.1.2 Anchors . . . . . . . . . . . . . . . . . . . . . . . . 75.1.3 Layers of a Shape . . . . . . . . . . . . . . . . . . . 75.1.4 Node Parts . . . . . . . . . . . . . . . . . . . . . . . 75.2 Creating Nodes . . . . . . . . . . . . . . . . . . . . . . . . 75.3 Using Anchors . . . . . . . . . . . . . . . . . . . . . . . . . 75.3.1 Referencing Anchors of Nodes in the Same Picture 75.3.2 Referencing Anchors of Nodes in Dierent Pictures 75.4 Special Nodes . . . . . . . . . . . . . . . . . . . . . . . . . 75.5 Declaring New Shapes . . . . . . . . . . . . . . . . . . . . 75.5.1 What Must Be Dened For a Shape? . . . . . . . . 75.5.2 Normal Anchors Versus Saved Anchors . . . . . . . 75.5.3 Command for Declaring New Shapes . . . . . . . . 76 Matrices 76.1 Overview . . . . . . . . . . . . . . . 76.2 Cell Pictures and Their Alignment 76.3 The Matrix Command . . . . . . . 76.4 Row and Column Spacing . . . . . 76.5 Callbacks . . . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

609 609 609 609 609 610 610 613 613 614 614 615 615 616 616 622 622 622 622 624 626 627 627 627 627 627 631 632 632

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

77 Coordinate and Canvas Transformations 77.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77.2 Coordinate Transformations . . . . . . . . . . . . . . . . . . . . . . . . . 77.2.1 How PGF Keeps Track of the Coordinate Transformation Matrix 77.2.2 Commands for Relative Coordinate Transformations . . . . . . . 77.2.3 Commands for Absolute Coordinate Transformations . . . . . . . 77.2.4 Saving and Restoring the Coordinate Transformation Matrix . . . 77.3 Canvas Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

78 Patterns 634 78.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 78.2 Declaring a Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 78.3 Setting a Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636 79 Declaring and Using Images 79.1 Overview . . . . . . . . . . 79.2 Declaring an Image . . . . 79.3 Using an Image . . . . . . 79.4 Masking an Image . . . . . 637 637 637 638 639 641 641 641 642 643 644 648 648 648 648 649 650

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

80 Externalizing Graphics 80.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . 80.2 Workow Step 1: Naming Graphics . . . . . . . . . 80.3 Workow Step 2: Generating the External Graphics 80.4 Workow Step 3: Including the External Graphics . 80.5 A Complete Example . . . . . . . . . . . . . . . . . 81 Creating Plots 81.1 Overview . . . . . . . . . . . . . . . . . . . . . . 81.2 Generating Plot Streams . . . . . . . . . . . . . 81.2.1 Basic Building Blocks of Plot Streams . 81.2.2 Commands That Generate Plot Streams 81.3 Plot Handlers . . . . . . . . . . . . . . . . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

16

82 Layered Graphics 82.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2 Declaring Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Using Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Shadings 83.1 Overview . . . . . . . . . . . . . . . . . . 83.2 Declaring Shadings . . . . . . . . . . . . 83.2.1 Horizontal and Vertical Shadings 83.2.2 Radial Shadings . . . . . . . . . . 83.2.3 General (Functional) Shadings . . 83.3 Using Shadings . . . . . . . . . . . . . .

652 652 652 652 654 654 654 654 655 655 657

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

84 Transparency 661 84.1 Specifying a Uniform Opacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 84.2 Specifying a Fading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 84.3 Transparency Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 85 Adding libraries to pgf : temporary registers 86 Quick Commands 86.1 Quick Coordinate Commands . . . . 86.2 Quick Path Construction Commands 86.3 Quick Path Usage Commands . . . . 86.4 Quick Text Box Commands . . . . . 665 667 667 667 668 668

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

IX

The System Layer

670

87 Design of the System Layer 671 87.1 Driver Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 87.2 Common Denition Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 88 Commands of the System Layer 88.1 Beginning and Ending a Stream of System Commands 88.2 Path Construction System Commands . . . . . . . . . 88.3 Canvas Transformation System Commands . . . . . . . 88.4 Stroking, Filling, and Clipping System Commands . . . 88.5 Graphic State Option System Commands . . . . . . . . 88.6 Color System Commands . . . . . . . . . . . . . . . . . 88.7 Pattern System Commands . . . . . . . . . . . . . . . . 88.8 Scoping System Commands . . . . . . . . . . . . . . . 88.9 Image System Commands . . . . . . . . . . . . . . . . 88.10 Shading System Commands . . . . . . . . . . . . . . . 88.11 Transparency System Commands . . . . . . . . . . . . 88.12 Reusable Objects System Commands . . . . . . . . . . 88.13 Invisibility System Commands . . . . . . . . . . . . . . 88.14 Position Tracking Commands . . . . . . . . . . . . . . 88.15 Internal Conversion Commands . . . . . . . . . . . . . 89 The 89.1 89.2 89.3 89.4 Soft Path Subsystem Path Creation Process . . . . . Starting and Ending a Soft Path Soft Path Creation Commands . The Soft Path Data Structure . 672 672 673 674 674 675 676 678 678 679 679 680 680 681 681 682 683 683 683 684 684 686

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

90 The Protocol Subsystem

X

References and Index17

687

Index

688

18

1

Introduction

The pgf package, where pgf is supposed to mean portable graphics format (or pretty, good, functional if you prefer. . . ), is a package for creating graphics in an inline manner. It denes a number of TEX commands that draw graphics. For example, the code \tikz \draw (0pt,0pt) -- (20pt,6pt); yields the and the code \tikz \fill[orange] (1ex,1ex) circle (1ex); yields . line In a sense, when you use pgf you program your graphics, just as you program your document when you use TEX. You get all the advantages of the TEX-approach to typesetting for your graphics: quick creation of simple graphics, precise positioning, the use of macros, often superior typography. You also inherit all the disadvantages: steep learning curve, no wysiwyg, small changes require a long recompilation time, and the code does not really show how things will look like.

1.1

Structure of the System

The pgf system consists of dierent layers: System layer: This layer provides a complete abstraction of what is going on in the driver. The driver is a program like dvips or dvipdfm that takes a .dvi le as input and generates a .ps or a .pdf le. (The pdftex program also counts as a driver, even though it does not take a .dvi le as input. Never mind.) Each driver has its own syntax for the generation of graphics, causing headaches to everyone who wants to create graphics in a portable way. pgfs system layer abstracts away these dierences. For example, the system command \pgfsys@lineto{10pt}{10pt} extends the current path to the coordinate (10pt, 10pt) of the current {pgfpicture}. Depending on whether dvips, dvipdfm, or pdftex is used to process the document, the system command will be converted to dierent \special commands. The system layer is as minimalistic as possible since each additional command makes it more work to port pgf to a new driver. As a user, you will not use the system layer directly. Basic layer: The basic layer provides a set of basic commands that allow you to produce complex graphics in a much easier manner than by using the system layer directly. For example, the system layer provides no commands for creating circles since circles can be composed from the more basic Bzier curves (well, e almost). However, as a user you will want to have a simple command to create circles (at least I do) instead of having to write down half a page of Bzier curve support coordinates. Thus, the basic layer e provides a command \pgfpathcircle that generates the necessary curve coordinates for you. The basic layer is consists of a core, which consists of several interdependent packages that can only be loaded en bloc, and additional modules that extend the core by more special-purpose commands like node management or a plotting interface. For instance, the beamer package uses only the core and not, say, the shapes modules. Frontend layer: A frontend (of which there can be several) is a set of commands or a special syntax that makes using the basic layer easier. A problem with directly using the basic layer is that code written for this layer is often too verbose. For example, to draw a simple triangle, you may need as many as ve commands when using the basic layer: One for beginning a path at the rst corner of the triangle, one for extending the path to the second corner, one for going to the third, one for closing the path, and one for actually painting the triangle (as opposed to lling it). With the tikz frontend all this boils down to a single simple metafont-like command:\draw (0,0) -- (1,0) -- (1,1) -- cycle;

There are dierent frontends: The Tik Z frontend is the natural frontend for pgf. It gives you access to all features of pgf, but it is intended to be easy to use. The syntax is a mixture of metafont and pstricks and some ideas of myself. This frontend is neither a complete metafont compatibility layer nor a pstricks compatibility layer and it is not intended to become either.A The pgfpict2e frontend reimplements the standard L TEX {picture} environment and commands like \line or \vector using the pgf basic layer. This layer is not really necessary since the pict2e.sty package does at least as good a job at reimplementing the {picture} environment. Rather, the idea behind this package is to have a simple demonstration of how a frontend can be implemented.

19

It would be possible to implement a pgftricks frontend that maps pstricks commands to pgf commands. However, I have not done this and even if fully implemented, many things that work in pstricks will not work, namely whenever some pstricks command relies too heavily on PostScript trickery. Nevertheless, such a package might be useful in some situations. As a user of pgf you will use the commands of a frontend plus perhaps some commands of the basic layer. For this reason, this manual explains the frontends rst, then the basic layer, and nally the system layer.

1.2

Comparison with Other Graphics Packages

pgf is not the only graphics package for TEX. In t