Questions tagged [tikz-pgf]

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.

Filter by
Sorted by
Tagged with
495 votes
8 answers
158k views

Drawing on an image with TikZ

Recently I have learned how to draw simple stuff with TikZ. I really like it. Now I wonder if it is possible to draw with TikZ on a image. Instead of pasting a image in Illustrator and adding some ...
user avatar
  • 10.6k
341 votes
8 answers
244k views

Is it possible to change the size of an arrowhead in TikZ/PGF?

I'm trying to draw an arrow with a bigger head than normal. Is it possible without changing the style of the line itself?
user avatar
  • 10.1k
337 votes
4 answers
46k 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 ...
user avatar
  • 8,923
293 votes
7 answers
287k views

Correctly scaling a tikzpicture

I was wondering which is the correct way to scale a tikzpicture. I tried with \begin{tikzpicture}[scale=0.50] but what I obtain is that distances between elements are scaled but not their sizes or ...
user avatar
  • 3,033
284 votes
2 answers
120k views

Manual/automatic line breaks and text alignment in TikZ nodes

How can I insert a line break in a TikZ node? Simply putting \\ where I want the break doesn't work (see MWE). Is there a way to make lines break automatically at some specified width? And can I ...
user avatar
  • 226k
274 votes
14 answers
225k views

Good way to make \textcircled numbers?

This question led to a new package: circledsteps I'm trying to make some good-looking numbers in a circle, using the simple command: \textcircled{1} However, the circle is misaligned vertically ...
user avatar
252 votes
12 answers
116k views

List of available TikZ libraries with a short introduction

Quick links: Summary ❧ Intersections library ❧ Arrow tips library ❧ Decorations libraries ❧ Calc library ❧ Mindmap library ❧ Shapes library ❧ Paper Folding library ❧ Chains library ❧ Shapes ...
240 votes
5 answers
243k 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 [...
user avatar
  • 18.6k
238 votes
3 answers
98k 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 ...
user avatar
  • 11.3k
225 votes
2 answers
104k views

Should \tikzset or \tikzstyle be used to define TikZ styles?

The PGF/TikZ manual states in section 12.4 Using Graphic Options, page 120 (v2.10), that TikZ styles can be set using: \tikzset{my style/.style={<tikz options>},...} However, in several places ...
user avatar
209 votes
18 answers
43k views

How can we draw a Christmas tree with decorations, using TikZ?

I would like to use TikZ for drawing a christmas tree. Here's a start, I used the lindenmayersystems library for drawing a tree: \documentclass{article} \usepackage{tikz} \usetikzlibrary{...
user avatar
  • 220k
203 votes
5 answers
146k views

Easy curves in TikZ

I find myself needing to draw lots of elegantly curved paths in TikZ. Ideally, I'd just specify a series of points, and TikZ would calculate the extra data itself to draw a nice series of curves ...
user avatar
  • 10.4k
179 votes
12 answers
24k views

Simulating hand-drawn lines

I am working on a project that will have some vector graphics, perhaps using TikZ (or a similar package). All of the graphics consists of lines, in shades of gray. However, the lines from TikZ appear ...
user avatar
  • 12.4k
173 votes
16 answers
32k 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 discussions on Christmas Tree with LaTeX I am still willing to try. How do you draw a red ...
user avatar
168 votes
6 answers
21k views

How productive are you with TikZ?

First, I must say I have very limited knowledge about PGF/TikZ. Most things I do are blind copy-pastes of examples I find on the Internet with lots of trial-and-error and googling around. After ...
user avatar
158 votes
2 answers
112k views

How can I flip the direction of 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} \usetikzlibrary{decorations....
user avatar
  • 2,443
153 votes
8 answers
54k 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 ...
user avatar
147 votes
7 answers
70k views

How to scale a tikzpicture to \textwidth

I would like to scale my tikzpicture to exactly (or a proportion of) the \textwidth Of course I could play with the [scale=0.5] option until I found the right value, but I assume there must be an ...
user avatar
  • 13.2k
145 votes
5 answers
221k views

TikZ set node label position more precisely

This seems like it should be really easy but I can't seem to find it anywhere... I'd like to be able to fine-tune the positioning of a node label. I'm aware of the \node[label=above/below/etc:{label}...
user avatar
  • 2,899
143 votes
4 answers
301k views

Adjusting font size with TikZ picture

Taking from the PGF manual, \begin{tikzpicture} \draw [help lines] (0,0) grid (3,3); \coordinate (a) at (rnd,rnd); \coordinate (b) at (3-rnd,3-rnd); \draw (a) -- (b); \node (c) at (1,2) {x};...
user avatar
142 votes
4 answers
268k views

How to specify a fill color in RGB format in a node in tikzpicture?

I am just trying to get a rounded corner box with some text in it. The text color will be white and the box will be filled with a particular color. The preamble includes: \usepackage{tikz} \...
user avatar
  • 1,421
139 votes
4 answers
14k views

How to draw a Sankey Diagram using TikZ

This question led to a new package: sankey I would like to draw something similar to this (not exactly): using TikZ. Ideally I would be able to set the width by variables and rejoin two flows into ...
user avatar
  • 1,493
138 votes
5 answers
133k views

Rotate node text and use relative positioning in TikZ?

In TikZ, I sometimes want to rotate the text within a node and then position the node relative to another. However, the approach below doesn't work as expected: \documentclass{standalone} \...
user avatar
  • 16.3k
135 votes
5 answers
82k views

How can I use \linebreak inside a node, in tikz? [duplicate]

This is my code, which doesn't work: \documentclass{article} \usepackage{tikz} \begin{document} \tikz \node {start\linebreak{}stop}; \end{document} The \linebreak command doesn't work. In order to ...
user avatar
  • 10.1k
135 votes
1 answer
148k views

Tikz: use opacity for fill, yet leave draw (lines) untouched

When I use the tikz key opacity for a polygon in a tikzpicture, it applies to the drawn fill as well as to the draw lines. I would like to have it this way that the lines remain untouched by the ...
user avatar
  • 8,762
134 votes
1 answer
143k views

How can I embed an external image within a tikzpicture environment?

I want to embed an image within a tikzpicture environment. I tried the following, \begin{tikzpicture}[] \pgftext{\includegraphics[width=150pt]{pic1.png}} at (0pt,0pt); \pgftext{\includegraphics[...
user avatar
  • 2,828
133 votes
8 answers
14k views

How can we display fireworks?

Soon we can celebrate the New Year. How can we use TikZ for drawing fireworks? For example like this, photographed by Kurume-Shimin, found on Wikipedia: Click on Image search for getting further ...
user avatar
  • 220k
132 votes
7 answers
54k views

Cool Text Highlighting in LaTeX

LaTeX has soul. ConTeXt, of course, has beautifully marked up "sharpie" highlighting, where you can put sweet hightligher under your text for free! In the pictured example, you can see highlights ...
user avatar
132 votes
1 answer
37k views

Difference between "right of=" and "right=of" in PGF/TikZ

In the PGF/TikZ manual, sometimes I see the option right of=somenode instead of right=of somenode. They look very similar, but the effects are different. The distance between nodes positioned with ...
user avatar
  • 1,715
130 votes
8 answers
99k 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 defined, ...
user avatar
  • 3,125
128 votes
3 answers
143k views

What is the correct way to center a \tikzpicture? [duplicate]

Possible Duplicate: Should I use center or centering for figures and tables? What is the correct way to cause a \tikzpicture to be centered? By default it appears to be aligned with the left ...
user avatar
128 votes
2 answers
175k views

How to change the size of nodes?

How is it possible to change the size of a node, for example: \begin{tikzpicture} \draw node[fill,circle]{} (0,0);% \end{tikzpicture} How to make the circle smaller or larger?
user avatar
  • 27.9k
127 votes
7 answers
92k 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?
user avatar
  • 10.4k
126 votes
3 answers
12k views

Fundamental differences : PSTricks, TikZ/PGF and others

OK, since this is a pretty vague and subjective question. I need to set up some borders around the discussion that I intend to benefit from. But before anything, I certainly do NOT want to excite the ...
user avatar
  • 154k
123 votes
11 answers
22k views

What are the advantages of TikZ/PGF over PSTricks?

The first time I saw the PSTricks' 3D Galleries, I immediately fell in love with it. I have spent much time to learn and use it. In this forum, I see many people using TikZ. I have not used TikZ yet. ...
user avatar
122 votes
8 answers
92k views

TikZ: How to draw an arrow in the middle of the line?

Like this: .------<------. | | v ^ | | '------>------' I am currently using \begin{scope}[very thick,->] \draw (-4,1)--(-4,0)--(0.1,0); \draw (0,0)--...
user avatar
  • 5,902
118 votes
13 answers
15k 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.
user avatar
  • 1,370
117 votes
8 answers
13k views

Sieve of Eratosthenes in tikz

I am writing notes for my students under the topic of prime factorization and I needed to illustrate the Sieve of Eratosthenes and this is what I came up with in tikz: \documentclass{article} \...
user avatar
  • 27.7k
114 votes
5 answers
117k views

Define a variable in TikZ

I guess this is a very simple question, but I couldn't find the answer... How can I define a variable in TikZ? I want to have something like, for example: \draw[->] (x1,y1)--(x2,y2); Such that x1,...
user avatar
  • 21.6k
114 votes
6 answers
24k views

What are the relative strengths of TikZ and Asymptote?

I want to compare TikZ and Asymptote for their abilities in 2D & 3D functional plot and other general purpose, simple drawings. What are the strong aspects of TikZ over Asymptote?
user avatar
114 votes
4 answers
26k views

How to create magnified subfigures and corresponding boxes for portions of a large image

Updated Below I hope the title gets at what I'm trying to do. I have a large image for a thesis on an image processing topic, and I want show the large image, with zoomed in boxes (typically with the ...
user avatar
  • 3,672
114 votes
9 answers
118k views

How to draw Venn diagrams (especially: complements) in LaTeX

What I am up to is to write some exercises dealing with logical formulas for my students, like: And the students should draw these formulas on Venn diagrams. At the end of the lesson, I really would ...
user avatar
  • 1,506
113 votes
3 answers
135k views

Tikz: Multi-line text in the node description [duplicate]

I use tikz to create pictures in latex. My picture consists of set of nodes. Every node has its own text inside the node, for example, "This node is valuable": \node (mynode) [mystyle,right=of ...
user avatar
  • 1,807
112 votes
4 answers
40k views

Outsourcing TikZ code

My Tex files get very confusing since I have multiple long TikZ code in them. How do you organize your files when it comes to TikZ?
user avatar
  • 1,407
112 votes
3 answers
49k views

Putting a timeline for dates in moderncv

This question led to a new package: moderntimeline I just had the idea of using a timeline to specify dates in my CV. I've made a mockup in Inkscape: The idea, as you see it, is to display the ...
user avatar
  • 30.8k
111 votes
1 answer
234k views

TikZ Adding Text

I'm a recent convert to TikZ from xy-pic, and am still trying to get a hang for it. I see that one can add labels to the end of arrows and the like using \node. Is there a way to add an arbitrary ...
user avatar
  • 2,795
111 votes
8 answers
158k views

Specifying the width and height of a tikzpicture

Is it possible to specify the width and height of a tikzpicture? To scale a tikzpicture I use the option scale, i.e. for instance \begin{tikzpicture}[scale = 2] ... \end{tikzpicture} I tried to ...
user avatar
109 votes
4 answers
198k views

How to add caption for a TikZ picture?

I'm drawing a automaton figure, and I want to name it says 'M1' below the figure? A minimal example would be greatly appreciated. Thank you. \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on ...
user avatar
  • 9,387
108 votes
6 answers
7k views

What is the minimum one needs to know to use TikZ?

I am fed up with the poor quality of the pictures in the papers written by my graduate students and am trying to convince them to use TikZ. I know of three ways to begin learning TikZ: The TikZ & ...
user avatar
107 votes
5 answers
208k views

How to plot functions like ‎‎‎‎‎x=f(y)‎‎ using TikZ?

To plot functions in the form of y=f(x), we simply write‎ ‎\draw ‎[‎smooth,‎samples=100‎,domain=0:‎‎2‎‎] ‎plot(\x,‎‎‎‎‎‎‎‎{(\x)...‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎});‎‎ But how about functions like x=f(y)? How to ...
user avatar
  • 3,191

1
2 3 4 5
627