views:

1792

answers:

4

My group uses Literate Programming for most of our source code---this means that internal documentation is written using LaTeX. We have been using PStricks for fancy technical diagrams of the system, but have recently been recommended to use TikZ. I've gathered this information:

  • TikZ/PGF is new and maintained; PStricks went a long time without a maintainer but has received some maintenance in the last couple of years.
  • TikZ works with many back ends, including (for those who care) pdftex. PStricks works only with dvips.
  • PStricks is more powerful and expressive than TikZ. In a dire emergency you even have the full power of PostScript.
  • PStricks has a significant ecology of extra packages that have been built on top of it; TikZ is too new to have many such things.
  • TikZ claims to have been designed "with the shortcomings of PStricks in mind." The author does not specify which shortcomings.

I'm interested in the answers to two questions. If you wish, feel free to post one answer per question:

  • What is the learning curve like for the two tools? (I consider PStricks to have a steep learning curve; about TikZ I am uninformed.)

  • Considered as programming APIs, is one of these two packages significantly better designed than the other? If so, which is the better design, and why? (What properties does it have that make you consider it better?)

To make a compelling argument why one API is better than another, you may want to resort to examples.

+5  A: 

Quick answer: I prefer TikZ to pstricks because I think TikZ

  • is better designed
  • is easier to learn
  • is compatible with pdftex
  • gives you more power and abstraction (you don't have to specify as many coordinates by hand)
  • lets you create more beautiful graphics with the same effort
  • it is easier to extend using TeX programming (it was designed from the ground up with extensibility in mind)

For the users of pstricks, I'd recommend writing all new documents using TikZ in the future. For the users of METAPOST, if their graphics don't use linear equation solving, I'd recommend TikZ. If the METAPOST graphics needs linear equation solving, I'd suggest trying Asymptote.

pstricks does indeed give you the power of PostScript, but it is not PostScript which makes your graphics authoring powerful, but it is abstraction: the use of automatic positioning, automatic intersection calculations, and display style templates. TikZ gives you powerful abstractions, even if you are not a programmer, or you are not willing to program this time.

I don't have experience writing TikZ extensions, but from a quick glimpse of the TikZ source code, it seems to be easy to understand and extend, compared to other TeX macro packages I came across.

pts
What makes TikZ a better design?
Norman Ramsey
I am not familiar enough to the TikZ or PSTricks code to answer this for you. Have a look at the code. I think you'll find more proper and useful and generic abstractions there (which you can hook on in your extensions) than in PSTricks.
pts
It's been too long since I used PSTricks, so I can't answer the question, but I like to add that TikZ has a very nice 500+ pages manual full of examples. Once you are familiar with the basics of TikZ, you can quickly use almost any feature by looking in the manual for 10 minutes. I've written some TikZ extensions such as new node shapes, and this is not so hard if you understand the TeX calculation primitives and look at the TikZ source code.
Bruno De Fraine
+1  A: 

I think pstricks is superior. TikZ doesn't even have a good way of translating coordinates, like the rput/uput/Aput/Bput pstricks commands. You can use xshift and yshift, but these require units (!), so scaling the image will require manually shaling every xshift/yshift call.

John
Not true. You can scale the entire image in tikz by simply adding a scale option, such as `\begin{tikzpicture}[scale=2]` will make the image twice its original size.
Curious2learn
A: 

I've only ever used PSTricks, but I've made it do everything I want it to do. Tikz has a great-looking manual and is clearly very powerful. There are two things that I would want out of a drawing system that I can't do with PSTricks: feathered edges (which Tikz can do), and I can't remember the other thing. OP was asking about 'ease of learning': PSTricks certainly requires some trial and error, and I think some coding discipline which I'm not very good at. But \rput is pretty central to how I use PSTricks.. I can't imagine being without it.

On the other hand, 'decorations' look pretty neat. I like the 'saved from trash' example on page 210 (!) of the (560 pp. total) manual. I don't like the fact that Tikz seems to use an entirely different notation -- I don't recognize LaTeX in it which makes it seem foreign and weird. The manual looks beautiful, though. The transparency and 'fade' effects seem very powerful .. can that be done in pstricks? .. but I doubt that I would ever use them. Tikz seems a bit more on the "drawing" end of things. As a rule, I don't make drawings, I make figures.

Can you do arithmetic on coordinates? I'd have to start over and learn from scratch to use Tikz, which is a tough sell if I'm not even sure what I would get out of it.

brandon
+1  A: 

As a fond user of TikZ I have been having this debate with a professor in my physics department who loves pstricks and I think we have come to a conclusion as I have stated in other posts. Absent a few times when dipping into the PS itself, TikZ and pstricks are very comparable in most ways. The extensibility and compatibility of TiKZ is appealing leading us to agree that:

  • We think that new users should learn TikZ.
  • Old hands at pstricks probably wont gain enough from the switch and may not be worth doing.

Hopefully that helps!

Joel