Graphics, Figures & Tablestikzpicture node style throwing error (capacity exceeded)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
jess-elzbth
Posts: 7
Joined: Thu Sep 01, 2016 8:12 pm

tikzpicture node style throwing error (capacity exceeded)

Post by jess-elzbth »

I'm wondering why I'm getting the error message TeX capacity exceeded, sorry [input stack size=5000]. \node [fill, right=of t] in the following code:

Code: Select all

\begin{tikzpicture}
	[inner sep=0.5mm,
	nofill/.style={circle,draw=cyan, xshift=-5.5ex},
	fill/.style={circle, fill=cyan, xshift=-5.5ex}]

	\node (t) {Text};
	\node [fill, right=of t] (1) {}; 
	\node [nofill, right=of 1] (2) {}; 
	\node [nofill, right=of 2] (3) {};
	\node [nofill, right=of 3] (4) {};
	\node [nofill, right=of 4] (5) {};
\end{tikzpicture}
When I change the code slightly everything works perfectly.

Code: Select all

\begin{tikzpicture}
	[inner sep=0.5mm,
	nofill/.style={circle,draw=cyan, xshift=-5.5ex}]
%	fill/.style={circle, fill=cyan, xshift=-5.5ex}]

	\node (t) {Text};
	\node [nofill, fill=cyan, right=of t] (1) {}; 
	\node [nofill, right=of 1] (2) {}; 
	\node [nofill, right=of 2] (3) {};
	\node [nofill, right=of 3] (4) {};
	\node [nofill, right=of 4] (5) {};
\end{tikzpicture}
I'm using TeXstudio 2.11.0. Thanks for your help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

tikzpicture node style throwing error (capacity exceeded)

Post by Stefan Kottwitz »

That's just because of using the already existing name fill for the style. That error is a common symptom of recursion, here it's setting a fil style with a fill (style) setting inside.

Simply renaming fixes it. Btw. I would add draw=cyan also to the filled style, otherwise the default white or non-existent border makes it to small, compared to the nofill nodes.

Code: Select all

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
    \begin{tikzpicture}
            [inner sep=0.5mm,
            nofill/.style={circle,draw=cyan, xshift=-5.5ex},
            filled/.style={circle, fill=cyan, draw=cyan, xshift=-5.5ex}]

            \node (t) {Text};
            \node [filled, right=of t] (1) {};
            \node [nofill, right=of 1] (2) {};
            \node [nofill, right=of 2] (3) {};
            \node [nofill, right=of 3] (4) {};
            \node [nofill, right=of 4] (5) {};
    \end{tikzpicture}
\end{document}
Stefan
LaTeX.org admin
User avatar
jess-elzbth
Posts: 7
Joined: Thu Sep 01, 2016 8:12 pm

Re: tikzpicture node style throwing error (capacity exceeded

Post by jess-elzbth »

*Groan* I hate how glaringly obvious some errors are in hindsight. Thank you Stefan. Worked like a charm :)
Post Reply