LATEX-L Archives

Mailing list for the LaTeX3 project

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 >>]

Print Reply
Subject:
From:
David Kastrup <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Fri, 7 Mar 2008 18:57:27 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (57 lines)
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):

\documentclass{minimal}
\begin{document}
\leavevmode
\newcount\xxx
\loop
\label{xxx\number\xxx}
\advance\xxx1
\ifnum\xxx<10000
\repeat
\end{document}

Bombs out only when run with an empty .aux file.  What is the problem?
At the end of the document,
\@ifdefined{something}
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
\ifx\ifcsname\@undefined
  make a definition that first checks with \ifcsname, and only if that
  does not yield undefined, checks against \relax
\else
  the old definition
\fi

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

\begingroup \@ifdefined{xxx}{\endgroup...}{\endgroup...}

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
document.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

ATOM RSS1 RSS2