summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-errstruct.html
blob: ad8497914d2420148054379f2545f40b7c4c6a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<head>
<title>UK TeX FAQ -- question label errstruct</title>
</head><body>
<h3>The structure of TeX error messages</h3>
<p/>TeX&#8217;s error messages are reminiscent of the time when TeX itself
was conceived (the 1970s): they&#8217;re not terribly user-friendly, though
they do contain all the information that TeX can offer, usually in
a pretty concise way.
<p/>TeX&#8217;s error reports all have the same structure:
<ul>
<li> An error message
<li> Some &#8216;context&#8217;
<li> An error prompt
</ul>
The error message will relate to the <em>TeX</em> condition that is
causing a problem.  Sadly, in the case of complex macro packages such
as LaTeX, the underlying TeX problem may be superficially
difficult to relate to the actual problem in the &#8220;higher-level&#8221;
macros.  Many LaTeX-detected problems manifest themselves as
&#8216;generic&#8217; errors, with error text provided by LaTeX itself (or by a
LaTeX class or package).
<p/>The context of the error is a stylised representation of what TeX
was doing at the point that it detected the error.  As noted in
<a href="FAQ-erroradvice.html">approaching errors</a>, a macro package
can tell TeX how much context to display, and the user may need to
undo what the package has done.  Each line of context is split at the
point of the error; if the error <em>actually</em> occurred in a macro
called from the present line, the break is at the point of the call.
(If the called object is defined with arguments, the &#8220;point of call&#8221;
is after all the arguments have been scanned.)  For example:
<pre>
\blah and so on
</pre>
produces the error report
<pre>
! Undefined control sequence.
l.4 \blah
          and so on
</pre>
while:
<pre>
\newcommand{\blah}[1]{\bleah #1}
\blah{to you}, folks
</pre>
produces the error report
<pre>
! Undefined control sequence.
\blah #1-&#62;\bleah 
                 #1
l.5 \blah{to you}
                 , folks
</pre>
If the argument itself is in error, we will see things such as
<pre>
\newcommand{\blah}[1]{#1 to you}
\blah{\bleah}, folks
</pre>
producing
<pre>
! Undefined control sequence.
&#60;argument&#62; \bleah 
                  
l.5 \blah{\bleah}
                 , folks
</pre>
<p/>The prompt accepts single-character commands: the list of what&#8217;s
available may be had by typing <code>?</code>.  One immediately valuable
command is <code>h</code>, which gives you an expansion of TeXs original
pr&#233;cis message, sometimes accompanied by a hint on what to do to
work round the problem in the short term.  If you simply type &#8216;return&#8217;
(or whatever else your system uses to signal the end of a line) at the
prompt, TeX will attempt to carry on (often with rather little
success).
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=errstruct">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=errstruct</a>
</body>