I am comparing the cores of PSTricks with TikZ and their capabilities. I am not considering whether or not a library has been implemented.

Are there examples written in PSTricks and they cannot be done using TikZ?

Answers to question in the reverse direction, "Are there examples written in TikZ and they cannot be done using PSTricks? , is also allowed.

I still cannot imagine what kind of trickeries are possible in PSTricks but not in TikZ? Is there an example?

  • In PSTricks you can sometimes use Postscript code directly e.g. to calculate things. This of course requires a Postscript interpreter and therefore couldn't be done with TikZ when compiled with pdflatex. You could now argue that you can rewrite that code to something on a higher level TikZ supports. – Martin Scharrer Jun 2 '11 at 9:10
  • 1
    The limits actually of TikZ is pgfmath. Calculus with Tex are not efficient and often very slow. We can do a lot of things with TeX but we can't compare calculus and programming with postscript and the same thing with TeX. Now perhaps lua and luatex can change something. With lua and some modules we can do I think everything but I don't how if the compilation is not too slow ? – Alain Matthes Jun 2 '11 at 10:27
  • tug.org/PSTricks/main.cgi?file=Examples/Gallery3D/Gallery3D try to realize it with tikZ ... ;-) – user2478 Jun 3 '11 at 4:27
  • @Altermundus: It will be interesting to see what will be possible with LuaTeX with an integrated MetaPost 2. Since we will then have arbitrary precision, it will most likely be more powerfull than PSTricks. – Martin Schröder Jun 4 '11 at 22:59
  • 1
    @Herbert Yes, PSTricks does it, but it's too far from being a good typography. A skilled draftsman (from the past times) will do it faster and better looking. I am neither a draftsman, nor an engineer. But I am pretty sure, there are some DIN and ISO standards on 2D and 3D drafts. And I am also pretty sure - neither PSTricks, nor PGF/TikZ follow any of these standards in any way. I know, that the programmers are usually neither typographers, nor draftsmen. But... There is big, even I will say a huge, room for improvement... – Karl Karlsson Jun 7 '11 at 10:18

The PGF manual states (p20 in version 2.10):

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.

On the previous page, when discussing frontends to PGF, it says:

It would be possible to implement a pgftricks frontend that maps pstricks commands to pgf commands. However, I have not done this and even if fully implemented, many things that work in pstricks will not work, namely whenever some pstricks command relies too heavily on PostScript trickery. Nevertheless, such a package might be useful in some situations.

I remember reading something that Till Tantau wrote on a mailing list about this; sure enough, a search for "pgf pstricks" brings up this message from 2008 (I'm not sure if it is legal to cut-and-paste the whole message here, all of it is relevant I deem) which starts with:

actually, that passage in the manual is rather old, TikZ can now do
most of the things that pstricks can.

He goes on to say that the major advantage of PSTricks is that postscript is better at maths than TeX and that PSTricks can do fancy things with text that isn't possible in PDF. The last comment is:

According to user feedback, it seems to be an advantage that pstricks
has a short manual. A good book on TikZ would certainly help, here.

Or a good website ... such as this one!

| improve this answer | |
  • 2
    One example "computational trickery": I once wrote a simple forward Euler ODE solver in pstricks for my wife's thesis. (Ahh, good times) – Dean Serenevy Jun 2 '11 at 13:16
  • 4
    @Dean: Fancy posting the code? That would be a good example. – Andrew Stacey Jun 2 '11 at 13:27
  • @Andrew Stacey: where is the short manual of PSTricks? – user2478 Jun 3 '11 at 4:24
  • 1
    @Andrew: sure and it is a wrong statement from Till ... – user2478 Jun 3 '11 at 6:51
  • 1
    @Herbert: I am not trying to defend it! I was merely trying to help focus the question by gathering some information. I don't like the perception that there is some sort of "war" between TikZ and PSTricks, but this question is asking for examples which seems (to me) totally legitimate. My answer ought really to have been a comment (as it doesn't actually answer the question) but it was a bit long for that. Your comment (on the question) is more of an answer than this! – Andrew Stacey Jun 3 '11 at 7:32

By "popular demand", a forward Euler ODE solver. Very old code, so isn't really the most elegant, but gets the job done. Compile with latex or xelatex (no pdftex).


\newcommand{\arrowedphaseplane}{     \pscustom{
     \code{20 dict begin %DEFINE NEW DICTIONARY
           /as-arrows [\PhasePlaneArrows] def
           /as-arrows-length as-arrows length def
           /as-arrows-index 0 def  %ARROW ARRAY SETUP
           /as-y exch def /as-x exch def as-y sub neg /as-y-scale exch def
                                         as-x sub neg /as-x-scale exch def
           /as-x \x@start\space def /as-y \y@start\space def
           moveto %setup that defines scaling for PS and moves to (x_0,y_0)
           1 1 \steps\space { %step control
             as-arrows-index as-arrows length lt {
               as-arrows as-arrows-index get eq {
                 /as-arrows-index as-arrows-index 1 add def
                 as-x as-x-scale mul
                 as-y as-y-scale mul
                 as-x \fx \space \dx \space mul add as-x-scale mul
                 as-y \fy \space \dx \space mul add as-y-scale mul
                 ArrowB pop pop pop pop
                } if
              } {pop} ifelse
             \fx \space \dx \space mul dup as-x-scale mul
             \fy \space \dx \space mul dup 4 1 roll as-y-scale mul
             rlineto %draw the line
             as-x add /as-x exch def  %update x
             as-y add /as-y exch def  %update y
       } for }


  \psline[linewidth=1pt]{-}(-1.2,0)(1.2,0) % x-axis
  \psline[linewidth=1pt]{-}(0,-1.2)(0,1.2) % y-axis
  \psline[linewidth=0.5pt]{-}(1,-.05)(1,0.05)   % tick mark
  \psline[linewidth=0.5pt]{-}(-1,-.05)(-1,0.05) % tick mark
  \psline[linewidth=0.5pt]{-}(-.05,1)(0.05,1)   % tick mark
  \psline[linewidth=0.5pt]{-}(-.05,-1)(0.05,-1) % tick mark

  \psset{linewidth=1pt,arrowinset=1.4,arrowscale=2 1}

  \def\PhasePlaneArrows{10 25}% iterations where arrows are to be drawn

  \def\fx{as-x -0.2 div}                         % takes x'
  \def\fy{as-x 1 as-y sub mul as-y 10 div sub}   % takes y'






enter image description here

| improve this answer | |
  • 1
    Are there TikZ experts here who can confirm that this example is really impossible to be written in TikZ? I have no knowledge to make a decision to accept this as the final answer. :-) – xport Jun 3 '11 at 7:21
  • @xport: Theoretically one could write an ODE solver in pure TeX. However, it is not possible to use PostScript code directly in TikZ. – Caramdir Jun 3 '11 at 20:28
  • @Caramdir: TikZ can also use PostScript code – user2478 Jun 4 '11 at 6:19
  • 3
    @Herbert: If PostScript can be written in TikZ, then is there an answer for my question above? – xport Jun 4 '11 at 11:33

Since both run within TeX, which is a Turing complete engine the answer is NO, there is nothing that the one can do that the other can't, as it is always possible to write enough \expandafters and macros on top of them to achieve what you want.

One area though where pstricks is far more superior to pgfplots is a much cleaner user interface.

| improve this answer | |
  • @Jasper I mean the commands read better, they are more easily understood by the user. – Yiannis Lazarides Jun 3 '11 at 21:44
  • 8
    @Yiannis: The main part of PSTricks runs not inside TeX! And why is the user interface cleaner? The syntax is different, that's all ... – user2478 Jun 4 '11 at 6:13
  • @Herbert I am aware the main part is running outside TeX. TeX though gives you a hook to get there. Similarly one can hook to gnuplots or other programs or spent three years and do it through TeX. I personally find the PSTricks interface cleaner, that is easier to read ... less messy. – Yiannis Lazarides Jun 4 '11 at 7:05
  • 1
    @Jasper Loy: it makes only sense to decide which syntax or code is more consistent or not if you are a power user in TikZ and PSTricks. I do not know such a person ... – user2478 Jun 4 '11 at 10:35

Another example which cannot be done with TikZ. The image shows the first 15 derivations of f(x)=1-x^2/2+x^4/24-x^6/720+x^8/40320-x^10/3628800+x^12/479001600-x^14/87178291200 (black curve), calculated by the PS function Derive:


  \ifcase#1 black\or RedOrange\or magenta\or yellow\or green\or Orange\or
    blue\or DarkOrchid\or BrickRed\or Rhodamine\or OliveGreen\or Goldenrod\or 
    Mahogany\or OrangeRed\or CarnationPink\or RoyalPurple\or Lavender\fi}
  \ifnum\in=0 \psset{linewidth=1.75pt}\else\psset{linewidth=1pt}\fi%


enter image description here

| improve this answer | |
  • @Herbert: Is there a factorial function in PS? – xport Jun 3 '11 at 11:41
  • 1
    @xport: sure, but yet only in PostScript notation: "3 fact". Should be no big deal to make it also possible for the algebraich noation with "3!". – user2478 Jun 3 '11 at 12:30
  • @Herbert: Thanks. Hopefully algebraic version can be immediately available. :-) – xport Jun 3 '11 at 12:36
  • Are there TikZ experts here who can confirm that this example is really impossible to be written in TikZ? I have no knowledge to make a decision to accept this as the final answer. :-) – xport Jun 3 '11 at 14:04
  • @Jasper: We need more trickier examples than this one? – xport Jun 3 '11 at 19:57

1) nodesep with pstricks and pst-tree has no equivalent with tikz. This is a problem with Tikz you need to give the sibling distance by hand and not the distance between two nodes. It's possible to create the tree with TikZ with the result of pstricks but it's not easy.

With Pstricks:



With TikZ



node[rectangle split,rectangle split parts=3]%,rectangle split draw splits=false

       text width        = 8em,
       text centered,
       level distance    = 9em,
       every node/.style = {rectangle,
                            rounded corners,
                            top color=white,
                            bottom color=blue!50!black!20,
                            very thick,
                            outer sep =2pt,
                           every third node part/.style={font=\footnotesize}}]

  grow=up,<-,,>=open triangle 60,
  level 1/.style={sibling distance=60em},
  level 2/.style={sibling distance=11em}}}

  level 2/.style={sibling distance=65em},
  level 3/.style={sibling distance=60em},
  level 4/.style={sibling distance=30em},
  level 5/.style={sibling distance=20em},
  level 6/.style={sibling distance=10em}}}

  level 3/.style={sibling distance=10em},
  level 4/.style={sibling distance=10em}}}

\path \spnode { PAROIS}{Pascal}{date}
    child {\spnode {HAMEL}{Brigitte}{date}
      child {\spnode {GUIGARD}{Odette}{date}}
      child {\spnode { HAMEL}{Jean}{date}
        child {\spnode { TORQUEO}{Reine}{date}}
        child {\spnode { HAMEL}{Henri}{date}
              child {\spnode { THOMAS}{Marie}{date}}
              child {\spnode { HAMEL}{Paul}{date}
                child {\spnode { CHANTEUR}{Marie}{date}}
                child {\spnode { HAMEL}{Emile}{date}
                  child {\spnode { HAUVILLE}{Marie}{date}}
                  child {\spnode { HAMEL}{Ulysse}{date}}}}
    child[upstyleleft] { \spnode{ PAROIS}{Guy}{date}
    child[upstyleleftright] {\spnode { COLLANGE}{Odette}{date}
       child {\spnode {OLLIER}{Marie }{date}}
       child {\spnode { COLLANGE}{Claudius}{date}
            child {\spnode { GIMBERT}{Philomène}{date}}
            child {\spnode { COLLANGE}{Jean}{date}}
     child[upstyleleft] {\spnode { PAROIS}{Alexandre}{date}
     child {\spnode { BEZIEAU}{Marie}{date}
          child {\spnode { LEAUTE}{Marie}{date}
               child {\spnode { CHEVALIER}{Rosalie}{date}}
               child {\spnode { LEAUTE}{Pierre}{date}}
          child {\spnode { BEZIEAU}{Jean}{date}
               child {\spnode { GENDRON}{Marie}{date}}
               child {\spnode { BEZIEAU}{Jean}{date}}
     child {\spnode { PAROIS}{Alphonse}{date}
          child {\spnode { LEBRETON}{Marie}{date}
               child[sibling distance=10em] {\spnode { RENAUD}{Marie}{date}
                    child {\spnode { EGRON}{Angélique}{date}}
                    child {\spnode { RENAUD}{Pierre}{date}}
               child {\spnode { LEBRETON}{Jean}{date}}
          child {\spnode { PAROIS}{Auguste}{date}
               child {\spnode { DOUILLARD}{Adèle}{date}
                    child {\spnode { BONNET}{Marianne}{date}}
                    child {\spnode { DOUILLARD}{Louis}{date}}}
               child {\spnode { PAROIS}{Jean}{date}
                    child {\spnode{ DUGUY }{Marie}{date}}
                    child {\spnode{ PAROIS}{Pierre}{date}}



enter image description here

2) Another thing is about Bezier's curves and the control points, there is nothing automatic with Tikz

| improve this answer | |
  • TikZ can draw curve using code like \draw[smooth] plot coordinates {(0,0) (1,1) (2,0)}; – Leo Liu Jul 15 '11 at 5:50
  • @Leo Yes but you can't compare \draw[smooth] with the algorithm of John Hobby In Metapost or with the Three-dimensional generalization of Hobby’s algorithms in Asymptote !!! – Alain Matthes Jul 15 '11 at 15:58
  • How about PSTricks? – Leo Liu Jul 15 '11 at 16:28
  • From the doc pgf : "Note that the smoothing algorithm is not very intelligent. You will get the best results if the bending angles are small, that is, less than about 30 and, even more importantly, if the distances between points are about the same all over the plotting path.". Now I don't know exactly how pscurve is built but in some cases you get strange results with smoothand not with pscurve. Herbert can find some examples ! – Alain Matthes Jul 15 '11 at 19:13
  • 1
    Just by-the-by: Hobby's algorithm now has several implementations in TikZ: tex.stackexchange.com/q/54771/86 – Andrew Stacey Jul 26 '12 at 8:52

TeX (and consequently PGF/TikZ) can't access drawing path of each characters. The only thing that is available is the bounding box of a character.

Conversely, TeX can't use results from PostScript (and PSTricks) calculus while it can take into account results from TikZ.

| improve this answer | |
  • Well, that first is not quite right. TeX can't automatically do so, but it's not hard to give it the relevant data. See tex.stackexchange.com/a/51462/86 and tex.stackexchange.com/a/21594/86 for how to do this. – Andrew Stacey Jun 6 '12 at 6:52
  • @AndrewStacey In this case, my second assertion is also false: PostScript interpreter can write an external file that is read by TeX (during a second compilation). ;-) – Paul Gaborit Jun 6 '12 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.