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)

10
votes
3answers
4k views

TikZ: Intersection of two lines

what is the easiest way to determine the intersection of two lines? I tried \usetikzlibrary{intersections} \begin{tikzpicture}[every node/.style={black,above right}] \draw[name path=line 1] (0,0) -- ...
20
votes
4answers
4k views

Is there a way to control whitespace around a TikZ picture?

When I draw a tikzpicture that includes paths, I get quite a bit of extra whitespace added around the elements of the picture. Depending on the elements the figure contains, this can work out in some ...
11
votes
2answers
3k views

Automatically draw and labels angles of a triangle in TikZ

I'm using LaTeX with TikZ to create a (right-angle) triangle. Now I would like to label each angle by adding a half circle and a text label. Unfortunately I only managed to create a label for the ...
20
votes
2answers
931 views

How can I put a coloured outline around fraction lines?

I use the contour package to put thick white outlines around labels in graphs, so they remain readable above the grid lines without taking up too much space. Unfortunately, the package is not able to ...
17
votes
2answers
623 views

Modifying `*` and `o` style tikz arrows so that they are centered at the end of line

I would like to use tikz * and o arrows to indicate included/excluded endpoints in plots of piecewise functions, like for example the following one: However, it seems that tikz always aligns the ...
12
votes
1answer
2k views

plot within a plot: zoom into a plot so that the magnified part is framed by axis with ticks and tick labels

I want to zoom into a plot much like it is possible by using the spy library but I want the spy-in node to contain its own ticks and tick labels with a finer grid than the original plot. To clarify ...
12
votes
3answers
1k views

Use macro as coordinate in pgfplots plot

I'm trying to come up with a solution to the question How to maintain consistency with TikZ and Pgfplots?. Essentially, what is needed is a way to save a coordinate as a macro (or a global key, ...
8
votes
1answer
1k views

Arrows and nodes in TikZ

I wish to draw arrows not necessarily at the end of the line, nor in the middle. I would also like to write a node directly above (or below, or to the right, ...) the arrow. I saw this question, but ...
17
votes
1answer
408 views

What are most important variables set at the beginning of a tikzpicture? of a scope?

I asked a lot of questions about nested tikzpicture environments and if I agree with Andrew and Martin that nesting TikZ pictures isn't a good idea, it's interesting to know why. I gave some examples ...
15
votes
4answers
1k views

Is there a way to draw TikZ lines on the “inside” or “outside” of a path?

In this answer, Jake points out The miter option is more "correct" in that it doesn't add new corners to a shape or introduce rounding. In some cases with very sharp angles, the results might ...
15
votes
5answers
492 views

Combining |- and !.5! in TikZ

How do I combine the !.5! operator with the -| operator? I want a node that has x-coordinate equal to the average of x coordinates of nodes A and B, and a y-coordinate equal to the average the y ...
11
votes
5answers
4k views

Commutative Diagrams and TikZ

I wish I knew how to draw the this commutative diagram with the TikZ package. I would also like to know how to put subtitles in the diagram.
11
votes
2answers
1k views

Which package can easily write a graph, as an arbitrary curve or area, just for indication

Which package can easily write a graph, as an arbitrary curve or area, just for indication? The circle and ellipse don't be considered for their particular shape. TIKZ's Bézier curve is too ...
9
votes
1answer
1k views

How can I mix an “ybar” and an “ybar stacked” with pgfplots?

I tried a while to create that kind of chart with ybar but it's a mix between "ybar stacked" and "ybar". How can I do that? I tried this way but with no great results: \begin{tikzpicture} ...
33
votes
2answers
2k views

How can I draw a cake using TikZ?

It is always someone's birthday. I would like to use TikZ to draw a birthday cake. There are all sorts of cakes. What I would like is a cake that looks nice and tasty. Preferably a cake with lots of ...
17
votes
4answers
2k views

A line of length \textwidth in TikZ

Why does the following latex document: \documentclass{minimal} \usepackage{tikz} \begin{document} \noindent \begin{tikzpicture} \draw (0,0) -- (\textwidth,0); \end{tikzpicture} ...
15
votes
2answers
3k views

How can I compute the distance between two coordinates in TikZ?

Given two points (defined, for instance using nodes), I want to compute the distance between them. Is there some build in functionality in tikz to do this? If not, how can it be done using the ...
15
votes
3answers
649 views

LaTeX equivalent of ConTeXt buffers

While creating a series of graphics (using TikZ) in ConTeXt, I frequently use ConTeXt's buffer to "copy-paste" code. Is there a LaTeX package that implements this feature? Since most LaTeX users may ...
14
votes
3answers
874 views

Draw a closed liquid-droped shaped curve with TikZ

I am trying to draw a closed liquid-droped shaped curve using TikZ, but I don't know how. I tried to draw it using coordinates but I don't think that this is the solution. I am using ...
11
votes
1answer
2k views

Cycle option when drawing between nodes in TikZ

Cycle lets you close curves when drawing, and \coordinate (a) at (0,0); \coordinate (b) at (1,0); \coordinate (c) at (0.5, -1); \draw (a) -- (b) -- (c) -- cycle; works fine. Shouldn't also \node ...
9
votes
2answers
502 views

Faded or blurred lines

My question was inspired by Rotate fading in tikz where the inquiror is drawing laser beams that shall look somewhat blurred not as lines but as boxes with a fading. The problem with this approach is ...
7
votes
3answers
4k views

Problem with TikZ and vertical alignment of text inside nodes

I have a problem in TikZ with the vertical alignment of text inside nodes. With a very minimal example like this: \usetikzlibrary{arrows,positioning,shapes.geometric} \begin{tikzpicture}[% ->, ...
6
votes
1answer
800 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 ...
23
votes
1answer
2k views

How can I improve this family tree in TikZ?

To answer a question about how to draw family tree on LaTeX-Community.org, I created an example: \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{trees} \begin{document} ...
21
votes
2answers
2k views

TikZ: multiple decorations on a path.

I would like to draw a squiggly line with an arrow somewhere in the middle of it. TikZ has a pathmorphing decoration that draws a squiggly line and a markings decoration to place an arrow tip. So a ...
17
votes
1answer
1k views

TikZ library for Computer Science

Is there a Computer Science library for TikZ? I am looking for a library for drawing standard data structures (array, linked list, stack, queue, pointers, trees, etc) in a consistent way. I would ...
16
votes
1answer
3k views

pgfplots: prevent single plot from being listed in legend

In order to fill the area between two complex curves I use tables and the vertcat command (see Fill between two curves in pgfplots.). Now I don't want the plotted area to appear in my legend, just ...
11
votes
2answers
736 views

Compute the x distance between two nodes

Is there a way to define a macro which would evaluate to the x part of the distance between two nodes? I know there are the point registers \p and the correspoding \x commands, but I find them rather ...
10
votes
1answer
1k views

Drawing a tree where many nodes have the same child in TikZ

I'm trying the draw a tree using the TikZ package, but I don't know how to draw a child node that has many parents. An example for that, is given by this picture My problem is how to draw the level ...
9
votes
2answers
1k views

Timing and integration with TikZ PGFlots

How do I set intervals or integration with TikZ PGFlots? Something similar to the figure below, but I want to define the function, the intervals of integration and the partitions. ...
8
votes
4answers
1k views

How can I set the background color of the rows and columns of a matrix node in Tikz?

I have a matrix where some cells have nodes while others don't, with rows and columns of varying size depending on the biggest nodes in them. In this matrix, I would like to have the background of ...
7
votes
2answers
2k views

How to draw a cube with TikZ where all faces have a distinct color?

For each face, to show a distinct color I guess we have to use opacity, but at this point, this problem seemed out of my hand. Could anyone help me out? My attempt \documentclass{article} ...
17
votes
3answers
6k views

Moving a label along the path

Friends, consider the following code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{automata,positioning} \begin{document} \pagestyle{empty} \begin{tikzpicture}[shorten >=1pt,node ...
17
votes
1answer
924 views

Is it possible to use spot colors in TikZ graphics?

Using ConTeXt and Metapost, it is fairly easy to define spot colors and use them in an image: \starttext \definecolor[MyRed][c=0,m=1,y=1,k=0] \definespotcolor[RedSpot][MyRed][p=1,e=MyRed] ...
16
votes
2answers
5k views

How to combine fill and pattern in a pgfplot bar plot?

Is it possible to combine a TikZ pattern with a background of a chosen color? \addplot[black,fill=yellow,pattern=north east lines] ... yields bars which have black stripes on white (transparent?) ...
10
votes
2answers
6k views

tikzstyle default node text with fill color

As a follow-up to this solution on defining the default text for a node, how can it be done with the use of a fill color? Note below that specification of a fill color abolishes the node text. ...
9
votes
2answers
9k views

How to make an arrow bigger and change its color in TikZ?

I draw a line with an arrow at the end by \draw[->] .... Now I would like to make the arrow bigger, and change its color to red (without impacting the line). Does anyone know how to do it?
9
votes
1answer
6k views

How to label a path drawn using tikz with \draw plot?

Is there any workaround to use [pos=] or [midway] option in a node following a "plot" to annotate the path? The following minimal example will have the node text missing: \documentclass{article} ...
8
votes
1answer
548 views

Dependent node size in TikZ

I'm producing some control theory flow sheets in TikZ where I have specified the node box size. Since I'm making a lot of these flow sheets, I have set global styles for them, for instance the box ...
7
votes
2answers
1k views

Tree-like diagram (flow chart?) showing selection of scientific papers when reviewing

I know the title I came up with is not self-explanatory, but I will show straight on some real life examples: Part 1, Question 1: Which package(s) is(are) closely suited for such diagrams? I ...
4
votes
1answer
781 views

Using Macro Defined Lists in TikZ/PGFplots

I want to be able to use a macro to specify a list (it is a constant list, i.e. will not change throughout the document) and use this macro rather than hard code the list contents in the TikZ/PGFplots ...
2
votes
2answers
133 views

Using htlatex with tikz-dependency

I am trying to generate an html file from a tex file using htlatex. The htlatex works well with simple tikz pictures, but it has problem with the pictures (trees) drawn with tikz-dependency package. ...
10
votes
6answers
732 views

Second Derivative

I would like to make a function analysis and I'm trying to make a tabular which includes the first and second derivatives and the curve arrow which indicates the monotonicity of my function and I ...
9
votes
2answers
822 views

Cut one side of a rectangle node in TikZ

I would like to draw two consecutive rectangle nodes (one is next to the other with an intersected edge). How to cut one side of a rectangle node in TikZ so that the intersected side looks like ...
9
votes
2answers
481 views

Unexpected clash between babel and pgf spy

The following example taken from the pgfplots manual (p. 121) works fine only if the line loading babel is commented \documentclass{article} \usepackage[frenchb]{babel} % this is the troubelsome ...
9
votes
3answers
2k views

'Standalone' TikZ pictures

I want to create a TikZ picture in an external PDF file, which then can be included in my main document via \includegraphics. However, compiling a document with a TikZ picture in it produces a whole ...
5
votes
1answer
1k views

Update TikZ/PGF on mac

the TeXLive 2012 distribution on my Mac is shipped with TikZ version 2.10 - I want to use (try) the CVS (most updated beta(?) version). Here's what I've done so far: Downloaded the the TDS package ...
5
votes
2answers
1k views

node names and nested loops in TikZ

I'm trying to draw a (part of a) lattice. To achieve that I use two nested foreach loops, like this: \foreach \x in {-1, 0, 1} { \foreach \y in {0, 1, 2} { \path node (\x.\y) at (\x+\y-1, ...
5
votes
2answers
748 views

How to Specify two level row and column labels of a matrix by braces?

I'm trying to write the following matrices. I used the following code (given by Caramdir) \documentclass{article} % Load TikZ \usepackage{tikz} ...
56
votes
3answers
27k views

How to scale a tikzpicture including texts?

It seems that the scale option scales only the length of lines, but not the size of texts. For instance, 1 and true and not scaled in the following code. \begin{tikzpicture}[thick, scale=0.6] \draw ...