I created following example script to draw a TikZ that contains a nested tikz:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.multipart, backgrounds, fit}
\tikzset{
box/.style={
draw,
rectangle,
minimum height=3cm,
fill=white,
align=center,
inner sep=2ex
}
}
\begin{document}
\begin{tikzpicture}[]
% Box 1
\node[box, label={Label 1}] (Box1) {\rotatebox{90}{Content 1}};
% Box 2 - Inner
\node[right=of Box1] (Box2) {
\begin{tikzpicture}
\node[box] (Inner) {\rotatebox{90}{\ttfamily{Something goes in here}}};
\end{tikzpicture}
};
% Box 2 - Outer
\begin{scope}[on background layer]
\node[box, inner sep=0ex, fit=(Box2), label={Label 2}] {};
\end{scope}
% Box 3
\node[box, right=of Box2, label={Label 3}] (Box3) {\rotatebox{90}{Content 2}};
\draw[dashed] (Box1) -- (Box2);
\draw[dashed] (Box2) -- (Box3);
\end{tikzpicture}
\end{document}
Assume that the true content of Box2, where we currently have placeholder "Something goes in here" is a more complex TikZ drawing with many nodes.
Is it necessary to have the \begin{tikzpicture} within Box2, or is there a better way? I tried without, but it produced errors.
Thanks!


local bounding box. – Paul Gaborit Jan 11 '18 at 09:02local bounding box... – Paul Gaborit Jan 11 '18 at 09:40