├── 01-Getting-Started-with-TikZ
├── 01-classic-picture-mode.tex
└── 02-first-tikz-drawing.tex
├── 02-First-steps-creating-TikZ-images
├── 01-using-tikzpicture.tex
├── 02-cartesian-coordinates.tex
├── 03-circles.tex
├── 04-polar-coordinates.tex
├── 05-3d-coordinates.tex
├── 06-relative-coordinates-1.tex
├── 07-relative-coordinates-2.tex
├── 08-geometric-shapes.tex
├── 09-filling-colors.tex
└── 10-ball-shading.tex
├── 03-drawing-and-positioning-nodes
├── 01-node-color.tex
├── 02-node-positioning.tex
├── 03-nodes-arrows.tex
├── 04-node-anchor.tex
├── 05-node-anchor-south-west.tex
├── 06-tikzpeople.tex
├── 07-circle-text.tex
├── 08-node-above.tex
├── 09-node-right.tex
├── 10-node-above-right.tex
├── 11-label.tex
├── 12-pins.tex
├── 13-image-node.tex
├── 14-image-node-arrows.tex
├── extra-01-shape-rectangle.tex
├── extra-02-shape-circle.tex
├── extra-03-shape-ellipsis.tex
├── extra-04-shape-diamond.tex
├── extra-05-node-spacing-circle.tex
├── extra-05-node-spacing-rectangle.tex
└── extra-06-node-spacing-x-y.tex
├── 04-drawing-edges-and-arrows
├── 01-basic-edge.tex
├── 02-text-over-edge.tex
├── 03-quotes-syntax.tex
├── 04-style-definitions.tex
├── 05-more-nodes.tex
├── 06-nodes-and-edges.tex
├── 07-sloped-edge-texts.tex
├── 08-to-operation.tex
└── 09-customizing-arrow.tex
├── 05-using-styles-and-pics
├── 01-simple-nodes-edge.tex
├── 02-node-style.tex
├── 03-small-graph.tex
├── 04-konigsberg-bridges.tex
├── 05-inheriting-style.tex
├── 06-highlight-node-label.tex
└── 07-using-smiley-pics.tex
├── 06-drawing-trees-graphs-charts
├── 01-simple-tree.tex
├── 02-customized-edge.tex
├── 03-tree-children.tex
├── 04-tree-style.tex
├── 05-small-tree.tex
├── 06-big-tree.tex
├── 07-tree-distances.tex
├── 08-colored-tree.tex
├── 09-sideways-tree.tex
├── 10-upwards-tree.tex
├── 11-inverted-tree.tex
├── 12-circular-tree.tex
├── 13-small-mind-map.tex
├── 14-medium-mind-map.tex
├── 15-big-mind-map.tex
├── 16-simple-graph.tex
├── 17-node-chains.tex
├── 18-node-group.tex
├── 19-node-distance.tex
├── 20-edge-quotes.tex
├── 21-matrix-of-nodes.tex
├── 22-matrix-nodes-style.tex
├── 23-matrix-arrows.tex
└── 24-matrix-named-nodes.tex
├── 07-filling-clipping-shading
├── 01-paths.tex
├── 02-inside-outside.tex
├── 03-inside-outside-complex.tex
├── 04-filling-two-parts.tex
├── 05-filling-reversed.tex
├── 06-filling-area.tex
├── 07-star.tex
├── 08-nonzero-vs-even-odd.tex
├── 09-circle-triangle.tex
├── 10-clipped-triangle.tex
├── 11-intersecting-rings.tex
├── 12-filled-rings-nonzero.tex
├── 13-filled-rings-evenodd.tex
├── 14-clipped-filled-rings.tex
├── 15-clipped-segment.tex
├── 16-filled-segment.tex
├── 17-filled-segment.tex
├── 18-reverse-clipping.tex
├── 19-colored-segments.tex
├── 20-shaded-squares.tex
├── 21-rotated-shading.tex
├── 22-shaded-cube.tex
├── 23-axis-shading.tex
├── 24-radial-shading.tex
├── 25-ball-shading.tex
├── 26-bilinear-interpolation.tex
├── 27-color-wheel.tex
├── 28-color-ring.tex
├── 29-color-triangle.tex
├── 30-color-wheel-black.tex
└── 31-color-wheel-white.tex
├── 08-decorating-paths
├── 01-triangle.tex
├── 02-preaction-postaction.tex
├── 03-arrow-markings.tex
├── 04-arrows-curve.tex
├── 05-zigzag-arrow.tex
├── 06-linear-decorations-line.tex
├── 07-linear-decorations-arc.tex
├── 08-curvy-decorations-line.tex
└── 09-curvy-decorations-arc.tex
├── 09-using-layers
├── 01-duck.tex
├── 02-opacity.tex
├── 03-fill-opacity.tex
├── 04-fill-text-opacity.tex
├── 05-overlapping-transparency.tex
├── 06-grouping-transparency.tex
├── 07-transposing-matrix.tex
├── 08-highlighting-matrix.tex
├── 09-background-layer.tex
├── 10-tikzmark.tex
└── 11-page-background.tex
├── 10-calculating-transforming
├── 01-foreach-loop.tex
├── 02-rotated-circles-loop.tex
├── 03-filled-circles-loop.tex
├── 04-foreach-alphanumeric.tex
├── 05-partway-modifier.tex
├── 06-projection-modifier.tex
├── 07-partway-modifier-angle.tex
├── 08-spiral-circles.tex
├── 09-spiral-balls.tex
├── 10-colored-segments-spiral.tex
├── 11-intersecting-lines.tex
├── 12-triangles-circles.tex
└── 13-intersecting-triangles-circles.tex
├── 11-transforming-coordinates
├── 01-rotated-triangle-origin.tex
├── 02-triangle-rotated-point.tex
├── 03-scaled-triangle.tex
├── 04-mirrored-scope.tex
├── 05-multiple-transformations.tex
├── 06-rotated-scaled-squares.tex
├── 07-slanted-grid.tex
├── 08-slanted-cube.tex
└── 09-transform-canvas.tex
├── 12-drawing-smooth-curves
├── 01-sample-curve.tex
├── 02-curve-grid.tex
├── 03-plot-dots.tex
├── 04-smooth-path.tex
├── 05-plot-points.tex
├── 06-smooth-plot.tex
├── 07-bezier-curve.tex
├── 08-bezier-splines.tex
├── 09-hobby-curve.tex
├── 10-closed-hobby.tex
├── 11-angle-hobby.tex
├── 12-points-plane.tex
└── 13-filled-blob.tex
├── 13-plotting
├── 01-plot-points.tex
├── 02-plot-tikz.tex
├── 03-function-pgfplots.tex
├── 04-plot-style.tex
├── 05-cubic-plot.tex
├── 06-intersection.tex
├── 07-filling-below-curve.tex
├── 08-filling-between-curves.tex
├── 09-filling-soft-clip.tex
├── 10-legend.tex
├── 11-spiral.tex
├── 12-spiral-polar.tex
├── 13-rename-variable.tex
├── 14-parametric-plot.tex
├── 15-parametric-plot-polar.tex
└── info.txt
├── 14-diagrams
├── 01-horizontal-flowchart.tex
├── 02-vertical-flowchart.tex
├── 03-sequence-diagram.tex
├── 04-circular-diagram.tex
├── 05-bubble-diagram.tex
├── 06-constellation-diagram
├── 07-constellation-diagram-arrows.tex
├── 08-descriptive-diagram.tex
├── 09-bullet-diagram.tex
├── 10-priority-descriptive-diagram.tex
├── 11-line-chart.tex
├── 12-line-chart-stacked.tex
├── 13-bar-chart.tex
├── 14-bar-chart-stacked.tex
├── 15-horizontal-bar-chart.tex
├── 16-horizontal-bar-chart-stacked.tex
├── 17-pie-chart.tex
├── 18-pie-chart-absolute.tex
└── 19-wheel-chart.tex
├── 15-fun
├── 01-duck.tex
├── 02-ducks.tex
├── 03-tikzlings.tex
├── 04-tikzlings-variants.tex
├── 05-bear.tex
├── 06-snowman.tex
├── 07-penguin.tex
├── 08-penguin-variant.tex
├── 09-human-node-shape.tex
├── 10-human-shapes.tex
├── 11-jigsaw-small.tex
├── 12-jigsaw-matrix.tex
├── 13-jigsaw-big.tex
├── 14-jigsaw-picture.tex
├── 15-bricks.tex
├── 16-bricks-wall.tex
├── 17-bricks-tux-penguin.tex
├── 18-flag-brazil.tex
└── 19-tikzling-flag.tex
├── LICENSE
└── README.md
/01-Getting-Started-with-TikZ/01-classic-picture-mode.tex:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \begin{document}
3 | \setlength{\unitlength}{1cm}
4 | \begin{picture}(1,1)
5 | \put(0,0){\circle{1}}
6 | \put(-0.5,0){\line(1,0){1}}
7 | \put(-0.3,0.06){text}
8 | \end{picture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/01-Getting-Started-with-TikZ/02-first-tikz-drawing.tex:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \usepackage{tikz}
3 | \usetikzlibrary{quotes}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \draw circle (0.5);
7 | \draw (-0.5,0) to ["text"] (0.5,0);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/01-using-tikzpicture.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/02-cartesian-coordinates.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \draw[very thick, blue] (-2,-2) -- (-2,2)
8 | -- (2,2) -- (2,-2) -- cycle;
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/03-circles.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \draw[very thick, blue] (-2,-2) circle (1) (-2,2)
8 | circle (1) (2,2) circle (1) (2,-2) circle (1);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/04-polar-coordinates.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw (-3,0) -- (3,0);
6 | \draw (0,-3) -- (0,3);
7 | \draw[very thick, blue] (0:2) -- (60:2) -- (120:2)
8 | -- (180:2) --(240:2) -- (300:2) -- cycle;
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/05-3d-coordinates.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[y={(-0.86cm,0.5cm)},x={(0.86cm,0.5cm)}, z={(0cm,1cm)},font=\sffamily]
4 | \draw[very thick, blue] (-2,-2,0) -- (-2,2,0) -- (2,2,0) -- (2,-2,0) -- cycle;
5 | \draw[->] (0,0,0) -- (2.5, 0, 0) node [right] {x};
6 | \draw[->] (0,0,0) -- (0, 2.5, 0) node [left] {y};
7 | \draw[->,dashed] (0,0,0) -- (0, 0, 2.5) node [above] {z};
8 | \draw circle (2);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/06-relative-coordinates-1.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[very thick, blue] (-2,-2) -- ++(1,0) -- ++(0,1) --++ (1,0) -- ++(0,1) --++ (1,0) -- ++(0,1) --++ (1,0);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/07-relative-coordinates-2.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \draw[very thick, blue] (-3,-1) -- ++(1,0) -- ++(1,2) -- ++(2,0) --++ (1,-2) -- ++ (1,0);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/08-geometric-shapes.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw (0,0) circle [radius=2];
5 | \draw (-0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
6 | \draw (0.5,0.5) ellipse [x radius=0.2, y radius=0.4];
7 | \draw (-1,-1) arc [start angle=185, end angle=355,
8 | x radius=1, y radius=0.5];
9 | \draw (-3,-3) rectangle (3,3);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/09-filling-colors.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[fill=yellow] (0,0) circle [radius=2];
5 | \draw[fill=black] (-0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
6 | \draw[fill=black] (0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
7 | \draw[very thick] (-1,-1) arc [start angle=185, end angle=355,
8 | x radius=1, y radius=0.5];
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/02-First-steps-creating-TikZ-images/10-ball-shading.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[shading=ball,ball color=yellow] (0,0) circle [radius=2];
5 | \draw[shading=ball,ball color=black] (-0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
6 | \draw[shading=ball,ball color=black] (0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
7 | \draw[very thick] (-1,-1) arc [start angle=185, end angle=355,
8 | x radius=1, y radius=0.5];
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/01-node-color.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw (4,2) node[draw, color=red, fill=yellow, text=blue] {TikZ};
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/02-node-positioning.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shapes}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node (r) at (0,1) [draw, rectangle] {rectangle};
6 | \node (c) at (1.5,0) [draw, circle] {circle};
7 | \node (e) at (3,1) [draw, ellipse] {ellipse};
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/03-nodes-arrows.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shapes}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node (r) at (0,1) [draw, rectangle] {rectangle};
6 | \node (c) at (1.5,0) [draw, circle] {circle};
7 | \node (e) at (3,1) [draw, ellipse] {ellipse};
8 | \draw[->] (r.east) -- (e.west);
9 | \draw[->] (r.south) -- (c.north west);
10 | \draw[->] (e.south) -- (c.north east);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/04-node-anchor.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[fill=red] (4,2) circle[radius=0.1];
5 | \node at (4,2) [draw, rectangle] {rectangle};
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/05-node-anchor-south-west.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[fill=red] (4,2) circle[radius=0.1];
5 | \node at (4,2) [draw, rectangle, anchor=south west]
6 | {rectangle};
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/06-tikzpeople.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzpeople}
3 | \usetikzlibrary{shapes}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (student) [graduate, monitor, minimum size=2cm] {};
7 | \node at (student.45) [starburst, draw=red, fill=yellow,
8 | starburst point height=0.4cm, line width=1pt,
9 | font=\ttfamily\scriptsize, inner sep=1.5pt] {error};
10 | \node at (student.130) [cloud callout, cloud puffs=13, aspect=3,
11 | anchor=pointer, shading=ball, ball color=darkgray,
12 | text=white, font=\bfseries] {My thesis...!};
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/07-circle-text.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw circle [fill, radius=2pt] node [anchor=south] {text};
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/08-node-above.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw circle [fill, radius=2pt] node [above] {text};
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/09-node-right.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node [draw] (TikZ) {TikZ};
6 | \node [draw, right = 0.1cm of TikZ] {PDF};
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/10-node-above-right.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node [draw] (TikZ) {TikZ};
6 | \node [draw, above right = -0.25cm and 0.1cm of TikZ] {PDF};
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/11-label.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[every label/.style = {scale=0.5}]
4 | \node[
5 | label = above:Graphics,
6 | label = left:Design,
7 | label = below:Typography,
8 | label = right:Coding,
9 | circle, shading=ball, ball color=blue!60,
10 | text=white] {TikZ};
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/12-pins.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[every pin/.style = {scale=0.5}]
4 | \node[
5 | pin = above:Graphics,
6 | pin = left:Design,
7 | pin = below:Typography,
8 | pin = right:Coding,
9 | circle, shading=ball, ball color=blue!60,
10 | text=white] {TikZ};
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/13-image-node.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node (router) [inner sep=0pt]
6 | {\includegraphics[width=2cm]{router.pdf}};
7 | \node (switch) [inner sep=0pt, right = of router]
8 | {\includegraphics[width=2cm]{switch.pdf}};
9 | \draw[double] (router) -- (switch);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/14-image-node-arrows.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node (router) [inner sep=0pt]
6 | {\includegraphics[width=2cm]{router.pdf}};
7 | \node (switch) [inner sep=0pt, right = of router]
8 | {\includegraphics[width=2cm]{switch.pdf}};
9 | \draw[double] (router) --
10 | node [above, font=\scriptsize] {TenGig}
11 | node [font=\tiny, inner xsep=0pt,
12 | at start, anchor=north west] {1}
13 | node [font=\tiny, inner xsep=0pt,
14 | at end, anchor=north east] {24}
15 | (switch);
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-01-shape-rectangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=5]{standalone}
2 | \usetikzlibrary{positioning}
3 | \tikzset{shape example/.style = {
4 | color=black!50, draw, fill=blue!10,
5 | inner xsep=1.5cm, inner ysep=0.5cm,
6 | }}
7 | \begin{document}
8 | \Huge
9 | \begin{tikzpicture}[node distance = 1mm]
10 | \node[name=n,shape=rectangle,shape example]
11 | {\Huge rectan\smash{g}le\hspace{3cm}node};
12 | \foreach \anchor/\placement in
13 | {center/above, text/below, 45/above right,
14 | mid/right, mid east/right, mid west/left,
15 | base/below, base east/below right, base west/below left,
16 | north/above, south/below, east/above right, west/above left,
17 | north east/above, south east/below, south west/below, north west/above}
18 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
19 | node[\placement,label distance = 0mm,inner sep=3pt]
20 | {\scriptsize\texttt{(n.\anchor)}};
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-02-shape-circle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=5]{standalone}
2 | \usetikzlibrary{positioning}
3 | \tikzset{shape example/.style = {
4 | color=black!50, draw, fill=blue!10,
5 | inner xsep=0.5cm, inner ysep=0.5cm,
6 | }}
7 | \begin{document}
8 | \Huge
9 | \begin{tikzpicture}[node distance = 1mm]
10 | \node[name=n,shape=circle,shape example] {\Huge circle\hspace{2cm}node};
11 | \foreach \anchor/\placement in
12 | {center/above, text/below, 30/above right,
13 | mid/right, mid east/right, mid west/left,
14 | base/below, base east/below right, base west/below left,
15 | north/above, south/below, east/above right, west/above left,
16 | north east/above right, south east/below right, south west/below left,
17 | north west/above left}
18 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
19 | node[\placement,label distance = 0mm,inner sep=3pt]
20 | {\scriptsize\texttt{(n.\anchor)}};
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-03-shape-ellipsis.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=5]{standalone}
2 | \usetikzlibrary{shapes}
3 | \tikzset{shape example/.style={
4 | color=black!50, draw, fill=blue!10,
5 | inner xsep=0.5cm, inner ysep=0.5cm,
6 | minimum height=3cm,
7 | }}
8 | \begin{document}
9 | \Huge
10 | \begin{tikzpicture}[node distance = 1mm]
11 | \node[name=n,shape=ellipse,shape example] {\Huge ellipse\hspace{2cm} node};
12 | \foreach \anchor/\placement in
13 | {center/above, text/below, 45/above right,
14 | mid/right, mid east/right, mid west/left,
15 | base/below, base east/below right, base west/below left,
16 | north/above, south/below, east/above right, west/above left,
17 | north east/above, south east/below, south west/below, north west/above}
18 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
19 | node[\placement,label distance = 0mm,inner sep=3pt] {\scriptsize\texttt{(n.\anchor)}};
20 | \end{tikzpicture}
21 | \end{document}
22 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-04-shape-diamond.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=5]{standalone}
2 | \usetikzlibrary{shapes,positioning}
3 | \tikzset{shape example/.style = {
4 | color=black!50, draw, fill=blue!10,
5 | inner xsep=0.5cm, inner ysep=0.5cm,
6 | }}
7 | \begin{document}
8 | \Huge
9 | \begin{tikzpicture}[node distance = 1mm]
10 | \node[name=n,shape=diamond,shape example] {\Huge diamond\hspace{2.6cm}node};
11 | \foreach \anchor/\placement in
12 | {center/above, text/below, 30/above right,
13 | mid/right,
14 | base/below,
15 | north/above, south/below, east/above right, west/above left,
16 | north east/above right, south east/below right, south west/below left,
17 | north west/above left}
18 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
19 | node[\placement,label distance = 0mm,inner sep=3pt]
20 | {\scriptsize\texttt{(n.\anchor)}};
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-05-node-spacing-circle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \newcommand{\n}{\sffamily\Large node n}
4 | \newcommand{\invis}{\phantom{\sffamily\Large node n}}
5 | \begin{document}
6 | \begin{tikzpicture}[font={\scriptsize\ttfamily}]
7 | % node n
8 | \node[draw,circle,outer sep=1cm,inner sep=1cm,color=black!50, draw, fill=blue!10] (n) {{\n}};
9 | % label "shape circle"
10 | \node[above] at ($(n.center)!0.5!(n.north)$) {shape circle};
11 |
12 | % dashed helper nodes with same position and (invisible) same text
13 | \node[circle,draw,densely dashed,inner sep=0pt,outer sep=0pt] at (n.center) {\invis};
14 | \node[rectangle,draw,densely dashed,inner sep=0pt,outer sep=0pt] at (n.center) {\invis};
15 | \node (o) [rectangle,draw, dashed,inner sep=1cm,outer sep=0pt] at (n.center) {\invis};
16 |
17 | % neighbor node
18 | \node[circle,inner sep=0,outer sep=0,draw,right,color=black!50, draw, fill=blue!10]
19 | (m) at(n.east) {{\sffamily\Large node m}};
20 |
21 | % vertical sep
22 | \draw[<->,thick,blue] (n.south)
23 | --++(0,1cm) node[midway,right]{outer sep};
24 | \draw[<->,thick,red] (o.south)
25 | -- ++(0,1cm) node[pos=0.3,right]{inner sep};
26 |
27 | % horizontal sep
28 | \draw[<->,red,thick] (o.east) -- ++(-1cm,0)
29 | node[midway,above] {inner} node[midway,below] {sep};
30 | \draw[<->,blue,thick] (m.west) -- ++(-1cm,0)
31 | node[midway,above] {outer} node[midway,below] {sep};
32 |
33 | % some anchors
34 | \foreach \anchor/\placement in
35 | {south west/below left,south/below,north/above,north west/above left,
36 | north east/above right,south east/below right,west/left}
37 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
38 | node[\placement,label distance = 0mm,inner sep=3pt] {(n.\anchor)};
39 | \foreach \anchor/\placement in
40 | {east/right,south/below,north/above}
41 | \draw[shift=(m.\anchor)] plot[mark=x] coordinates{(0,0)}
42 | node[\placement,label distance = 0mm,inner sep=3pt] {(m.\anchor)};
43 |
44 | % random circle :-)
45 | \draw[dashed] (n.center) circle (3.05cm);
46 |
47 | \end{tikzpicture}
48 | \end{document}
49 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-05-node-spacing-rectangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}[font={\scriptsize\ttfamily}]
5 | \node[draw,rectangle,outer sep=1cm,inner sep=1cm,color=black!50, draw, fill=blue!10,]
6 | (n) {{\sffamily\Large node n}};
7 |
8 | \draw[<->,thick,blue] (n.south)
9 | --++(0,1cm) node[midway,right]{outer sep};
10 |
11 | \draw[<->,thick,red] (n.south) ++(0,1cm)
12 | --++(0,1cm)node[midway,right]{inner sep};
13 |
14 | \node[,outer sep=0,draw,left,color=black!50, draw, fill=blue!10,]
15 | (m) at(n.west) {{\sffamily\Large node m}};
16 |
17 | \draw[<->,blue,thick] (m.east) -- ++(1cm,0) node[midway,above] {outer}
18 | node[midway,below] {sep};
19 |
20 | \draw[<->,red,thick] ($(n.west)+(1,0)$) -- ++(1cm,0) node[midway,above] {inner}
21 | node[midway,below] {sep};
22 |
23 | \foreach \anchor/\placement in
24 | {south west/below left,south/below,north/above,north west/above left,
25 | north east/above right,south east/below right}
26 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
27 | node[\placement,label distance = 0mm,inner sep=3pt] {(n.\anchor)};
28 | \foreach \anchor/\placement in
29 | {west/left,south/below,north/above}
30 | \draw[shift=(m.\anchor)] plot[mark=x] coordinates{(0,0)}
31 | node[\placement,label distance = 0mm,inner sep=3pt] {(m.\anchor)};
32 | \draw[dashed] (n.south west) rectangle (n.north east);
33 | \node[above] at ($(n.center)!0.5!(n.north)$) {shape rectangle};
34 | \end{tikzpicture}
35 | \end{document}
36 |
--------------------------------------------------------------------------------
/03-drawing-and-positioning-nodes/extra-06-node-spacing-x-y.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}[font={\scriptsize\ttfamily}]
5 | \node[draw,rectangle,outer xsep=1cm,outer ysep=0.5cm,inner xsep=1cm,
6 | inner ysep=0.5cm,color=black!50, draw, fill=blue!10,] (n) {{\sffamily\Large node n}};
7 |
8 | \draw[<->,thick,blue] (n.south)
9 | --++(0,0.5cm) node[midway,right]{outer ysep};
10 |
11 | \draw[<->,thick,red] (n.south) ++(0,0.5cm)
12 | --++(0,0.5cm)node[midway,right]{inner ysep};
13 |
14 | \draw[<->,blue,thick] (n.west) -- ++(1cm,0) node[midway,above] {outer}
15 | node[midway,below] {xsep};
16 |
17 | \draw[<->,red,thick] ($(n.west)+(1,0)$) -- ++(1cm,0) node[midway,above] {inner}
18 | node[midway,below] {xsep};
19 |
20 | \foreach \anchor/\placement in
21 | {south west/below left,south/below,north/above,north west/above left,
22 | north east/above right,south east/below right}
23 | \draw[shift=(n.\anchor)] plot[mark=x] coordinates{(0,0)}
24 | node[\placement,label distance = 0mm,inner sep=3pt] {(n.\anchor)};
25 | \draw[dashed] (n.south west) rectangle (n.north east);
26 | \node[above] at ($(n.center)!0.5!(n.north)$) {shape rectangle};
27 | \end{tikzpicture}
28 | \end{document}
29 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/01-basic-edge.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex) edge[->] (pdf);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/02-text-over-edge.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex) edge[->] node[font=\tiny\ttfamily,above] {pdflatex} (pdf);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/03-quotes-syntax.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,quotes}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex)
10 | edge["pdflatex" {font=\ttfamily\tiny,above},->] (pdf);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/04-style-definitions.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,quotes}
4 | \begin{document}
5 | \begin{tikzpicture}[
6 | every node/.style={font=\large,text=white},
7 | every edge/.style={draw,->},
8 | every edge quotes/.style={auto,font=\ttfamily\tiny,text=black,fill=none}
9 | ]
10 | \node (tex) [fill=orange] {TEX};
11 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},right=of tex] {PDF};
12 | \draw (tex) edge["pdflatex"] (pdf);
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/05-more-nodes.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,quotes}
4 | \begin{document}
5 | \begin{tikzpicture}[
6 | every node/.style = {text=white, minimum width = 1.1cm},
7 | every edge/.style = {draw,->},
8 | every edge quotes/.style = {auto, font=\tiny\ttfamily, text=black}]
9 | ]
10 | \node (tex) [fill=orange] {TEX};
11 | \node (pdf) [fill={rgb:red,244;green,15;blue,2}, right = of tex] {PDF};
12 | \node (dvi) [fill=blue, above = of tex] {DVI};
13 | \node (ps) [fill=black!60,above = of pdf] {PS};
14 | \end{tikzpicture}
15 | \end{document}
16 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/06-nodes-and-edges.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,quotes}
4 | \begin{document}
5 | \begin{tikzpicture}[
6 | every node/.style = {text=white, minimum width = 1.1cm},
7 | every edge/.style = {draw,->},
8 | every edge quotes/.style = {auto, font=\tiny\ttfamily, text=black}]
9 | ]
10 | \node (tex) [fill=orange] {TEX};
11 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},right = of tex] {PDF};
12 | \node (dvi) [fill=blue, above = of tex] {DVI};
13 | \node (ps) [fill=black!60, above = of pdf] {PS};
14 | \draw (tex) edge["pdflatex"] (pdf);
15 | \draw (tex) edge["latex"] (dvi);
16 | \draw (dvi) edge["dvips"] (ps);
17 | \draw (dvi) edge["dvipdfmx"] (pdf);
18 | \draw (ps) edge["ps2pdf"] (pdf);
19 | \end{tikzpicture}
20 | \end{document}
21 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/07-sloped-edge-texts.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,quotes}
4 | \begin{document}
5 | \begin{tikzpicture}[
6 | every node/.style = {font=\large, text=white},
7 | every edge/.style = {draw, ->},
8 | every edge quotes/.style = {auto, font=\ttfamily\tiny,
9 | text=black, fill=none, sloped}]
10 | \node (tex) [fill = orange] {TEX};
11 | \node (pdf) [fill = {rgb:red,244;green,15;blue,2}, right = of tex] {PDF};
12 | \node (dvi) [fill = blue, above = of tex] {DVI};
13 | \node (ps) [fill = black!60, above = of pdf] {PS};
14 | \draw (tex) edge["pdflatex"] (pdf);
15 | \draw (tex) edge["latex"] (dvi);
16 | \draw (dvi) edge["dvips"] (ps);
17 | \draw (ps) edge["ps2pdf"] (pdf);
18 | \draw (dvi) edge["dvipdfmx"] (pdf);
19 | \end{tikzpicture}
20 | \end{document}
21 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/08-to-operation.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw[->] (tex) to[out=45, in=225, looseness=1.5] (pdf);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/04-drawing-edges-and-arrows/09-customizing-arrow.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning,arrows.meta}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex) edge[very thick, draw=red,
10 | -{Stealth[color=orange, fill=red, width=8pt, length=10pt]}]
11 | (pdf);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/01-simple-nodes-edge.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (A) {A};
7 | \node[right= 4 cm of A] (B) {B};
8 | \draw (A) edge node [fill=white] {1} (B);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/02-node-style.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node [font = \sffamily\bfseries, text = white, shape = circle,
7 | ball color = blue] (A) {A};
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/03-small-graph.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \tikzset{vertex/.style = {font = \sffamily\bfseries, text = white,
5 | shape = circle, ball color = blue}}
6 | \tikzset{bridge/.style = {thick, double = yellow,
7 | double distance = 1pt}}
8 | \tikzset{number/.style = {font = \sffamily\bfseries, text = white,
9 | draw, fill = red}}
10 | \begin{document}
11 | \begin{tikzpicture}
12 | \node[vertex] (A) {A};
13 | \node[vertex, right = 4 cm of A] (B) {B};
14 | \draw (A) edge[bridge] node [number] {1} (B);
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/04-konigsberg-bridges.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \tikzset{
5 | vertex/.style = {font = \sffamily\bfseries, text = white,
6 | shape = circle, ball color = blue},
7 | bridge/.style = {thick, double = yellow,
8 | double distance = 1pt},
9 | number/.style = {font = \sffamily\bfseries, text = white,
10 | draw, fill = red}}
11 | \begin{document}
12 | \begin{tikzpicture}
13 | \node[vertex] (A) {A};
14 | \node[vertex, right = 4 cm of A] (B) {B};
15 | \draw (A) edge [bridge] node [number] {1} (B);
16 | \node[vertex, below = 2cm of A] (C) {C};
17 | \node[vertex, above = 2cm of A] (D) {D};
18 | \tikzset{bridge/.append style = {bend right}}
19 | \draw (C) edge [bridge] node [number] {2} (B)
20 | (B) edge [bridge] node [number] {3} (D)
21 | (C) edge [bridge] node [number] {4} (A)
22 | (A) edge [bridge] node [number] {5} (C)
23 | (A) edge [bridge] node [number] {6} (D)
24 | (D) edge [bridge] node [number] {7} (A);
25 | \end{tikzpicture}
26 | \end{document}
27 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/05-inheriting-style.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \tikzset{
5 | mytext/.style = {font=\sffamily\bfseries, text=white},
6 | vertex/.style = {mytext, shape = circle,
7 | ball color = blue},
8 | number/.style = {mytext, draw, fill = red}}
9 | \tikzset{
10 | bridge/.style = {thick, double = yellow,
11 | double distance = 1pt}}
12 | \begin{document}
13 | \begin{tikzpicture}
14 | \node[vertex] (A) {A};
15 | \node[vertex, right = 4 cm of A] (B) {B};
16 | \draw (A) edge [bridge] node [number] {1} (B);
17 | \node[vertex, below = 2cm of A] (C) {C};
18 | \node[vertex, above = 2cm of A] (D) {D};
19 | \tikzset{bridge/.append style = {bend right}}
20 | \draw (C) edge [bridge] node [number] {2} (B)
21 | (B) edge [bridge] node [number] {3} (D)
22 | (C) edge [bridge] node [number] {4} (A)
23 | (A) edge [bridge] node [number] {5} (C)
24 | (A) edge [bridge] node [number] {6} (D)
25 | (D) edge [bridge] node [number] {7} (A);
26 | \end{tikzpicture}
27 | \end{document}
28 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/06-highlight-node-label.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \tikzset{
5 | mytext/.style = {font=\sffamily\bfseries, text=white},
6 | vertex/.style = {mytext, shape = circle,
7 | ball color = blue},
8 | number/.style = {mytext, draw, fill = red}}
9 | \tikzset{
10 | bridge/.style = {thick, double = yellow,
11 | double distance = 1pt}}
12 | \tikzset{highlight/.style = {draw=yellow, very thick,
13 | densely dotted},
14 | highlight vertex/.style = {vertex, highlight},
15 | highlight number/.style = {number, highlight}}
16 | \begin{document}
17 | \begin{tikzpicture}
18 | \node[highlight vertex] (A) {A};
19 | \node[vertex, right = 4 cm of A] (B) {B};
20 | \draw (A) edge [bridge] node [highlight number] {1} (B);
21 | \node[vertex, below = 2cm of A] (C) {C};
22 | \node[vertex, above = 2cm of A] (D) {D};
23 | \tikzset{bridge/.append style = {bend right}}
24 | \draw (C) edge [bridge] node [number] {2} (B)
25 | (B) edge [bridge] node [number] {3} (D)
26 | (C) edge [bridge] node [number] {4} (A)
27 | (A) edge [bridge] node [number] {5} (C)
28 | (A) edge [bridge] node [number] {6} (D)
29 | (D) edge [bridge] node [number] {7} (A);
30 | \end{tikzpicture}
31 | \end{document}
32 |
--------------------------------------------------------------------------------
/05-using-styles-and-pics/07-using-smiley-pics.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \tikzset{smiley/.pic={
3 | \draw[shading=ball, ball color=yellow] (0,0)
4 | circle [radius=2];
5 | \draw[shading=ball, ball color=black] (-0.5,0.5,0)
6 | ellipse [x radius=0.2, y radius=0.4];
7 | \draw[shading=ball, ball color=black] (0.5,0.5,0)
8 | ellipse [x radius=0.2, y radius=0.4];
9 | \draw[very thick] (-1,-1) arc [start angle=185,
10 | end angle=355, x radius=1, y radius=0.5];}}
11 | \begin{document}
12 | \begin{tikzpicture}
13 | \draw
14 | (0,0) pic{smiley}
15 | (2,2) pic [scale=0.5, rotate=-30] {smiley}
16 | (-2,1.5) pic [scale=0.3, rotate= 30] {smiley}
17 | (-1.6,2) pic [scale=0.15, rotate=-20] {smiley}
18 | (0,2) pic [scale=0.2, rotate=-10] {smiley};
19 | \end{tikzpicture}
20 | \end{document}
21 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/01-simple-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \node {A} child { node {1} edge from parent };
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/02-customized-edge.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \node {A} child { node {1}
5 | edge from parent [dashed, ->]
6 | node[above, sloped, font=\tiny] {down} };
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/03-tree-children.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \node {A}
5 | child { node {1} }
6 | child { node {2} }
7 | child { node {3} }
8 | child { node {4} }
9 | child { node {5} }
10 | ;
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/04-tree-style.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[thick]
4 | \node [draw, black, rectangle] {A}
5 | [red, ->]
6 | child { node {1} }
7 | child { node {2} }
8 | child [densely dashed]
9 | { node [draw, blue, circle] {3} }
10 | child { node {4} }
11 | child { node {5} }
12 | ;
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/05-small-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{hvlogos}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node {\TeX}
6 | child { node {\LaTeX} }
7 | child { node {\ConTeXt} }
8 | ;
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/06-big-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{hvlogos}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node {\TeX}
6 | child { node {\LaTeX}
7 | child { node {\pdfLaTeX} }
8 | child { node {\XeLaTeX} }
9 | child { node {\LuaLaTeX} }
10 | }
11 | child { node {\ConTeXt} }
12 | ;
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/07-tree-distances.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{hvlogos}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | level 1/.style = { level distance = 8mm,
6 | sibling distance = 20mm },
7 | level 2/.style = { level distance = 10mm,
8 | sibling distance = 20mm } ]
9 | \node {\TeX}
10 | child { node {\LaTeX}
11 | child { node {\pdfLaTeX} }
12 | child { node {\XeLaTeX} }
13 | child { node {\LuaLaTeX} }
14 | }
15 | child { node {\ConTeXt} }
16 | ;
17 | \end{tikzpicture}
18 | \end{document}
19 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/08-colored-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{hvlogos}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | level 1/.style = { level distance = 8mm,
6 | sibling distance = 20mm },
7 | level 2/.style = { level distance = 10mm,
8 | sibling distance = 20mm },
9 | treenode/.style = {shape = rectangle,
10 | rounded corners, draw,
11 | top color=white, bottom color=blue!30},
12 | every child node/.style = {treenode},
13 | engine/.style = {inner sep = 1pt, font=\tiny, above}
14 | ]
15 | \node [treenode] {\TeX}
16 | child { node {\LaTeX}
17 | child { node {\pdfLaTeX}
18 | edge from parent node[engine, sloped] {\pdfTeX}}
19 | child { node {\XeLaTeX}
20 | edge from parent node[engine, left] {\XeTeX} }
21 | child { node {\LuaLaTeX}
22 | edge from parent node[engine, sloped] {\LuaTeX}}
23 | }
24 | child { node {\ConTeXt} }
25 | ;
26 | \end{tikzpicture}
27 | \end{document}
28 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/09-sideways-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{hvlogos}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | level 1/.style = { level distance = 16mm,
6 | sibling distance = 10mm },
7 | level 2/.style = { level distance = 30mm,
8 | sibling distance = 10mm },
9 | treenode/.style = {shape = rectangle,
10 | rounded corners, draw,
11 | top color=white, bottom color=blue!30},
12 | every child node/.style = {treenode},
13 | engine/.style = {inner sep=1pt, font = \tiny, sloped, above},
14 | grow = right
15 | ]
16 | \node [treenode] {\TeX}
17 | child { node {\LaTeX}
18 | child { node {\pdfLaTeX} edge from parent node[engine] {\pdfTeX}}
19 | child { node {\XeLaTeX} edge from parent node[engine] {\XeTeX} }
20 | child { node {\LuaLaTeX} edge from parent node[engine] {\LuaTeX}}
21 | }
22 | child { node {\ConTeXt} }
23 | ;
24 | \end{tikzpicture}
25 | \end{document}
26 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/10-upwards-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[grow=up]
4 | \node {A}
5 | child { node {1} }
6 | child { node {2} }
7 | child { node {3} }
8 | child { node {4} }
9 | child { node {5} }
10 | ;
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/11-inverted-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[grow'=up]
4 | \node {A}
5 | child { node {1} }
6 | child { node {2} }
7 | child { node {3} }
8 | child { node {4} }
9 | child { node {5} }
10 | ;
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/12-circular-tree.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{trees}
3 | \begin{document}
4 | \begin{tikzpicture}[clockwise from = 180,
5 | sibling angle=45]
6 | \node {A} child { node {1} };
7 | \node {A}
8 | child { node {1} }
9 | child { node {2} }
10 | child { node {3} }
11 | child { node {4} }
12 | child { node {5} }
13 | ;
14 | \end{tikzpicture}
15 | \end{document}
16 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/13-small-mind-map.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{mindmap}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | mindmap,
6 | concept color = blue!50,
7 | text = white,
8 | ]
9 | \node [concept, font=\Huge\sffamily\bfseries] {TikZ}
10 | child [clockwise from = 0] {
11 | node [concept, font=\Large\sffamily] {Graphs}
12 | };
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/14-medium-mind-map.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{mindmap}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | mindmap,
6 | text = white,
7 | concept color = blue!50,
8 | nodes = {concept},
9 | root/.append style = {
10 | font = \Huge\sffamily\bfseries},
11 | level 1 concept/.append style =
12 | {font = \Large\sffamily, sibling angle=90},
13 | level 2 concept/.append style =
14 | {font = \normalsize\sffamily}
15 | ]
16 | \node [root] {TikZ} [clockwise from=0]
17 | child [concept color=blue] {
18 | node {Graphs} [clockwise from=90]
19 | child { node {Trees} }
20 | child { node {Mind maps} }
21 | child { node {DOT syntax} }
22 | child { node {Algorithms} }
23 | };
24 | \end{tikzpicture}
25 | \end{document}
26 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/15-big-mind-map.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{mindmap}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | mindmap,
6 | text = white,
7 | concept color = blue!50,
8 | nodes = {concept},
9 | root/.append style = {
10 | font = \Huge\sffamily\bfseries},
11 | level 1 concept/.append style =
12 | {font = \Large\sffamily, sibling angle=90},
13 | level 2 concept/.append style =
14 | {font = \normalsize\sffamily}
15 | ]
16 | \node [root] {TikZ} [clockwise from=0]
17 | child [concept color=blue] {
18 | node {Graphs} [clockwise from=90]
19 | child { node {Trees} }
20 | child { node {Mind maps} }
21 | child { node {DOT syntax} }
22 | child { node {Algorithms} }
23 | }
24 | child [concept color=green] {
25 | node {Basics} [clockwise from=30]
26 | child { node {Drawing} }
27 | child { node {Colors} }
28 | child { node {Nodes} }
29 | child { node {Edges} }
30 | child { node {Styles} }
31 | }
32 | child [concept color=red] {
33 | node {Diagrams} [clockwise from=-90]
34 | child { node {Flow charts} }
35 | child { node {Bar charts} }
36 | child { node {Pie charts} }
37 | child { node {Venn diagrams} }
38 | }
39 | child [concept color=orange!80] {
40 | node {Advanced} [clockwise from=180]
41 | child { node {Shading\\Fading} }
42 | child { node {Deco\-rations} }
43 | child { node {Transfor\-mations} }
44 | child { node {Scopes\\Overlays} }
45 | };
46 | \end{tikzpicture}
47 | \end{document}
48 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/16-simple-graph.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{graphs}
3 | \begin{document}
4 | \begin{tikzpicture}[nodes = {text depth = 1ex,
5 | text height = 2ex}]
6 | \graph { tex -> dvi -> ps -> pdf };
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/17-node-chains.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{graphs}
3 | \begin{document}
4 | \begin{tikzpicture}[nodes = {text depth = 1ex,
5 | text height = 2ex}]
6 | \graph { tex -> dvi -> ps -> pdf,
7 | bib -> bbl,
8 | bbl -> dvi };
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/18-node-group.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{graphs}
3 | \begin{document}
4 | \begin{tikzpicture}[nodes = {text depth = 1ex,
5 | text height = 2ex}]
6 | \graph { tex -> {dvi, pdf } -> html };
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/19-node-distance.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{graphs}
3 | \begin{document}
4 | \begin{tikzpicture}[nodes = {text depth = 1ex,
5 | text height = 2ex}]
6 | \graph [grow right = 2cm] { tex -> dvi -> ps -> pdf };
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/20-edge-quotes.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{graphs,quotes}
3 | \begin{document}
4 | \begin{tikzpicture}[nodes = {text depth = 1ex,
5 | text height = 2ex},
6 | every edge quotes/.style = {font=\tiny\ttfamily,
7 | above, inner sep = 0pt}]
8 | \graph [grow right = 2cm]
9 | { tex -> ["latex"] dvi
10 | -> ["dvips"] ps -> ["ps2pdf"] pdf };
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/21-matrix-of-nodes.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{matrix}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | % commented out: way without matrix library
6 | %\node[matrix,draw] {
7 | % \node{A}; & \node{B}; & \node{C}; \\
8 | % \node{D}; & \node{E}; & \node{F}; \\
9 | %};
10 | \matrix[matrix of nodes, draw] {
11 | A & B & C \\
12 | D & E & F \\
13 | };
14 | \end{tikzpicture}
15 | \end{document}
16 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/22-matrix-nodes-style.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{matrix}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \matrix [matrix of nodes, draw,
6 | nodes = {circle, draw, minimum width=2em} ] {
7 | A & B & C \\
8 | D & E & |[red]|F \\
9 | };
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/23-matrix-arrows.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{matrix}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \matrix (m) [matrix of nodes,
6 | row sep = 2em, column sep = 2em,
7 | nodes = {text depth = 1ex, text height = 2ex}
8 | ]
9 | {
10 | tex & dvi & ps \\
11 | & pdf & \\
12 | };
13 | \draw [-stealth]
14 | (m-1-1) edge (m-1-2)
15 | (m-1-2) edge (m-1-3)
16 | (m-1-1) edge (m-2-2)
17 | (m-1-2) edge (m-2-2)
18 | (m-1-3) edge (m-2-2)
19 | ;
20 | \end{tikzpicture}
21 | \end{document}
22 |
--------------------------------------------------------------------------------
/06-drawing-trees-graphs-charts/24-matrix-named-nodes.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border = 10pt]{standalone}
2 | \usetikzlibrary{matrix}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \matrix (m) [matrix of nodes,
6 | row sep = 2em, column sep = 2em,
7 | nodes = {text depth = 1ex, text height = 2ex}
8 | ]
9 | {
10 | tex & |(d)|dvi & ps \\
11 | & |(p)|pdf & \\
12 | };
13 | \draw (d) -- (p);
14 | \end{tikzpicture}
15 | \end{document}
16 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/01-paths.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{scopes}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw (90:2) -- (210:2) -- (330:2) -- cycle
6 | (90:1) -- (330:1) -- (210:1) -- cycle;
7 | {[shift={(3cm,0.35cm)},scale=1.65]
8 | \draw (90:1) -- (234:1) -- (18:1)
9 | -- (162:1) -- (306:1) -- cycle;
10 | }
11 | {[shift={(7cm,0.5cm)},scale=0.76]
12 | \draw (-1,0) circle (1.2) (-1,0) circle (2);
13 | \draw (1,0) circle (1.2) (1,0) circle (2);
14 | }
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/02-inside-outside.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings,quotes}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | draw=black, fill=orange,
6 | decoration={markings,
7 | mark = between positions 0.04 and 1 step 0.035
8 | with {\arrow{stealth}}},
9 | every edge quotes/.style = {font=\sffamily\tiny,sloped,above,inner sep=1pt}
10 | ]
11 | \filldraw[postaction={decorate}] (90:2) -- (210:2) -- (330:2) -- cycle;
12 | \draw (0,0) circle[fill=black, radius=0.03]
13 | edge[-stealth,"inside" pos=0.4] (1,1);
14 | \draw (1,1.3) circle[fill=black, radius=0.03]
15 | edge[-stealth,"outside" pos=0.16] (-1,1.3);
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/03-inside-outside-complex.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings,quotes}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | draw=black, fill=orange,
6 | decoration={markings,
7 | mark = between positions 0.03 and 1 step 0.035
8 | with {\arrow{stealth}}},
9 | every edge quotes/.style = {font=\sffamily\tiny,sloped,above,inner sep=1pt}
10 | ]
11 | \filldraw[postaction={decorate}] (150:1) -- (210:2) -- (330:2) -- (30:1) -- (0,-0.5) -- cycle;
12 | \draw (-0.8,0) circle[fill=black, radius=0.03]
13 | edge[-stealth,"inside" {pos=0.02,below}] (1.8,0);
14 | \draw (1.5,0.3) circle[fill=black, radius=0.03]
15 | edge[-stealth,"outside" pos=0.07] (-1.5,0.3);
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/04-filling-two-parts.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings,quotes}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | draw=black, fill=orange,
6 | decoration={markings,
7 | mark= between positions 0.04 and 1 step 0.035
8 | with {\arrow{stealth}}},
9 | every edge quotes/.style = {font=\sffamily\tiny,sloped,above,inner sep=1pt}
10 | ]
11 | \filldraw[postaction={decorate}] (90:2) -- (210:2) -- (330:2) -- cycle
12 | (90:1) -- (210:1) -- (330:1) -- cycle;
13 | \draw (0,0) circle[fill=black,radius=0.03] edge[-stealth,"inside" pos=0.18] (1.5,0);
14 | \draw (1.4,0.64) circle[fill=black,radius=0.03] edge[-stealth,"outside" pos=0.12] (-1.4,0.64);
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/05-filling-reversed.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings,quotes}
3 | \begin{document}
4 | \begin{tikzpicture}[
5 | draw=black, fill=orange,
6 | decoration={markings,
7 | mark = between positions 0.04 and 1 step 0.035
8 | with {\arrow{stealth}}},
9 | every edge quotes/.style = {font=\sffamily\tiny,sloped,above,inner sep=1pt}
10 | ]
11 | \filldraw[postaction={decorate}] (90:2) -- (210:2) -- (330:2) -- cycle
12 | (90:1) -- (330:1) -- (210:1) -- cycle;
13 | \draw (-0.2,0.2) circle[fill=black,radius=0.03] edge[-stealth,"outside" pos=0.18] (1.5,0.2);
14 | \draw (1.4,0.64) circle[fill=black,radius=0.03] edge[-stealth,"outside" pos=0.12] (-1.4,0.64);
15 | \draw (-1.1,-0.2) circle[fill=black,radius=0.03] edge[-stealth,"inside" pos=0.06] (1.5,-0.2);
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/06-filling-area.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \fill[orange]
5 | (90:2) -- (210:2) -- (330:2) -- cycle
6 | (90:1) -- (330:1) -- (210:1) -- cycle;
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/07-star.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | %\draw[thin,dotted] (-3,-3) grid (3,3) (0,0) circle(1);
5 | \draw (90:1) -- (234:1) -- (18:1) -- (162:1) -- (306:1) -- cycle;
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/08-nonzero-vs-even-odd.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \begin{scope}[xshift=-2.25cm]
5 | \fill[blue!50]
6 | (90:1) -- (234:1) -- (18:1) -- (162:1) -- (306:1) -- cycle;
7 | \end{scope} \fill[blue!50, even odd rule]
8 | (90:1) -- (234:1) -- (18:1) -- (162:1) -- (306:1) -- cycle;
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/09-circle-triangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \fill[orange]
5 | (90:2) -- (210:2) -- (330:2) -- cycle
6 | (90:1) -- (330:1) -- (210:1) -- cycle;
7 | \draw[dashed] (0,0) circle[radius=1.5];
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/10-clipped-triangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \clip (0,0) circle[radius=1.5];
5 | \fill[orange]
6 | (90:2) -- (210:2) -- (330:2) -- cycle
7 | (90:1) -- (330:1) -- (210:1) -- cycle;
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/11-intersecting-rings.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \begin{scope}
5 | \clip (-3,0) rectangle (3,2);
6 | \clip (-1,0) circle (1.2) (-1,0) circle (2);
7 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
8 | \end{scope}
9 | \draw[dashed] (-3,0) rectangle (3,2);
10 | \draw[dashed] (-1,0) circle (1.2) (-1,0) circle (2);
11 | \draw[dashed] (1,0) circle (1.2) (1,0) circle (2);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/12-filled-rings-nonzero.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \fill[red!70] (-1,0) circle (1.2) (-1,0) circle (2);
5 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/13-filled-rings-evenodd.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \fill[red!70] (-1,0) circle (1.2) (-1,0) circle (2);
5 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/14-clipped-filled-rings.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=2pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \draw[dashed,gray] (-3,0) rectangle (3,2);
5 | \clip (-3,0) rectangle (3,2);
6 | \fill[red!70] (-1,0) circle (1.2) (-1,0) circle (2);
7 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/15-clipped-segment.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \clip (-3,0) rectangle (3,2);
5 | \clip (-1,0) circle (1.2) (-1,0) circle (2);
6 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/16-filled-segment.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \begin{scope}
5 | \clip (-1,0) circle (1.2);
6 | \fill[orange] (1,0) circle (1.2) (1,0) circle (2);
7 | \end{scope}
8 | \draw[dashed] (-1,0) circle (1.2) (-1,0) circle (2);
9 | \draw[dashed] (1,0) circle (1.2) (1,0) circle (2);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/17-filled-segment.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \begin{scope}
5 | \clip (-1,0) circle (1.2)
6 | (-2,-2) rectangle (3,2);
7 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
8 | \end{scope}
9 | \draw[dashed] (-1,0) circle (1.2) (-1,0) circle (2);
10 | \draw[dashed] (1,0) circle (1.2) (1,0) circle (2);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/18-reverse-clipping.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \begin{scope}
5 | \fill[gray!50] (-1,0) circle (1.2)
6 | (-3,-2) rectangle (3,2);
7 | %\fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
8 | \end{scope}
9 | %\draw[dashed] (-3,0) rectangle (3,2);
10 | \draw[dashed] (-1,0) circle (1.2) (-1,0) circle (2);
11 | \draw[dashed] (1,0) circle (1.2) (1,0) circle (2);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/19-colored-segments.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[even odd rule]
4 | \begin{scope}
5 | \clip (-1,0) circle (1.2);
6 | \fill[orange] (1,0) circle (1.2) (1,0) circle (2);
7 | \end{scope}
8 | \begin{scope}
9 | \clip (-1,0) circle (1.2)
10 | (-2,-2) rectangle (3,2);
11 | \fill[red!70] (1,0) circle (1.2) (1,0) circle (2);
12 | \end{scope}
13 | \draw[dashed] (-1,0) circle (1.2) (-1,0) circle (2);
14 | \draw[dashed] (1,0) circle (1.2) (1,0) circle (2);
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/20-shaded-squares.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shadedraw [top color=red, bottom color=yellow]
5 | (0,0) rectangle (1,1);
6 | \shadedraw [left color=red, right color=yellow]
7 | (1.5,0) rectangle (2.5,1);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/21-rotated-shading.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shade[top color=red, bottom color=yellow,
5 | shading angle=30]
6 | (90:2) -- (210:2) -- (330:2) -- cycle
7 | (90:1) -- (330:1) -- (210:1) -- cycle;
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/22-shaded-cube.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shade[left color=black!60, right color=black!10]
5 | (0,0,0) -- (1,0,0) -- (1,1,0) -- (0,1,0);
6 | \shade[left color=black!10, right color=black!80]
7 | (1,0,0) -- (1,0,-1) -- (1,1,-1) -- (1,1,0);
8 | \shade[bottom color=black!10, top color=black!80]
9 | (0,1,0) -- (0,1,-1) -- (1,1,-1) -- (1,1,0);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/23-axis-shading.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shadedraw [left color= black, right color=red,
5 | middle color=white] (0,0) rectangle (1,1);
6 | \shadedraw [bottom color=black, top color=blue,
7 | middle color=orange] (1.5,0) rectangle (2.5,1);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/24-radial-shading.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shade[inner color=yellow, outer color=red]
5 | (0,0) circle (1);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/25-ball-shading.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \shade[ball color=red] (0,0) circle (1);
5 | \shade[ball color=green] (2.5,0) circle (1);
6 | \shade[ball color=blue] (5,0) circle (1);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/26-bilinear-interpolation.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[upper left=green, upper right=blue,
6 | lower left=red, lower right=yellow]
7 | (0,0) rectangle (1,1);
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/27-color-wheel.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[shading=color wheel] (0,0) circle (1);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/28-color-ring.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[shading=color wheel, even odd rule]
6 | (1,0) circle (1.2) (1,0) circle (2);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/29-color-triangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[shading=color wheel]
6 | (90:2) -- (210:2) -- (330:2);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/30-color-wheel-black.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[shading=color wheel black center] (0,0) circle (1);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/07-filling-clipping-shading/31-color-wheel-white.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shadings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \shade[shading=color wheel white center] (0,0) circle (1);
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/08-decorating-paths/01-triangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[orange, line width=3mm]
5 | (90:2) -- (210:2) -- (330:2) -- cycle;
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/08-decorating-paths/02-preaction-postaction.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[orange, line width=3mm,
5 | preaction = {draw, red, line width=5mm},
6 | postaction = {draw, yellow, line width=1mm}]
7 | (90:2) -- (210:2) -- (330:2) -- cycle;
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/08-decorating-paths/03-arrow-markings.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[-stealth,postaction=decorate,
6 | decoration={markings,
7 | mark = between positions 0.2 and 1 step 0.2
8 | with {\arrow{stealth}}}]
9 | (0,0) --(2,0);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/08-decorating-paths/04-arrows-curve.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.markings}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[-stealth, postaction=decorate,
6 | decoration = {markings, mark = between positions 0.1
7 | and 1 step 0.1 with {\arrow{stealth}}}]
8 | (0,0) arc(180:0:1) arc(-180:0:1);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/08-decorating-paths/05-zigzag-arrow.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \usetikzlibrary{decorations.pathmorphing}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex) edge[->,decorate,decoration=zigzag] (pdf);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/08-decorating-paths/06-linear-decorations-line.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \usetikzlibrary{decorations.pathmorphing}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \draw[decorate,decoration=zigzag] (0,0) -- (2,0);
7 | \draw[decorate,decoration=saw,yshift=-6mm] (0,0) -- (2,0);
8 | \draw[decorate,decoration={random steps,segment length=2mm},yshift=-12mm] (0,0) -- (2,0);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/08-decorating-paths/07-linear-decorations-arc.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.pathmorphing}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[decorate,decoration={zigzag,pre=curveto,post=curveto,pre length=4.5mm,post length=3mm}]
6 | (0,0) arc(180:0:1);
7 | \draw[decorate,decoration=saw,yshift=-8mm]
8 | (0,0) arc(180:0:1);
9 | \draw[decorate,decoration=random steps,yshift=-16mm]
10 | (0,0) arc(180:0:1);
11 | \draw[decorate,decoration=lineto,yshift=-20mm]
12 | (0,0) arc(180:0:1);
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/08-decorating-paths/08-curvy-decorations-line.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \usetikzlibrary{decorations.pathmorphing}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \draw[decorate,decoration=bumps] (0,0) -- (2,0);
7 | \draw[decorate,decoration={coil, amplitude=2mm,segment length=2mm},yshift=-4.5mm] (0,0) -- (2,0);
8 | \draw[decorate,decoration={snake},yshift=-10mm] (0,0) -- (2,0);
9 | \draw[decorate,decoration={bent},yshift=-14mm] (0,0) -- (2,0);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/08-decorating-paths/09-curvy-decorations-arc.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{decorations.pathmorphing}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[decorate,decoration={bumps,pre=curveto,post=curveto,pre length=4.5mm,post length=3mm},yshift=-7mm]
6 | (0,0) arc(180:0:1);
7 | \draw[decorate,decoration={coil, amplitude=2mm,segment length=2mm},yshift=-16mm]
8 | (0,0) arc(180:0:1);
9 | \draw[decorate,decoration={snake,pre=curveto,post=curveto,pre length=1.1mm,post length=0},yshift=-24mm]
10 | (0,0) arc(180:0:1);
11 | \draw[decorate,decoration=lineto,yshift=-28mm]
12 | (0,0) arc(180:0:1);
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/09-using-layers/01-duck.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{shapes.geometric,decorations.pathmorphing,backgrounds}
3 | \usepackage{tikzducks}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \duck[laughing]
7 | \fill[top color=white, bottom color=blue, opacity=0.5]
8 | (-1,-0.2) -- (-1,0.5)
9 | decorate[decoration={snake}]{-- (3,0.5)} -- (3,-0.2);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/09-using-layers/02-opacity.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[very thick, opacity=0.4]
4 | \filldraw[red] ( 90:1.2) circle (2);
5 | \filldraw[green] (210:1.2) circle (2);
6 | \filldraw[blue] (330:1.2) circle (2);
7 | \node at ( 90:2) {Designing};
8 | \node at (210:2) {Drawing};
9 | \node at (330:2) {Coding};
10 | \node [font=\LARGE] {TikZ};
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/09-using-layers/03-fill-opacity.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[very thick, fill opacity=0.4]
4 | \filldraw[red] ( 90:1.2) circle (2);
5 | \filldraw[green] (210:1.2) circle (2);
6 | \filldraw[blue] (330:1.2) circle (2);
7 | \node at ( 90:2) {Designing};
8 | \node at (210:2) {Drawing};
9 | \node at (330:2) {Coding};
10 | \node [font=\LARGE] {TikZ};
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/09-using-layers/04-fill-text-opacity.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}[very thick, fill opacity=0.4, text opacity=1]
4 | \filldraw[red] ( 90:1.2) circle (2);
5 | \filldraw[green] (210:1.2) circle (2);
6 | \filldraw[blue] (330:1.2) circle (2);
7 | \node at ( 90:2) {Designing};
8 | \node at (210:2) {Drawing};
9 | \node at (330:2) {Coding};
10 | \node [font=\LARGE] {TikZ};
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/09-using-layers/05-overlapping-transparency.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{babel}
3 | \usepackage{blindtext}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{scope}[opacity=0.6]
7 | \draw [line width=4mm, red] circle(1);
8 | \fill[rounded corners, fill=red, rotate=15]
9 | (-1.3,-0.2) rectangle (1.3,0.2);
10 | \end{scope}
11 | \node[rotate=15] {TOP SECRET};
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/09-using-layers/06-grouping-transparency.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{babel}
3 | \usepackage{blindtext}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{scope}[opacity=0.6, transparency group]
7 | \draw [line width=4mm, red] circle(1);
8 | \fill[rounded corners, fill=red, rotate=15]
9 | (-1.3,-0.2) rectangle (1.3,0.2);
10 | \end{scope}
11 | \node[rotate=15] {TOP SECRET};
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/09-using-layers/07-transposing-matrix.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{matrix,positioning,quotes,decorations.pathreplacing,arrows.meta}
3 | \tikzset{standard/.style={matrix of nodes,left delimiter={(},right delimiter={)},inner sep=0pt,nodes={inner sep=0.3em}}}
4 | \begin{document}
5 | \begin{tikzpicture}[every node/.append style={font=\sffamily}]
6 | \matrix[standard] (m) {
7 | 1 & 2 & 3 \\
8 | 4 & 5 & 6 \\
9 | 7 & 8 & 9 \\};
10 | \matrix[standard,right = 3cm of m] (n) {
11 | 1 & 4 & 7 \\
12 | 2 & 5 & 8 \\
13 | 3 & 6 & 9 \\};
14 | \draw[->,shorten <=1em,shorten >=1em,thick] (m.east) to["Transpose"] (n);
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/09-using-layers/08-highlighting-matrix.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{matrix,positioning,quotes,tikzmark}
3 | \tikzset{standard/.style = {matrix of nodes, inner sep=0pt,
4 | nodes={inner sep=0.3em},
5 | left delimiter={(}, right delimiter={)}}}
6 | \tikzset{submatrix/.style = {rectangle, rounded corners,
7 | fill=yellow, fill opacity=0.5}}
8 | \tikzset{every node/.append style = {font=\sffamily}}
9 | \begin{document}
10 | \begin{tikzpicture}
11 | \matrix[standard] (m) {
12 | 1 & 2 & 3 \\
13 | 4 & 5 & 6 \\
14 | 7 & 8 & 9 \\};
15 | \matrix[standard,right = 3cm of m] (n) {
16 | 1 & 4 & 7 \\
17 | 2 & 5 & 8 \\
18 | 3 & 6 & 9 \\};
19 | \draw[->,shorten <=1em, shorten >=1em, thick]
20 | (m.east) to["Transpose"] (n);
21 | \draw[submatrix] (m-2-2.north west) rectangle (m-3-3.south east);
22 | \draw[submatrix] (n-2-2.north west) rectangle (n-3-3.south east);
23 | \end{tikzpicture}
24 | \end{document}
25 |
--------------------------------------------------------------------------------
/09-using-layers/09-background-layer.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{matrix,positioning,quotes,fit}
3 | \usetikzlibrary{backgrounds}
4 | \tikzset{standard/.style={matrix of nodes,left delimiter={(},right delimiter={)},inner sep=0pt,nodes={inner sep=0.3em}}}
5 | \tikzset{submatrix/.style = {rectangle, rounded corners,
6 | fill=yellow, draw, inner sep=0pt}}
7 | \begin{document}
8 | \begin{tikzpicture}[every node/.append style={font=\sffamily}]
9 | \matrix[standard] (m) {
10 | 1 & 2 & 3 \\
11 | 4 & 5 & 6 \\
12 | 7 & 8 & 9 \\};
13 | \matrix[standard,right = 3cm of m] (n) {
14 | 1 & 4 & 7 \\
15 | 2 & 5 & 8 \\
16 | 3 & 6 & 9 \\};
17 | \draw[->,shorten <=1em,shorten >=1em,thick] (m.east) to["Transpose"] (n);
18 | \begin{scope}[on background layer]
19 | \node (m1) [submatrix, fit=(m-2-2) (m-3-3)] {};
20 | \node (n1) [submatrix, fit=(n-2-2) (n-3-3)] {};
21 | \end{scope}
22 | \draw [->] (m1.south east) to[bend right=20] (n1.south west);
23 | \end{tikzpicture}
24 | \end{document}
25 |
--------------------------------------------------------------------------------
/09-using-layers/10-tikzmark.tex:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \usepackage{amsmath}
3 | \usepackage{tikz}
4 | \usetikzlibrary{fit,tikzmark}
5 | \tikzset{submatrix/.style = {draw, rectangle, rounded corners,
6 | fill=yellow}, inner sep=2pt}
7 | \pagestyle{empty}
8 | \begin{document}
9 | \begin{tikzpicture}[overlay, remember picture]
10 | \node (m) [submatrix, fit={([yshift={1.5ex}]pic cs:m1) (pic cs:m2)}] {};
11 | \node (n) [submatrix, fit={([yshift={1.5ex}]pic cs:n1) (pic cs:n2)}] {};
12 | \draw [->] (m.south east) to[bend right=20] (n.south west);
13 | \end{tikzpicture}
14 | \[
15 | \begin{pmatrix}
16 | 1 & 2 & 3 \\
17 | 4 & \tikzmark{m1}5 & 6 \\
18 | 7 & 8 & 9\tikzmark{m2}
19 | \end{pmatrix}
20 | \xrightarrow{\text{Transpose}}
21 | \begin{pmatrix}
22 | 1 & 4 & 7 \\
23 | 2 & \tikzmark{n1}{5} & 8 \\
24 | 3 & 6 & 9\tikzmark{n2}
25 | \end{pmatrix}
26 | \]
27 | \end{document}
28 |
--------------------------------------------------------------------------------
/09-using-layers/11-page-background.tex:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \usepackage[english]{babel}
3 | \usepackage{tikz,blindtext}
4 | \usepackage{atbegshi}
5 | \AtBeginShipout{\AtBeginShipoutAddToBox{\tikz[overlay,remember picture]]
6 | \node[rotate=40,scale=10,lightgray,font=\bfseries]
7 | at (current page.center) {DRAFT};}}
8 | \pagestyle{empty}
9 | \begin{document}
10 | \blinddocument
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/10-calculating-transforming/01-foreach-loop.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \foreach \i in {-3,-2,-1,1,2,3} {
8 | \node at (\i,-0.2) {\i};
9 | \node at (-0.2,\i) {\i};
10 | }
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/10-calculating-transforming/02-rotated-circles-loop.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw \foreach \i in {10,20,...,360} {(\i:1) circle (1)};
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/10-calculating-transforming/03-filled-circles-loop.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \filldraw[even odd rule] \foreach \i in {10,20,...,360} {(\i:1) circle (1)};
5 | \end{tikzpicture}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/10-calculating-transforming/04-foreach-alphanumeric.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-3,-3) grid (3,3);
5 | \draw[->] (-3,0) -- (3,0);
6 | \draw[->] (0,-3) -- (0,3);
7 | \foreach \i/\j in {A/1,B/2,C/3} \node at (\j,-0.2) {\i};
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/10-calculating-transforming/05-partway-modifier.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \coordinate (A) at (1,2);
6 | \coordinate (B) at ($(A)+(1,0)$);
7 | \coordinate (C) at ($(A)+(60:1)$);
8 | \draw (A) -- (B) -- (C) --cycle;
9 | \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6});
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/10-calculating-transforming/06-projection-modifier.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \coordinate (A) at (1,2);
6 | \coordinate (B) at ($(A)+(1,0)$);
7 | \coordinate (C) at ($(A)+(60:1)$);
8 | \draw (A) -- (B) -- (C) --cycle;
9 | \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6});
10 | \draw[densely dotted] (C) -- ($(A)!(C)!(B)$);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/10-calculating-transforming/07-partway-modifier-angle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \coordinate (A) at (1,2);
6 | \coordinate (B) at ($(A)+(1,0)$);
7 | \coordinate (C) at ($(A)+(60:1)$);
8 | \draw (A) -- (B) -- (C) --cycle;
9 | \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6});
10 | \draw[densely dotted] (C) -- ($(A)!(C)!(B)$);
11 | \filldraw ($(A)!0.5!60:(B)$) circle (0.03);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/10-calculating-transforming/08-spiral-circles.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \i in {0,0.025,...,1}
6 | \draw ($(0,0)!\i!\i*360:(1,0)$) circle(0.08*\i);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/10-calculating-transforming/09-spiral-balls.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \i in {0,0.025,...,6}
6 | \draw[shading=ball] ($(0,0)!\i!\i*360:(1,0)$) circle(0.08*\i);
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/10-calculating-transforming/10-colored-segments-spiral.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{calc}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \i [remember=\i as \j (initially 6),
6 | evaluate=\i as \c using 20*\i] in {5.95,5.9,...,0}
7 | \fill[fill=black!60!blue!\c!white]
8 | ($(0,0)!\i!\i*180:(1,0)$) --
9 | ($(0,0)!\j!\j*180:(1,0)$) -- (0,0);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/10-calculating-transforming/11-intersecting-lines.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{intersections}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[thin,dotted] (-3,-3) grid (3,3);
6 | \draw[->] (-3,0) -- (3,0);
7 | \draw[->] (0,-3) -- (0,3);
8 | \draw[name path = l1] (-2,-2) -- (3,3);
9 | \draw[name path = l2] (-1,3) -- (3,-3);
10 | \fill[name intersections = {of = l1 and l2}]
11 | (intersection-1) circle(1mm) node[right] {here};
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/10-calculating-transforming/12-triangles-circles.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{intersections}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \fill[name path=triangle, orange]
6 | (90:2) -- (210:2) -- (330:2) -- cycle
7 | (90:1) -- (330:1) -- (210:1) -- cycle;
8 | \draw[name path=circle, dashed, gray]
9 | circle(1.5) circle(0.65);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/10-calculating-transforming/13-intersecting-triangles-circles.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{intersections}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \fill[name path=triangle, orange]
6 | (90:2) -- (210:2) -- (330:2) -- cycle
7 | (90:1) -- (330:1) -- (210:1) -- cycle;
8 | \draw[name path=circle, dashed, gray]
9 | circle(1.5) circle(0.65);
10 | \fill[blue,
11 | name intersections = {of = triangle and circle,
12 | total=\max, name=c, sort by = circle}]
13 | \foreach \i in {1,...,\max} {
14 | (c-\i) circle(0.5mm)
15 | node[above left=0.5mm,font=\tiny, inner sep=0]{\i}};
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/01-rotated-triangle-origin.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | % grid and coordinate axes:
5 | \draw[thin,dotted] (-1,-1) grid (3,3);
6 | \draw[->] (-1,0) -- (3,0);
7 | \draw[->] (0,-1) -- (0,3);
8 | % original triangle:
9 | \fill[gray!40] (0,1) -- (3,1) -- (2,2) --cycle;
10 | % rotated triangle:
11 | \fill[orange, rotate=45] (0,1) -- (3,1) -- (2,2) --cycle;
12 | % clipped circles to show the rotation:
13 | \begin{scope}
14 | \clip (0,1) rectangle (3,2.82);
15 | \draw[densely dotted] circle(3.16);
16 | \end{scope}
17 | \begin{scope}
18 | \clip (0,3) rectangle (2,2);
19 | \draw[densely dotted] circle(2.83);
20 | \end{scope}
21 | \begin{scope}
22 | \clip (-0.7,0.6) rectangle (0,1);
23 | \draw[densely dotted] circle(1);
24 | \end{scope}
25 | \end{tikzpicture}
26 | \end{document}
27 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/02-triangle-rotated-point.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-1,-1) grid (3,3);
5 | \draw[->] (-1,0) -- (3.2,0);
6 | \draw[->] (0,-1) -- (0,3.2);
7 | % original triangle:
8 | \fill[gray!40] (0,1) -- (3,1) -- (2,2) --cycle;
9 | % rotated triangle:
10 | \fill[orange,rotate around={45:(0,1)}]
11 | (0,1) -- (3,1) -- (2,2) --cycle;
12 | % clipped circles to show the rotation:
13 | \begin{scope}
14 | \clip (2.1,3.1) rectangle (3,1);
15 | \draw[blue, densely dotted] (0,1) circle(3);
16 | \end{scope}
17 | \begin{scope}
18 | \clip (0.72,3.2) rectangle (2,2);
19 | \draw[blue, densely dotted] (0,1) circle(2.24);
20 | \end{scope}
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/03-scaled-triangle.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[thin,dotted] (-1,-1) grid (6,3);
5 | \draw[->] (-1,0) -- (6.2,0);
6 | \draw[->] (0,-1) -- (0,3.2);
7 | % scaled triangle:
8 | \fill[orange, scale around={2:(0,1)}]
9 | (0,1) -- (3,1) -- (2,2) --cycle;
10 | % original triangle:
11 | \fill[gray!40,opacity=0.6] (0,1) -- (3,1) -- (2,2) --cycle;
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/04-mirrored-scope.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzducks}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \begin{scope}[xscale=-1,transform shape]
6 | \duck[laughing,speech={\tiny Oh a mirror!}]
7 | \end{scope}
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/05-multiple-transformations.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzducks}
3 | \begin{document}
4 | \begin{tikzpicture}[transform shape, every node/.style={draw, fill=white}]
5 | \draw[thin,dotted] (-3,-3) grid (3,3);
6 | \draw[->] (-3,0) -- (3.2,0);
7 | \draw[->] (0,-3) -- (0,3.2);
8 | \draw circle(2);
9 | \node[xshift=2cm, rotate=45] {A};
10 | \node[rotate=45, xshift=2cm] {B};
11 | \node[rotate=45, yshift=2cm, yscale=-1] {P};
12 | \node[yscale=-1, yshift=2cm, rotate=45] {Q};
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/06-rotated-scaled-squares.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \i in {90,85,...,5}
6 | \node[fill=black!\i, scale=\i, rotate=\i/2] {};
7 | \end{tikzpicture}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/07-slanted-grid.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | % \draw[thin,dotted] (-3,-3) grid (3,3);
6 | % \draw[->] (-3,0) -- (3,0);
7 | % \draw[->] (0,-3) -- (0,3);
8 | \draw[yslant=0.5] (0,0) grid +(3,3);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/08-slanted-cube.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{positioning}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[yslant=0.5,
6 | left color=gray!10, right color=gray!70]
7 | (3,-3) rectangle +(3,3)
8 | (3,-3) grid +(3,3);
9 | \draw[yslant=-0.5,
10 | left color=black!50, right color=gray!10]
11 | (0,0) rectangle +(3,3)
12 | (0,0) grid +(3,3);
13 | \draw[yslant=0.5,xslant=-1,
14 | bottom color=gray!10, top color=black!80]
15 | (3,0) rectangle +(3,3)
16 | (3,0) grid +(3,3);
17 | \node[yslant=-0.5, scale=3.2]
18 | at (1.5,1.75) {TikZ};
19 | \node[yslant= 0.5, scale=3.2]
20 | at (4.5,1.75) {Cube};
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/11-transforming-coordinates/09-transform-canvas.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{tikz}
3 | \usetikzlibrary{positioning}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (tex) [fill=orange, text=white] {TEX};
7 | \node (pdf) [fill={rgb:red,244;green,15;blue,2},
8 | text=white, right=of tex] {PDF};
9 | \draw (tex) edge[->,transform canvas={yshift= 0.1mm,rotate=4}] (pdf);
10 | \draw (tex) edge[->,transform canvas={yshift=-0.1mm,rotate=-4}] (pdf);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/01-sample-curve.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \begin{axis}[axis lines=none]
6 | \addplot [domain=-3:3, smooth, thick] { x^3 - 5*x };
7 | \end{axis}
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/02-curve-grid.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[domain=-3:3,samples=50,color=gray!50,thick] plot (\x, \x^3/5 - \x);
6 | \draw[very thin,gray,step=.2] (-3,-3) grid (3,3);
7 | \draw[step=1] (-3,-3) grid (3,3);
8 | \draw[->] (-3,0) -- (3,0) node[right] {x};
9 | \draw[->] (0,-3) -- (0,3) node[above] {y};
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/03-plot-dots.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[domain=-3:3,samples=50,color=gray!50,thick] plot (\x, \x^3/5 - \x);
6 | \draw[very thin,gray,step=.2] (-3,-3) grid (3,3);
7 | \draw[step=1] (-3,-3) grid (3,3);
8 | \draw[->] (-3,0) -- (3,0) node[right] {x};
9 | \draw[->] (0,-3) -- (0,3) node[above] {y};
10 | \foreach \x/\y in {-3/-2.4, -2/0.4, -0.4/0.4, 0.4/-0.4, 2/-0.4, 3/2.4}
11 | \fill (\x,\y) circle (0.6mm);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/04-smooth-path.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[domain=-3:3,samples=50,color=gray!50,thick] plot (\x, \x^3/5 - \x);
6 | \foreach \x/\y in { -3/-2.4, -2/0.4, -0.4/0.4,
7 | 0.4/-0.4, 2/-0.4, 3/2.4 }
8 | \fill (\x,\y) circle (0.6mm);
9 | \draw (-3,-2.4) to[out=77,in=240] (-2,0.4)
10 | to[out=60,in=135, looseness=1.2] (-0.4,0.4) to[out=-45,in=135] (0.4,-0.4)
11 | to[out=-45,in=-120,looseness=1.2] (2,-0.4) to[out=60,in=257] (3,2.4);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/05-plot-points.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[domain=-3:3,samples=50,color=gray!50,thick] plot (\x, \x^3/5 - \x);
6 | \foreach \x/\y in { -3/-2.4, -2/0.4, -0.4/0.4,
7 | 0.4/-0.4, 2/-0.4, 3/2.4 }
8 | \fill (\x,\y) circle (0.6mm);
9 | \draw plot coordinates {
10 | (-3,-2.4) (-2,0.4) (-1.3,0.86) (-0.4,0.4)
11 | (0.4,-0.4) (1.3,-0.86) (2,-0.4) (3,2.4) };
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/06-smooth-plot.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[domain=-3:3,samples=50,color=gray!50,thick] plot (\x, \x^3/5 - \x);
6 | \foreach \x/\y in { -3/-2.4, -2/0.4, -0.4/0.4,
7 | 0.4/-0.4, 2/-0.4, 3/2.4 }
8 | \fill (\x,\y) circle (0.6mm);
9 | \draw plot[smooth] coordinates {
10 | (-3,-2.4) (-2,0.4) (-1.3,0.86) (-0.4,0.4)
11 | (0.4,-0.4) (1.3,-0.86) (2,-0.4) (3,2.4) };
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/07-bezier-curve.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \foreach \x/\y in { -3/-2.4, 3/2.4 }
5 | \fill (\x,\y) circle (0.6mm);
6 | \draw[thick] (-3,-2.4) .. controls +(77:9) and +(257:9) .. (3,2.4);
7 | \draw[help lines] (-3,-2.4) -- (-1,6.4) node[right] {P};
8 | \draw[help lines] (3,2.4) -- (1,-6.4) node[right] {Q};
9 | \draw[help lines] (-1,6.4) -- (1,-6.4);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/08-bezier-splines.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{spline}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \x/\y in { -3/-2.4, -1.3/0.86,
6 | 1.3/-0.86, 3/2.4 }
7 | \fill (\x,\y) circle (0.6mm);
8 | \draw[thick] (-3,-2.4) to[spline coordinates=S, spline through={(-1.3,0.86)(1.3,-0.86)}] (3,2.4);
9 | \foreach \i [evaluate=\i as \j using \i+1] in {1,2,...,\tikzsplinesegments} {
10 | \draw[thin] (S K-\i) -- (S P-\i)
11 | (S K-\j) -- (S Q-\i);
12 | \fill[gray!50,semithick] (S P-\i) circle (0.6mm);
13 | \fill[gray!50,semithick] (S Q-\i) circle (0.6mm);
14 | }
15 | \end{tikzpicture}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/09-hobby-curve.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{hobby}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \x/\y in { -3/-2.4, -1.3/0.86,
6 | 1.3/-0.86, 3/2.4 }
7 | \fill (\x,\y) circle (0.6mm);
8 | \draw plot[hobby,thick] coordinates { (-3,-2.4) (-1.3,0.86) (1.3,-0.86) (3,2.4)};
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/10-closed-hobby.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{hobby}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \x/\y in { -3/-2.4, -1.3/0.86,
6 | 1.3/-0.86, 3/2.4 }
7 | \fill (\x,\y) circle (0.6mm);
8 | \draw (-3,-2.4) to[closed, curve through = {(-1.3,0.86) (1.3,-0.86)}] (3,2.4);
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/11-angle-hobby.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{hobby}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \foreach \x/\y in { -3/-2.4, -1.3/0.86,
6 | 1.3/-0.86, 3/2.4 }
7 | \fill (\x,\y) circle (0.6mm);
8 | \draw (-3,-2.4) to[out angle=80, in angle=260,
9 | curve through = {(-1.3,0.86) (1.3,-0.86)}] (3,2.4);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/12-points-plane.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{hobby}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[step=1,thin,dotted] (-3,-3) grid (3,3);
6 | \draw[->] (-3,0) -- (3,0) node[right] {x};
7 | \draw[->] (0,-3) -- (0,3) node[above] {y};
8 | \foreach \c in {(0,0),(-1,-2),(-2,-1),(-1,0),
9 | (-1,2),(0,1),(2,1)} \fill \c circle (0.5mm);
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/12-drawing-smooth-curves/13-filled-blob.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary{hobby}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \draw[step=1,thin,dotted] (-3,-3) grid (3,3);
6 | \draw[->] (-3,0) -- (3,0) node[right] {x};
7 | \draw[->] (0,-3) -- (0,3) node[above] {y};
8 | \foreach \c in {(0,0),(-1,-2),(-2,-1),(-1,0),
9 | (-1,2),(0,1),(2,1)} \fill \c circle (0.5mm);
10 | \draw[thick, fill=gray] (0,0) to[closed, curve through =
11 | { (-1,-2) (-2,-1) (-1,0) (-1,2) (0,1) }] (2,1);
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/13-plotting/01-plot-points.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{compat=1.18}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{axis}[grid]
7 | \addplot[only marks] coordinates
8 | { (-3,-2.4) (-2,0.4) (-0.4,0.4)
9 | (0.4,-0.4) (2,-0.4) (3,2.4) };
10 | \end{axis}
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/13-plotting/02-plot-tikz.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \begin{document}
3 | \begin{tikzpicture}
4 | \draw[->] (-3,0) -- (3,0);
5 | \draw[->] (0,-3) -- (0,3);
6 | \foreach \i in {-3,-2,-1,1,2,3} {
7 | \node at (\i,-0.2) {\i};
8 | \node at (-0.2,\i) {\i};
9 | }
10 | \draw[domain=-3:3, samples=50, thick] plot (\x, \x^3/5 - \x);
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/13-plotting/03-function-pgfplots.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \begin{axis}[axis lines=center]
6 | \addplot[samples=80, smooth, thick, domain=-3:3]
7 | {x^3/5 - x};
8 | \end{axis}
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/13-plotting/04-plot-style.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{every axis plot post/.append style =
4 | {samples=80, smooth, thick, black, mark=none} }
5 | \begin{document}
6 | \begin{tikzpicture}
7 | \begin{axis}[axis lines = middle, domain = -3:3]
8 | \addplot {x^3/5 - x};
9 | \end{axis}
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/13-plotting/05-cubic-plot.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{every axis plot post/.append style={thick,smooth,mark=none}}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{axis}[axis lines = middle, domain = -1.25:1.25,
7 | y domain = 0:1.25, ymax = 1.25]
8 | \addplot { (x^2-1)^2 };
9 | \end{axis}
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/13-plotting/06-intersection.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{fillbetween}
4 | \pgfplotsset{every axis plot post/.append style =
5 | {samples=80, smooth, thick, black, mark=none} }
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \begin{axis}[axis lines = center, axis equal,
9 | domain = -1.5:1]
10 | \addplot[name path=cubic] {x^3/5 - x};
11 | \addplot[name path=quartic] {(x^2-1)^2};
12 | \fill[name intersections = {of=cubic and quartic,
13 | name=p}]
14 | (p-1) circle (2pt) node [above right] {$p_1$}
15 | (p-2) circle (2pt) node [left] {$p_2$};
16 | \end{axis}
17 | \end{tikzpicture}
18 | \end{document}
19 |
--------------------------------------------------------------------------------
/13-plotting/07-filling-below-curve.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{fillbetween}
4 | \pgfplotsset{every axis plot post/.append style =
5 | {samples=80, smooth, thick, black, mark=none} }
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \begin{axis}[axis lines = center,
9 | axis equal image, domain = -1.5:1.5]
10 | \addplot[name path=quartic] {(x^2-1)^2};
11 | \path[name path=xaxis] (axis cs:-1.6,0)
12 | -- (axis cs:1.6,0);
13 | \addplot[darkgray,opacity=0.5]
14 | fill between[of=quartic and xaxis];
15 | \end{axis}
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/13-plotting/08-filling-between-curves.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{fillbetween}
4 | \pgfplotsset{every axis plot post/.append style =
5 | {samples=80, smooth, thick, black, mark=none} }
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \begin{axis}[axis lines = center, axis equal,
9 | domain = -1.5:1]
10 | \addplot[name path=cubic] {x^3/5 - x};
11 | \addplot[name path=quartic] {(x^2-1)^2};
12 | \addplot fill between[of=cubic and quartic, split,
13 | every segment/.style = {transparent},
14 | every segment no 1/.style = {gray,opaque}];
15 | \end{axis}
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/13-plotting/09-filling-soft-clip.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{fillbetween}
4 | \pgfplotsset{every axis plot post/.append style =
5 | {samples=80, smooth, thick, black, mark=none} }
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \begin{axis}[axis lines = center,
9 | axis equal image, domain = -1.5:1.5]
10 | \addplot[name path=quartic] {(x^2-1)^2};
11 | \path[name path=xaxis] (axis cs:-1.6,0)
12 | -- (axis cs:1.6,0);
13 | \addplot[darkgray, opacity=0.5]
14 | fill between[of=quartic and xaxis,
15 | soft clip = {domain=-0.5:0.5} ];
16 | \end{axis}
17 | \end{tikzpicture}
18 | \end{document}
19 |
--------------------------------------------------------------------------------
/13-plotting/10-legend.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | %\pgfplotsset{every axis plot post/.append style=
4 | % {samples=80,,thick}}
5 | \begin{document}
6 | \begin{tikzpicture}
7 | \begin{axis}[axis lines = center, axis equal,
8 | domain = -1.5:1,
9 | legend entries = {$\frac{1}{5}x^3-x$, $(x^2-1)^2$}]
10 | \addplot[red,samples=80, mark=none] {x^3/5 - x};
11 | \addplot[blue,samples=80, mark=none] {(x^2-1)^2};
12 | \end{axis}
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/13-plotting/11-spiral.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{trig format plots=rad}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{axis}[axis lines = middle, axis equal,
7 | domain = 0:6*pi,
8 | ymin=-18, ymax=18,
9 | xtick = {-4*pi,-2*pi,pi,3*pi,5*pi},
10 | xticklabels={$-4\pi$,$-2\pi$,$\vphantom{1}\pi$,$3\pi$,$5\pi$},
11 | ytick = {pi,2*pi,3*pi,4*pi,5*pi},
12 | yticklabels={$\vphantom{1}\pi$,$2\pi$,$3\pi$,$4\pi$,$5\pi$}
13 | ]
14 | \addplot[samples=120, smooth, thick] ( {x*cos(x)}, {x*sin(x)} );
15 | \end{axis}
16 | \end{tikzpicture}
17 | \end{document}
18 |
--------------------------------------------------------------------------------
/13-plotting/12-spiral-polar.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{compat=1.18}
4 | \usepgfplotslibrary{polar}
5 | \begin{document}
6 | \begin{tikzpicture}
7 | \begin{polaraxis}[yticklabel=\empty]
8 | \addplot[domain=0:2880, samples=200, smooth, thick] {x};
9 | \end{polaraxis}
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/13-plotting/13-rename-variable.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{trig format plots=rad}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{axis}[axis lines = middle, axis equal,
7 | domain = 0:6*pi, ymin=-18, ymax=18,
8 | xtick = {-4*pi,-2*pi,pi,3*pi,5*pi},
9 | ytick = {pi, 2*pi, 3*pi, 4*pi, 5*pi},
10 | xticklabels = {$-4\pi$, $-2\pi$,
11 | $\vphantom{1}\pi$, $3\pi$, $5\pi$},
12 | yticklabels = {$\vphantom{1}\pi$, $2\pi$,
13 | $3\pi$, $4\pi$, $5\pi$}
14 | ]
15 | \addplot[samples=120, smooth, thick, variable=t]
16 | ( {t*cos(t)}, {t*sin(t)} );
17 | \end{axis}
18 | \end{tikzpicture}
19 | \end{document}
20 |
--------------------------------------------------------------------------------
/13-plotting/14-parametric-plot.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{colormaps}
4 | \pgfplotsset{trig format plots=rad}
5 | \begin{document}
6 | \begin{tikzpicture}
7 | \begin{axis}[
8 | domain = -4:4, samples y = 80,
9 | y domain = -4:4, samples = 80,
10 | colormap/blackwhite,
11 | grid]
12 | \addplot3[surf] { cos(sqrt(x^2+y^2)) };
13 | \end{axis}
14 | \end{tikzpicture}
15 | \end{document}
16 |
--------------------------------------------------------------------------------
/13-plotting/15-parametric-plot-polar.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepgfplotslibrary{colormaps}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \begin{axis}[hide axis, colormap/hot2]
7 | \addplot3 [surf, z buffer=sort, trig format plots=rad,
8 | samples=65, domain=-pi:pi, y domain=0:1.25,
9 | variable=t, variable y=r]
10 | ({r*sin(t)}, {r*cos(t)}, {(r^2-1)^2});
11 | \end{axis}
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/13-plotting/info.txt:
--------------------------------------------------------------------------------
1 | Files will be added before book release.
2 |
--------------------------------------------------------------------------------
/14-diagrams/01-horizontal-flowchart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \smartdiagramset{font=\sffamily}
4 | \begin{document}
5 | \smartdiagram[flow diagram:horizontal]{
6 | Define Styles, Position nodes, Add arrows,
7 | Add labels, Review and refine}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/14-diagrams/02-vertical-flowchart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \smartdiagramset{font=\sffamily,
4 | text width = 3cm, back arrow disabled}
5 | \tikzset{module/.append style=
6 | { top color=\col, bottom color=\col},
7 | every shadow/.style = {fill=none, shadow scale=0}}
8 | \begin{document}
9 | \smartdiagram[flow diagram]{
10 | Define styles, Position nodes, Add arrows,
11 | Add labels, Review and refine}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/14-diagrams/03-sequence-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \begin{document}
4 | \smartdiagramset{sequence item font size=\sffamily\Large\strut,
5 | set color list={red!80, red!60, red!45, red!30} }
6 | \tikzset{module/.append style = {top color=\col} }
7 | \smartdiagram[sequence diagram]{
8 | Styles, Positions, Arrows, Labels}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/14-diagrams/04-circular-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \smartdiagramset{font=\sffamily}
4 | \begin{document}
5 | \smartdiagram[circular diagram:clockwise]{
6 | Define styles, Position nodes, Add arrows,
7 | Add labels, Review and refine}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/14-diagrams/05-bubble-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \smartdiagramset{bubble node font=\sffamily\Large,
4 | bubble center node font=\sffamily\Huge}
5 | \begin{document}
6 | \smartdiagram[bubble diagram]{Diagrams,
7 | Nodes, Edges, Arrows, Labels, Colors}
8 | \end{document}
9 |
--------------------------------------------------------------------------------
/14-diagrams/06-constellation-diagram:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \smartdiagramset{planet font=\sffamily\LARGE,
4 | planet text width=2.2cm,
5 | satellite font=\sffamily}
6 | \begin{document}
7 | \smartdiagram[connected constellation diagram]{
8 | Drawing diagrams, Define styles,
9 | Position nodes, Add arrows, Add labels}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/14-diagrams/07-constellation-diagram-arrows.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \usetikzlibrary{shapes.geometric}
4 | \smartdiagramset{planet font=\sffamily\Huge,
5 | satellite font=\sffamily,
6 | planet color=green!40, uniform connection color=true,
7 | uniform color list = red!40 for 8 items}
8 | \tikzset{satellite/.append style={regular polygon,
9 | regular polygon sides=8, inner sep=0pt},
10 | planet/.append style={regular polygon,
11 | regular polygon sides=8, inner sep=6pt}}
12 | \begin{document}
13 | \smartdiagram[constellation diagram]{TikZ,
14 | pgfplots, smartdiagram, hobby, tikzducks,
15 | tikzlings, tikzpeople, tikzmark, tikz-ext}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/14-diagrams/08-descriptive-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \begin{document}
4 | \smartdiagramset{description title font=\sffamily\LARGE,
5 | description font=\sffamily\footnotesize}
6 | \smartdiagram[descriptive diagram]{
7 | {PGF,{Portable Graphics Format, package for
8 | creating graphics in \LaTeX{} documents}},
9 | {TikZ, {User-friendly frontend for PGF}},}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/14-diagrams/09-bullet-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \usepackage{fontawesome5}
4 | \begin{document}
5 | \smartdiagramset{description title font=\LARGE,
6 | description font=\sffamily}
7 | \smartdiagram[descriptive diagram]{
8 | {\faLightbulb[regular],{Identify purpose and message,
9 | gather information and data}},
10 | {\faProjectDiagram, {Select diagram type,
11 | define node shapes, colors, and text styles}},
12 | {\faPencil*, {Draw nodes, insert text, draw arrows,
13 | add labels}},
14 | {\faAlignLeft, {Align nodes, refine positioning}},
15 | {\faRedo, {Fine-tune, review and revise}}, }
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/14-diagrams/10-priority-descriptive-diagram.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{smartdiagram}
3 | \begin{document}
4 | \smartdiagramset{description font=\sffamily\Large,
5 | description text width = 1.9cm,
6 | description width = 2cm}
7 | \smartdiagram[priority descriptive diagram]{
8 | \TeX, \LaTeX, PGF, TikZ, pgfplots}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/14-diagrams/11-line-chart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \tikzset{every node/.style={font=\sffamily}}
4 | \usepackage{sansmath}
5 | \pgfplotsset{tick label style = {font=\sansmath}}
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \begin{axis}[title = Keyword popularity in Google trends,
9 | x tick label style =
10 | {/pgf/number format/set thousands separator={}},
11 | legend pos = north west,
12 | legend cell align=left ]
13 | \addplot coordinates { (2007,16) (2008,19) (2009,30) (2010,36)
14 | (2011,42) (2012,48) (2013,55)};
15 | \addplot coordinates { (2007,39) (2008,28) (2009,24) (2010,19)
16 | (2011,15) (2012,12) (2013,8)};
17 | \addplot coordinates { (2007,22) (2008,13) (2009,11) (2010,8)
18 | (2011,6) (2012,4) (2013,4)};
19 | \legend{tikz, pstricks, metapost}
20 | \end{axis}
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/14-diagrams/12-line-chart-stacked.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepackage{sansmath}
4 | \pgfplotsset{tick label style = {font=\sansmath\sffamily}}
5 | \begin{document}
6 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
7 | \begin{axis}[title = Keyword popularity in Google trends,
8 | stack plots=y,
9 | area style,
10 | x tick label style =
11 | {/pgf/number format/set thousands separator={}},
12 | legend pos = outer north east,
13 | legend cell align=left ]
14 | \addplot coordinates { (2007,16) (2008,19) (2009,30) (2010,36)
15 | (2011,42) (2012,48) (2013,55)}\closedcycle;;
16 | \addplot coordinates { (2007,39) (2008,28) (2009,24) (2010,19)
17 | (2011,15) (2012,12) (2013,8)}\closedcycle;;
18 | \addplot coordinates { (2007,22) (2008,13) (2009,11) (2010,8)
19 | (2011,6) (2012,4) (2013,4)}\closedcycle;;
20 | \legend{tikz, pstricks, metapost}
21 | \end{axis}
22 | \end{tikzpicture}
23 | \end{document}
24 |
--------------------------------------------------------------------------------
/14-diagrams/13-bar-chart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepackage{sansmath}
4 | \pgfplotsset{tick label style = {font=\sansmath\sffamily}}
5 | \begin{document}
6 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
7 | \begin{axis}[title = Keyword popularity in Google trends,
8 | ybar,
9 | bar width=2mm,
10 | x tick label style =
11 | {/pgf/number format/set thousands separator={}},
12 | legend pos=north west,
13 | legend cell align=left]
14 | \addplot coordinates { (2007,16) (2008,19) (2009,30) (2010,36)
15 | (2011,42) (2012,48) (2013,55)};
16 | \addplot coordinates { (2007,39) (2008,28) (2009,24) (2010,19)
17 | (2011,15) (2012,12) (2013,8)};
18 | \addplot coordinates { (2007,22) (2008,13) (2009,11) (2010,8)
19 | (2011,6) (2012,4) (2013,4)};
20 | \legend{tikz, pstricks, metapost}
21 | \end{axis}
22 | \end{tikzpicture}
23 | \end{document}
24 |
--------------------------------------------------------------------------------
/14-diagrams/14-bar-chart-stacked.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \usepackage{sansmath}
4 | \pgfplotsset{tick label style = {font=\sansmath\sffamily}}
5 | \begin{document}
6 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
7 | \begin{axis}[title = Keyword popularity in Google trends,
8 | ybar stacked,
9 | x tick label style =
10 | {/pgf/number format/set thousands separator={}},
11 | legend pos = outer north east,
12 | legend cell align=left]
13 | \addplot coordinates { (2007,16) (2008,19) (2009,30) (2010,36)
14 | (2011,42) (2012,48) (2013,55)};
15 | \addplot coordinates { (2007,39) (2008,28) (2009,24) (2010,19)
16 | (2011,15) (2012,12) (2013,8)};
17 | \addplot coordinates { (2007,22) (2008,13) (2009,11) (2010,8)
18 | (2011,6) (2012,4) (2013,4)};
19 | \legend{tikz, pstricks, metapost}
20 | \end{axis}
21 | \end{tikzpicture}
22 | \end{document}
23 |
--------------------------------------------------------------------------------
/14-diagrams/15-horizontal-bar-chart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{compat=1.18}
4 | \usepackage{sansmath}
5 | \begin{document}
6 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
7 | \begin{axis}[title = Keyword popularity on LaTeX.org,
8 | height=6cm, enlarge y limits = 0.6,
9 | xbar,
10 | axis x line = none,
11 | y axis line style = transparent,
12 | ytick = data,
13 | tickwidth = 0pt,
14 | symbolic y coords = {TikZ, PSTricks, MetaPost},
15 | nodes near coords,
16 | nodes near coords style = {font=\sansmath},
17 | legend cell align = right ]
18 | \addplot coordinates { (2750,TikZ) (1568,PSTricks)
19 | (69,MetaPost) };
20 | \addplot coordinates { (1197,TikZ) (585,PSTricks)
21 | (41,MetaPost)};
22 | \legend{Posts,Topics}
23 | \end{axis}
24 | \end{tikzpicture}
25 | \end{document}
26 |
--------------------------------------------------------------------------------
/14-diagrams/16-horizontal-bar-chart-stacked.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgfplots}
3 | \pgfplotsset{compat=1.18}
4 | \usepackage{sansmath}
5 | \begin{document}
6 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
7 | \begin{axis}[title = Keyword popularity on LaTeX.org,
8 | height=6cm, enlarge y limits = 2.2,
9 | xbar stacked, xmin=-10,
10 | axis x line = none,
11 | y axis line style = transparent,
12 | ytick = data,
13 | tickwidth = 0pt,
14 | symbolic y coords = {TikZ, PSTricks, MetaPost},
15 | nodes near coords,
16 | nodes near coords style = {font=\sansmath},
17 | legend cell align = right ]
18 | \addplot coordinates { (2750,TikZ) (1568,PSTricks) };
19 | \addplot coordinates { (1197,TikZ) (585,PSTricks) };
20 | \legend{Posts,Topics}
21 | \end{axis}
22 | \end{tikzpicture}
23 | \end{document}
24 |
--------------------------------------------------------------------------------
/14-diagrams/17-pie-chart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgf-pie}
3 | \begin{document}
4 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
5 | \pie{ 42/Izaak Neutelings,
6 | 21/Janosh Riebesell,
7 | 17/Alexandros Tsagkaropoulos,
8 | 10/Efraín Soto Apolinar,
9 | 10/Other authors }
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/14-diagrams/18-pie-chart-absolute.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{pgf-pie}
3 | \begin{document}
4 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
5 | \pie[sum=auto]{ 207/Izaak Neutelings,
6 | 105/Janosh Riebesell,
7 | 85/Alexandros Tsagkaropoulos,
8 | 49/Efraín Soto Apolinar,
9 | 49/Other authors }
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/14-diagrams/19-wheel-chart.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=10pt]{standalone}
2 | \usepackage{wheelchart}
3 | \begin{document}
4 | \begin{tikzpicture}[every node/.style={font=\sffamily}]
5 | \wheelchart [middle={{\LARGE TikZ.net}\\contributions},
6 | inner data = {\scriptsize\WCperc}, inner data sep=0.3,
7 | wheel lines=white]
8 | {42/red/Izaak\\Neutelings,
9 | 21/orange/Janosh Riebesell,
10 | 17/yellow/Alexandros\\Tsagkaropoulos,
11 | 10/green/Efraín Soto Apolinar,
12 | 10/blue/Other authors}
13 | \end{tikzpicture}
14 | \end{document}
15 |
--------------------------------------------------------------------------------
/15-fun/01-duck.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzducks}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \duck[crazyhair=brown!60!black, glasses, eyebrow,
6 | signpost=TikZ, speech=Use it!, laughing,
7 | jacket=orange, lapel, buttons, water]
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/15-fun/02-ducks.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzducks}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node [matrix] {
6 | \duck[laughing, tophat, bowtie=violet, jacket=black,
7 | buttons=violet, recedinghair=black!80,
8 | wine, eye=red!40] &
9 | \duck[magichat, recedinghair=lightgray,
10 | jacket=violet, beard=lightgray, magicwand] &
11 | \duck[parrot, stethoscope=black!70, jacket=gray!30,
12 | buttons=gray, squareglasses, longhair=gray] \\
13 | \duck[snowduck=lightgray!60] &
14 | \duck[umbrella=red!70, handbag=red, bill=red!70,
15 | jacket=pink!80!black, longhair=yellow,
16 | necklace=magenta, sunglasses=magenta] &
17 | \duck[alien, body=green!70!black, crystalball,
18 | bill=green!50!black, laughing] \\ };
19 | \end{tikzpicture}
20 | \end{document}
21 |
--------------------------------------------------------------------------------
/15-fun/03-tikzlings.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary {positioning,matrix}
3 | \usepackage{tikzlings}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node (birds) [matrix] {
7 | \owl & \chicken] & \penguin \\ };
8 | \node [matrix, below = 0 cm of birds] {
9 | \bee & \bug & \\ };
10 | \end{tikzpicture}
11 | \begin{tikzpicture}
12 | \matrix[nodes={minimum width=6cm}] {
13 | \squirrel & \marmot & \moles & \sloth \\
14 | \pig & \koala & \coati & \panda[body=lightgray]\\
15 | \cat & \mouse & \sheep & \wolf\\
16 | };
17 | \end{tikzpicture}
18 | \begin{tikzpicture}
19 | \matrix[nodes={minimum width=6cm}] {
20 | \elephant \hippo[xshift=2.5cm] & \rhino & \anteater \\
21 | \bat[xshift=1.5cm] & \snowman[body=gray!35] & \draw (1.7,0) node{};\bear \\ };
22 | \end{tikzpicture}
23 | \end{document}
24 |
--------------------------------------------------------------------------------
/15-fun/04-tikzlings-variants.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary {positioning,matrix}
3 | \usepackage{tikzlings}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node [matrix] {
7 | \pig & \pig[back] & \pig[3D] & \pig[contour]\\
8 | };
9 | \end{tikzpicture}
10 | \end{document}
11 |
--------------------------------------------------------------------------------
/15-fun/05-bear.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usetikzlibrary {positioning,matrix}
3 | \usepackage{tikzlings}
4 | \tikzset{bat/.pic={\bat}}
5 | \usepackage{bearwear}
6 | \begin{document}
7 | \begin{tikzpicture}
8 | \bear
9 | \bearwear[shirt={shade, top color=yellow, bottom color=red},
10 | body deco={\node[scale=0.5] at ([yshift=0.8mm]bearheart) {\tiny TikZ};
11 | \pic at (beartummy)[scale=0.18,yshift=-1cm]{bat} ;}]
12 | \end{tikzpicture}
13 | \end{document}
14 |
--------------------------------------------------------------------------------
/15-fun/06-snowman.tex:
--------------------------------------------------------------------------------
1 | \documentclass[border=2pt]{standalone}
2 | \usepackage{scsnowman}
3 | \begin{document}
4 | \scsnowman[scale=2.5]\hspace{-0.3mm}
5 | \scsnowman[scale=2.5,hat,snow=blue,arms,buttons,note=red]
6 | \scsnowman[scale=2.5,muffler=red,arms,hat=blue,broom=brown]
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/15-fun/07-penguin.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzpingus}
3 | \begin{document}
4 | \tikz{\pingu}
5 | \end{document}
6 |
--------------------------------------------------------------------------------
/15-fun/08-penguin-variant.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzpingus}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \pingu[eyes shiny, crown, gold medal, right wing wave]
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/15-fun/09-human-node-shape.tex:
--------------------------------------------------------------------------------
1 | % based on an example in the tikzpeople manual
2 | \documentclass[tikz,border=2pt]{standalone}
3 | \usepackage{tikzpeople}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \node[name=s, shape=businessman, monogramtext=TEX, minimum width=3cm]
7 | {Businessman\rule{0pt}{0.8cm}};
8 | \foreach \anchor/\placement in
9 | { north west/above left, north/above, north east/above right,
10 | west/left, center/above, east/right,
11 | mid west/above left, mid/above, mid east/above right,
12 | base west/left, base/below, base east/right,
13 | south west/below left, south/below, south east/below right,
14 | text/below left, 20/right, 30/right, 40/right, 130/left,
15 | 160/left, 210/left, 330/right, mouth/above}
16 | \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
17 | node[\placement] {\scriptsize\texttt{(s.\anchor)}};
18 | \end{tikzpicture}
19 | \end{document}
20 |
--------------------------------------------------------------------------------
/15-fun/10-human-shapes.tex:
--------------------------------------------------------------------------------
1 | \documentclass{article}
2 | \usepackage[demo]{tikzpeople}
3 | \begin{document}
4 | \alltikzpeople{1.5}{}
5 | \end{document}
6 |
--------------------------------------------------------------------------------
/15-fun/11-jigsaw-small.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{jigsaw}
3 | \usepackage{worldflags}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \piece[red]{-1}{-1}{0}{0}
7 | % Now scopes for shifting:
8 | \begin{scope}[shift={(0,-1)}]
9 | \piece[blue]{0}{-1}{1}{0}
10 | \end{scope}
11 | \begin{scope}[shift={(1,0)}]
12 | \piece[yellow]{-1}{0}{0}{1}
13 | \end{scope}
14 | \begin{scope}[shift={(1,-1)}]
15 | \piece[green]{0}{0}{1}{1}
16 | \end{scope}
17 | \end{tikzpicture}
18 | \end{document}
19 |
--------------------------------------------------------------------------------
/15-fun/12-jigsaw-matrix.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{jigsaw}
3 | \usetikzlibrary{matrix}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \matrix[column sep=-0.315cm, row sep=-0.315cm] {
7 | \piece[red,overlay]{-1}{-1}{0}{0}
8 | & \piece[yellow]{-1}{0}{0}{1} \\
9 | \piece[blue]{0}{-1}{1}{0}
10 | & \piece[green]{0}{0}{1}{1} \\ };
11 | \end{tikzpicture}
12 | \end{document}
13 |
--------------------------------------------------------------------------------
/15-fun/13-jigsaw-big.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{jigsaw}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \jigsaw{10}{6}
6 | \end{tikzpicture}
7 | \end{document}
8 |
--------------------------------------------------------------------------------
/15-fun/14-jigsaw-picture.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{jigsaw}
3 | \usepackage{tikzlings}
4 | \tikzset{chicken/.pic={\chicken}}
5 | \begin{document}
6 | \begin{tikzpicture}
7 | \fill[gray!40] (0,0) rectangle (3,3);
8 | \pic[scale=1.25] at (1.5,0){chicken};
9 | \jigsaw{3}{3}
10 | \end{tikzpicture}
11 | \end{document}
12 |
--------------------------------------------------------------------------------
/15-fun/15-bricks.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzbricks}
3 | \begin{document}
4 | \begin{tikzpicture}
5 | \node [matrix] {
6 | \brick[color=red]{1}{3} &
7 | \brick[color=blue,yshift=(0.13cm)]{3}{2} \\};
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/15-fun/16-bricks-wall.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzbricks}
3 | \begin{document}
4 | \begin{wall}
5 | \wallbrick[color=blue]{2}{2}
6 | \wallbrick[color=red]{1}{2}
7 | \stepcounter{brickx}
8 | \wallbrick[color=green]{2}{2}
9 | \newrow
10 | \stepcounter{brickx}{1}
11 | \wallbrick[color=brown]{4}{2}
12 | \newrow
13 | \addtocounter{brickx}{2}
14 | \wallbrick[color=orange]{2}{2}
15 | \end{wall}
16 | \end{document}
17 |
--------------------------------------------------------------------------------
/15-fun/17-bricks-tux-penguin.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,svgnames,border=20pt]{standalone}
2 | \usepackage{tikzbricks}
3 | \begin{document}
4 | \begin{wall}
5 | \addtocounter{brickx}{6}
6 | \wallbrick[color=OrangeRed]{3}{2}
7 | \addtocounter{brickx}{8}
8 | \wallbrick[color= OrangeRed]{3}{2}
9 | \newrow
10 | %
11 | \addtocounter{brickx}{4}
12 | \wallbrick[color=OrangeRed]{2}{2}
13 | \wallbrick[color=orange]{2}{2}
14 | \wallbrick[color=OrangeRed]{1}{2}
15 | \stepcounter{brickx}
16 | \wallbrick[color=black]{6}{2}
17 | \stepcounter{brickx}
18 | \wallbrick[color=OrangeRed]{1}{2}
19 | \wallbrick[color=orange]{2}{2}
20 | \wallbrick[color=OrangeRed]{2}{2}
21 | \newrow
22 | %
23 | \addtocounter{brickx}{2}
24 | \wallbrick[color=OrangeRed]{2}{2}
25 | \wallbrick[color=orange]{5}{2}
26 | \wallbrick[color=black]{8}{2}
27 | \wallbrick[color=orange]{5}{2}
28 | \wallbrick[color=OrangeRed]{2}{2}
29 | \newrow
30 | %
31 | \addtocounter{brickx}{1}
32 | \wallbrick[color=OrangeRed]{1}{2}
33 | \wallbrick[color=orange]{7}{2}
34 | \wallbrick[color=black]{8}{2}
35 | \wallbrick[color=orange]{7}{2}
36 | \wallbrick[color=OrangeRed]{1}{2}
37 | \newrow
38 | %
39 | \wallbrick[color=OrangeRed]{1}{2}
40 | \wallbrick[color=orange]{7}{2}
41 | \wallbrick[color=black]{3}{2}
42 | \wallbrick[color=lightgray]{1}{2}
43 | \wallbrick[color=white]{3}{2}
44 | \wallbrick[color=black]{3}{2}
45 | \wallbrick[color=orange]{7}{2}
46 | \wallbrick[color=OrangeRed]{1}{2}
47 | \newrow
48 | %
49 | \wallbrick[color=OrangeRed]{1}{2}
50 | \wallbrick[color=orange]{7}{2}
51 | \wallbrick[color=black]{3}{2}
52 | \wallbrick[color=lightgray]{1}{2}
53 | \wallbrick[color=white]{3}{2}
54 | \wallbrick[color=black]{3}{2}
55 | \wallbrick[color=orange]{7}{2}
56 | \wallbrick[color=OrangeRed]{1}{2}
57 | \newrow
58 | %
59 | \addtocounter{brickx}{1}
60 | \wallbrick[color=OrangeRed]{1}{2}
61 | \wallbrick[color=orange]{6}{2}
62 | \wallbrick[color=black]{2}{2}
63 | \wallbrick[color=lightgray]{2}{2}
64 | \wallbrick[color=white]{3}{2}
65 | \wallbrick[color=black]{3}{2}
66 | \wallbrick[color=orange]{6}{2}
67 | \wallbrick[color=OrangeRed]{1}{2}
68 | \newrow
69 | %
70 | \addtocounter{brickx}{1}
71 | \wallbrick[color=OrangeRed]{1}{2}
72 | \wallbrick[color=orange]{6}{2}
73 | \wallbrick[color=lightgray]{3}{2}
74 | \wallbrick[color=white]{5}{2}
75 | \wallbrick[color=black]{2}{2}
76 | \wallbrick[color=orange]{6}{2}
77 | \wallbrick[color=OrangeRed]{1}{2}
78 | \newrow
79 | %
80 | \addtocounter{brickx}{2}
81 | \wallbrick[color=OrangeRed]{1}{2}
82 | \wallbrick[color=orange]{3}{2}
83 | \wallbrick[color=OrangeRed]{1}{2}
84 | \wallbrick[color=lightgray]{3}{2}
85 | \wallbrick[color=white]{6}{2}
86 | \wallbrick[color=black]{3}{2}
87 | \wallbrick[color=orange]{4}{2}
88 | \wallbrick[color=OrangeRed]{1}{2}
89 | \newrow
90 | %
91 | % \addtocounter{brickx}{2}
92 | % \wallbrick[color=OrangeRed]{1}{2}
93 | % \wallbrick[color=orange]{3}{2}
94 | % \wallbrick[color=OrangeRed]{1}{2}
95 | % \wallbrick[color=lightgray]{3}{2}
96 | % \wallbrick[color=white]{6}{2}
97 | % \wallbrick[color=black]{3}{2}
98 | % \wallbrick[color=orange]{4}{2}
99 | % \wallbrick[color=OrangeRed]{1}{2}
100 | % \newrow
101 | %
102 | \addtocounter{brickx}{2}
103 | \wallbrick[color=OrangeRed]{4}{2}
104 | \wallbrick[color=black]{1}{2}
105 | \wallbrick[color=lightgray]{3}{2}
106 | \wallbrick[color=white]{7}{2}
107 | \wallbrick[color=black]{3}{2}
108 | \wallbrick[color= OrangeRed]{4}{2}
109 | \newrow
110 | %
111 | \addtocounter{brickx}{3}
112 | \wallbrick[color=black]{4}{2}
113 | \wallbrick[color=lightgray]{3}{2}
114 | \wallbrick[color=white]{8}{2}
115 | \wallbrick[color=black]{4}{2}
116 | \wallbrick[color=darkgray]{1}{2}
117 | \newrow
118 | %
119 | \addtocounter{brickx}{3}
120 | \wallbrick[color=black]{4}{2}
121 | \wallbrick[color=lightgray]{3}{2}
122 | \wallbrick[color=white]{9}{2}
123 | \wallbrick[color=darkgray]{1}{2}
124 | \wallbrick[color=black]{2}{2}
125 | \wallbrick[color=darkgray]{1}{2}
126 | \newrow
127 | %
128 | \addtocounter{brickx}{4}
129 | \wallbrick[color=black]{4}{2}
130 | \wallbrick[color=lightgray]{2}{2}
131 | \wallbrick[color=white]{10}{2}
132 | \wallbrick[color=black]{1}{2}
133 | \wallbrick[color=darkgray]{1}{2}
134 | \newrow
135 | %
136 | \addtocounter{brickx}{4}
137 | \wallbrick[color=black]{4}{2}
138 | \wallbrick[color=lightgray]{3}{2}
139 | \wallbrick[color=white]{8}{2}
140 | \wallbrick[color=black]{2}{2}
141 | \wallbrick[color=darkgray]{1}{2}
142 | \newrow
143 | %
144 | \addtocounter{brickx}{4}
145 | \wallbrick[color=black]{4}{2}
146 | \wallbrick[color=lightgray]{3}{2}
147 | \wallbrick[color=white]{8}{2}
148 | \wallbrick[color=black]{2}{2}
149 | \wallbrick[color=darkgray]{1}{2}
150 | \newrow
151 | %
152 | \addtocounter{brickx}{5}
153 | \wallbrick[color=black]{3}{2}
154 | \wallbrick[color=lightgray]{4}{2}
155 | \wallbrick[color=white]{7}{2}
156 | \wallbrick[color=black]{1}{2}
157 | \wallbrick[color=darkgray]{1}{2}
158 | \newrow
159 | %
160 | \addtocounter{brickx}{5}
161 | \wallbrick[color=black]{4}{2}
162 | \wallbrick[color=lightgray]{4}{2}
163 | \wallbrick[color=white]{5}{2}
164 | \wallbrick[color=black]{2}{2}
165 | \wallbrick[color=darkgray]{1}{2}
166 | \newrow
167 | %
168 | \addtocounter{brickx}{6}
169 | \wallbrick[color=black]{3}{2}
170 | \wallbrick[color=lightgray]{4}{2}
171 | \wallbrick[color=white]{4}{2}
172 | \wallbrick[color=black]{2}{2}
173 | \wallbrick[color=darkgray]{1}{2}
174 | \newrow
175 | %
176 | \addtocounter{brickx}{6}
177 | \wallbrick[color=black]{4}{2}
178 | \wallbrick[color=lightgray]{3}{2}
179 | \wallbrick[color=white]{4}{2}
180 | \wallbrick[color=black]{2}{2}
181 | \wallbrick[color=darkgray]{1}{2}
182 | \newrow
183 | %
184 | \addtocounter{brickx}{6}
185 | \wallbrick[color=black]{4}{2}
186 | \wallbrick[color=lightgray]{1}{2}
187 | \wallbrick[color=orange]{4}{2}
188 | \wallbrick[color=white]{2}{2}
189 | \wallbrick[color=black]{2}{2}
190 | \wallbrick[color=darkgray]{1}{2}
191 | \newrow
192 | %
193 | \addtocounter{brickx}{7}
194 | \wallbrick[color=black]{3}{2}
195 | \wallbrick[color=orange]{1}{2}
196 | \wallbrick[color=black]{4}{2}
197 | \wallbrick[color=orange]{1}{2}
198 | \wallbrick[color=white]{1}{2}
199 | \wallbrick[color=black]{1}{2}
200 | \wallbrick[color=darkgray]{1}{2}
201 | \newrow
202 | %
203 | \addtocounter{brickx}{7}
204 | \wallbrick[color=black]{2}{2}
205 | \wallbrick[color=orange]{8}{2}
206 | \wallbrick[color=black]{1}{2}
207 | \wallbrick[color=darkgray]{1}{2}
208 | \newrow
209 | %
210 | \addtocounter{brickx}{7}
211 | \wallbrick[color=black]{4}{2}
212 | \wallbrick[color=orange]{4}{2}
213 | \wallbrick[color=black]{3}{2}
214 | \wallbrick[color=darkgray]{1}{2}
215 | \newrow
216 | %
217 | \addtocounter{brickx}{7}
218 | \wallbrick[color=black]{11}{2}
219 | \wallbrick[color=darkgray]{1}{2}
220 | \newrow
221 | %
222 | \addtocounter{brickx}{7}
223 | \wallbrick[color=black]{2}{2}
224 | \wallbrick[color=white]{1}{2}
225 | \wallbrick[color=black]{1}{2}
226 | \wallbrick[color=white]{1}{2}
227 | \wallbrick[color=black]{2}{2}
228 | \wallbrick[color=white]{1}{2}
229 | \wallbrick[color=black]{1}{2}
230 | \wallbrick[color=white]{1}{2}
231 | \wallbrick[color=black]{1}{2}
232 | \wallbrick[color=darkgray]{1}{2}
233 | \newrow
234 | %
235 | \addtocounter{brickx}{7}
236 | \wallbrick[color=black]{2}{2}
237 | \wallbrick[color=white]{1}{2}
238 | \wallbrick[color=black]{1}{2}
239 | \wallbrick[color=white]{1}{2}
240 | \wallbrick[color=black]{2}{2}
241 | \wallbrick[color=white]{1}{2}
242 | \wallbrick[color=black]{1}{2}
243 | \wallbrick[color=white]{1}{2}
244 | \wallbrick[color=black]{1}{2}
245 | \wallbrick[color=darkgray]{1}{2}
246 | \newrow
247 | %
248 | \addtocounter{brickx}{7}
249 | \wallbrick[color=black]{3}{2}
250 | \wallbrick[color=white]{1}{2}
251 | \wallbrick[color=black]{4}{2}
252 | \wallbrick[color=white]{1}{2}
253 | \wallbrick[color=black]{2}{2}
254 | \wallbrick[color=darkgray]{1}{2}
255 | \newrow
256 | %
257 | \addtocounter{brickx}{8}
258 | \wallbrick[color=black]{10}{2}
259 | \newrow
260 | %
261 | \addtocounter{brickx}{8}
262 | \wallbrick[color=darkgray]{1}{2}
263 | \wallbrick[color=black]{8}{2}
264 | \wallbrick[color=darkgray]{1}{2}
265 | \newrow
266 | %
267 | \addtocounter{brickx}{8}
268 | \wallbrick[color=darkgray]{1}{2}
269 | \wallbrick[color=black]{7}{2}
270 | \wallbrick[color=darkgray]{2}{2}
271 | \newrow
272 | %
273 | \addtocounter{brickx}{9}
274 | \wallbrick[color=darkgray]{3}{2}
275 | \wallbrick[color=black]{2}{2}
276 | \wallbrick[color=darkgray]{3}{2}
277 | \newrow
278 | %
279 | \addtocounter{brickx}{11}
280 | \wallbrick[color=darkgray]{4}{2}
281 | \end{wall}
282 | \stepcounter{brickx}
283 | \end{document}
284 |
--------------------------------------------------------------------------------
/15-fun/18-flag-brazil.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzlings}
3 | \usepackage{worldflags}
4 | \begin{document}
5 | \worldflag[width=2cm,framewidth=0.3mm,framecolor=black]{BR}
6 | \end{document}
7 |
--------------------------------------------------------------------------------
/15-fun/19-tikzling-flag.tex:
--------------------------------------------------------------------------------
1 | \documentclass[tikz,border=10pt]{standalone}
2 | \usepackage{tikzlings}
3 | \usepackage{worldflags}
4 | \begin{document}
5 | \begin{tikzpicture}
6 | \hippo[body=brown!60!black,lightsaber=brown,think={\textsf{The end}}]
7 | \pic [country=MW,hang=20,rotate=-30,scale=0.5] at (1.02,1.1) {worldflag};
8 | \end{tikzpicture}
9 | \end{document}
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Packt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LATEX Graphics with TikZ
2 |
3 |
4 |
5 | This is the code repository for [LATEX Graphics with TikZ](https://www.packtpub.com/product/latex-graphics-with-tikz/9781804618233?utm_source=github&utm_medium=repository&utm_campaign=), published by Packt.
6 |
7 | **A practitioner's guide to drawing 2D and 3D images, diagrams, charts, and plots**
8 |
9 | ## What is this book about?
10 |
11 | This book covers the following exciting features:
12 | * Understand the TikZ language and how to use its libraries and packages
13 | * Draw geometric shapes with text and add arrows, labels, and decorations
14 | * Apply transformations and use transparency, shading, fading, and filling features
15 | * Define styles and program with loops to streamline your code
16 | * Build trees, graphs, and mind maps and draw easy curves with smooth transitions
17 | * Produce block diagrams and flow charts to visualize process steps
18 | * Generate line charts and bar charts to showcase your data
19 | * Plot data sets and mathematical functions in two and three dimensions
20 |
21 | If you feel this book is for you, get your [copy](https://www.amazon.com/dp/1804618233) today!
22 |
23 |
25 |
26 | ## Instructions and Navigations
27 | All of the code is organized into folders. For example, Chapter01.
28 |
29 | The code will look like the following:
30 | ```
31 | \begin{tikzpicture}
32 | \draw (-0.5,0) to ["text"] (0.5,0);
33 | \end{tikzpicture}
34 | ```
35 |
36 | **Following is what you need for this book:**
37 | This book is for LaTeX users, including students and academic authors, seeking to incorporate figures such as diagrams, plots, and graphics to their theses, articles, and books. If you’re familiar with LaTeX basics from beginner’s books or tutorials, you’ll be able to effortlessly explore the graphics topics in this book.
38 |
39 | With the following software and hardware list you can run all code files present in the book (Chapter 1-15).
40 | ### Software and Hardware List
41 | | Chapter | Software required | OS required |
42 | | -------- | ------------------------------------ | ----------------------------------- |
43 | | 1-15 | TeX Live, MiKTeX, or MacTeX | Windows, Mac OS X, and Linux (Any) |
44 |
45 |
46 | We also provide a PDF file that has color images of the screenshots/diagrams used in this book. [Click here to download it](https://packt.link/7hkX1).
47 |
48 | ### Related products
49 | * LaTeX Cookbook [[Packt]](https://www.packtpub.com/product/latex-cookbook/9781784395148?utm_source=github&utm_medium=repository&utm_campaign=9781784395148) [[Amazon]](https://www.amazon.com/dp/1784395145)
50 |
51 | * LaTeX Beginner’s Guide - Second Edition [[Packt]](https://www.packtpub.com/product/latex-beginners-guide-second-edition/9781801078658?utm_source=github&utm_medium=repository&utm_campaign=9781801078658) [[Amazon]](https://www.amazon.com/dp/1847199860)
52 |
53 | ## Errata:
54 |
55 | * Page 52: At the end of the first code section,
56 | ```
57 | ]]
58 | ```
59 |
60 | _should be_
61 |
62 | ```
63 | ]
64 | ```
65 |
66 | ## Get to Know the Author
67 | **Stefan Kottwitz**
68 | studied mathematics in Jena and Hamburg. He works as a network and IT security engineer for Lufthansa Industry Solutions. For twenty years, he has been providing LaTeX support in online forums. He maintains several LaTeX web forums in English, French, and German languages. He runs TikZ graphics gallery web sites, the TeXlive online compiler, the TeXdoc online service, and a CTAN software mirror. He is a moderator of the TeX and LaTeX Stack Exchange site since 2010. He publishes ideas and news from the TeX world on blogs and on Twitter. Before this book, he authored the LaTeX Beginner's Guide in 2011 and the second edition in 2021, and the LaTeX Cookbook in 2015, all published by Packt.
69 |
--------------------------------------------------------------------------------