# Underline in metauml

\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}
\begin{figure}
\begin{mpost}[use]
input metauml;

Class.A("A")
("-instance: A")
("-A()",
"+instance(): A");

drawObjects(A);
\end{mpost}
\caption{Class \texttt{A} as a singleton}
\label{fig:uml-a}
\end{figure}
\end{document}


How can I make +instance(): A underlined to mark it as a static method?

Is it possible to disable converting + and - to graphics ?

Egreg's solution below works but is there any way to draw "true" underline? For example if I add something below underlined part I would have to move line maually. I want to avoid this.

-

You should use mpsettings={input metauml;}; then you can use Metapost for drawing a line.

\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}
\begin{figure}
\begin{mpost}[use,mpsettings={input metauml;}]

Class.A("A")
("-instance: A")
("-A()",
"+instance(): A");

drawObjects(A);

draw A.sw+(13,1.5) -- A.se+(-4,1.5);

\end{mpost}
\caption{Class \texttt{A} as a singleton}
\label{fig:uml-a}
\end{figure}
\end{document}


In order to change the + and - to something else than the default, one should study in detail the source metauml.mp

-
OK, thanks for the tip. But this is not an answer to my question. –  Ichibann Aug 22 '12 at 6:03
OK, this works. It is not an underlined text but looks good :) –  Ichibann Aug 22 '12 at 15:58
Is it possible to add "true" underline? –  Ichibann Aug 22 '12 at 20:16

Idea in drawing line under "attribute" label. (reputation killed image)

+---------------------+
|      Singleton      |
+---------------------+
| -  static Instance  |
|   ----------------- |
+---------------------+
|                     |
+---------------------+


This is variation on egreg 's answer. It is possible that more accurate answer exist...

input metauml;

beginfig(1);
Class.SingletonLite("Singleton")("- static Instance")();

drawObject(SingletonLite);

draw SingletonLite.attributeStack.pict[0].sw -- SingletonLite.attributeStack.pict[0].se ;
endfig;

end.

-
Welcome to TeX.sx! You now have the rep required for posting images so you could revise your answer :-) –  Peter Jansson Apr 29 '13 at 8:56