Auto incremented document number

Philip Taylor P.Taylor at Hellenic-Institute.Uk
Sat Feb 20 11:50:23 CET 2021

I still do not understand why anything more than "TeX out of the box" is 
required.  I have shewn in a previous message how a simple text file, in 
conjunction with TeX, can be used to generate a monotonic increasing 
sequence of integers, and if each document requires its own sequence 
then the following trivial modification is all that is required —

    \newread \trackerin

    \newwrite \trackerout

    \newcount \seqno

    \openin \trackerin = \jobname.seqno

    \ifeof \trackerin

         \seqno = 0


         \read \trackerin to \seqtmp

         \seqno = \seqtmp


    \closein \trackerin

    \advance \seqno by 1

    \message {New sequence number = \number \seqno}

    \immediate \openout \trackerout = \jobname.seqno

    \immediate \write \trackerout {\number \seqno}

    \immediate \closeout \trackerout


/Philip Taylor/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the texhax mailing list.