[texhax] transport between latex runs; reuse .aux file content

Mathias messagecollector at gmx.net
Sat Aug 13 20:24:19 CEST 2011


I want to transport commands and lengths between (pdf)latex runs.
Their values are altered during processing the document and
exactly those at the document's end should be reused from the
document's very beginning of the next run.

My first idea was to use something similar to the TOC generation
via the .aux file.  So I took the sources of the lastpage package
and did some experiments:





%    \string\AtBeginDocument{\string\immediate\string\setlength{\string\myLen}{200pt}}}%
%    \string\immediate\string\setlength{\string\myLen}{200pt}}%

\typeout{DEBUG: \string\myCmd\space = \myCmd}%
\typeout{DEBUG: \string\myLen\space = \number\myLen}%
\typeout{DEBUG: \string\myCmd\space = \myCmd}%
\typeout{DEBUG: \string\myLen\space = \number\myLen}%
Command: \myCmd \\
Lengths: \\
\rule{100pt}{1ex} (100pt) \\
\rule{\myLen}{1ex} \\
\rule{200pt}{1ex} (200pt)

This writes a correct-looking .aux file:


Unfortunately this doesn't work as expected:  the
\renewcommand... and the \setlength seem not to be executed at
the document's beginning.

My attempts with an additional "\AtBeginDocument{...}"  or with
"\string\immediate" don't work either.  I also took some looks
into LaTeX's source source2e (especially section 18 ltfiles.dtx)
but this didn't help much.

Can you give me some hint concerning the above problem?

What exactly happens while passing from the preamble to the
document?  Where can I find more about this?

Thanks a lot,

More information about the texhax mailing list