This is not new here. But with the solutions in:
- Problem with overlay when a tikzpicture is inside another tikzpicture
- How to typeset a TikZ picture inside a node?
I couldn't put it to work.
Basically what I want is to define a command that will be a picture and can be used inside other picture as a node, similarly how the shape is defined. So that I can reuse the code because each picture has many elements. See the MWE:
\documentclass{standalone}
\usepackage{ellipsis}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{shapes.geometric}
\newcommand{\MUE}[1]{%
\begin{tikzpicture}
\node[draw, shape = rectangle, minimum width=15mm, minimum height=7.5mm] (box) {#1};
\draw ($(box.south west)+(0.25,0)$) circle (4pt);
\draw ($(box.south east)-(0.25,0)$) circle (4pt);
\draw[fill=black] ($(box.south west)+(0.25,0)$) circle (1pt);
\draw[fill=black] ($(box.south east)-(0.25,0)$) circle (1pt);
\draw ($(box.north west)+(0.25,0)$) -- +(0,0.25) node[midway] (ant1) {};
\draw ($(box.north east)-(0.25,0)$) -- +(0,0.25) node[midway] (ant2) {};
\node at ($(ant1)!0.5!(ant2)$) {\dots};
\draw (ant1.north) -- +(135:0.25);
\draw (ant1.north) -- +(45:0.25);
\draw (ant2.north) -- +(135:0.25);
\draw (ant2.north) -- +(45:0.25);
\end{tikzpicture}
}
\newcommand{\MBS}[1]{%
\begin{tikzpicture}
\node[draw, shape = dart, shape border rotate = 90, minimum width = 10mm, minimum height = 10mm] (base) {#1};
\draw[line join = round] (base.110) -- (base.70) -- (base.north west) -- (base.north east) -- cycle;
\draw ($(base.north)+(0.5,0)$) -- +(0,0.25) node[midway] (ant1) {};
\draw ($(base.north)-(0.5,0)$) -- +(0,0.25) node[midway] (ant2) {};
\draw[cap = rect, line join = round] (ant1.south) -- (ant2.south);
\node at ($(ant1)!0.5!(ant2)$) {\dots};
\draw (ant1.north) -- +(135:0.25);
\draw (ant1.north) -- +(45:0.25);
\draw (ant2.north) -- +(135:0.25);
\draw (ant2.north) -- +(45:0.25);
\end{tikzpicture}
}
\begin{document}
\begin{tikzpicture}
\node[draw, shape = circle, fill = yellow!30] at (0,0) (test1) {\MBS{BS}};
\node[draw, shape = circle, fill = blue!30] at (3,3) (test2) {\MUE{UE1}};
\node[draw, shape = circle, fill = blue!30] at (3,-3) (test3) {\MUE{UE2}};
\draw[->] (test1) -- (test2);
\draw[->] (test1) -- (test3);
\end{tikzpicture}
\end{document}
As it can be seen, the antennas in the picture are not correcly placed because I am using draw, shape = circle in the nodes of the second picture. Also, if I add inner sep = 0pt the result is even worst. How can I use such kind of nesting inside TikZ?


\dots. Can you provide the code? – cacamailg Apr 11 '13 at 16:09antnodes to add the last lines to the antenna, just use the last point on the line on which you place the (unnecessary) nodes. — You can also use thepath picturekey to place additional stuff inside a node (provided you know the size of the content before hand) or you place first the content and thenfitthe circle around it. – Qrrbrbirlbel Apr 11 '13 at 16:10vat the very last point of the antenna. Using nodes helps me in keeping centered the\dots. Is there an automatic way to calculate the last point? – cacamailg Apr 11 '13 at 16:31coordinatethere and use this when you draw thev; or you dothe same path again but without the--`. – Qrrbrbirlbel Apr 11 '13 at 16:38