LaTeX forum ⇒ Graphics, Figures & TablesMetapost MetaUML: use italics

Information and discussion about graphics, figures & tables in LaTeX documents.
Posts: 12
Joined: Sun Jul 12, 2009 4:48 pm

Metapost MetaUML: use italics

Postby mina » Thu Jun 24, 2010 2:27 pm

Hi all,

I am not sure whether this is the right place to post (you already corrected me Thorsten, sorry about my last post :P).

Is anyone here using the MetaUML package? I have been using it for quite a while now but I have been unable to find a way to make parts of the text in the diagram appear in Italics. By reading the manual (CTAN links to 0.2.3, on sourceforge 0.2.5 can be found too) and the short intro I deduced that I may have two options to do this.
The tex file (use PDFLaTeX):
  1. \documentclass[a4paper,10pt]{report}
  2. % The following is needed in order to make the meta-uml code compatible
  3. % with both latex/dvips and pdflatex. Has to come before hyperref!
  4. \ifx\pdftexversion\undefined
  5. \usepackage[dvips]{graphicx}
  6. \else
  7. \usepackage[pdftex]{graphicx}
  8. \DeclareGraphicsRule{*}{mps}{*}{}
  9. \fi
  10. % hyperref has to be loaded last
  11. \usepackage{hyperref}
  13. \begin{document}
  14. \begin{figure}[ht]
  15. \includegraphics[keepaspectratio, scale=.8]{mwePicA.1} % replace the A with B or C if you get the mpost running
  16. \end{figure}
  17. \end{document}

Then I have three mp files, called, and
A: the working example that shows a box with text in it. Of this text, only the first two words need to be in italics.
  1. input metauml;
  2. beginfig(1);
  3. Activity.a("De novo assembly");
  4. drawObject(a);
  5. endfig;
  6. end

B: one option is to set the font for that box. I think this is the way to do it (based on what I read in the manual), but it doesn't work and even if it did work, it would make the whole text italic instead of the first two words.
  1. input metauml;
  2. beginfig(1);
  3. Activity.b("De novo assembly");
  4. := metauml_defaultFontOblique;
  5. drawObject(b);
  6. endfig;
  7. end

When I run mpost on this (command: mpost it renders this error:
  1. >>
  2. >> "ptmro8r"
  3. ! Equation cannot be performed (numeric=string).
  4. <to be read again>
  5. ;
  6. l.6 := metauml_defaultFontOblique;
  8. ?

Looking at the second line of the error, I think that 'metauml_defaultFontOblique' is interpreted as being the font called 'ptmro8r' (this is an adobe font that lives here: /usr/share/texmf/fonts/tfm/adobe/times/ptmro8r.tfm).

C: another option is to set the font for a part of the text that appears in a box.
  1. input metauml;
  2. beginfig(1);
  3. Activity.c("De novo assembly" infont "ptmro8r");
  4. drawObject(c);
  5. endfig;
  6. end

This gives the following error:
  1. >> unknown string c.lines0
  2. >> picture
  3. ! Equation cannot be performed (unknown string=picture).
  4. <to be read again>
  5. ;
  6. <for(picture)> c.lines[c.nLines]:=(EXPR0);
  7. c.nLines:=c.nLines+1; ENDFOR
  8. EActivity->...IX2)nLines:=(SUFFIX2)nLines+1;endfor
  9. ;EPictureStack(SUFFIX2)sta...
  11. Activity->...Activity(SUFFIX2)(iActivity)((TEXT3))
  12. ;endgroup
  13. l.5 ...vity.c("De novo assembly" infont "ptmro8r")
  14. ;
  15. ?

So, I exhausted the two options the manual gave me. And even if they had worked, they would have made all text in the box go italics instead of just the first two words.

Does anyone have an idea how to address this problem?

If you need more info, please ask.

For those not familiar with MetaUML: "MetaUML is a GNU GPL MetaPost library for typesetting UML diagrams, using a human-friendly textual notation." and can be found at or at CTAN

Many thanks,


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 3 guests