If, in the process of LaTeXing a file, the error "! File ended while
scanning ..." is generated, such as by a missing "}" following
"\end{document":
______
\documentclass{article}
\begin{document}
\end{document
______
the following output is generated:
______
This is TeX, Version 3.1415 (no format preloaded)
**&LaTeX EndedTest.tex
(EndedTest.tex
LaTeX2e <1994/12/01> patch level 1
(:TeX-inputs:LaTeX:article.cls
Document Class: article 1994/12/09 v1.2x Standard LaTeX document class
(:TeX-inputs:LaTeX:size10.clo)) (EndedTest.aux))
Runaway argument?
{document
! File ended while scanning use of \end.
<inserted text>
\par
<*> &LaTeX EndedTest.tex
? e
Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something,
H for help, X to quit.
? h
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
? x
No pages of output.
Transcript written on EndedTest.log.
Memory allocated: 989006 bytes.
Time elapsed: 14.1 seconds.
______
Despite the "help" suggestion of typing `E' to edit the source, TeX
appears to have no idea where the error occurred and does not transfer to
the editor. Other "Runaway arguments?", like "! Paragraph ended before
..." transfer to the editor properly.
One difference is that "! Paragraph ended before ..." gives a line number
for the context line but "! File ended while scanning ..." does not.
In the case of "\end" it's probably not too hard to find the problem,
especially since "\end{document" seems to be the only one that doesn't
generate a "! Paragraph ended before ...". There are less trivial cases:
an unclosed caption, such as
_______
\begin{table}
\caption{Testing table.
\protect\label{tab-test}
\end{table}
_______
generates:
______
Runaway argument?
{Testing table. \protect \label {tab-test} \end {table} \par \ETC.
! File ended while scanning use of \@xdblarg.
<inserted text>
\par
<*> &LaTeX TableTest.tex
? e
Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something,
H for help, X to quit.
______
Based on the context line, TeX has some idea where it ran into trouble,
but it doesn't give sufficient information to transfer to the editor.
This may not be high in the Pantheon of Things-To-Work-On, but it does
strike me (and Andrew) as a {\it bona fide} bug in TeX.
Any comment?
--
Jonathan E. Guyer j-g...@nwu.edu
>In article <j-guyer-0502...@dogbert.ms.nwu.edu>
>j-g...@nwu.edu (Jon Guyer) writes:
>
>>Any comment?
>
>No bug.
O.K. Don't call it a bug. Call it a pain in the butt. I understand _why_
it happens. I'm just saying that TeX's response to this situation could be
_much_ more civilized.
If it were simply a case of TeX reading all of the way to the end of the
file and determining that it was dazed and confused and wanted no more to
do with the file, I'd be happy to agree with you. But TeX isn't
_completely_ dazed and confused. I agree with you that identifying the end
of the file (where TeX became certain that something was wrong) is of no
value to TeX or the user. As you said, however:
>To give some help,
>TeX therefore shows the tokens with which the intended argument starts
>` {document ' in this case.
If it knows this, why doesn't it send me to that point, then? The fact is,
in every instance where I've encountered this problem, the beginning
tokens are a pretty good place to look. I made a point of saying, in the
case I posted before, that tracking down a faulty '\end' is not a problem,
particularly when '\end{document' appears to be the only offender. The
second example I gave, though, is quite a bit more obscure, generating the
error:
___________
Runaway argument?
{Testing table. \protect \label {tab-test} \end {table} \par \ETC.
! File ended while scanning use of \@xdblarg.
<inserted text>
\par
<*> &LaTeX TableTest.tex
___________
It's not nearly so obvious as looking for an '\end' that has the first
token '{document'. O.K., O.K, my trivial example says 'table' or 'tab' in
several places in the context line; so again, this shouldn't be an
enormous amount of work to track down. Now consider:
___________
\begin{table}
\caption{It is clear, to the most casual observer, that TeX's response
to this error is extraordinarily incovenient, to say the least.
\protect\label{tab-Table}
\end{table}
___________
which generates:
__________
Runaway argument?
{It is clear, to the most casual observer, that TeX's response\ETC.
! File ended while scanning use of \@xdblarg.
<inserted text>
\par
<*> &LaTeX TableTest.tex
__________
Any guesses where this might have been generated in a multi-hundred page
document? How many LaTeXers know or care what a '\@xdblarg' is? Sure, I
could search on the context string, but if I'm supposed to do that, why
have an 'E' response to _any_ error? Moreover, when I say 'H', why does
TeX say:
__________
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
__________
I don't know anything about TeX's error handler, but it would appear that
at some point, someone (Knuth?) thought you should be able to edit your
way out of this problem.
So...it may not be a "bug," but it shouldn't (IMO) and needn't be the way it is.