LaTeX forum ⇒ Graphics, Figures & Tablesgmp package not work Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm

gmp package not work

Postby nphaibk » Wed Oct 08, 2014 6:08 am

I am trying to just test how to use gmp package to plot images inside Latex.
However, only [MP] showed in the pdf.

I used Texstudio with Miktex29 (also tested with Texlive, same error).

I saw a message "mpost is not recognized as an internal or external command...". But I did configure the mpost in /miktex/bin/mpost and added the option "-enable-write18" for pdflatex.

Can someone get me out of this?

  1. \documentclass[a4paper,11pt]{article}
  2. \usepackage[shellescape,latex]{gmp}
  3. \begin{document}
  4. \begin{figure}
  5. \centering
  6. \begin{mpost}[mpsettings=input metauml;]
  7. Class.A("A")()();
  8. Class.B("B")()();
  9. B.e = A.w + (-20, 0);
  10. drawObjects(A, B);
  11. link(inheritance)(B.e -- A.w);
  12. \end{mpost}
  13. \caption{A class diagram}
  14. \end{figure}
  15. \end{document}

User avatar
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Oct 08, 2014 8:42 am

Clicking on Open on Writelatex just above the code you posted opens an online LaTeX editor compiling the code sample. It works just fine. The package has last been updated in 2011, so i guess it is not simply solvable by an update.

Try compiling this code on the command line, so we can rule the editor out. Sometimes they are overprotective or do crazy things.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm

Postby nphaibk » Thu Oct 09, 2014 11:31 am

Thank you very much.

I have tried Texworks (built-in editor with Miktex) but received the same result.

Could you give some detailed guide for compiling the code via cmd line, I have never done with that, either Latex or Metapost. I am a Windows user.

Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm

Postby nphaibk » Thu Oct 09, 2014 2:31 pm

I managed to make it work.

mpost command in gmp package needs to be written in full path, for example:


(in the package, it is just "mpost").

This works with simple plot "draw (100,0)--(200,0)". For my example above, it still generates some error, but I think it is not related to my original question.

Thanks anyway.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9609
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Oct 10, 2014 11:21 am

Hi nphaibk,

very interesting, that you use MetaPost! Do you have experience with it, or specific reasons to use it? It's very capable, just today many people work with TikZ. The latter works natively within LaTeX and is very user friendly and also capable. Did you compare when choosing the plotting program?

Perhaps have a look at for seeing what I mean. For plotting, there's also PGFPlots which builds on TikZ.

I would be interested in what you make with MetaPost, so it would be great if you would post such images from time to time so that we can learn this code.

Stefan admin

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests