Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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);
link(inheritance)(B.e -- A.w);
\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);
link(inheritance)(B.e -- A.w);
\end{emp}
\caption{A class diagram}
\end{figure}
\end{empfile}

\end{document}

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

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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);
link(inheritance)(B.e -- A.w);
\end{mpost}
\caption{A class diagram}
\end{figure}

\end{document}

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

share|improve this answer
    
Does pdflatex -shell-escape relate to the answer based on ifpdf? I've replaced \ifx ... \fi with corresponding code, but nothing have changed. –  Dmitrii F. Volosnykh May 3 '11 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. –  egreg May 3 '11 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. –  Dmitrii F. Volosnykh May 3 '11 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. –  egreg May 3 '11 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. –  Dmitrii F. Volosnykh May 3 '11 at 18:16
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.