I'm trying to create an animation of a geometrical figure using Tikz and the animate package, in which I want to typeset the angles between lines frame by frame. I can actually achieve this, however when I want to change the font size of the angles I get the following error:
! TeX capacity exceeded, sorry [input stack size=5000].
\pgf@selectfontorig ->\pgf@selectfontorig
\nullfont
l.43 }
The MWE describing the problem is provided here below.
MWE:
\documentclass[a4paper,10pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{animate}
\usetikzlibrary{shapes.geometric, calc, positioning, decorations.text}
\newlength{\R}\setlength{\R}{6cm}
\def\hbb{-2cm}
\def\wbb{6cm}
\def\frate{10}
\begin{document}
\begin{animateinline}[poster=first, controls,autoplay, width=\textwidth, keepaspectratio, begin={\begin{tikzpicture} \useasboundingbox (\hbb,\hbb) rectangle (\wbb,\wbb);}, end={\end{tikzpicture}}]{\frate}
\newframe[\frate]
\begin{tikzpicture}
\useasboundingbox (\hbb,\hbb) rectangle (\wbb,\wbb);
\node [circle, fill=none, draw=black, minimum size=\R, thick] (BaseCircle) {};
\node [circle, fill=none, draw=black, minimum size=0.25\R, thick] (Hole) {};
\end{tikzpicture}
\multiframe{4}{n=1+1}{
\begin{tikzpicture}
\useasboundingbox (\hbb,\hbb) rectangle (\wbb,\wbb);
\node [circle, fill=none, draw=black, minimum size=\R, thick] (BaseCircle) {};
\node [circle, fill=none, draw=black, minimum size=0.25\R, thick] (Hole) {};
\foreach \j in {1,...,\n}{
\pgfmathsetmacro\startangle{30*\j}
\pgfmathsetmacro\endangle{\startangle + 30}
\draw [draw=blue, -latex, postaction={decorate},decoration={text along path, text color=blue, text={{}|{\small}|{$\theta/n$} {}}, text align=center, raise=3pt}] +(\startangle:0.2\R) arc [start angle=\startangle, end angle=\endangle, radius=0.2\R] {};
}
\end{tikzpicture}
}
\end{animateinline}
\end{document}
So, as soon as I remove the \small macro in the code, the animation works as expcted, but it turns out the text along the path is too big for my purposes. I have also tried with \fontsize{6}{6}\selectfont to reduce the font size, but no luck so far.
I also thought it could be a problem with the tikz decorations library, so I moved to the old school way and defined a node containing the text in a sloped fashion, using this:
\draw [draw=blue, -latex] +(\startangle:0.2\R) arc [start angle=\startangle, end angle=\endangle, radius=0.2\R] node [pos =0.5, sloped, above] {\small Test} ;
But I get the same error. I have to say that this actually works and the document is compiled with no errors without the animateinline environment.
Update1:
The issue isn't related to the compiler. I have tested the MWE with PDFLaTeX, XeLaTeX and LuaLaTeX. However the error remains the same.
In any case, the document isn't generated at all.
Update2:
Following the recommendations of the animate package in the documentation (section 10), in order to increase memory and stack input size, does not solve the problem either. Since I have Linux, the recommendation is to do the following:
- Find the configuration file ‘texmf.cnf’ by means of kpsewhich texmf.cnf at the shell prompt in a terminal.
- As Root, open the file in your favourite text editor, scroll to the ‘main_memory’ entry and change it to the value given above; save and quit.
- Rebuild the formats by
fmtutil-sys --byfmt latex
fmtutil-sys --byfmt pdflatex
fmtutil-sys --byfmt xelatex
I must add that I had to run the fmutil-sys command as root, because otherwise it didn't succeed. I don't know if that could be a possible cause of the problem.
Update3:
When increasing the stack size to 500000, the error differs slightly and becomes to:
! TeX capacity exceeded, sorry [input stack size=30000].
\pgf@selectfontorig ->\pgf@selectfontorig
\nullfont
l.43 }
So, [input stack size=30000] instead of [input stack size=5000].
Update4
I tried to change the space between the denominator and the numerator of the fraction (angle), following an answer given here: too little space between the bar on the denominator and the horizontal line
I defined a custom fraction and interestingly a similar error is produced. It seems a font modification of some sort is not permitted or something.
Any suggestions? What I'm doing wrong here?
Best,
C.

