23

Can the experts here comment on the pros and cons of these two languages? I have been using metapost for a long time and I was wondering if I should learn pgf/tikz also.

How does both languages compare as far as the programming ability goes? I mean the ability to create user defined functions.

I am a research student in engineering. So my requirement is drawing graphs/block diagrams/engineering figures etc.

Thanks in advance for your opinions suresh

suresh
  • 1,447
  • 2
    That's a very general and open question. You know MetaPost well, perhaps have a look at pgf/TikZ and post a very specific question? For explanation, see: Gorilla vs. Shark. – Stefan Kottwitz Nov 11 '11 at 22:30
  • 1
    I guess a look at the PGF manual can tell you about the power of TikZ/PGF. It starts with some very nice tutorials showing the general usage. – Tobi Nov 11 '11 at 23:01
  • Why leave MetaPost if it can do everything you need? If there is something it can't do then that can be your starting point. Also, have you considered PSTricks such as here or here? – DJP Nov 12 '11 at 04:56
  • 1
    @DJP I tarted with PSTricks when I learned LaTeX, but I was lured by MetaPost later and finally left PSTricks completely. I was looking for some comparisons based on facts from those who know both MetaPost and pgf/tikz well. My googling did not surprisingly give any comparison info :) – suresh Nov 13 '11 at 00:09
  • 1
    I have the same dilemma as @suresh. I need to draw a plethora of technical drawings (e.g., statistical distributions with annotations, graph theory concepts) and include them both into lecture notes created with LaTeX and into Beamer slides. I'm now struggling between MetaPost and TikZ/PGF too. – Andrej Nov 13 '11 at 14:33
  • @Andrej I have not switched to TikZ/PGF. I am curious to know how things go for you. :) – suresh Nov 17 '11 at 21:51
  • 1
    @suresh What I miss in MetaPost is better (i.e., fluent) integration with LaTeX documents. So I stay with TiKZ/PGF for now. – Andrej Nov 17 '11 at 22:32
  • @Andrej may be all this tempts me to learn TiKZ/PGF :) – suresh Nov 17 '11 at 22:45
  • 3
    Metapost code can be easily integrated in LaTex documents using the gmp package http://www.ctan.org/pkg/gmp . – mmj Apr 08 '13 at 14:08

1 Answers1

17

For me, the main differences are:

  • metapost is an external program, so you need more complicated processing or \write18 calls; also, tikz pictures may be better integrated with the rest of the document (eg, they ingerit the fonts from their surroundings).
  • metapost is an easier programming language (no problems with TeX parsing, macros, expansion etc.).
  • metapost is better at drawing "nice" Bezier curves (you do not have to specify control points yourself).
  • tikz seems to have larger library of dedicated routines for different tasks; also, it has quite a few built-in ways of specifying coordinates, shape and decoration libraries etc.
  • tikz supports mainly pdf (in particular, transparencies); metapost had some problems with that (or with filling with patterns-but it was a long time ago I used it).
  • on the other hand, metapost has the excellent metafun macro package by Has Hagen.
mbork
  • 13,385
  • 4
    AFAIK with luaTeX metapost is not longer an external program. – Schweinebacke Nov 13 '11 at 10:26
  • 2
    @Schweinebacke Metapost has been turned into a library and LuaTeX has some APIs to link to it. But only ConTeXt has support for these calls, up to now. – egreg Nov 13 '11 at 10:41
  • 3
    Two recent packages allow for integration of Metapost into LaTeX (via shell-escape, of course): mpgraphics by Vafa Khaligi and gmp (it's a package of mine). – egreg Nov 13 '11 at 10:43
  • @egreg: right, but (obviously) they utilize \write18, which might e.g. be not very portable (I don't know for sure, never used that). BTW: I hardly ever use metapost in LaTeX now that tikz is available. – mbork Nov 13 '11 at 18:19
  • 2
    It's portable so long as the final user has a TeX distribution not several years old and they give the -shell-escape option (or -enable-write18 for MiKTeX; in the last version also MiKTeX knows -shell-escape) – egreg Nov 13 '11 at 18:55
  • @egreg: thanks, I was also thinking about problems with paths (which might be nontrivial in case of parallel installations of, say, different versions of MikTeX). I guess this should also be fine, if the installation is done correctly anyway. As for "several years old" - well, people are still using MikTeX 2.6 from 2007 (and older versions too, I guess), but again: it is them who asks for problems then. – mbork Nov 13 '11 at 23:24
  • @mbork Any comparison regarding the programming capabilities of both languages? I did a quick scan of the tikz manual, but I couldn't figure this out myself. – suresh Nov 17 '11 at 21:54
  • Well, tikz is built on top of (La)TeX, so you have what you have in TeX. Metapost seems to be a bit more similar to "classical" programming languages, although (afaik) it still has macros and not functions, for instance. So both are quite powerful, but in their peculiat way;).

    One thought: if you want something more similar to modern scripting languages, you might use lualatex and generate tikz code on lua end.

    – mbork Nov 17 '11 at 22:42
  • 3
    I endorse egreg's comment, gmp package (http://www.ctan.org/pkg/gmp) allows easy Metapost integration into LaTex. – mmj Apr 08 '13 at 14:11