1

What general strategies are available for minimising the occurrence of errors concerning too large dimensions in PGF/TikZ?

The following is an example but I'm less interested in a fix for this specific problem than in general approaches to avoiding these errors where possible.

I understand that this is a hard limit, but I know that some specific constructions are especially problematic and can be avoided relatively easily. (For example, see this question, where the problem is the result of to paths.)

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{shadows}
\begin{document}
\tikzset{
  bom/.pic={
    \foreach \i in {1,...,9}
    \node (i\i) [shape=circle, inner sep=0pt, minimum size=(10-\i)/3*1mm*#1, circular glow={fill=red!\i0!yellow}, yshift=#1*.5mm, xshift=-#1*.2mm] at (70:#1*16mm) {};
  }
}
\begin{tikzpicture}
  \pic {bom=.25};
  \pic at (-5,6) {bom=.25};
\end{tikzpicture}
\end{document}
cfr
  • 198,882
  • Once again, the problem appears to come from some internal calculations by TikZ, in this case regarding the minimum size of a circle node with circular glow. In general there is no way to avoid hidden traps of this kind except to avoid using very large or very small shapes. – John Kormylo Dec 05 '15 at 16:30
  • Thanks. (And +1 for the test.) I was worried this might be the answer.... – cfr Dec 05 '15 at 20:29

1 Answers1

1

Determined approximate minimum minimum size by trial and error. Added test.

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{shadows}
\begin{document}
\tikzset{
  bom/.pic={
    \foreach \i in {1,...,10}
    \pgfmathsetlengthmacro{\size}{#1*(10-\i)*0.333mm}
    \pgfmathsetlengthmacro{\size}{\size>0.2mm ? \size: 0.2mm}
    \node (i\i) [shape=circle, inner sep=0pt, minimum size={\size}, circular glow={fill=red!\i0!yellow}, yshift={#1*.5mm}, xshift={-#1*.2mm}]
      at (70:.25*16mm) {};
  }
}
\begin{tikzpicture}
  \pic {bom=.25};
  \pic at (-5,6) {bom=.25};
\end{tikzpicture}
\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120