I want to keep track of some info of my .tex files.
More precisely, I give an id (an integer) to my math exercises and would like to keep somewhere the maximal id already given (and maybe other info). The macro is just \idExo{}.
I would like also the macro to be executable on other people's distributions without causing bugs.
Here is my plan :
- Choose a specific hard-coded path OR write to the "texmf" folder
- Read the maximal
idin the file if it exists - If the current
idis higher, replace it
So far, I am able to write to a file:
\def\writeToFile
{
\newwrite\myfile
\immediate\openout\myfile=\jobname.foo
\immediate\write\myfile{coucou}
\immediate\closeout\myfile
}
Is there something simplier or am I on the good track?
%and the\newwriteshould be outside your macro so you only do it once (otherwise in classic tex you will not be able to write more than 12 or so times) – David Carlisle Apr 17 '18 at 12:28\end{document}? – Colas Apr 17 '18 at 12:34