Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
LaTeX Graphics with TikZ
LaTeX Graphics with TikZ

LaTeX Graphics with TikZ: A practitioner's guide to drawing 2D and 3D images, diagrams, charts, and plots

eBook
AU$34.98 AU$49.99
Paperback
AU$61.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

LaTeX Graphics with TikZ

Creating the First TikZ Images

This chapter will work with the most basic but essential concepts.

Specifically, our topics are as follows:

  • Using the tikzpicture environment
  • Working with coordinates
  • Drawing geometric shapes
  • Using colors

This gives us the foundation to move on to more complex drawings in the upcoming chapters.

It’s good if you already know the basics of geometry and coordinates, but we will have a quick look at the parts we need.

By the end of this chapter, you’ll learn how to create colored drawings with lines, rectangles, circles, ellipses, and arcs and how to position them in a coordinate system.

Technical requirements

You need to have LaTeX on your computer, or you can use Overleaf to compile the code examples of this chapter online. Alternatively, you can go with the book’s website, where you can open, edit, and compile all examples. You can find the code for this chapter at https://tikz.org/chapter-02.

The code is also available on GitHub at https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/tree/main/02-First-steps-creating-TikZ-images.

Using the tikzpicture environment

In the previous chapter, we saw that we basically load TikZ and then use a tikzpicture environment that contains our drawing commands. Let’s go step by step to create a document that will be the base of all our drawings in this chapter. Our goal is to draw a rectangular grid with dotted lines. Such a grid is really beneficial in positioning objects in our pictures later on. I usually start with such a helper grid, make my drawing, and take the grid out in the final version of the drawing.

As it’s one of our first TikZ examples, we will do it step by step and then discuss how it works:

  1. Open your LaTeX editor. Start with the standalone document class. In the class options, use the tikz option and define a border of 10 pt:
    \documentclass[tikz,border=10pt]{standalone}
  2. Begin the document environment:
    \begin{document}
  3. Next, begin a tikzpicture environment:
    \begin{tikzpicture}
  4. Draw a thin, dotted grid from the coordinate (-3,-3) to the coordinate (3,3):
    \draw[thin,dotted] (-3,-3) grid (3,3);
  5. To better see where the horizontal and vertical axis is, let’s draw them with an arrow tip:
    \draw[->] (-3,0) -- (3,0);
    \draw[->] (0,-3) -- (0,3);
  6. End the tikzpicture environment:
    \end{tikzpicture}
  7. End the document:
    \end{document}

Compile the document and look at the output:

Figure 2.1 – A rectangular grid

Figure 2.1 – A rectangular grid

In step 1, we used the standalone document class. That class allows us to create documents that consist only of a single drawing and cuts the PDF document to the actual content. Therefore, we don’t have an A4 or letter page with just a tiny drawing, plus a lot of white space and margins.

To get a small margin of 10 pt around the picture, we wrote border=10pt because, with a small margin, it looks nicer in a PDF viewer. Since the standalone class is designed for drawings, it provides a tikz option. As we set that option, the class loads TikZ automatically, so we don’t have to add \usepackage{tikz} anymore.

After we started the document in step 1, we opened a tikzpicture environment in step 3. Every drawing command will happen in this environment until we end it. As it’s a LaTeX environment, it can be used with optional arguments. For example, we could write \begin{tikzpicture}[color=red] to get everything we draw in red unless we specify otherwise. We will talk about valuable options later in this book.

Step 4 was our main task of drawing a grid. We used the \draw command that we will see exceptionally often throughout this book. We specified the following:

  • How: We added thin and dotted options in square brackets because that’s the LaTeX syntax for optional arguments. So, everything the \draw command does will now be in thin and dotted lines.
  • Where: We set (-3,-3) as the start coordinate and (3,3) as the end coordinate. We will look thoroughly at the coordinates in the next section.
  • What: The grid element is like a rectangle where one corner is the start coordinate, to the left of it, and the other corner is the end coordinate, to the right of it. It fills this rectangle with a grid of lines. They are, as we required before, thin and dotted.

\draw produces a path with coordinates and picture elements in between until we end with a semicolon. We can sketch it like the following:

\draw[<style>] <coordinate> <picture element> <coordinate> ... ;

Every path must end with a semicolon. Paths with coordinates, elements, and options can be pretty complex and flexible – the rule to end paths with a semicolon allows TikZ to parse and understand where such paths end and other commands follow.

The lines in a grid have a distance of 1 by default. The optional step argument can change that. For example, you could write grid[step=0.5] or do that right at the beginning as the \draw option, such as the following:

\draw[thin,dotted,step=0.5] <coordinate>
  <picture element> <coordinate> ... ;

In step 5, we have drawn two lines. The picture element here is a straight line between the coordinates given. We use the convenient -- shortcut that stands for a line. The -> style determines that we shall have an arrow tip at the end. In the next section, we will draw many lines.

Finally, we just ended the tikzpicture and document environments.

TikZ, document classes, and figures

In this book, we will focus on TikZ picture creation. Remember that we can use TikZ with any LaTeX class, such as article, book, or report. Furthermore, TikZ pictures can be used in a figure environment with label and caption, just like \includegraphics.

While this section showed a manageable number of commands, we should have a closer look at the concept of coordinates, which is now the topic of our next section.

Working with coordinates

When we want TikZ to place a line, a circle, or any other element on the drawing, we need to tell it where to put it. For this, we use coordinates.

Now, you may remember elementary geometry from school or have looked at a good geometry book. In our case, we will use our knowledge of geometry mainly to position elements in our drawings.

Let’s start with classic geometry and how to use it with TikZ.

Cartesian coordinates

You may remember the Cartesian coordinate system you learned in school. Let’s quickly recap it. In the two dimensions of our drawing, we consider an x axis in the horizontal direction going from left to right and a y axis in the vertical order going from bottom to top. Then, we define a point by its distance to each axis. Let’s look at it in a diagram:

Figure 2.2 – Cartesian coordinate system

Figure 2.2 – Cartesian coordinate system

In Figure 2.2, we see a point (0,0) that we call the origin. It has a distance of zero to each axis. Then there’s the point, (1,2), that has a distance to the origin in a positive x direction of 1 and a positive y direction of 2. Similarly, for the (-2,1) point, we have an x value of -2, since it goes in the negative direction, and a y value of -1 for the same reason.

Labels at the x axis and y axis and a grid help us to see the dimensions. We will reuse the grid from Figure 2.1 when we next draw lines.

Remember, we draw elements between coordinates, and -- is the code for a line. So, the following command draws a line between the (2,-2) and (2,2) coordinates:

\draw (2,-2) -- (2,2);

We can add more coordinates and lines to this command – let’s make it a square. And to better see it over the grid, let’s make it have very thick blue lines:

\draw[very thick, blue] (-2,-2) -- (-2,2)
  -- (2,2) -- (2,-2) -- cycle;

Here, cycle closes the path, so the last line returns to the first coordinate.

The full context – that is, the complete LaTeX document with the cycle command – is highlighted in the code for Figure 2.1:

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
  \draw[thin,dotted] (-3,-3) grid (3,3);
  \draw[->] (-3,0) -- (3,0);
  \draw[->] (0,-3) -- (0,3);
  \draw[very thick, blue] (-2,-2) -- (-2,2)
    -- (2,2) -- (2,-2) -- cycle;
\end{tikzpicture}
\end{document}

When you compile this document, you get this picture:

Figure 2.3 – A square in Cartesian coordinates

Figure 2.3 – A square in Cartesian coordinates

We used the \draw command to put lines at and between coordinates. How about something else? In TikZ, we can draw a circle with a certain radius as an element, with that radius as an argument in parentheses, such as circle (1) with a radius of 1. Let’s replace the -- lines with that and remove the now unnecessary cycle, and the command now looks like this:

\draw[very thick, blue] (-2,-2) circle (1) (-2,2)
  circle (1) (2,2) circle (1) (2,-2) circle (1);

Compile, and you get this in the PDF document:

Figure 2.4 – Circles in Cartesian coordinates

Figure 2.4 – Circles in Cartesian coordinates

This example emphasizes how we use the \draw command – as a sequence of coordinates with picture elements at those coordinates. As you saw, we can draw several elements in a single \draw command.

With Cartesian coordinates, it was easy to draw a square. But how about a pentagon? Or a hexagon? Calculating corner coordinates looks challenging. Here, angle- and distance-based coordinates can be more suitable; let’s look at this next.

Polar coordinates

Let’s consider the same plane as we had in the last section. Just now, we define a point by its distance to the origin and the angle to the x axis. Again, it’s easier to see it in a diagram:

Figure 2.5 – Polar coordinate system

Figure 2.5 – Polar coordinate system

We have a point with the polar coordinates (60:2), which means a distance of 2 from the origin with an angle of 60 degrees to the x axis. TikZ uses a colon to distinguish it from Cartesian coordinates in polar coordinate syntax. The syntax is (angle:distance). So, (20:2) also has a distance of 2 to the origin, (0:0), and an angle of 20 degrees to the x axis, and (180:3) has a distance of 3 and an angle of 180 degrees.

Now, it becomes easier to define points for a hexagon – we specify the angles in multiples of 60 degrees, and all have the same distance from the origin, (0:0); let’s choose 2. Our drawing command becomes as follows:

  \draw[very thick, blue] (0:2) -- (60:2) -- (120:2)
    -- (180:2) --(240:2) -- (300:2) -- cycle;

With the same grid code in the LaTeX document from the previous sections, we get this result from compiling:

Figure 2.6 – A hexagon in polar coordinates

Figure 2.6 – A hexagon in polar coordinates

Polar coordinates are handy when we think of points by distance, rotation, or direction.

Until now, everything was two-dimensional; now, let’s step up by one dimension.

Three-dimensional coordinates

We could use a projection on our drawing plane if we want to draw a cube, a square, or spatial plots. The most famous is isometric projection.

TikZ provides three-dimensional coordinate systems and options. Here is a quick view of how we can use them:

  • Specify x, y, and z coordinates that shall be the projection of our three-axis vectors:
    \begin{tikzpicture}[x={(0.86cm,0.5cm)},
      y={(-0.86cm,0.5cm)}, z={(0cm,1cm)}]
  • Use three coordinates now. We will draw the same square as in Figure 2.3, with 0 as the z value, so still in the xy plane:
    \draw[very thick, blue] (-2,-2,0) -- (-2,2,0)
      -- (2,2,0) -- (2,-2,0) -- cycle;

For a better view, we shall again draw axes, as shown in Figure 2.3. Furthermore, we add a circle with a radius of 2. With the necessary aforementioned code highlighted, the full code example is as follows:

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\sffamily
\begin{tikzpicture}[x={(0.86cm,0.5cm)},
  y={(-0.86cm,0.5cm)}, z={(0cm,1cm)}]
  \draw[very thick, blue] (-2,-2,0) -- (-2,2,0)
   -- (2,2,0) -- (2,-2,0) -- cycle;
  \draw[->] (0,0,0) -- (2.5, 0,  0) node [right] {x};
  \draw[->] (0,0,0) -- (0,  2.5, 0) node [left] {y};
  \draw[->,dashed] (0,0,0) -- (0,  0, 2.5) node [above] {z};
  \draw circle (2);
\end{tikzpicture}
\end{document}

This gives us a skewed view, where the axes and circle help in recognizing it as a 3D isometric view:

Figure 2.7 – The square and circle in three dimensions

Figure 2.7 – The square and circle in three dimensions

In later chapters, we will work with additional libraries and packages for three-dimensional drawing.

Until now, we have used only absolute coordinates, which refer to the origin and axes. How about a reference to another point, with a distance or angle? We will now look at that.

Using relative coordinates

When we use \draw with a sequence of coordinates, we can state the relative position to the first coordinate by adding a + sign. So, +(4,2) means the new coordinate is plus 4 in the x direction and plus 2 in the y direction. Note that with +, it is always relative to the first coordinate in this path section.

Let’s try this in our code with the grid from Figure 2.3:

\draw[very thick, blue] (-3,-1) -- +(1,0)
  -- +(2,2) -- +(4,2) -- +(5,0) -- +(6,0);

Compile, and you get the following:

Figure 2.8 – Drawing with relative coordinates

Figure 2.8 – Drawing with relative coordinates

That’s not so handy – always looking back to the first coordinate. Luckily, TikZ offers another syntax with double plus signs. For example, ++(1,2) means plus one in the x direction and plus 2 in the y direction, but from the previous point. That means we can move step by step.

The modified drawing command for the same output is as follows:

\draw[very thick, blue] (-3,-1) -- ++(1,0)
  -- ++(1,2) -- ++(2,0) -- ++(1,-2) -- ++(1,0);

We get the same drawing as shown in Figure 2.8; currently, it’s much easier to follow the movement from one coordinate to the next. That’s why this syntax is pretty popular. Remember that -- here is not the negative version of ++; it’s the line element. The use of -- ++ together can look confusing, but they are two different things – a line and a relative positioning modifier.

Using units

You may already have wondered what a coordinate, (1,2), or a radius of 2 can mean in a document regarding the size of the PDF. Mathematically, in a coordinate system, it’s clear, but in a document, we need actual width, height, and lengths.

So, by default, 1 means 1 cm. You can use any LaTeX dimension, so you can also write (8mm,20pt) as a coordinate or (60:1in) for 60 degrees with a 1-inch distance.

You can change the default unit lengths of 1 cm to any thing else you like. If you write \begin
{tikzpicture}[x=3cm,y=2cm]
you get x = 1 as 3 cm, and y = 1 will be 2 cm. So, (2,2) would mean the point, (6cm,4cm). It’s an easy way of changing the dimensions of a complete TikZ drawing. For example, change x and y to be twice as big in the tikzpicture options to double a picture in size.

We have now seen how to draw lines, circles, and a grid. Let’s look at more shapes now.

Drawing geometric shapes

We want to progress from high-speed to advanced TikZ concepts, so let’s have a compact summary of what we can draw in this basic setting – that is, we start with \draw <coordinate> (that’s the current coordinate) and continue with some of the following elements:

  • Line: -- (x,y) draws a line from the current coordinate to (x,y).
  • Rectangle: rectangle (x,y) draws a rectangle where one corner is the current coordinate, and the opposite corner is (x,y).
  • Grid: Like rectangle but with lines in between as a grid.
  • Circle: circle (r) was a short syntax we used previously, but the extended syntax is circle [radius=r], which draws a circle with the center at the current coordinate and a radius of r.
  • Ellipse: ellipse [x radius = rx, y radius = ry] draws an ellipse with a horizontal radius of rx and a vertical radius of ry. The short form is ellipse (rx and ry).
  • Arc: arc[start angle=a, end angle=b, radius=r] gives a part of a circle with a radius of r at the current coordinate, starting from angles a to angles b. The short command version is arc(a:b:r).

arc[start angle=a, end angle=b, x radius=rx, y radius=ry] gives a part of an ellipse with an x radius of rx and a y radius of ry at the current coordinate, starting from angle a and going to angle b. The short syntax would be arc(a:b:rx and ry).

Let’s have a few examples to see what these commands do:

  1. Draw a circle with a radius of 2 at the origin:
    \draw (0,0) circle [radius=2];
  2. Next, draw an ellipse with a horizontal radius of 0.2 and a vertical radius of 0.4:
    \draw (-0.5,0.5,0) ellipse [x radius=0.2, y radius=0.4];
  3. Now, draw the same ellipse at (0.5,0.5):
    \draw (0.5,0.5) ellipse [x radius=0.2, y radius=0.4];
  4. Next, draw an arc that looks like a smile:
    \draw (-1,-1) arc [start angle=185, end angle=355,
      x radius=1, y radius=0.5];
  5. Finally, draw a rectangle with the lower-left corner at -3,-3 and the upper-right corner at 3,3:
    \draw (-3,-3) rectangle (3,3);

When you use all the commands from steps 1 to 5 in a tikzpicture environment and compile, you get the following:

Figure 2.9 – A smiley in a rectangle

Figure 2.9 – A smiley in a rectangle

This result of the command examples still looks a bit dull. Let’s improve it a bit and fill it with color.

Using colors

We can add colors as options to \draw, as we did for Figure 2.3 when we added blue lines. When we look at circles, ellipses, and rectangles, we can see that the element can have one color while the inner area can have another color. We can add the latter using the fill option.

It’s easier to see it with an example – to draw a blue circle filled with yellow. For this, we can write the following:

\draw[blue,fill=yellow] (0,0) circle [radius=2];

Let’s now fill colors in Figure 2.9. We’ll use fill=yellow for the circle, fill=black for the ellipses, and make the arc thicker by using very thick. Also, let’s omit the rectangle. Our commands are as follows, in a complete document, with the changes highlighted:

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
  \draw[fill=yellow] (0,0) circle [radius=2];
  \draw[fill=black] (-0.5,0.5,0)
    ellipse [x radius=0.2, y radius=0.4];
  \draw[fill=black] (0.5,0.5,0)
    ellipse [x radius=0.2, y radius=0.4];
  \draw[very thick] (-1,-1) arc [start angle=185,
    end angle=355, x radius=1, y radius=0.5];
\end{tikzpicture}
\end{document}

When we compile this document, we get the following:

Figure 2.10 – A smiley with color

Figure 2.10 – A smiley with color

TikZ has another way of filling called shading. Instead of filling with a uniform color, shading fills an area with a smooth transition between colors. For our smiley, we chose a predefined ball shading that gives a three-dimensional impression. We set the shading=ball and ball color=yellow options for the face, and ball color=black for the eyes. The code becomes the following:

\draw[shading=ball, ball color=yellow] (0,0)
  circle [radius=2];
\draw[shading=ball, ball color=black] (-0.5,0.5,0)
  ellipse [x radius=0.2, y radius=0.4];
\draw[shading=ball, ball color=black] (0.5,0.5,0)
  ellipse [x radius=0.2, y radius=0.4];
\draw[very thick] (-1,-1) arc [start angle=185,
  end angle=355, x radius=1, y radius=0.5];

Now, our four draw commands produce an even fancier smiley:

Figure 2.11 – A smiley with a three-dimensional appearance

Figure 2.11 – A smiley with a three-dimensional appearance

In Chapter 7, Filling, Clipping, and Shading, we will learn more about choosing and mixing colors and explore various ways of filling areas with colors.

Summary

In this chapter, we got used to the basic TikZ syntax, and we learned to draw with different kinds of coordinates. We saw how to draw lines, rectangles, grids, circles, ellipses, and arcs, and how to color them.

Combining text and shapes with alignment options is even more important and worthwhile. That’s the concept of nodes, which we will explore in the next chapter.

Further reading

The TikZ manual includes some excellent tutorials in Part I, Tutorials and Guidelines. You can find the manual at https://texdoc.org/pkg/tikz in PDF format and https://tikz.dev/tutorials-guidelines.

Coordinates and coordinate systems are explained in depth in Part III, Section 13, Specifying Coordinates, and online at https://tikz.dev/tikz-coordinates.

The geometric shapes we learned to draw in this chapter are called path operations in the TikZ manual. Part III, Section 14, Syntax for Path Specifications, is the reference for them. You can read that section online at https://tikz.dev/tikz-paths.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Achieve native construction of images and diagrams in your LaTex theses, articles, or books with enhanced quality
  • Discover comprehensive explanations and real-world use cases to apply in your own endavors
  • Explore customizations and tweaks to grasp the synergy of LaTeX and TikZ graphics

Description

In this first-of-its-kind TikZ book, you’ll embark on a journey to discover the fascinating realm of TikZ—what it’s about, the philosophy behind it, and what sets it apart from other graphics libraries. From installation procedures to the intricacies of its syntax, this comprehensive guide will help you use TikZ to create flawless graphics to captivate your audience in theses, articles, or books. You’ll learn all the details starting with drawing nodes, edges, and arrows and arranging them with perfect alignment. As you explore advanced features, you’ll gain proficiency in using colors and transparency for filling and shading, and clipping image parts. You’ll learn to define TikZ styles and work with coordinate calculations and transformations. That’s not all! You’ll work with layers, overlays, absolute positioning, and adding special decorations and take it a step further using add-on packages for drawing diagrams, charts, and plots. By the end of this TikZ book, you’ll have mastered the finer details of image creation, enabling you to achieve visually stunning graphics with great precision.

Who is this book for?

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.

What you will learn

  • Understand the TikZ language and how to use its libraries and packages
  • Draw geometric shapes with text and add arrows, labels, and decorations
  • Apply transformations and use transparency, shading, fading, and filling features
  • Define styles and program with loops to streamline your code
  • Build trees, graphs, and mind maps and draw easy curves with smooth transitions
  • Produce block diagrams and flow charts to visualize process steps
  • Generate line charts and bar charts to showcase your data
  • Plot data sets and mathematical functions in two and three dimensions
Estimated delivery fee Deliver to Australia

Economy delivery 7 - 10 business days

AU$19.95

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 09, 2023
Length: 304 pages
Edition : 1st
Language : English
ISBN-13 : 9781804618233
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to Australia

Economy delivery 7 - 10 business days

AU$19.95

Product Details

Publication date : Jun 09, 2023
Length: 304 pages
Edition : 1st
Language : English
ISBN-13 : 9781804618233
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 182.97
LaTeX Beginner's Guide
AU$64.99
LaTeX Graphics with TikZ
AU$61.99
LaTeX Cookbook
AU$55.99
Total AU$ 182.97 Stars icon

Table of Contents

17 Chapters
Chapter 1: Getting Started with TikZ Chevron down icon Chevron up icon
Chapter 2: Creating the First TikZ Images Chevron down icon Chevron up icon
Chapter 3: Drawing and Positioning Nodes Chevron down icon Chevron up icon
Chapter 4: Drawing Edges and Arrows Chevron down icon Chevron up icon
Chapter 5: Using Styles and Pics Chevron down icon Chevron up icon
Chapter 6: Drawing Trees and Graphs Chevron down icon Chevron up icon
Chapter 7: Filling, Clipping, and Shading Chevron down icon Chevron up icon
Chapter 8: Decorating Paths Chevron down icon Chevron up icon
Chapter 9: Using Layers, Overlays, and Transparency Chevron down icon Chevron up icon
Chapter 10: Calculating with Coordinates and Paths Chevron down icon Chevron up icon
Chapter 11: Transforming Coordinates and Canvas Chevron down icon Chevron up icon
Chapter 12: Drawing Smooth Curves Chevron down icon Chevron up icon
Chapter 13: Plotting in 2D and 3D Chevron down icon Chevron up icon
Chapter 14: Drawing Diagrams Chevron down icon Chevron up icon
Chapter 15: Having Fun with TikZ Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(28 Ratings)
5 star 96.4%
4 star 0%
3 star 3.6%
2 star 0%
1 star 0%
Filter icon Filter
Most Recent

Filter reviews by




Kim Plunkett Jul 23, 2024
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Good but some of the code examples contain errors.
Feefo Verified review Feefo
Adam Jakubowski Apr 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
An excellent introduction to basic features of TikZ. LaTeX users will find it very useful, as it allows to avoid reading a thousand pages long TikZ manual. Well written.
Amazon Verified review Amazon
Monadic Reviewer Mar 07, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Pure fun
Amazon Verified review Amazon
Chet L. Feb 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
LaTeX has a lot of capabilities that can overwhelm one new to this tool. This book gives a lot of great examples that demonstrate the various features this typesetting tool has. There are also several great videos on YouTube that help newcomers.
Amazon Verified review Amazon
Werner H. Feb 19, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Following the tradition in the LaTeX world I shall write this comment in English."LaTeX Graphics with TikZ" by Stefan Kottwitz is outstanding. From the very first and simple graphics in a standalone environment he takes the reader on a well structured journey through the world of TikZ. The reader can follow every step as Stefan explains the commands in depth. Additionally, he provides all the code snippets (including his illustration source code, so the advanced user can even delve deeper) on a web page created for this book.The above said illustrates that this book is superior to the TikZ manual or the 15-page-chapter of the "LaTeX companion - 3rd edition", so I highly recommend this book to every person interested in drawing in the LaTeX environment.My background:Having started with LaTeX as a teacher of chemistry who wants to express certain concepts and thoughts in a reproducable and visually nice way I stumbled upon the TikZ manual on CTAN. It took me hours on hours to achieve my goals (including wide range internet research) without having a comprehensive source that gave me a methodically well structured start. Having bought "LaTeX Graphics with TikZ" I am able to really understand and make use of TikZ for my teaching material.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela