TikZ and pgf - Boston University

Tik Z and pgf

Manual for version 1.18

\tikzstyle{level 1}=[sibling angle=120]

\tikzstyle{level 2}=[sibling angle=60]

\tikzstyle{level 3}=[sibling angle=30]

\tikzstyle{every node}=[fill]

\tikzstyle{edge from parent}=[snake=expanding waves,segment length=1mm,segment angle=10,draw]

\tikz [grow cyclic,shape=circle,very thick,level distance=13mm,cap=round]

\node {} child [color=\A] foreach \A in {red,green,blue}

{ node {} child [color=\A!50!\B] foreach \B in {red,green,blue}

{ node {} child [color=\A!50!\B!50!\C] foreach \C in {black,gray,white}

{ node {} }

}

};

1

Fu?r meinen Vater, damit er noch viele scho?ne TEX-Graphiken erschaffen kann.

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

later version. A copy of the license is included in the section entitled LATEX Project Public License.

2

The Tik Z and PGF Packages

Manual for version 1.18



Till Tantau?

Institut fu?r Theoretische Informatik

Universita?t zu Lu?beck

June 12, 2007

Contents

1 Introduction

1.1

Structure of the System . . . . . . . . . . .

1.2

Comparison with Other Graphics Packages

1.3

Utilities: Page Management . . . . . . . .

1.4

How to Read This Manual . . . . . . . . .

1.5

Authors and Acknowledgements . . . . . .

1.6

Getting Help . . . . . . . . . . . . . . . . .

I

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Tutorials and Guidelines

14

14

15

15

16

16

16

17

2 Tutorial: A Picture for Karl¡¯s Students

2.1

Problem Statement . . . . . . . . . . . . . . . . .

2.2

Setting up the Environment . . . . . . . . . . . .

2.2.1 Setting up the Environment in LATEX . . .

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 Adding Arrow Tips . . . . . . . . . . . . . . . . .

2.17 Scoping . . . . . . . . . . . . . . . . . . . . . . . .

2.18 Transformations . . . . . . . . . . . . . . . . . . .

2.19 Repeating Things: For-Loops . . . . . . . . . . .

2.20 Adding Text . . . . . . . . . . . . . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

18

18

18

18

19

19

20

20

21

21

22

22

23

23

24

25

25

26

26

28

29

29

30

31

? 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 . . . . . . . . . . . .

3.2.1 Setting up the Environment in LATEX . . .

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 . . . . . . . . . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

35

35

35

35

35

36

36

37

37

38

38

39

39

40

42

42

43

43

4 Guidelines on Graphics

4.1

Planning the Time Needed for the Creation of Graphics

4.2

Workflow for Creating a Graphic . . . . . . . . . . . . .

4.3

Linking Graphics With the Main Text . . . . . . . . . .

4.4

Consistency Between Graphics and Text . . . . . . . . .

4.5

Labels in Graphics . . . . . . . . . . . . . . . . . . . . .

4.6

Plots and Charts . . . . . . . . . . . . . . . . . . . . . .

4.7

Attention and Distraction . . . . . . . . . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

46

46

47

47

48

48

49

52

II

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Installation and Configuration

53

5 Installation

5.1

Package and Driver Versions . . . . . . . . . . . . .

5.2

Installing Prebundled Packages . . . . . . . . . . .

5.2.1 Debian . . . . . . . . . . . . . . . . . . . . .

5.2.2 MiKTeX . . . . . . . . . . . . . . . . . . . .

5.3

Installation in a texmf Tree . . . . . . . . . . . . .

5.3.1 Installation that Keeps Everything Together

5.3.2 Installation that is TDS-Compliant . . . . .

5.4

Updating the Installation . . . . . . . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

54

54

54

54

55

55

55

55

55

6 Licenses and Copyright

6.1

Which License Applies? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.2

The GNU Public License, Version 2 . . . . . . . . . . . . . . . . . . . . . .

6.2.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.2.2 Terms and Conditions For Copying, Distribution and Modification

6.2.3 No Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.3

The LATEX Project Public License, Version 1.3c 2006-05-20 . . . . . . . . .

6.3.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.3.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.3.3 Conditions on Distribution and Modification . . . . . . . . . . . . .

6.3.4 No Warranty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.3.5 Maintenance of The Work . . . . . . . . . . . . . . . . . . . . . . .

6.3.6 Whether and How to Distribute Works under This License . . . . .

6.3.7 Choosing This License or Another License . . . . . . . . . . . . . .

6.3.8 A Recommendation on Modification Without Distribution . . . . .

6.3.9 How to Use This License . . . . . . . . . . . . . . . . . . . . . . . .

6.3.10 Derived Works That Are Not Replacements . . . . . . . . . . . . .

6.3.11 Important Recommendations . . . . . . . . . . . . . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

56

56

56

56

57

59

59

59

59

60

61

62

62

62

63

63

63

63

4

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

6.4

GNU Free Documentation License, Version 1.2, November 2002

6.4.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.4.2 Applicability and definitions . . . . . . . . . . . . . . . .

6.4.3 Verbatim Copying . . . . . . . . . . . . . . . . . . . . . .

6.4.4 Copying in Quantity . . . . . . . . . . . . . . . . . . . .

6.4.5 Modifications . . . . . . . . . . . . . . . . . . . . . . . .

6.4.6 Combining Documents . . . . . . . . . . . . . . . . . . .

6.4.7 Collection of Documents . . . . . . . . . . . . . . . . . .

6.4.8 Aggregating with independent Works . . . . . . . . . . .

6.4.9 Translation . . . . . . . . . . . . . . . . . . . . . . . . .

6.4.10 Termination . . . . . . . . . . . . . . . . . . . . . . . . .

6.4.11 Future Revisions of this License . . . . . . . . . . . . . .

6.4.12 Addendum: How to use this License for your documents

7 Input and Output Formats

7.1

Supported Input Formats . . . . . . . . .

7.1.1 Using the LATEX Format . . . . .

7.1.2 Using the Plain TEX Format . . .

7.1.3 Using the ConTEXt Format . . .

7.2

Supported Output Formats . . . . . . . .

7.2.1 Selecting the Backend Driver . .

7.2.2 Producing PDF Output . . . . .

7.2.3 Producing PostScript Output . .

7.2.4 Producing HTML / SVG Output

7.2.5 Producing Perfectly Portable DVI

III

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

Output

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

64

64

64

65

65

65

67

67

67

67

67

68

68

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

69

69

69

69

69

70

70

70

71

71

72

Tik Z ist kein Zeichenprogramm

8 Design Principles

8.1

Special Syntax For Specifying Points . . .

8.2

Special Syntax For Path Specifications . .

8.3

Actions on Paths . . . . . . . . . . . . . .

8.4

Key-Value Syntax for Graphic Parameters

8.5

Special Syntax for Specifying Nodes . . . .

8.6

Special Syntax for Specifying Trees . . . .

8.7

Grouping of Graphic Parameters . . . . .

8.8

Coordinate Transformation System . . . .

73

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

74

74

74

74

75

75

75

76

76

9 Hierarchical Structures: Package, Environments, Scopes,

9.1

Loading the Package and the Libraries . . . . . . . . . . .

9.2

Creating a Picture . . . . . . . . . . . . . . . . . . . . . . .

9.2.1 Creating a Picture Using an Environment . . . . .

9.2.2 Creating a Picture Using a Command . . . . . . . .

9.2.3 Adding a Background . . . . . . . . . . . . . . . . .

9.3

Using Scopes to Structure a Picture . . . . . . . . . . . . .

9.4

Using Scopes Inside Paths . . . . . . . . . . . . . . . . . .

9.5

Using Styles to Manage How Pictures Look . . . . . . . .

and Styles

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

77

77

77

77

79

79

79

80

80

10 Specifying Coordinates

10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . .

10.2 Coordinate Systems . . . . . . . . . . . . . . . . . . .

10.2.1 Canvas, XYZ, and Polar Coordinate Systems

10.2.2 Barycentric Systems . . . . . . . . . . . . . .

10.2.3 Node Coordinate System . . . . . . . . . . . .

10.2.4 Intersection Coordinate Systems . . . . . . . .

10.2.5 Defining New Coordinate Systems . . . . . . .

10.3 Relative and Incremental Coordinates . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

82

82

82

82

85

85

87

88

89

.

.

.

.

.

.

.

.

5

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

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

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download