Consider the following MWE which writes the word "Cat" to a file.
\documentclass{article} \usepackage{amsmath} \begin{document} \newwrite\datei \immediate\openout\datei=Beispiel.txt \begin{align*} a+b &=c \\ \immediate\write\datei{Cat} c+d &= 88+ 9 \end{align*} \end{document} Actually, this writes the word "Cat" twice (I have more complicated examples, where it is written four times).
Can I determine how many times is an align processed?
Can I somehow ensure that the writing command is only called once?