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)

11
votes
2answers
3k 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 ...
10
votes
2answers
913 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 ...
86
votes
10answers
24k 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 ...
72
votes
2answers
22k 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 ...
39
votes
3answers
11k 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 ...
35
votes
1answer
1k views

Hobby path realization in convex hull approach

Motivation In the answer Highlight a group of nodes in a tikz tree, Jake suggested combining the convex hull approach from padded boundary of convex hull with the hobby path and I was really ...
22
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 ...
16
votes
3answers
2k views

Drawing different tikz shapes parameterized by data from a file

I have a file with three columns of data, x, y, r. # x y r 1 1 0.1 2 2 0.5 3 3 1.2 and so on. I'd like to loop over the rows, and draw a circle at x,y with radius r for each row. I first thought ...
9
votes
1answer
1k views

Is it possible to change the color of a single bar when the bar plot is based on symbolic values?

I am beginner in LaTeX, trying to use it for industrial documents. I wonder if there is a way to change the color of only one bar of the plot below, ie "TestDetails", to illustrate it is a local macro ...
20
votes
2answers
3k views

Pascal's triangle in tikz

I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code \begin{tikzpicture} \foreach ...
14
votes
4answers
763 views

tikz declare function and babel french option

I would like to declare functions in tikz for multiple uses of the same function within the code. Sadly, it seems that the tikz "declare function" is not compatible with the french option in babel. ...
9
votes
1answer
158 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 ...
36
votes
3answers
9k views

Pgfplots: how to fill the area under a curve with oblique lines (hatching) as a pattern?

I want to hatch the area under a curve (graph of a function) with oblique lines on an interval (to illustrate the function's integral on that interval). This can be done elegantly in gnuplot... ...
26
votes
2answers
2k views

Mouseover events in beamer: hovering on \eqref and a comment containing the original equation popping up

This idea came into my mind while I was listening to a speaker presenting his results in a seminar, he used lots of equation references in his later slides, however I can't remember which equation he ...
42
votes
3answers
5k views

Dimensioning of a technical drawing in TikZ

Is there is an easy way to mark dimensions in a technical drawing with TikZ? Is there a library or something? Edit I am using XeLaTeX. Update I chose Martin's answer because it serves me well ...
19
votes
6answers
12k views

How to establish node-anchor-like points on a (tikz) rectangle path (is there a better method than the one described)?

Background and desired functionality Rectangles can be drawn with tikz in a number of ways, one way of doing so is to define a rectangle node as follows: \node (rectangle) [draw, rectangle] {A ...
14
votes
2answers
8k views

Plotting bell shaped curve in TikZ-PGF

I want to create some bell shaped curves for demonstrating hypothesis testing in statistics. Can anybody help me drawing curves like shown in the following picture?
24
votes
4answers
6k views

Faded drop-shadow using tikz-based rounded rectangle?

Background Epigraphs are in a box with rounded corners. The boxes have a drop-shadow. Example Picture #1 shows a shadow, while Picture #2 shows a shadow that fades out (soft blur): Problem ...
19
votes
2answers
1k views

High level digital design in TikZ

I am very new to TikZ and I have trouble making a diagram similar to the one here: My problems are specifically making MUX to get to inputs which would be on 1/3 and 2/3 of the width. Taking sigma ...
16
votes
5answers
2k views

Creating a node fitting the horizontal width of two other nodes

I have the two PGF nodes foo and bar positioned in a row. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[node ...
79
votes
6answers
4k views

What is the minimum one needs to know to use TikZ?

I am fed up with the poor quality of the pictures in the papers written by my graduate students and am trying to convince them to use TikZ. I know of three ways to begin learning TikZ: The TikZ ...
45
votes
10answers
10k views

How can I speed up LaTeX compilation?

The slowest part is a dozen of diagrams in TikZ.
45
votes
4answers
6k views

3-dimensional histogram in pgfplots

I have a simple 3d histogram which I want to import into pgfplots, e.g. using matlab2tikz or by hand. PGFplots does not offer 3d histograms. Is there an easy way to do this?
40
votes
5answers
9k views

How can I use TikZ to make standalone (SVG) graphics?

I would like to use TikZ in other settings than TeX and I'd especially like to use the drawings on websites where the text should be searchable and selectable. However, I'm unsure of the best way to ...
51
votes
6answers
15k views

What You See is What You Get (WYSIWYG) for PGF/TikZ?

Are there any WYSIWYG editors for PGF/TikZ? Perhaps something similar to LyX but for PGF/TikZ? If there is no WYSIWYG editor for this tandem, is there one perhaps that allows the user to easily ...
41
votes
5answers
4k views

3D helix torus with hidden lines

How can I generate the above image using TikZ (possibly other methods will work if they produce better looking results)? I would like to have a nicely shaded (not so dark image) without gridlines ...
25
votes
1answer
3k views

How to customize the table of contents using TikZ?

Are you aware of tentatives to customize the table of contents with TikZ? I am thinking of fancy graphical objects (coloured ovals, squares, rectangles...) coming with "chapter" or the numbering, for ...
21
votes
1answer
2k views

TikZ picture shapes

I am very new to the TikZ package, and I need to draw some flow chars by using the following shapes. However I couldn't figure out how to draw the 4th and and 6th ones below. It would be very nice ...
25
votes
2answers
2k views

How can I produce a 'ring (or wheel) chart' like that on page 88 of the PGF manual?

I really like the 'ring chart' or 'wheel chart' given as an example on page 88 of the PGF manual. It is like a pie chart, but with a label in the centre. Unfortunately, the manual doesn't give the ...
27
votes
2answers
4k views

TikZ rectangular node with different rounded corners

This is my minimal example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[rounded corners=3pt, draw, fill=red!20]{Hallo!}; \end{tikzpicture} ...
19
votes
2answers
2k views

Strange arrow mark with TikZ edge and anchors.

When I draw an edge between two nodes with anchors and globally set option [->], I get an additional arrow tip symbol at the beginning of the last edge in the path. For example in ...
22
votes
3answers
6k views

How can I set the TikZ label anchor explicitly?

I want to add a label to a node, but "inside" the node. Something like this: The manual seems to indicate it might be possible, although no actual key is named. The ... anchor point for the ...
15
votes
3answers
979 views

TikZ parallel Edges between Nodes

I'm looking for a simple way to draw the following picture using TikZ. Namely, I would like to only specify the coordinates of the cities and then to connect them by edges using a \foreach loop. This ...
26
votes
3answers
1k views

padded boundary of convex hull

I'm trying to draw a boundary around a convex set of circular nodes in TikZ. The aim is to have it padded by 1cm, with an arc at the corners between segments, like this: I currently have the ...
26
votes
3answers
2k views

Applying a postaction to every path in TikZ

Sometime, for example in a solution to a recent question, one wants to apply a postaction (like a decoration) to a group of paths. A naive solution is to use every path/.style={}. Unfortunately this ...
14
votes
1answer
1k views

Drawing relationships between elements of a database

I am looking into a feasible way of drawing relationships between Elements from a database. An example: Element x is related to Element Y via the Role "sister". Relationships exist in the form 1:1, ...
18
votes
5answers
2k views

How can I force TikZ pin angle?

I'm trying to draw a resultant force diagram like so: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) -- (90:2.7) -- ++ (-13:12) ...
17
votes
2answers
5k views

Is plotting exponential graphs a known source of bugs in TikZ?

I want to plot $y = 2^x$ over a small domain. Unfortunately, even though tikz (v 2.1) seems to be able to calculate 2^{negative numbers} it is not plotting them correctly. My minimal example is: ...
9
votes
3answers
560 views

How to draw a return arrow from node-3 to node-1

Say I have a code to draw a flow chart, I want now a arrow from node 3 to node 1, how can I do that? 1<--| | | 2 | | | 3---- MWE \documentclass[class=article,border=0pt]{standalone} ...
13
votes
1answer
416 views

How can I use an hbox inside a TikZ environment for text dimension measurement?

I'm trying to use an \hbox to measure the dimensions of a certain text. This is working in normal text as in the following example: \setbox37=\hbox{this is a text that I want to measure} text width ...
10
votes
3answers
786 views

Problem with babel and tikz using \draw

I'm trying the next code: \documentclass[pdftex,spanish]{article} \usepackage{babel} \usepackage{tikz} \begin{document} Simple arrow: \begin{tikzpicture} \draw[->] (-1.5,0) -- (1.5,0); ...
237
votes
2answers
27k views

Create xkcd style diagram in TeX

The unique style of the diagrams at xkcd has an informative but nice hand-drawn touch. I guess they are actually drawn by hand but just recently on our partner site for Mathematica someone asked how ...
60
votes
5answers
9k views

How can I create a pdf document exactly as big as my tikz picture?

I often create pictures in tikz that I want to either send to someone, or include in an email. The problem with that is that there is a big white space around and and especially below my pictures. To ...
61
votes
6answers
2k views

Curve through a sequence of points with Metapost and TikZ

This question led to a new package: hobby I found Metapost best for drawing complex smooth curves (i.e., Bezier, splines), since you do not have to directly specify Bezier control points. ...
86
votes
10answers
5k views

How can I draw an egg using TikZ?

I would like to draw an egg-format element, but I have only found ways of drawing ellipses.
32
votes
8answers
11k views

What is the easiest way to draw 3D cube with TikZ?

I'm trying to find the easiest way to draw a 3D cube (it's for my UML diagram) with TikZ. Could you please give an example? Like this:
21
votes
5answers
6k views

Label angle with tikz

I am able to draw a nice right triangle with \begin{tikzpicture}[thick] \draw (0,0) -- (4,0) node[midway,below]{$f$} -- (4,2) node[midway,right]{$\frac{x}{2}$}-- cycle; \end{tikzpicture} Now I ...
48
votes
2answers
19k views

Draw Curly Braces in TikZ

I am using TikZ with the following code to draw a picture. How can I turn the curly bracket next to $P_2$ to the right? \documentclass{article} \usepackage{tikz} ...
35
votes
1answer
9k views

Bell Curve/Gaussian Function/Normal Distribution in TikZ/PGF

Can anyone tell me how to plot a gaussian function/bell curve using TikZ/PGF? I'm basically looking to implement something like PSTricks's \psGauss command.
25
votes
1answer
7k views

Simplest way to overlay a text + rectangle label an image?

For my figures thus far I've been using LaTeX's straightforward figure code, i.e.: \begin{figure} \centering \includegraphics[width=6.5in]{figure.png} \caption[Stuff here]{(A) More stuff ...