## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ gmp package not work Topic is solved

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

### gmp package not work

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?

\documentclass[a4paper,11pt]{article}\usepackage[shellescape,latex]{gmp}\begin{document}\begin{figure}\centering\begin{mpost}[mpsettings=input metauml;]Class.A("A")()();Class.B("B")()();B.e = A.w + (-20, 0);drawObjects(A, B);link(inheritance)(B.e -- A.w);\end{mpost}\caption{A class diagram}\end{figure}\end{document}

Johannes_B
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm
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.

nphaibk
Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm
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.

nphaibk
Posts: 23
Joined: Fri Sep 19, 2008 4:34 pm
I managed to make it work.

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

"C:/somefolder/MikTex29/MikTex/bin/mpost"

(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.

Stefan Kottwitz
Posts: 9609
Joined: Mon Mar 10, 2008 9:44 pm
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 TeXample.net 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