Re: Using MetaPost output in pdflatex...



I haven't been dia'ing or latex'ing for quite some time (sad world where I
don't write papers anymore), but I don't ever remember directly including
the metapost file into my latex file.  Maybe I didn't know better.  At any
rate, from a Dia list mail I sent shortly after writing the initial
MetaPost
plugin:

"Basically you just put your LaTeX expression in a text box, export your
diagram to produce a .mp file, run mpost file.mp to produce file.1 which
can
be renamed to file.eps and used.  The eps file will have your latex
results
in it."

This worked, at least, at one time.

I've tried that approach also, it gives me the exact same problems.
MetaPost doesn't like some aspects of the *.mp file.  I'm not sure whether
there are some Dia components I could avoid that would dodge these problems,
but I really need those components that I've used (UML class with text,
connecting lines with arrows.)

I'll probably just end up exporting a *.eps file, or trying the approach
described by moritz.

If you ever get the chance to do some more papers, the little idiom I listed
below pulls all the metapost content throughout your document into a single
*.mp file.  You then run mp on that one file, creating a bunch of .1, .2,
.3, etc. files.  This file is then automatically included in the latex
document.

Of course, in the preamble, you need something like this...

\usepackage{emp}
\DeclareGraphicsRule{*}{mps}{*}{}

\ifx\pdftexversion\undefined
\usepackage[dvips]{graphicx}
\DeclareGraphicsExtensions{.eps}\else
\usepackage[pdftex]{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.mps,.mp}
\usepackage{epstopdf}
\fi

The epstopdf package lets you do seamless integration of *.eps files in a
pdflatex document.  If it encounters a *.eps file for which no *.pdf exists,
it creates one.

\begin{figure}
\begin{emp}
\input diagram.mp;
\end{emp}
\end{figure}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]