Fri, 7 Mar 2008 18:57:27 +0100
Ok, I get bombed out with save stack size exceeded in a large document.
At the end of the document. Here is an example (bombs out with a save
stack size of 5000, adjust the number for other binaries):
Bombs out only when run with an empty .aux file. What is the problem?
At the end of the document,
is run within a local group for all labels. This replaced the undefined
label _locally_ with \relax and pushes the outer "undefined" value onto
the save stack.
This is idiotic. Of course, by far the easiest solution is
make a definition that first checks with \ifcsname, and only if that
does not yield undefined, checks against \relax
the old definition
This is incompatible in that it does not have the sideeffect of turning
an undefined macro locally into \relax.
This is the solution I prefer. It will avoid save stack buildup (and
sideeffects I don't consider useful) elsewhere, too.
Another possibilities are to remove the grouping from the end of
document action testing the labels. Yet another is to perform the
\@ifdefined test within a group of its own, namely as
This will also not have the side effect of changing the label internal
to \relax and will avoid save stack buildup. So it keeps the changed
side effect to a very small area and does not depend on eTeX. One could
also implement both (which would help with non-eTeX as well), but I
don't think that supporting large documents on non-eTeX that previously
did not work is much of a priority.
What is your take? I find it clearly unsatisfactory to have LaTeX eat
up save stack for newly defined labels like that at the end of the
David Kastrup, Kriemhildstr. 15, 44793 Bochum