Graphics, Figures & TablesMetapost MetaUML: use italics

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

Metapost MetaUML: use italics

Post by mina »

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):

Code: Select all

\documentclass[a4paper,10pt]{report}
% The following is needed in order to make the meta-uml code compatible
% with both latex/dvips and pdflatex. Has to come before hyperref!
\ifx\pdftexversion\undefined
	\usepackage[dvips]{graphicx}
\else
	\usepackage[pdftex]{graphicx}
	\DeclareGraphicsRule{*}{mps}{*}{}
\fi
% hyperref has to be loaded last
\usepackage{hyperref}

\begin{document}
\begin{figure}[ht]
  \includegraphics[keepaspectratio, scale=.8]{mwePicA.1} % replace the A with B or C if you get the mpost running
\end{figure}
\end{document}
Then I have three mp files, called mwePicA.mp, mwePicB.mp and mwePicC.mp.
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.

Code: Select all

input metauml;
beginfig(1);
Activity.a("De novo assembly");
drawObject(a);
endfig;
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.

Code: Select all

input metauml;
beginfig(1);
Activity.b("De novo assembly");
b.info.iName.iFont.name := metauml_defaultFontOblique;
drawObject(b);
endfig;
end
When I run mpost on this (command: mpost mwePicB.mp) it renders this error:

Code: Select all

>> b.info.iName.iFont.name
>> "ptmro8r"
! Equation cannot be performed (numeric=string).
<to be read again> 
                   ;
l.6 ...e.iFont.name := metauml_defaultFontOblique;
                                                  
? 
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.

Code: Select all

input metauml;
beginfig(1);
Activity.c("De novo assembly" infont "ptmro8r");
drawObject(c);
endfig;
end
This gives the following error:

Code: Select all

>> unknown string c.lines0
>> picture
! Equation cannot be performed (unknown string=picture).
<to be read again> 
                   ;
<for(picture)> c.lines[c.nLines]:=(EXPR0);
                                          c.nLines:=c.nLines+1; ENDFOR
EActivity->...IX2)nLines:=(SUFFIX2)nLines+1;endfor
                                                  ;EPictureStack(SUFFIX2)sta...

Activity->...Activity(SUFFIX2)(iActivity)((TEXT3))
                                                  ;endgroup
l.5 ...vity.c("De novo assembly" infont "ptmro8r")
                                                  ;
? 
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 http://metauml.sourceforge.net or at CTAN http://ctan.org/pkg/metauml.

Many thanks,
Mina

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply