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 used metagraf to create the figure I wanted and saved it as a .mp file and I wanted to use the command "includegraphics{**.mps}" to include the corresponding figure but it said wrong, no such file founded. Now my question is how should I carry out the procedure provided I had already drawn out the figure I wanted using metagraf and saved it as a .mp file, so that I can include the figure into my output pdf file?

share|improve this question
Don't you have to convert it via 'metapost <filename>' to the final format? – Uwe Ziegenhagen Nov 15 '12 at 6:32
Welcome to TeX.SE. – Peter Grill Nov 15 '12 at 6:36
Possible Duplicate: metapost and pdflatex. Please have a look at this and see if it answers your question. If so, the this question can be closed as a duplicate. – Peter Grill Nov 15 '12 at 6:37
Well, I use mpost <filename> and sometimes it works well, sometimes it keeps saying "I can't find file XXX" where XXX is not the name of my file at all. Now who knows what's going on here and exactly how to include the product of metagraf in a latex file? – Xu Sun Nov 15 '12 at 13:16
did you really write \includegraphics{**.mps}, or was the ** just an example? – wasteofspace Nov 16 '12 at 10:43

You can use mpgraphics package to do this. Here is an example:


h=2in; w=2.7in;
path p[], q[], pp;
for i=2 upto 4: ii:=i**2;
p[i] = (w/ii,h){1,-ii}...(w/i,h/i)...(w,h/ii){ii,-1};
q0.5 = (0,0)--(w,0.5h);
q1.5 = (0,0)--(w/1.5,h);
pp = buildcycle(q0.5, p2, q1.5, p4);
fill pp withcolor .7white;
z0=center pp;
picture lab; lab=thelabel(btex $f>0$ etex, z0);
unfill bbox lab; draw lab;
draw q0.5; draw p2; draw q1.5; draw p4;
dotlabel.top(btex $P$ etex, p2 intersectionpoint q0.5);
dotlabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5);
dotlabel.lft(btex $R$ etex, p4 intersectionpoint q1.5);
dotlabel.bot(btex $S$ etex, p4 intersectionpoint q0.5);


You need to run TeX with shell scape option so if you use pdftex: pdflatex -shell-escape filename

share|improve this answer

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.