# TikZ node with UML comment shape

I'm wondering how could I draw node that looks like ** UML comment **. Any suggestions?

-
The PGF manual contains an example for creating exactly this node shape in the section "Declaring New Shapes". –  Jake Dec 27 '12 at 20:16
If you want to create UML diagrams with tikz, you should look at TikZ-UML. –  Nicolás Dec 27 '12 at 22:14

As it is stated in the tikz manual, there is no UML support in TikZ at the moment [p. 791]. So you might find MetaUML interesting, and especially their notes.

If you have installed MetaUML, simply save the following code as name.mp and type in the console mptopdf name.mp:

input metauml;
input TEX;

beginfig(5);
Note.A("This class implements the formula:",
TEX("$\sum_1^n f(x)\cdot dx$"));
drawObjects(A);
endfig;

end


You'll get this result as name.pdf.

So you have to define your UML structure externally and then just include the pdf in your document.

Have Fun!

-
that's not what i want, it it is not how to do it in tikz –  Meter Dec 27 '12 at 20:13
@Daniel Thanks for the advise, I hope my answer is now more helpful. –  xfoo Dec 28 '12 at 13:47
+1: I have deleted my now obsolete comment :-) –  Daniel Dec 28 '12 at 21:11
\pgfdeclareshape{umlnote}
{
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{north east}
\inheritanchor[from=rectangle]{north west}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{south east}
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{east}
\backgroundpath{
\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
\pgfpathclose
\pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
}
}


copied from documentation

-
Does it work? If so could you post a working example, because solely \usepackage{tikz} and the shapes library are not enough to make this work. –  xfoo Dec 27 '12 at 22:51
You should consider improving your answer. First of all because it doesn't provide a minimal working example. Second because it doesn't provide any insight into how it solves your problem. Anybody else who hasn't read the pgf manual would not be able to make sense out of this. –  Marc van Dongen Dec 28 '12 at 6:55
please don't downvote own answers. –  percusse Dec 29 '12 at 3:08