< a quantity that can be divided into another a whole number of time />

Asymptote and Metapost

January 18, 2011

I am planning to make a lot of illustrations for basic mathematical and statistical concepts, but I am still hesitating about the drawing program to choose. I know a bit of Metapost and Asymptote, but I am not clear about the pros and cons of each of the vector drawing language. Especially, I’ve heard that Asymptote is somewhat “superior” to Metapost.

MetaPost is based on Knuth’s METAFONT, but it is intended for figures in technical documents according to its primary author, John Hobby. I had a hard time understanding its syntax when I discovered it. Asymptote was developed more recently.

So, what are the main differences between Metapost and Asymptote?


I like Metapost because it nicely fits within Context. It is also possible to typeset directly Metapost code into a document, see MPlib: MetaPost as a reusable component, TUGboat, Volume 28 (2007), No. 3), and the luamplib package for Lua$\LaTeX$. My preferred textbook is still Metafun, from Hans Hagen:


A simple previewer was made available online by Troy Henderson.

Other useful references are:

I should also cite the splendid work of Alan Kennington who offers more than 300 illustrations on his dedicated website

The current maintainer of MetaPost, Taco Hoekwater, recently announced the release of an alpha version of Metapost 1.5, but I didn’t switch. The MP version that comes with TeXLive is actually

$ mpost --version

MetaPost 1.211
Copyright 2009 AT&T Bell Laboratories.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the MetaPost copyright and
the Lesser GNU Lesser General Public License.
For more information about these matters, see the files
named COPYING, COPYING.LESSER and the MetaPost source.
Primary author of MetaPost: John Hobby.
Current maintainer of MetaPost: Taco Hoekwater.


Asymptote is arguably more recent and it allows to work in 3D. It also plays nicely with animated PDFs. It is supposed to have a cleaner syntax — I suspect this is also a way to say that some people were quite reluctant to MP syntax, and to correct drawing imprecision of Metapost (I should look into more details). There’s no internal solver, though; but there is a Metapost compatibility module.

Asymptote can also be used in interactive mode, which is very handy. Here is what I added in my .profile file so that EPS file are directly previewed using

export ASYMPTOTE_PSVIEWER="/usr/bin/open"

Other useful references are:

So what?

The Asymptote FAQ - Section 8 comes in mind first since it is dedicated to the differences between Asymptote and MetaPost. However, it appears that it merely concentrates on which Asy commands correspond to which MP instructions.

The most interesting thread I found on the web was MP vs. Asymptote (Laurence Finston, 2006). Unfortunately, it doesn’t provide an in-depth comparison of both languages, although I remain sensible to Finston’s arguments.

At risk of being old-fashioned, I like those kind of programs because we don’t have to bother with complex or useless GUIs. I must admit I never get used to xfig, and I didn’t reinstall it on my Mac. Maybe I should give a try to jfig. I know OmniGraffle is available on OS X. I used it from time to time, but I didn’t get used to all of its features, to be honest. Anyway, the Graphics page from the Context Navigator includes a lot of useful pointers for those interested in managing graphics and vector drawings with Context.


See Also

» Syntax highlighting in Latex » Switching to Biblatex » Upgrading Context