## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

```Philip Taylor writes:
>  > No idea how Frank does it, but at successful completion I close A and B,
>  > open B for input and A for output, and copy B to A in a robust environment
>  > (sorry, not the LaTeX sense of "robust" but then I don't speak LaTeX!).

To which Frank Mittelbach replies:
> that is more or less what i did implement as well if i remember
> correctly. my idea was to provide for doing the copying within LaTeX
> (the slow but portable variant) but also allow to set things up that
> the copying is done by some OS script wrapper outside LaTeX instead.

How about seeking to avoid the copying altogether? According to a small
experiment I just did it seems it might be possible to do this, with a
slight cost: using three extensions aux, auy, auz instead of just two.
(But in the case of a book with multiple \include statements the
subordinate files never use the .aux extension; only \jobname.au[xyz]
uses all three.)

Don't know if I've overlooked some critical impediment, but the method I
tried was

\jobname.aux contains only one line:

\auxselect{y}{...}% first arg is y or z

\jobname.auy, \jobname.auz: alternate output streams for aux data

At end-document:

---If a complete .auy file was successfully written, write
\auxselect{y}{...} to the \jobname.aux.

---If a complete .auz file was successfully written, write
\auxselect{z}{...} to the \jobname.aux.

If \enddocument is not executed (probably the LaTeX run ended
prematurely with an error), \jobname.aux will automatically be left in
its previous state, so that the next LaTeX run will again select the
last complete (set of) auxiliary file(s).

As for the second arg of \auxselect, I thought it would be useful to
write there something to indicate whether any aux data changed (meaning
another run is necessary). Then external OS scripts that want to test
whether another run is necessary could look only at the first line of
the .aux file instead of diffing .auy and .auz (maybe a bit of a pain
for a multi-\include document).