Re: Metapost - text alignment



On 1/29/07, Lars Clausen <lars raeder dk> wrote:
Thanks, I'll give it a try.  Do you have a quick-and-dirty way to see if
metapost output is correct (e.g. convert MP files directly to PNG or
something)?  I'm not a metaposter myself.

Here is a fairly minimal LaTeX file to include MP figures.  First, run
LaTeX or PdfLaTeX on the test.tex file (with Diagram.mp in the same
directory).  This will create test.mp with all the metapost diagrams
from the file in one place.  Then, run 'mpost -tex=latex test.mp' to
do the MetaPost magic.  This will create 'text.1' which is a
postscript file with some extra goodies.  Finally, re-run LaTeX (or
PdfLaTeX) to create your final output.

There will be an error complaining about the end of the MP file.
Using the above stuff, I can work with a LaTeX document with lots of
MP figures, and they are all updated and compiled on the fly.  The
'\empfile' starts a bulk *.mp file, but I haven't found any way to end
it.  As far as I can tell, this error is totally harmless.

Let me know if you have any questions,

              Rob

\documentclass[]{article}

\usepackage{ifpdf}

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

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


\begin{document}

\empfile

\begin{figure}[htbp]
\begin{emp}(1,1)
input Diagram1.mp;
\end{emp}
\end{figure}

\end{document}



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