Auto incremented document number

Jerry jerry at seibercom.net
Fri Feb 19 20:27:54 CET 2021


On Fri, 19 Feb 2021 12:08:38 -0500, Philip Taylor stated:
>Jerry wrote:
>
>I have no idea if this is possible, so I thought I would ask.
>
>I work for a municipality. I need to create several documents that
>need to be numbered in consecutive order, i.e., SWI-100, SWI-101,
>SWI-102, etcetera. Is there any latex package that can keep track of
>the last used number and increment it in each new document? Since all
>of the papers are not written simultaneously, it would need to
>"remember" the last used number and increment it at a future date. I
>can do this with a regular MS Access database or MySQL, but I cannot
>figure out how to do it with LaTeX.
>
>
>I may be missing something obvious, but why can you not (a) open a
>tracker file for reading, and note if it is empty; then, (b) if it is
>not empty, read an integer from it, increment the integer, close the
>file for reading, open it for writing, and write the augmented integer
>back.  If it was empty, treat it as if it contained zero.

Perhaps I am misunderstanding you, but that sounds like a like more
work than I want to invest. I was looking for an automated system.

I have investigated using SQL with LaTeX to get what I want. It won't
be easy; however, it seems like once I get it up and running, it will
take care of itself. (famous last words)

-- 
Jerry



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 659 bytes
Desc: OpenPGP digital signature
URL: <https://tug.org/pipermail/texhax/attachments/20210219/86ded2d4/attachment.sig>


More information about the texhax mailing list.