2

I'd like to have a tikzpicture (actually several) appear inside a node of another tikzpicture. I already know that I can use savebox for that, the problem is: When I change the fontsize of a node inside of this nested picture it causes TeX to exceed its stack size, giving the following error:

TeX capacity exceeded, sorry [input stack size=5000].

It works if I leave the font size at normal, so that seems to be the root of the problem. However, as I do want the text in the node to be smaller, that's not a solution... I've searched for an hour now to find a solution, but am pretty much stuck. Increasing the stack size to 50000 didn't work, neither did putting extra braces anywhere. Does anyone have an idea why this eats all of my save stack?

MWE:

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

\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
    \node (1) {$x$};

    \newsavebox\MyBox
    \begin{lrbox}{\MyBox}
        \begin{tikzpicture}
            \node (1) {\scriptsize $y$};
        \end{tikzpicture}
    \end{lrbox}

    \node[right=of 1] (2) {\usebox\MyBox};
\end{tikzpicture}
\end{document}

As said, it works fine, if I remove the \scriptsize. I do know of course, that the MWE can be done differently (read: without the savebox), the thing I actually want to do however would require a lot of rewriting to be done differently, so I'd prefer to find a solution to this problem...

Fabian
  • 21

0 Answers0