I would like to create a tree in TikZ whose nodes are trees themselves.
I have the following piece of code:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree}
\tikzset{%
every picture/.append style={
grow'=up,
sibling distance=.5em
}
}
\begin{document}
\begin{tikzpicture}[baseline=-.3em]
\node[draw] {
\begin{tikzpicture}
\Tree
[. $+$
\node[draw]{
\begin{tikzpicture}
\Tree
[. $+$ [. $+$ $a$ $b$ ]
[. $+$ $c$ $d$ ] ]
\end{tikzpicture}
};
\node[draw]{
\begin{tikzpicture}
\Tree
[. $+$ $e$
$f$ ]
\end{tikzpicture}
};
]
\end{tikzpicture}
};
\end{tikzpicture}
\end{document}
The problem is that the nodes of the outer tree are not connected right:
I think the reason is that qtree somehow "still sees" the inner nodes. Is there a way to let TikZ "unsee" the inner nodes? Something like the opposite of "remember picture"?
I can always export the inner nodes as a separate pdf and then reinclude it, but I was looking for a more elegant option, if possible.
tikzpicture
s which should be avoided. – user121799 Feb 22 '19 at 15:20