TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get better at metapost, but the error messages are pretty cryptic (if there are at all) and it always takes a big effort go compile an mp file. Up 'best' program for writing and compiling mp so far is http://www.tlhiv.org/mppreview/. It does provide some error messages but most of them are not useful.

What program do you use for writing/debugging your metapost code?

Is there a good IDE for writing metapost (that e.g. checks syntax and automatically updates a preview)?

MP seems to be such a nice thing but it seems for beginners it is incredibly complicated to get into.

share|improve this question
Do you get better error messages when you compile at the command line? If so, your IDE is hiding stuff from you. If not, I doubt any IDE will expand on the error messages produced by the compilation command itself. – cfr Jul 27 '14 at 22:09
What platform are you using? Windows? OSX? Linux? – Thruston Jul 27 '14 at 23:06
I am using win7 with miktex (texmaker as editor for tex files) – flawr Jul 28 '14 at 11:21

If you use the gmp package, you can compile your document and get the Metapost figure at the same time; so if you need an IDE, the one you use for LaTeX will do.

Myself, I have a very short shell script to compile the figure and a de minimis LaTeX file for viewing it:

mpost figure.mp;
mv figure.1 figure.mps;
pdflatex testfigure.tex;

The file testfigure.tex is very simple, as well:


It occurs to me that I really should just have the script write out this file as well as compile it; it would be very easy, and cut out a step in preparing to develop Metapost figures.

This small preparation done, I can just go to work on the figure and compile/view it with a single command. I write it in vim and view it in xpdf.

Good luck with Metapost; it really is a joy.

share|improve this answer
Thank you for answering! I already tried to make a batch file (successfull) to do the work, but there too I cannot get any helpful error messages which makes it a pain to find them. How do you deal with 'bugs'? – flawr Jul 27 '14 at 18:45
@flawr, what happens if you run the script suggested by @dgoodmaniii with an added -debug flag to mpost, so mpost -debug figure.mp? – Joe Corneli Jul 27 '14 at 22:29
As for helpful error messages, I find Metapost's error messages to be reasonably helpful already. I've rarely had serious trouble locating errors in Metapost; the line where Metapost finally hung itself is clearly identified, and it's usually fairly straightforward to track the error backward from there. When I can't tell, I've googled the error and always found the solution. -debug may be helpful. When you get the error, you can also hit "H", just like for a TeX error, and the system will try to give you more information. Otherwise, the Internet may have to be your last resort. – dgoodmaniii Jul 28 '14 at 1:26
Thank you for your hints and comments, I came up with the following solution: I have three windwos on my screen: 1.) npp for editing the source testfile.mp which needs to have follwong command (or it won't work): outputtemplate:="%j.mps";, 2.) the console for the compilation command (perhaps gonna make a nice batch file someday) with the command mptopdf testfile.mp 3.) the SumatraPDF viewer which automatically reloads the new pdf as soon as it has changed. But it really is a pitty that there is no 'plug and play' sort of editor, that would it make easier for beginners... – flawr Jul 28 '14 at 11:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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