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?
1 Answer
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
\includegraphics{**.mps}
, or was the**
just an example?