[tex-eplain] Putting two \definexref together

Oleg Katsitadze olegkat at gmail.com
Thu Sep 6 23:32:32 CEST 2007

On Thu, Sep 06, 2007 at 11:44:53AM +0200, Rodolfo Medina wrote:
>  \def\mylabel#1#2{\definexref{#1.a}{#2}{}\definexref{#1.b}{#2}{}}
> , but over large files it produces a `TeX capacity exceeded, sorry' error
> message.  Can anybody suggest a clever and polite way to achive what I want?

Actually, there's no problem with your use of two \definexref's.  The
problem is with the way the .aux file is read by Eplain (and, well, by
your doubling the number of xrefs :).

You have a save stack overflow here.  Eplain (actually, btxmac.tex)
reads the .aux file inside a group.  \@definelabel defines xref labels
using the \csname...\endcsname construct.  And although the definition
itself is global, when an undefined macro is constructed using
\csname...\endcsname, it is made equivalent to \relax, locally within
the group.  These local "definitions" intermixed with the global
definitions cause save stack build-up.  This can be reproduced with
something like the following (adjust the number of interation of the
loop and compile twice):

\input eplain




\ifnum\xrefcount < 3000
\advance\xrefcount by1


You can do something like the following to cure this, before you call
the first xref macro (somewhere near the beginning of your document,
but after \input eplain):

\if at fileexists
   \endlinechar = -1
   \input \jobname.aux
   \endlinechar = 13
\immediate\openout\@auxfile = \jobname.aux

This is basically a rewrite of btxmac.tex's \@readauxfile, without the
group around `\input \jobname.aux'.

I don't know if it's possible to avoid the local "definition" of a
\csname...\endcsname macro.  If it's not possible, then I don't see
how the Eplain macros can be fixed.  Except maybe if we avoid the
group altogether, by saving the catcode of `@' and the value of
\endlinechar and then restoring them after we read the .aux file --


More information about the tex-eplain mailing list