diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-endingroup.html')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-endingroup.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-endingroup.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-endingroup.html new file mode 100644 index 00000000000..4bbeb620fe9 --- /dev/null +++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-endingroup.html @@ -0,0 +1,69 @@ +<head> +<title>UK TeX FAQ -- question label endingroup</title> +</head><body> +<h3><code>\</code><code>end</code> occurred inside a group</h3> +<p/>The actual error we observe is: +<p/> +<code>(\end occurred inside a group at level <</code><code><em>n</em></code><code>>)</code> +<p/> +and it tells us that something we started in the document never got +finished before we ended the document itself. The things involved +(‘groups’) are what TeX uses for restricting the scope of things: +you see them, for example, in the “traditional” font selection +commands: <code>{\it stuff\/}</code> — if the closing brace is left off such a +construct, the effect of <code>\</code><code>it</code> will last to the end of the document, +and you’ll get the diagnostic. +<p/>TeX itself doesn’t tell you where your problem is, but you can +often spot it by looking at the typeset output in a previewer. +Otherwise, you can usually find mismatched braces using an intelligent +editor (at least <i>emacs</i> and <i>winedt</i> offer this facility). +However, groups are not <em>only</em> created by matching +<code>{</code> with <code>}</code>: +other grouping commands are discussed elsewhere in these FAQs, +and are also a potential source of unclosed group. +<p/><code>\</code><code>begin{<<i>environment</i>>}</code> encloses the environment’s body +in a group, and establishes its own diagnostic mechanism. If you end +the document before closing some other environment, you get the +‘usual’ LaTeX diagnostic + +<pre> +! LaTeX Error: \begin{blah} on input line 6 ended by \end{document}. +</pre> +which (though it doesn’t tell you which <em>file</em> the +<code>\</code><code>begin{blah}</code> was in) is usually enough to locate the +immediate problem. If you press on past the LaTeX error, you get +one or more repetitions of the “occurred inside a group” message +before LaTeX finally exits. The <i>checkend</i> package +recognises other unclosed <code>\</code><code>begin{blob}</code> commands, and +generates an “ended by” error message for each one, rather than +producing the “occurred inside a group” message, which is sometimes +useful (if you remember to load the package). +<p/>In the absence of such information from LaTeX, you need to use +“traditional” binary search to find the offending group. Separate +the preamble from the body of your file, and process each half on its +own with the preamble; this tells you which half of the file is at +fault. Divide again and repeat. The process needs to be conducted +with care (it’s obviously possible to split a correctly-written group +by chopping in the wrong place), but it will usually find the problem +fairly quickly. +<p/>e-TeX (and e-LaTeX — LaTeX run on e-TeX) gives you +further diagnostics after the traditional infuriating TeX one — it +actually keeps the information in a similar way to LaTeX: + +<pre> +(\end occurred inside a group at level 3) + +### semi simple group (level 3) entered at line 6 (\begingroup) +### simple group (level 2) entered at line 5 ({) +### simple group (level 1) entered at line 4 ({) +### bottom level +</pre> +The diagnostic not only tells us where the group started, but also the +<em>way</em> it started: <code>\</code><code>begingroup</code> or <code>{</code> (which is an alias of +<code>\</code><code>bgroup</code>, and the two are not distinguishable at the TeX-engine +level). +<dl> +<dt><tt><i>checkend.sty</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/bezos.zip">macros/latex/contrib/bezos</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/bezos.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/bezos/">browse</a>) +</dl> +<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=endingroup">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=endingroup</a> +</body> |