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)

8
votes
1answer
850 views

Parameters for newly-defined shapes

I want to declare a new shape in TikZ using \pgfdeclareshape. This shape will be formed from several parts, but often, when invoking the shape, I won't want all of the parts displayed. It would be ...
12
votes
3answers
8k 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}[% ->, ...
5
votes
1answer
2k views

Reducing left margin inside a TikZ node

I would like to reduce the left margin inside this node: \documentclass[a4paper,12pt,twoside]{article} \usepackage{tikz} \usepackage{enumerate} \usetikzlibrary{shapes,arrows} \begin{document} ...
12
votes
4answers
2k views

Programming in TikZ

How do I write a macro that will return a path or a coordinate? Here's an example: \documentclass[border=2em]{standalone} \usepackage{tikz} \usetikzlibrary{calc} % \circleByPoint{centre}{point} ...
3
votes
1answer
570 views

Using a macro for the coordinate in \coordinate

It seems that the two lines in the following code are not equivalent: \documentclass{article} \usepackage{tikz} \def\coord{(0,0)} \begin{document} % \tikz \coordinate at \coord; \tikz ...
25
votes
6answers
2k views

Are there examples written in PSTricks and they cannot be done using TikZ?

I am comparing the cores of PSTricks with TikZ and their capabilities. I am not considering whether or not a library has been implemented. Are there examples written in PSTricks and they cannot be ...
7
votes
1answer
8k views

How to place and scale TikZ pictures in subfigure?

I have a problem with placing four TikZ pictures in one figure. I use subfigure to embedded TikZ pictures. Now I have the following problem: I do not know how to scale the TikZ figures. When I use ...
10
votes
1answer
6k views

Plot a function of a binary logarithm with TikZ

How do I plot a function of a binary logarithm with TikZ? Say that I want to plot f(x) = log_2 x.
11
votes
1answer
2k views

How to control the fading size in TikZ?

I am trying to create a fading using tikzfadingfrompicture, but I cannot understand how TikZ computes the size of the fading. I assumed that TikZ calculates the bounding box of the image to fade, and ...
3
votes
2answers
967 views

Does a workaround or solution exists for the label conflict of circuitikz and TikZ?

I would like to use circuitikz with TikZ. However, I find that circuitikz modifies or does not recognize TikZ labels. The author of circuitiz has commented that in the "released version of CircuiTikz ...
4
votes
2answers
3k views

How to prevent a TikZ arrow from touching a node?

I am using TikZ to draw some trees in my thesis. This is a sample of what is being done: \documentclass{article} \usepackage{tikz-qtree} \newcommand{\Ta}{ \begin{tikzpicture}[level distance=30pt, ...
3
votes
1answer
559 views

TikZ's externalization and mylatex

I know I am greedy... I have tried for quite a while to get TikZ's externalization facilities to work nicely with mylatex, without any luck. My document currently looks like \documentclass{article} ...
0
votes
1answer
10k views

pgf install error - MiKTeX [closed]

i have this code taken from another question trying to produce a tree: \documentclass{article} \usepackage{tikz-qtree} \begin{document} \tikzset{edge from parent/.style= {draw, edge from parent ...
10
votes
1answer
3k views

How to draw a line passing through a point and parallel to another?

How to draw a line passing through a point and parallel to another? \draw (0,0) -- (1,0); \node (A) at (1,1); I need \draw (0,1) -- (1,1); parallel to first line.
15
votes
4answers
8k views

How to control spacing in a TikZ tree?

I want to draw a tree and I don't know how to enforce the spacing between them. Some are overlapping. This is my code: \begin{tikzpicture} \tikzstyle{every node}=[circle,draw] \node {A} child { node ...
32
votes
4answers
13k views

How to draw a line passing through a point and perpendicular to another?

I'm having a bit of a headache right now as I can't draw this basic figure: A straight line goes through points A and B. Another line is perpendicular to AB and goes through an arbitrary point P. I ...
1
vote
2answers
6k views

Installing pgfcore.sty

There is a problem with installing pgfcore.sty file for the beamer package. This file can not be installed from the internet (TeX says file not found) and when I plug this file manually into the ...
2
votes
1answer
423 views

Problem when drawing an axis-aligned bounding box around a tilted rectangle.

I need to draw an axis-aligned bounding box containing a tilted rectangle for a report about physic engines. My initial idea was to simply insert a rectangular node, apply a rotational transformation ...
16
votes
3answers
2k views

How to draw text-anchored tikz line below text instead of above?

I wish to mark several pairs of from/to anchor locations in text, and use tikz to draw lines between these. The anchors are not in absolute page locations; the text determines where the endpoints of ...
6
votes
4answers
522 views

(Commutative) diagram with long labels on vertices

I am trying to draw a diagram that looks something similar to the following: ############## ---------> ############## \ / \ / ...
3
votes
1answer
1k views

Tikz arrow starting exactly in the center

I have the following problem. I am using the tikz package to draw figures. I am drawing some sort of a data structure. This includes having nodes and lines which connect nodes. Sometimes, a line has ...
7
votes
2answers
1k views

How to define a random number with xcolor and tikz/pgf

I tried to get a random color with xcolor and tikz: \documentclass{article} \usepackage[xetex, rgb]{xcolor} \usepackage{tikz} \begin{document} \pgfmathsetseed{1} \begin{tikzpicture} ...
5
votes
1answer
523 views

Latex plotting (jagged function)

Hey, I have a function which I would like to plot with latex/tikz. Since I'm just a beginner I really don't know how to do it. Don't get me wrong I don't have any problems with most functions but this ...
4
votes
2answers
2k views

Block Diagrams Multi Input - Multi Output Components in TikZ

My problem is to define blocks (mainly rectangles) that has labels in them in terms of matrices (mostly block diagonal) such that the n-many arrows that goes in this rectangle visually is at the same ...
13
votes
1answer
3k views

Increment loop variable in inner foreach loop

I need the following pairs of numbers: 12 13 14 23 24 34 My first attempt was to use two nested foreach loops: \foreach \x in {1,...,4} { \foreach \y in {\x+1,...,4} { % This would be very easy in ...
12
votes
4answers
4k views

PGF Math Function to compute cube root

When I found that a simple x^(1.0/3.0) does not yield a graph in PGFplots for negative values of x, I attempted to define my own function for CubeRoot using pgfmathdeclarefunction as below. But, am ...
5
votes
2answers
710 views

Passing nodes as parameters to a macro in TikZ

I would like to define a macro which would take two nodes as arguments and "connect" them using a third, predefined node. Like this: \documentclass{minimal} \usepackage{tikz} ...
2
votes
1answer
780 views

using foreach to draw a chain with a branch

This is an extension to How to draw the border of a node using late options I'm drawing a chain of nodes with different colors using foreach from tikz. Now I want to add a branch, also using foreach. ...
10
votes
1answer
1k views

How to have linked axes on plots?

I plot infrared spectra in many reports and I display the energy units in two ways, wavenumbers $cm^{-1}$ on the bottom x-axis and wavelength (nm) on the upper x-axis. The relationship is ...
4
votes
1answer
1k views

set a caption and label in a tikz timingtable environment

Is it possible to set a caption and label within a tikz timing table? Or do I have to do that somehow within a tikzpicture? Here the codefragment: \begin{minipage}{0.5\textwidth} ...
6
votes
2answers
2k views

tikz doesn't work properly

I am trying to toy around with tikz and I have found that the result is strange. When I run the code given here: \documentclass{article} \usepackage{pgf} \usepackage{tikz} ...
8
votes
2answers
161 views

Are there any differences between a “newly defined” path and a path using predefined nodes?

I am not sure how I should phrase my question. consider the following example \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[inner sep=0] at (0,0) (a) {}; ...
12
votes
1answer
3k views

\ifnum and pgfmath: error

In the following example I want to use \ifnum to compare two numbers computed by pgfmath, for simplicity I use simply 1 and 2 in the example below. Compiling this code gives me the error: ERROR: ...
4
votes
2answers
2k views

Use variable in domain of a plot in tikz

Consider the following example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings} \begin{document} \begin{tikzpicture} ...
14
votes
2answers
4k views

Store \pgfmathresult in a variable

The result of \pgfmathparse is automatically stored in \pgfmathresult. Is it possible to store it in an other variable, too?
3
votes
1answer
2k views

Vertical align in tikz matrix

\documentclass[a4paper,12pt]{report} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{center} \begin{tikzpicture} \tikzset{square matrix/.style={ matrix of nodes, column ...
29
votes
5answers
3k views

How can I fix jumping TikZ pictures in beamer?

The problem of stuff jumping in beamer is a common one, (see e.g. Avoiding jumping frames in beamer) and we've seen it here from time to time (I imagine the "related" list at the side will be quite ...
7
votes
2answers
2k views

How to draw the border of a node using late options

I want to create a series of rectangles, each with a different shade. The shade varies from white to black. I want to make the white (first) rectangle visible by drawing its border. My first step is ...
16
votes
1answer
2k views

PGFplot Axis Labels Detaching From Graph

Update: Aug 04, 2013 With the current version of TeXLive 2013, the second MWE below still exhibits the same behavior if the \todo[inline] is commented out after the first run. Furthermore, the ...
5
votes
2answers
1k views

Using tikz command inside tikzpicture environment (alignment problem)

This is a followup question to Expandable nested boxes with TikZ. When using the \tikz command inside the tikzpicture environment, the positioning of the contents is altered. Here are the two ...
7
votes
3answers
759 views

Bad intersection of lines in TikZ

Consider the following: \documentclass{minimal} \usepackage{tikz} \begin{document} \begin{tikzpicture}[line width = 4] \coordinate (a) at (0,0); \coordinate (b) at (1,0); \coordinate (c) at (1,1); ...
3
votes
1answer
930 views

Plots in TikZ don't work

I want to do some plots using TikZ, however the following code doesn't work: \documentclass{minimal} \usepackage{amsmath} \usepackage{pgf,tikz}% \begin{document} \begin{tikzpicture} ...
14
votes
4answers
2k views

TikZ: draw only a certain central length of a given path

I have two nodes (A) and (B), and I want to only draw a central segment of the straight line between them, of a certain given length (say 2cm, but will vary). Is there some way I can do this? I am ...
2
votes
1answer
2k views

Aligning nodes with TikZ

Consider this: There are several problems: The \exists operator is not horizontaly aligned with the following node (a,b). There is too little space between foobar and the node below it and ...
2
votes
1answer
527 views

How to put part of a TikZ graphic into a box to measure its size

After adding support for tooltips today in pdfcomment (\pdftooltip) I wanted to make a TikZ example with tooltip annotations. Within \pdftooltip the annotated element is set into a box to measure the ...
13
votes
1answer
457 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 ...
5
votes
1answer
1k views

TikZ trees grow right typesets things “upside down”

This is a pretty minor gripe with what is a great library. \documentclass[border=3em]{standalone} \usepackage{tikz} \usetikzlibrary{trees} \begin{document} \begin{tikzpicture}[grow=right] \node {a} ...
8
votes
2answers
1k views

Expandable Nested Boxes with TikZ

Could someone please post a minimal tikz example to draw this: I am currently doing this with nested tables, but would like to see how it can be done with tikz. The nodes would ideally have a ...
1
vote
1answer
2k views

Tikz, centering object and correcting an arrow in flowchart

i placed the circle with the word Start in the center of picture using positioning library: \node[start] (start) {start}; % row 2 \node[block] (measurement) [below of=start] {Add new measurement, \\ ...
4
votes
2answers
509 views

PGFplot producing “noise” (incorrect graph)

Update: This has problems if the samples are one of these: {19,21,23,28,30,31,32,34,36,38,39}, so I think something else is going on. I can get this example to work fine if I reduce the number of ...