I have a problem with the aux-file. According to some posts here on Tex-Exchange, the aux-file is read at the beginning of the document (is this at \begin{document}
or \documentclass
? I wanted to built a test document. For every run it should increase the number that it is printed on the paper.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{graphicx}
\usepackage{environ}
\usepackage{etoolbox}
\begin{document}
%Don't overwrite \counti
\ifdefined\counti
TRUE
\else
FALSE
\newcount\counti
\counti=0
\fi
%make counti raise by 1
\the\counti
\advance\counti by1
%write to aux-file
\makeatletter
\write\@auxout{\noexpand\newcount\counti}
\write\@auxout{\counti= \the\counti}
\makeatother
\end{document}
The output is
TRUE
0
This proves, that it reads the newcount from the aux-file. But unfortunately, the value stays 0. Actually it should raise by one by every run.
The aux-file says
\newcount \counti
\counti = 1
after every run.
\begin{document}
-- is thisTeX
count register stuff really necessary. Have a look onxassoccnt
package and it'snumberofruns
counter