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)

15
votes
2answers
2k views

Placement of arrowtips with TikZ’s markings

With the decoration library it is possible to place arrow tips at arbitrary positions along a path. TikZ places the front end of the arrow at the specified position, which is often exactly what one ...
5
votes
1answer
1k views

Matrix of nodes column style inconsistency

For the following code: \begin{tikzpicture} \matrix [matrix of nodes, column 2/.style={red}] { 8 & 1 & 6 \\ 3 & 5 & 7 \\ 4 & 9 & 2 \\ }; \end{tikzpicture} This picture is ...
6
votes
2answers
601 views

Forcing tikz/pgf to expand macros within commands

I would like to use simple macros within tikz commands, but it seems tikz doesn't expand them in the ways I would expect. For instance, the code ...
18
votes
2answers
4k views

to path + relative coordinates in TikZ?

The following gives an error with PGF 2.00: \begin{tikzpicture} \draw (0,0) to +(1,1); \end{tikzpicture} I could swear that this worked once with a different version, but I don't know which. The ...
16
votes
3answers
3k views

Drawing a circle in the complex plane.

I would like to draw the set of points in the complex plane that satisfies $|z-1+i| <= 3$ using LaTeX (with TikZ, or some related system). I would want to fill this circle with say dashed lines, or ...
3
votes
3answers
694 views

Tikz rectangle hiding text!

Using this code to achieve an effect as in the question Page border coloured. \usepackage{tikz} \usetikzlibrary{calc} \newcommand{\pageframe}{% \begin{tikzpicture}[remember picture,overlay] ...
11
votes
1answer
910 views

Need to plot a lattice and the topological building of a torus!

as told in the title I need to plot a lattice on the plane (not the standard one with basis (1,0), (0,1) ) and I'd like to show up how to build a torus starting from its topological square... If ...
20
votes
3answers
7k views

How to scale Tikz drawings and text together?

I'm trying to build a diagram (a logo, actually) that I can scale easily through a parameter. I'd like to be able to scale both drawing and fonts through a single parameter. Here's my current MWE, ...
1
vote
1answer
444 views

Missing $ error

Why doesn't this code compile? % Oxidation and reduction % Author: Arne Röhrs % Note that two compilations are necessary. \documentclass{article} \usepackage{tikz} ...
9
votes
1answer
750 views

TikZ: Execute code at end of scope OR picture and access its bounding box

TikZ provides the two keys execute at end picture={<code>} and execute at end scope={<code>} which can be used to execute any code at the end of the picture and of the current scope, ...
19
votes
1answer
4k views

Draw edges and paths in the background of nodes in TikZ

Is it possible to draw edges or paths in the background of nodes independently of whether they are constructed before or after the nodes are defined? In the following example, the \draw instruction ...
11
votes
2answers
2k views

How to maintain consistency with TikZ and Pgfplots?

I would like to maintain some consistency between TikZ and PGFplots, and have run into numerous difficulties. Here is an example of two of them: I would like to be able to use something similar to ...
4
votes
1answer
903 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 ...
5
votes
2answers
6k views

tikz: control text size and location

I am trying to create flowchart, using tikz: \begin{document} \tikzstyle{decision} = [diamond, draw, fill=blue!20, minimum size=2em, text badly centered, node distance=2.5cm, inner sep=0pt] ...
5
votes
2answers
4k views

Successive display of animations in a beamer/tikz environment

i made a simple animated graphic in a tikz/beamer environment. the problem is that when i click on one of the slides, all animations begin to move. what i am looking for is that on slide 2 S begins to ...
14
votes
4answers
3k views

How to automatically draw a graph in LaTeX

clarification: when I say "graph", I mean the computer science term. I want to draw a full binary tree of h height. It means that there's one root with two sons, each son has two sons and so forth. ...
5
votes
1answer
331 views

Using \IfNoValueTF within a TikZ style specification.

In an answer to Flushing PGF commands and local variable Matthew had suggested using \IfNoValueTF within a TikZ \node specification to determine the text. This solution works great for me. However, ...
9
votes
1answer
535 views

TikZ picture too tall

I am typesetting the following equation: \documentclass[12pt]{article} \usepackage{tikz} \begin{document} \begin{equation} f\left( \begin{tikzpicture}[scale=0.5] \tikzstyle{every ...
4
votes
0answers
259 views

Shiny button-like node style with TikZ [duplicate]

Possible Duplicate: Web buttons with WYSIWYM Would it be possible with TikZ to draw (3D) shiny button-like nodes as those appearing in the mindmap on page 44 of Lukas Doktor presentation ...
11
votes
1answer
496 views

Using ifthenelse for crop marks with tikz

How do I use to insert ifthenelse crop marks in Tikz. I want ifthenelse{\printcrop=true}{\draw(0,0) -- ++(0,1);}{} That is, if yes, make a drawing, else but do nothing. And yet, where I can choose ...
2
votes
1answer
422 views

Put long formulas on new line/pgf tikz?

Sometimes I have to work with long formulas that can (or I want) not be split over two lines. I'm trying to write a macro that sent the formula at the new line if the formula would go over the margin. ...
3
votes
1answer
645 views

Variables and basic arithmetics and tikz-euclide

I want to draw a circle using tkz-euclide and n segments of this circle. Since I want to have n as a basic variable I need to divide in the following example. However it doesn't work, any ideas? ...
5
votes
1answer
3k views

Probability Tree-diagram with TikZ

Thanks for helping me out. How can I make the following tree-diagrams? http://www.vias.org/tmdatanaleng/cc_prob_cond_independ.html
12
votes
1answer
12k views

How to properly scale a TikZ/PGF picture which has a `\begin{axis}…\end{axis}`

Applying a scale option to a TikZ picture works great. It keeps the text the proper size and scales everything else. I would like to have the same behavior when using a \begin{axis}...\end{axis}. ...
4
votes
1answer
236 views

Determine if within a PGF axis environment

Is there an easy way to test whether a macro is called from within an PGF \begin{axis}...\end{axis} environment? One solution would be to define a new environment myself that sets a flag at ...
4
votes
1answer
293 views

How can I pass the body of a TikZ node to a font-changing macro?

After looking around at some other answers on this site, I'm trying to typeset a tree using the tikz-qtree package. It works great, but by design it does not let you use macros in the tree nodes, ...
9
votes
1answer
1k views

Conditional using non-integer numbers

I am trying to generate fractals using affine transformations. I need to generate a random number in the interval (0,1), and depending on the value of this random number choose a function to ...
3
votes
1answer
449 views

Using color variable in TikZ before they are declared

I want to use the color of a path to set the color of the nodes. But I want the nodes to be lighter than the path color. And I want to do this before knowing what the path color will be. Hence, how do ...
2
votes
2answers
995 views

Aligning multiple TikZ trees with other nodes

This question is directly related to Aligning TikZ trees with other nodes that I asked some time ago. By the time I asked the question I didn't realize that aligning multiple trees was not the same as ...
5
votes
1answer
396 views

TikZ: pgfutil-common: pgfutil@in@ - how does it work?

Having been writing small lib for TikZ, I tried to use this macro in order to search for @. Code compiled, but the result was false, despite that I was sure it was in tested string. So, I decided to ...
1
vote
2answers
415 views

Flushing PGF commands and local variable

I think I need a way to flush the PGF commands as the reference to \LabelText uses the last value, and not value at the time of invocation. The macro LabelPoint is intended to replace the first ...
2
votes
1answer
5k views

TikZ Coordinate calculation - calculate coordinates separately

I'm trying to calculate coordinates based on existing coordinates but each coordinate individually. The first thing which is unclear to me is how to define scalar variables. I can define coordinates ...
1
vote
1answer
538 views

Export/convert/externalize tikzpicture as LaTeX (picture) code?

I have seen "32.4 Externalizing Graphics" in the Tikz manual, which explains how Tikz images can easily be exported as PDF images using pdfLaTeX. However, I am persuaded I saw somewhere a way to ...
4
votes
1answer
1k views

Does tikz 2.1 no longer work with the preview package?

I used to be able to create png images of diagrams made with tikz code by using the preview package and printing the dvi output from dvips to a png file using ghostscript. The latest version of tikz ...
5
votes
1answer
928 views

How do I include labels using Tikz's fit?

I'm creating a graph using TikZ. It's working fine, but when I try to use the fit to make a background, it's not quite large enough: Notice that the green doesn't cover the labels Gateway and Root. ...
12
votes
4answers
2k views

Aligning an enumeration item to the top of a tikzpicture

I've drawn a tree using pgf/tikz and am trying to place it in an enumerated list. A snippet of my complete code is as follows: \subsection*{Problem 2} \begin{enumerate}[1)] \item Max heap \item ...
8
votes
2answers
6k views

Decision node on TikZ (diamond)

I'm trying to find a way to tame decision nodes (diamond shape) but I just can't do a thing! If I put a formula inside the diamond and if that formula is a little big the shape just grows like a ...
19
votes
4answers
2k views

Draw only some segments of a path in TikZ?

Is there a good way to create a path in TikZ only some segments of which are stroked? I want to create the whole path in a single command so that it can be filled, but I also want to stroke some ...
6
votes
2answers
1k views

TikZ: Track the bounding rectangle of created nodes (Storing values?)

In the main part of the tikzpicture I'd like to simply create blocks. So I need somewhere in theirs' style definition to perform tracking of their common bounding rectangle. I've tried to access ...
7
votes
2answers
899 views

Aligning TikZ trees with other nodes

I would like to align a TikZ tree with another node by considering the tree as a whole like as if it was a node with anchors. For the moment I am only able to align the root node of the tree, not the ...
1
vote
2answers
392 views

Upgrading PGF without tex-package manager

I don't use MiKTeX or any other package managers. I usually install new styles/libraries by adding the .sty file to the same directory as the .tex file and compile using pdflatex. I figured out I ...
3
votes
3answers
2k views

How to plot a third variable (z) on pgfplot as a color gradient

I'm trying to use pgfplots to create a 2D plot with 3 variables, the third one being plotted as a color gradient. \begin{tikzpicture}[scale=0.75] \begin{axis}[xlabel=Selta,ylabel={Hitastig ...
8
votes
2answers
2k views

Nested foreach loop in TikZ

I would like to draw some vector fields on a triangle, and I am using nested \foreach loop to do that, however in the inner loop, you can't use the outer loop variable as the numeric range. For e.g. ...
6
votes
1answer
3k views

TikZ `edge from parent` followed by a node.

The TikZ documentation gives the following example for adding a label on an edge in a tree: \begin{tikzpicture} \node {r} child {node {t} edge from parent node {label}}; \end{tikzpicture} ...
3
votes
1answer
360 views

tkz-euclide, define points outside of tikzpicture

Is it possible to define points in tkz-euclide outside of the tikzpicture environment? For example I would like to have something like this exercise in elementary geometry: Exercise: Consider the ...
6
votes
5answers
3k views

How do I use pgfmathdeclarefunction to create define a new pgf function?

I'd like to define new function for pgf so I can use it in pgfplots. I'm trying to create a unit pulse function p(x) which has a value of 1 from x=0 to x=1, and 0 elsewhere. I read the pgf manual on ...
10
votes
3answers
3k views

Commutative diagram with rounded arrows

I want to draw a diagram which has some arrows between to points A and B. First arrow goes straight from A to B and above it should be a $\Psi$. Second arrow goes in a round way from A to B and above ...
3
votes
1answer
294 views

tikzpicture without leaving vertical mode

It seems that the tikzpicture environment always leaves vertical mode, even when the overlay option is given (and thus the picture doesn't actually take any space). This can cause unexpected ...
2
votes
2answers
1k views

TikZ flowchart for a poster

I'm making a poster and need to include a flowchart. I've never done this, so I'm starting with the example in the manual. Problem is, it doesn't work. ! Package pgfbasematrix Error: Single ampersand ...