jump to navigation

Tikz April 21, 2009

Posted by Ben Webster in math life, tikz.

For those of you following the long OT comments discussion on graphics programs, let me second Chris’s endorsement of Tikz. It is by far the best LaTeX graphics package I have ever used. I couldn’t possibly compete with the manual (what other manual starts with 3 fantastic tutorials?), and this page of examples. I have a certain affection for xypic, which has served me well over the years, but Tikz is just lightyears ahead. That is all.

About these ads


1. Greg Kuperberg - April 21, 2009

I have been using PSTricks for many years. The main inconvenience is that it has a roundabout implementation with pdflatex. Should I retrain with Tikz? Is it better than PSTricks?

2. Andy P. - April 21, 2009

Instead of using pstricks, I recommend using pinlabel, which can be found here : http://www.ctan.org/tex-archive/help/Catalogue/entries/pinlabel.html

It interacts much better with pdf than pstricks.

I also recommend inkscape for drawing the eps files. It is much more functional than any other free alternative.

3. Ben Webster - April 21, 2009

I can’t address that question, since I have little experience with pstricks. The manual says:

The pstricks package is certainly powerful enough to create any conceivable kind of graphic, but it
is not portable at all. Most importantly, it does not work with pdftex nor with any other driver that
produces anything but PostScript code.

Compared to pgf, pstricks has a broader support base. There are many nice extra packages for
special purpose situations that have been contributed by users over the last decade.

The TikZ syntax is more consistent than the pstricks syntax as TikZ was developed \in a more
centralized manner” and also \with the shortcomings on pstricks in mind.”

Note that a number of neat tricks that pstricks can do are impossible in pgf. In particular, pstricks
has access to the powerful PostScript programming language, which allows trickery such as inline
function plotting.

4. Nathan Dunfield - April 21, 2009

How common is pgf/TikZ? That is, is it part of most reasonably up-to-date TeX distributions? Most importantly, does the arXiv TeX setup have it? (There are quite a few standard packages that the arXiv lacks…)

5. Ben Webster - April 21, 2009


There are a large number (hundreds) of arXiv papers which claim to have Tikz figures. My home computer had an out of date PGF installation that came when I installed LaTeX the last time, and getting the new one was a snap.

6. Nathan Dunfield - April 21, 2009

I downloaded the TeX source for a couple of the papers that Ben referred to and, yeah, they’re really using Tikz. Random rant: I really wish that when you downloaded a TeX source from the arXiv that consisted of multiple files that it was kind enough to a) it append “.tar” to the name so that my browser knows what to do with the download and b) the tar file was structured so that it creates a subdirectory when you untar it instead of spilling its guts all over the current directory. Bleech.

7. Matt Daws - April 22, 2009

Just a quick message: I checked on my install of MikTeX, and it certainly does support PGF and Tikz. It turns out that the beamer class uses it. So, as I guess most people use beamer these days, this means you can almost certainly use PGF without installing anything extra.

8. Pace - April 22, 2009

I’ve used IPE to draw my pictures. It is quite simple, but not very sophisticated. I’ll have to try Tikz.

9. Dan - April 22, 2009

Another enthusiastic +1 for TikZ here. It’s great.

I recommend http://www.texample.net/tikz/ which has lots of cool examples of things you can do with TikZ.

10. Greg Kuperberg - April 23, 2009

Now that I have glanced at an example, it actually looks extremely similar to PSTricks in spirit. Some of the syntax has been improved, and it’s great that it’s more portable. But it is as much a variation of PSTricks as it is an alternative.

When people ask me how I do graphics in my papers, I have been answering for many years: “I might not recommend PSTricks for everyone, because it’s an anti-WYSIWYG throwback and many people haven’t heard of it. But it works really well for me, and you were happy enough with the results to ask the question.”

Unfortunately PSTricks development has been very slow for many years. In the context of this discussion, PSTricks is amazingly old; Timothy van Zandt wrote the first version in 1991. It’s hard to blame him too much that PSTricks doesn’t do PDF. PSTricks predates PDF by two years and Adobe didn’t make the transition from PS to PDF easy at all. PDFTeX only appeared around 1997.

Given how things turned out with PSTricks, it’s nice to see an anti-WYSIWYG revival in the form of TikZ. Granted, if you use Inkscape or similar, you can have a WYSIWYG layer on top; you can have a WYSIWYG layer on top of TeX too. TeX and TikZ still make the point that WYSIWYG isn’t the be-all of user interfacing.

11. Emily Peters - April 23, 2009

I want to third or fourth or whatever the endorsements of TikZ. I don’t know much about other drawing programs, but TikZ was extremely easy to learn (like Ben mentions, the tutorials are wonderful), and I’ve made tons of pictures in it without tears.

12. Theo - April 25, 2009

Ok mathies, I have a TikZ question, which Google and the Manual don’t help me with. I’d like to draw Dynkin diagrams in TikZ, and the diagram for G2 should have a triple edge. It seems that TikZ does not come with a predefine “triple” command, and I find defining my own decorations reasonably confusing. Help!

13. Ben Webster - April 26, 2009


\node (a) at (0,0) [circle, draw,inner sep=2pt];
\node (b) at (1,0) [circle, draw, inner sep=2pt];
\draw (a) to (b);
\draw (a.10) to (b.170);
\draw (a.-10) to (b.-170);
\draw (.5,0) to (.4,-.1);
\draw (.5,0) to (.4,.1);

I haven’t tested that code, so bit of adjustment may be necessary.

14. Chris Schommer-Pries - April 26, 2009

Ben’s method will make sure that the lines touch the node, which is probably what you want.

I had a similar issue where I needed to draw three arrows on top of each other, kind of like \rightrightarrows, but with three. Imagine what you would use for a simplicial set. I needed to do this a lot, so I made a new command:

\DeclareMathOperator{\triplearrow} {{\; \tikz{ \foreach \y in {0, 0.1, 0.2} \draw [-stealth] (0, \y) — +(0.5, 0);} \; }}

15. Yossi - June 10, 2009

Perhaps a little stale topic, but I wanted to let you know I just learned of a plugin for inkscape that lets you export to TikZ and apparently does a decent job:




Sorry comments are closed for this entry


Get every new post delivered to your Inbox.

Join 610 other followers

%d bloggers like this: