TikZ is a higher-level drawing language built on top of the PGF graphics framework. For questions specifically about the PGF layer use {pgf-core} instead. Both tags are possible on the same question. The tag {diagrams} is also compatible with this tag.

learn more… | top users | synonyms (3)

175
votes
4answers
27k views

Drawing on an image with TikZ

Recently I have learned how to draw simple stuff with TikZ. I really like it. Now I wonder if it is possible to draw with TikZ on a image. Instead of pasting a image in Illustrator and adding some ...
67
votes
2answers
11k views

Should \tikzset or \tikzstyle be used to define TikZ styles?

The PGF/TikZ manual states in section 12.4 Using Graphic Options, page 120 (v2.10), that TikZ styles can be set using: \tikzset{my style/.style={<tikz options>},...} However, in several ...
46
votes
1answer
5k views

Difference between “right of=” and “right=of” in PGF/TikZ

In the PGF/TikZ manual, sometimes I see the option right of=somenode instead of right=of somenode. They look very similar, but the effects are different. The distance between nodes positioned with ...
56
votes
5answers
32k views

How to install a current version of TikZ?

TikZ is undergoing lots of development with new features being added, but the versions distributed with standard TeX releases are often a little old. How do I get the latest version? If I want to be ...
126
votes
8answers
31k views

Is it possible to change the size of an arrowhead in TikZ/PGF?

I'm trying to draw an arrow with a bigger head than normal. Is it possible without changing the style of the line itself?
18
votes
2answers
3k views

Mindmap tikzpicture in beamer (reveal step by step)

I want to include a tikzpicture (mindmap) in beamer and I want the children to appear one after the other. So I use \visible but it don't works -- also not with \pause command. I get errors regarding ...
65
votes
5answers
16k views

Cool Text Highlighting in LaTeX

LaTeX has soul. ConTeXt, of course, has beautifully marked up "sharpie" highlighting, where you can put sweet hightligher under your text for free! In the pictured example, you can see highlights ...
44
votes
1answer
3k views

Manual/automatic line breaks and text alignment in TikZ nodes

How can I insert a line break in a TikZ node? Simply putting \\ where I want the break doesn't work (see MWE). Is there a way to make lines break automatically at some specified width? And can I ...
61
votes
11answers
25k views

Good way to make \textcircled numbers?

I'm trying to make some good-looking numbers in a circle, using the simple command: \textcircled{1} However, the circle is misaligned vertically with the number, and look a bit sloppy: Any ...
37
votes
6answers
12k views

TikZ: How to draw an arrow in the middle of the line?

Like this: .------<------. | | v ^ | | '------>------' I am currently using \begin{scope}[very thick,->] \draw (-4,1)--(-4,0)--(0.1,0); \draw ...
24
votes
3answers
4k views

Extract x, y coordinate of an arbitrary point in TikZ

I need a macro to extract the x and y coordinates from an arbitrary point, like (3,4), or like (A), or like ([xshift=-2pt] A.north west), where A is the name of a node. I've seen the solution ...
30
votes
6answers
3k views

How can I invert a 'clip' selection within TikZ?

I wish to draw an arc for a reflex angle on the outside of a triangle with coordinates (A), (B) and (C). If I wanted to draw the arc inside the triangle I could use something like \begin{scope} ...
34
votes
4answers
4k views

Vertical and horizontal lines in pgf-tikz

It is easy to produce a path between two nodes consisting of a single horizontal and a single vertical line (from the manual): \begin{tikzpicture} \draw (0,0) node(a) [draw] {A} (1,1) node(b) ...
17
votes
2answers
1k views

Highlighting in Beamer using TikZ nodes

This question led to a new package: aobs-tikz Is it possible to alter the code in the following MWE to the effect that “ABCD” is visible on both slides but only on the second it has the red ...
23
votes
4answers
4k views

How to draw arrows between parts of an equation to show the Math Distributive Property (Multiplication)?

there is a part of my paper where I use the distributive property and it's not that clear for the reader to see (I'm using in proposional logic for a proof). The logic equation (part of) is: (l_{1}) ...
152
votes
11answers
22k views

How can we draw a Christmas tree with decorations, using TikZ?

I would like to use TikZ for drawing a christmas tree. Here's a start, I used the lindenmayersystems library for drawing a tree: \documentclass{article} \usepackage{tikz} ...
21
votes
2answers
1k views

tikzmark to have different behaviour if first run (and mark locations not yet available)

The macro \tikzmark has been incredibly useful to me, but do not like the default behavior upon first run. So, I would like to be able to determine if this is a first run (where there coordinates of ...
11
votes
2answers
2k views

Using a pgfplots-style legend in a plain-old tikzpicture

I am using a plain-old tikzpicture to produce a pie-chart-like plot. Now, all other plots in my paper are handled using pgfplots (which doesn't do pie charts) and have their legend typeset by ...
51
votes
7answers
18k views

How to draw Venn diagrams (especially: complements) in LaTeX

What I am up to is to write some exercises dealing with logical formulas for my students, like: And the students should draw these formulas on Venn diagrams. At the end of the lesson, I really ...
50
votes
4answers
3k views

How to scale a tikzpicture to \textwidth

I would like to scale my tikzpicture to exactly (or a proportion of) the \textwidth Of course I could play with the [scale=0.5] option until I found the right value, but I assume there must be an ...
33
votes
2answers
9k views

How to make beamer overlays with Tikz node

I have a diagram of 4 nodes in my beamer slide. \begin{figure}[h] \begin{centering} \begin{tikzpicture}[system/.style={draw,rectangle,rounded corners=3,minimum width=2cm,text width=1.8cm,text ...
28
votes
2answers
2k views

Axis break in pgfplots

Is there an easy way to 'break' the axis in a pgfplots environment? What I'm talking about is something like this Any minimal plot will do as an example...for example \documentclass{minimal} ...
22
votes
1answer
10k views

Export eps figures from TikZ

Section 32 Externalization Library of the pgfmanual (v2.10) explains how to generate PDF figures and EPS figures. I successfully tried it with PDF output (there is an example with a full explanation ...
23
votes
4answers
4k views

How to place a node in the middle of an arc?

I think it is a simple question, but I didn't find the answer yet. The code I'm using is the following: \draw[->](1,0) arc(0:-30:1) node[midway]{$30$}; But in this way the node is placed at the ...
42
votes
2answers
7k views

Drawing simple 3D cylinders in TikZ

I'm trying to draw some simple 3D objects in TikZ. I can do spheres and cuboids okay, but I'm struggling with circular cylinders: When rotating the scene (I use tikz-3dplot for this), the end faces ...
49
votes
6answers
3k views

Materials for learning TikZ

I feel intimidated in learning TikZ. I was wondering if there are some nice materials (or just your replies) at different level: for providing big picture, which is important to beginners to not ...
38
votes
4answers
5k views

How do you draw the “snake” arrow for the connecting homomorphism in the snake lemma?

How does one draw the "snake" arrow for the connecting homomorphism when using the snake lemma? I'd also be interested in drawing similar arrows act as "carriage returns" when considering a long ...
21
votes
1answer
6k views

Custom and built in TikZ fill patterns

I can't find much information about creating TikZ fill patterns or even using the custom built-in patterns. Look to do all the common fills like lines, hatches, dots, stars, etc... I need to be able ...
15
votes
1answer
1k views

Background coloring with overlay specification in algorithm2e + beamer package

I want to highlight some portion of my pseudo codes in my slides during the course of presentation. It's easy in powerpoint and I've made a sample slide: However, I couldn't manage to get a similar ...
21
votes
9answers
3k views

TikZ: changing colour of a path half way along

Here's the problem: \documentclass{minimal} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale = 3, foo/.style={line width = 5pt}] \draw[foo,red] (0,0) -- (0,1); \draw[foo,blue] (0,1) -- ...
82
votes
8answers
7k views

Simulating hand-drawn lines

I am working on a project that will have some vector graphics, perhaps using TikZ (or a similar tool). All of the graphics consists of lines, in shades of gray. However, the lines from TikZ appear too ...
69
votes
4answers
5k views

How to create magnified subfigures and corresponding boxes for portions of a large image

Updated Below I hope the title gets at what I'm trying to do. I have a large image for a thesis on an image processing topic, and I want show the large image, with zoomed in boxes (typically with the ...
29
votes
2answers
2k views

“Z-level” in TikZ

This is an idle question, but neverthless, I think it's interesting. Does TikZ have a simple way to implement a "z-level" specification. By this, I don't mean 3D drawing, I mean specifying which ...
29
votes
2answers
2k views

Drawing heatmaps using TikZ

Introduction I want to create a heatmap using TikZ. You can see the basic idea in the picture below: I basically have a table of values and each value is assigned a color. The picture is the result ...
9
votes
2answers
2k views

Package PGF Math Error: Unknown operator `o' or `of'

I am getting a weird error while trying to place a node above another node using the below= syntax. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[] (node1) at ...
73
votes
10answers
17k views

List of available TikZ libraries with a short introduction

Quick links: Summary ❧ Intersections library ❧ Arrow tips library ❧ Calc library ❧ Mindmap Library ❧ Shapes library ❧ Paper Folding Library ❧ Chains Library ❧ Shapes library Very often I ...
78
votes
8answers
4k views

Sieve of Eratosthenes in tikz

I am writing notes for my students under the topic of prime factorization and I needed to illustrate the Sieve of Eratosthenes and this is what I came up with in tikz: \documentclass{article} ...
56
votes
2answers
15k views

Easy curves in TikZ

I find myself needing to draw lots of elegantly curved paths in TikZ. Ideally, I'd just specify a series of points, and TikZ would calculate the extra data itself to draw a nice series of curves ...
35
votes
3answers
8k views

pgfplots: how can I scale to text width?

This question led to a new package: tikzscale When I try to scale a plot with: width=\textwidth there is some horizontal space between the start/end of the plot and the start/end of the ...
28
votes
3answers
11k views

3D bodies in TikZ

Is there like a library that has default geometric figures like the ones shown below. Am not acquainted yet with 3D diagrams in TikZ.
22
votes
4answers
2k views

How to draw tangent line of an arbitrary point on a path in TikZ

Suppose I specify some node as occurring at some point on a path. Say for example the node (P) defined on the following path. \path[draw] (0,9) to[out=-90,in=180] (9,0) node[pos=0.7,circle] (P) {}; ...
20
votes
3answers
2k views

Using opacity in TikZ causes strange rendering in Acrobat.

I have a problem using opacity in TikZ. Whenever I use it somewhere in a picture, I get weird side-effects: colors in (some) other parts of the documents are changed apparently randomly and it makes ...
37
votes
8answers
6k views

How to draw a torus

Is there an easy way to draw a contour image of torus below with tikz? Or for that matter with any other graphics package.
26
votes
3answers
2k views

Parametrize shading in table through TikZ

I wanted to do some shading in a table according to its values. For example, if you see the table below: a b c d a 90 10 0 0 b 0 80 10 10 c 0 0 95 5 d 0 10 5 85 I want to ...
24
votes
2answers
4k views

Unknown error using tikz matrix of nodes in beamer

I am having trouble getting a basic example of a matrix of notes to show up in my beamer presentation. I am using the code copied from the pgf manual. Here is a complete working example. The error I ...
15
votes
1answer
3k views

TikZ \foreach loop with macro-defined list

I have a small problem with the TikZ \foreach loop whenever the list, over which we loop, is defined my a macro. The following code example will show my problem: \documentclass{scrartcl} ...
10
votes
2answers
806 views

Problem with overlay when a tikzpicture is inside another tikzpicture

update i discovered lately this question where Nickolay Kolev uses \tikz inside a tikzpicture environment. A lot of users think that is a wrong practice and I agree that is very strange but sometimes ...
19
votes
2answers
2k views

PGFplots foreach equivalent to TikZ's with multiple variables separated by a slash

I like TikZ's capability to traverse multiple variables separated by a slash in the foreach (as in the example below). I am looking for something equivalent in PGFplots? I saw in the documentation ...
8
votes
1answer
142 views

Measuring align

From what I read it seems that align environments are processed twice: the first time for measuring, the second time for actual typesetting. My question is whether one can get access to these ...
69
votes
3answers
3k views

Fundamental differences : PSTricks, TikZ/PGF and others

OK, since this is a pretty vague and subjective question. I need to set up some borders around the discussion that I intend to benefit from. But before anything, I certainly do NOT want to excite the ...