2

I'm trying to set up a node style that allows me to draw nodes like UML2 components diagrams, etc.

What I consider as a good idea for a syntax is:

\node {node}
    child{
         \node {other node}
    };

which is good, but I don't know how I can format this as rectangle, and place component symbols in the north east corner.

tikz-uml is not what I need, because it has an interface that is different than that of TikZ.

I've also tried to typeset it as:

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}
   \begin{tikzpicture}[remember picture]
      \node[draw, execute at begin node = \begin{tikzpicture}, execute at end node = \end{tikzpicture}] at (-1,-1)
      {
         \node[draw,minimum width=20pt] at (-1,1) {node};
      };
      \node[draw] at (1,1)
      {
         \begin{tikzpicture}
            \node[draw,minimum width=20pt] at (-1,1) {node};
         \end{tikzpicture}
      };
   \end{tikzpicture}
\end{document}

But there is a problem with nested nodes.

The problem is that execute at begin node affects sub-nodes.


I'm searching for something that allows me easly to make a node that is a UML2 component. No matter how, but I want to create it writing:

\node [umlcomponent] ...

or by

\umlcomponent[fill=red...] at (2,2) {damn UML component} ...
\draw (1,1) umlcomponent {damn uml component} ...

So there is my question:
How can I define a custom TikZ command/macro/something that allows me to reach the syntax Nested node class with pictogram decoration

Meter
  • 277
  • Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). For your target, I would consider first if TikZ-UML satisfies your needs. – Claudio Fiandrino Dec 22 '12 at 14:49
  • 2
    May I ask you why TikZ-UML is not what you need? Also nesting tikz pictures in this context is kind of looking for trouble since most of your nodes won't inherit/inherit wrong options. – percusse Dec 22 '12 at 15:39
  • Instead of execute at begin node and \begin{tikzpicture} inside of the node, you could just write \tikz\node …, which is at least shorter. On that node: Why do you want to place a node inside another one anyway? Do you want a double border? Do you want to fit an outer node around the inner one? What is your graphical goal here? The image of your linked question does look like something for a multi-part node. – Qrrbrbirlbel Dec 22 '12 at 23:02
  • No real reply to the points above: 'unclear'. – Joseph Wright Aug 04 '13 at 19:41

0 Answers0