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.

AFAIK pgf-umlcd does not support classes with template parameter (std::vector<T> for instance).

Does anybody have a workaround allowing the drawing of such classe? Is there a simple PGF/Tikz trick to do so?

I would achieve something roughly equivalent to MetaUML rendering. See MetaUML documentation page 8/9, section 2.5 "Parametrized Classes (Templates)".

Thanks!

share|improve this question
    
I have edited the question to take your comment into account: I would like something close to MetaUML template classes. –  Thomas Moulard Sep 10 '12 at 13:36

1 Answer 1

up vote 2 down vote accepted

Here's a new style template parameter that adds a dashed box to the upper right corner of the diagram:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{pgf-umlcd}
\tikzset{
    template parameter/.style={
        append after command={
            node [draw, densely dashed, umlcolor, font=\ttfamily]
                at (\tikzlastnode.north east)
                {#1}
        }
    }
}
\begin{document}
\begin{tikzpicture}
        \begin{interface}[template parameter=std::vector<T>,text width=7cm]{TestInterface}{0,0}
            \operation{Test}
        \end{interface}
\end{tikzpicture}
\end{document}
share|improve this answer
    
This is almost what I want. Is there a way to replace std::vector<T> by the content of the parameter automatically? –  Thomas Moulard Sep 10 '12 at 14:11
1  
@ThomasMoulard: Yes, sorry, I had accidentally left a static value in the code. The edited version of my answer uses the parameter value. –  Jake Sep 10 '12 at 14:13
    
Perfect, thanks! –  Thomas Moulard Sep 10 '12 at 14:15

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.