3

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?

5
  • 1
    Don't you have to convert it via 'metapost <filename>' to the final format? Nov 15, 2012 at 6:32
  • Welcome to TeX.SE. Nov 15, 2012 at 6:36
  • 1
    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. Nov 15, 2012 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, 2012 at 13:16
  • did you really write \includegraphics{**.mps}, or was the ** just an example? Nov 16, 2012 at 10:43

1 Answer 1

4

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

\documentclass{article}
\usepackage{mpgraphics}
\begin{document}

\begin{mpdisplay}
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};
endfor
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);
\end{mpdisplay}

\end{document}

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .