3

Using the command \umlemptypackage{name}, it's possible to create simple, empty packages with tikz-uml. This leads to a package with its name written in the top left field:

Package variant 1

Since UML makes it possible (and it looks better for small simple packages), I would like to use this notation, though, with the package name written inside the body of the package:

Package variant 2

Is it possible to achieve this in tikz-uml?

And if not, would it be possible to add custom elements inside a tikz-uml object? Thus, I would be able to add text or other graphics myself, like this:

Package variant 3

1 Answer 1

2

After taking a short look at tikz-uml.sty file, I've found that a package is defined as two nodes (package name and package name-caption) and there is no option to use an empty name because it's used to identify mentioned nodes.

Once the node is declared you can draw or fill it with TikZ commands.

Following code shows some examples. The solution to avoid packages names in top node is tricky. What I've done is to fix the text color equal to fill color. The text is written, but it's invisible.

\documentclass[border=2mm]{standalone}
\usepackage{tikz-uml}

\begin{document}
\begin{tikzpicture}
\begin{umlpackage}[fill=blue!30, text=blue!30]{pack}
\begin{umlpackage}[fill=red!30, text=red!30]{pack2}
\node {Pack 2};
\end{umlpackage}
\end{umlpackage}

\begin{umlpackage}[x=3, y=1, fill=green!30, text=green!30]{pack3}
\end{umlpackage}

\node at (pack3.center) {Test 3};

\draw[red] ([shift={(-45:1mm)}]pack2.north west) rectangle ([shift={(135:1mm)}]pack2.south east);

\draw[->] (pack-caption.center) circle (1mm) -- (pack3-caption.center) circle (1mm);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .