[metapost] how to use mpfile.1, mpfile.2 or other in latex file

liuqiang linux.qiang at gmail.com
Tue Sep 25 08:47:59 CEST 2007


Next is temp.mp and temp.tex.
After mposted tmep.mp file, I got two eps files: temp.1 and temp.2.
I can copy temp.1 into temp_1.mps, copy temp.2 into temp_2.mps.
Then in temp.tex file, using

\includegraphics{temp_1.mps}
\includegraphics{temp_2.mps}

I can encapsulate eps files into pdf file by

latex temp.tex
dvipdf temp.tex(or dvipdfmx temp.tex)

or

pdflatex temp.tex

Now, I have two questions:
1. why does "dvipdfm temp.tex" fail?
2. If I want to use temp.1 and temp.2 directly in tex file, how should I do?

----------------------------------------
Next is temp.mp.
----------------------------------------
verbatimtex
\documentclass [10pt]{article}
\begin {document}
etex;

input boxes;

beginfig(1)
  boxit.ba(btex box ba etex);
  boxid.dx = boxid.dy = 0.5cm;
  drawboxed(ba); 
endfig;

beginfig(2)
  drawarrow (-1cm, 0)--(5cm, 0);
  drawarrow (0, -1cm)--(0, 5cm);
  label.llft(btex $0$ etex, (0,0));
  draw (0, 0)--(1.5cm, 2.5cm) withcolor 0.625red;
endfig;

verbatimtex
  \end{document}
  etex;
end
----------------------------------------
Next is temp.tex.
----------------------------------------
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Below is figure 1.
\includegraphics{temp_1.mps}

Below is figure 2.
\includegraphics{temp_2.mps}
\end{document}
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
----------------------------------------


More information about the metapost mailing list