# MetaUML: via emp package for LaTeX gives no output

The following example prints only the figure's caption:

\documentclass[a4paper,11pt]{article}

\usepackage{emp}
\ifx\pdftexversion\undefined
\usepackage[dvips]{graphicx}
\else
\usepackage[pdftex]{graphicx}
\DeclareGraphicsRule{*}{mps}{*}{}
\fi

\begin{document}

\begin{empfile}
\begin{empcmds}
input metauml;
\end{empcmds}

\begin{figure}
\centering
\begin{emp}[classdiag](20, 20)
Class.A("A")()();
Class.B("B")()();
B.e = A.w + (-20, 0);
drawObjects(A, B);
\end{emp}
\caption{A class diagram}
\end{figure}
\end{empfile}

\end{document}


Environment: Ubuntu 11.04 (amd64), TexLive 2009, MetaUML 0.2.5, TeXMaker 2.2.1.

EDIT:

Here's full example with replacement of \ifx ... \fi with suggestion based on ifpdf package:

\documentclass[a4paper,11pt]{article}

\usepackage{emp}
\usepackage{ifpdf,graphicx}
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi

\begin{document}

\begin{empfile}
\begin{empcmds}
input metauml;
\end{empcmds}

\begin{figure}
\centering
\begin{emp}[classdiag](20, 20)
Class.A("A")()();
Class.B("B")()();
B.e = A.w + (-20, 0);
drawObjects(A, B);
\end{emp}
\caption{A class diagram}
\end{figure}
\end{empfile}

\end{document}


Processing still gives no graphical output. Only figure's caption is printed.

You shouldn't be testing pdflatex compilation as you do in the code from \ifx up to \fi, but rather with

\usepackage{ifpdf,graphicx}
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi


You can also use the gmp package

\documentclass[a4paper,11pt]{article}

\usepackage[shellescape,latex]{gmp}

\begin{document}

\begin{figure}
\centering
\begin{mpost}[mpsettings=input metauml;]
Class.A("A")()();
Class.B("B")()();
B.e = A.w + (-20, 0);
drawObjects(A, B);
\end{mpost}
\caption{A class diagram}
\end{figure}

\end{document}


and compile with pdflatex -shell-escape. (Disclaimer: I'm the author of the package.)

• Does pdflatex -shell-escape relate to the answer based on ifpdf? I've replaced \ifx ... \fi with corresponding code, but nothing have changed. May 3, 2011 at 15:39
• @Dmitry: No, for the emp solution it's not necessary to call pdflatex with -shell-escape. I've processed your input (with the suggested code change) with latex and pdflatex, getting the expected result. May 3, 2011 at 16:59
• I've edited my question adding (follow EDIT subsection) full example code with changes accordingly to your first suggestion. There must something tricky. May 3, 2011 at 17:10
• Nothing tricky: you have to run Metapost on the .mp file you get after the LaTeX run. If your file is called dmitry.tex, then there is a file called dmitry.mp; do mpost dmitry and run LaTeX again. May 3, 2011 at 17:14
• Being a little bit familiar with LaTeX and TikZ, I am very new to MetaPost. So, I've totally messed up with a plenty of new tools I should know about. You helped me so much! Thank you! I think I'll adopt using your package. May 3, 2011 at 18:16