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)

9
votes
3answers
461 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
886 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 ...
6
votes
1answer
585 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. ...
43
votes
2answers
7k 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 ...
39
votes
5answers
8k 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 ...
39
votes
3answers
10k views

Drawing Mechanical Systems in LaTeX

I really like CircuiTikZ for drawing diagrams in my LaTeX documents. However I mostly draw mechanical and not electronic systems, which is why I'm looking for some similar way to draw mechanical ...
29
votes
5answers
10k 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 ...
41
votes
6answers
12k views

TikZ: Node at same x-coordinate as another node, but specified y-coordinate?

In TikZ, if I have a node (A), how do I create a node (B) with the same x-coordinate as (A), but a given y-coordinate?
35
votes
1answer
8k 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.
33
votes
3answers
12k views

Add more anchors to standard TikZ nodes

I frequently find myself needing more than the standard anchors TikZ nodes provide, i.e. north, north east, east and so forth. I usually use coordinate calculations for this, as in the example below, ...
20
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 ...
24
votes
1answer
6k 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 ...
8
votes
4answers
9k views

How to draw graphs in LaTeX?

I need to draw simple graph (for example Petersen Graph) in LaTeX. I am using Kile in Ubuntu. I exactly don't know that which package should I use. Any suggestion with example is highly expected.
24
votes
1answer
6k 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 ...
25
votes
3answers
1k 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} ...
15
votes
3answers
5k 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 ...
10
votes
1answer
6k 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 ...
10
votes
3answers
500 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 ...
7
votes
5answers
2k views

Draw an aircraft with Tikz

I want to draw a plane using the Tikz tool. You will find, attached, a screenshot.
21
votes
2answers
5k views

Problems with TikZ calculations

When can I use functions and do calculations in TikZ? How do I make this work: \draw (0,0) arc(0:90:sqrt(15)); %not ok why is this working: \draw (0,0) arc(0:asin(1):5); %ok with ...
14
votes
2answers
2k views

Shrink figure only when necessary?

I'm writing a report where I have generated and included several TikZ pictures which I also want to use in my beamer presentation. However, some of the pictures (but not all) which fit in the report ...
11
votes
3answers
805 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 ...
9
votes
3answers
942 views

Replicate this chart using LaTeX

I need to replicate this chart using LaTeX, I understand that TikZ should come in handy: Can anyone please show me the best and easiest way to render the chart? Any ideas, tips, nudges in the right ...
7
votes
2answers
2k views

Centering a TikZ picture around an area

I often find myself in the following situation: A tikzpicture of mine consists of a main area and some outer material like text labels which are hardly symmetric around the main area. If such a ...
10
votes
1answer
208 views

Error with hobbyconvexpath

The hobby examples given on TEX.SX don't seem to be working with texlive 2013 (at least for me. For example, copying an MWE produces an error: \documentclass[tikz,border=2bp]{standalone} ...
7
votes
1answer
533 views

Is there something like \providetikzstyle similar to \providecommand?

I have standalone figures that I include in my document. These figures use statements like \providecommand{\HypotenuseLabel}{$h$} which allows the figure to have a default label, and which can be over ...
5
votes
2answers
729 views

Nested foreach inside a TikZ matrix for both rows and columns

I'm trying to create a matrix using nested \foreach loops. I tried following the example I found in a previous question, but I keep getting errors. Here is the code I tried to run: ...
12
votes
1answer
401 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 ...
107
votes
12answers
7k views

Can we make a love heart with LaTeX?

I understand that this post may cause some down votes because it seems a bit off-topic, but having seen the discussion on Christmas Tree with LaTeX I am still willing to try. My Girlfriend's birthday ...
36
votes
6answers
2k views

Creating gears in TikZ

I am trying to create a gear in TikZ in which the number of spikes can be determined and the size as well. I was looking through the pgfmanual and stumbled upon the decorations section and I tried a ...
36
votes
4answers
6k views

Draw mechanical springs in TikZ

Currently I am using the following path style to draw springs in TikZ \tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.1cm,post length=0.1cm,segment length=6}] for example ...
23
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 ...
11
votes
1answer
11k views

Typesetting a directed, weighted graph with TikZ

I just started doing things with TikZ today and I run into a problem: there is just no example code snippets for typesetting directed, weighted graphs. Can anyone supply one simple example in an ...
27
votes
5answers
2k 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 ...
21
votes
6answers
2k views

Best way to create this image, square and angle

I have just started looking into tikz, and trying to create the simple image below. I took a stab at it but could not quite do it. ABCD is a square and E is the midpoint on DC and F is the midpoint ...
12
votes
1answer
3k views

Non-linear curve fitting with gnuplot

I am trying to use gnuplot with pgfplots in TexShop, following on from an example by Martin H in the comments here. I can get the data points in OK, and plot them but the fit (red line) does not seem ...
20
votes
4answers
1k views

How to draw a Catalan number diagram on TikZ

This is a very easy question, but I am a LaTeX newbie. Any idea how to code diagrams of this kind? Image taken from the Catalan number Wikipedia page.
18
votes
4answers
3k views

Bounding box is larger than expected when drawing a curved path

I have been working on logo for my department and I have the following code. The problem is that whenever I compile the diagram seems to be larger than the actual logo. I do not know what is the ...
13
votes
2answers
656 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 ...
11
votes
2answers
1k views

Issues and potentiality of the tikzmark macro: dynamic box adaptation

Since I discovered the tikzmark macro I've been enthusiastic about it. I think that it is possible to distinguish at least two versions of the command: a basic one (two examples: ...
19
votes
1answer
1k views

Maintaining layout of Tikz diagrams with TeX4ht (converting as single pictures)

A Tikz diagram such as \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \path (0,0) node[draw] (A) {A}; \path (2,0) node[draw] (B) {B}; \draw (A) -- (B) ...
10
votes
2answers
2k views

How can I draw a Karnaugh map

Can you please help me drawing the kmap as shown in the link. A sample of the circles around the 1's is sufficient. *Edit** I made the following code. Can you help me now in completing this ...
18
votes
5answers
5k views

In TikZ, is it possible to nest nodes?

My use case: I am drawing chemical schemes. Each molecule contains several nodes. However, I also want to put each molecule into a "wrapper" node, so that I can use the usual anchors in combining ...
5
votes
1answer
2k views

How to typeset a TikZ picture inside a node?

The contents of a node are drawn in text mode. Is there a way, short of introducing a tikzpicture environment, to draw a picture inside a node? Nesting tikzpicture environments is problematic, also ...
16
votes
1answer
2k views

How to create a squiggle arrow with some text on it in TikZ?

I need to define a new command to create a squiggle arrow with some text on it. Something similar to what \xrightarrow command produces but with wiggly arrows as in \rightsquigarrow. The length of the ...
15
votes
2answers
1k views

Tikz-PGF: Draw integral test plot

So I'm doing a report on convergence tests in LaTeX, and would like to produce a diagram demonstrating the integral test for convergence. I am somewhat new to LaTeX, and a total n00b when it comes to ...
10
votes
3answers
1k views

Drawing a proper shadow for overlapping objects

I draw images that are composed of several overlapping nodes. If I add a drop shadow to each node, the shadow of the second node is drawn over the first node, as seen in the picture below (which ...
10
votes
1answer
1k views

Foreach inside a TikZ matrix

Consider this MWE: \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix [matrix of nodes] { a \\ b \\ c \\ }; \end{tikzpicture} ...
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 ...
5
votes
1answer
2k views

Tikz with positioning does not work with DVI

I have the following Tikz picture: \begin{tikzpicture} \node (a) {A}; \node [below=2cm of a] (b) {B}; \end{tikzpicture} When I compile this code with PDF-LaTeX, I get the expected result: "B" ...