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.

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

enter image description here

share|improve this question
2  
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

2 Answers 2

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.

Example of a Note in MetaUML

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

Have Fun!

share|improve this answer
1  
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
            \pgf@xc=\pgf@xb \advance\pgf@xc by-5pt
            \pgf@yc=\pgf@yb \advance\pgf@yc by-5pt
            \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

share|improve this answer
    
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
4  
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

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.