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)

26
votes
2answers
3k views

Draw a bivariate normal distribution in TikZ

For a small class I want to draw a bivariate normal distribution and show where the means from the two variables meet in the space. Has anyone done this in TikZ?
25
votes
2answers
1k 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 ...
13
votes
2answers
6k 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?
18
votes
2answers
4k views

How do I add an image in the upper, left-hand corner using TikZ and graphicx

This is perhaps a simple question with a simple answer, but I'm stumped as a tikz novice. What would be the best method to add an image (logo) file to the upper left-hand corner of my document? ...
13
votes
3answers
1k 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 ...
8
votes
3answers
1k views

use of tikzpicture matrix in align or gather environment

So far I have found using the matrix command in the TikZ package is the only way of drawing a T-shape around the bottom row and middle column of entries in a matrix. I now need to use this matrix in ...
23
votes
3answers
1k views

How can I work around this TikZ bug: (\x)^2 and \x^2 produce different results in TikZ plot?

I have some files with TikZ graphics that have suddenly changed appearance since I upgraded to PGF-2.10. Here is a minimal example: \documentclass{minimal} \usepackage{tikz} \begin{document} ...
45
votes
10answers
8k views

How can I speed up LaTeX compilation?

The slowest part is a dozen of diagrams in TikZ.
39
votes
5answers
3k 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 ...
33
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 ...
23
votes
2answers
469 views

Is there a TikZ equivalent to the PSTricks \ncbar command?

Although I now use TikZ, every so often I find myself looking for very useful PSTricks commands which don't seem to exist in TikZ. The pst-node package has an \ncbar command which allows one to ...
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 ...
24
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 ...
20
votes
3answers
3k 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 ...
18
votes
2answers
2k 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 ...
15
votes
2answers
4k 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: ...
222
votes
2answers
24k 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 ...
54
votes
5answers
6k 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 ...
82
votes
10answers
4k 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.
59
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. ...
28
votes
6answers
8k 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:
39
votes
2answers
14k 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} ...
37
votes
2answers
3k 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 ...
23
votes
2answers
2k 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} ...
23
votes
4answers
4k 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

Tikz: purely vertical arrow from nodeA.south to nodeB.north

I have the following tikz code % compilation command: pdflatex --jobname=Diag-f1 Diag.tex \documentclass{book} \usepackage{tikz} \pgfrealjobname{Diag} \begin{document} \beginpgfgraphicnamed{Diag-f1} ...
17
votes
4answers
2k views

How to generate all possible Venn diagrams (with the case below) efficiently?

I can draw Venn diagrams but now my question is more complicated than just drawing Venn diagrams one by one. I need to draw all possible Venn diagrams efficiently. I need a combinatorical approach ...
17
votes
2answers
1k 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 ...
13
votes
1answer
5k views

Absolute positioning in beamer

It's easy to absolute position something using remember picture with TikZ, but it only works with pdfLaTeX. I can get something working by using negative vskip and hskips (trial and error), but that ...
19
votes
3answers
844 views

Tikz: joining points on a circle

I have the following figure I would like to draw portions of circles between some of the red points. More explicitly, I would like to go from ac1 to ab1 and then to ac2 following circle A, then go ...
10
votes
2answers
2k views

Problem with defining shortcuts for TikZ matrices.

For answering a question yesterday I wanted to define a shortcut for creating a matrix inside a tikzpicture. As a minimal example, consider \newcommand\mymatrix[1]{ \begin{tikzpicture} ...
17
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) ...
8
votes
3answers
408 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} ...
6
votes
1answer
802 views

How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets?

How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets? E.g. using \bh and \eh commands from Highlight text in code listing while also keeping syntax ...
9
votes
7answers
12k views

Windows API error 5: “Access is denied” when trying to compile TikZ picture

I installed PGF but are unable to compile the following document: \documentclass[10pt]{article} \usepackage{pgf,tikz} \begin{document} \begin{tikzpicture} \draw (0,0) --(1,2); \end{tikzpicture} ...
6
votes
1answer
546 views

TikZ borders showing through when they shouldn't (overlapping circles)

If you draw two circles that are exactly the same in all aspects (location, size, etc...) except they have different colors, then the "border" of the underlying circle is showing through. ...
44
votes
4answers
4k 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?
34
votes
2answers
3k views

Design a custom Beamer theme from scratch

No matter how hard I search, I cannot find any information on creating a Beamer theme from scratch, as opposed to LEGOing it together from the built-in inner, outer and color themes, maybe modifying ...
24
votes
5answers
7k views

Draw arc in tikz when center of circle is specified

It would be convenient sometimes to be able to draw an arc in tikz by specifying the center of the corresponding circle its radius the initial/final angle i.e., the "natural" way an arc is ...
34
votes
3answers
7k 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... ...
32
votes
1answer
7k 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.
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 ...
18
votes
6answers
9k 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 ...
24
votes
1answer
5k views

TikZ matrix as a replacement for tabular

I would like to use TikZ matrices to for some drawings. I am currently using nodes and positioning them manually to simulate a tabular. That helps in positioning arrows and shading. However, if I ...
23
votes
3answers
908 views

Properly aligning drawn lines between the corners of 2 rectangular nodes in TikZ?

When I draw a thick line from the corner of one box to the same corner of another, it doesn't attach properly. See the code and picture below: \documentclass[a4paper, 11pt]{article} ...
17
votes
2answers
766 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 ...
15
votes
3answers
4k views

Large braces over several items in an itemize with text by the brace

This question is related to this question: Adding large brace next to body text, but is not a duplicate. I have an itemize in a beamer presentation. I want to put a brace over some of these items. So ...
9
votes
1answer
5k views

Legend in tikzpicture

I am looking for a way to create a legend in a regular tikzpicture. I found this Using a pgfplots-style legend in a plain-old tikzpicture but I don't know how to put the legend at the wanted ...
14
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 ...
10
votes
3answers
459 views

Macro to access a specific member of a list

I want to be able to have a macro access a specific element of a list. The following code works, however requires me to have two separate macros: one that accepts a list, and the other that accepts ...