summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-errstruct.html
blob: 96584e85424ff904cc7f70dfdc09a5b680306d80 (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&rsquo;s error messages are reminiscent of the time when TeX itself
was conceived (the 1970s): they&rsquo;re not terribly user-friendly, though
they do contain all the information that TeX can offer, usually in
a pretty concise way.
<p>TeX&rsquo;s error reports all have the same structure:
<ul>
<li> An error message
<li> Some &lsquo;context&rsquo;
<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 &ldquo;higher-level&rdquo;
macros.  Many LaTeX-detected problems manifest themselves as
&lsquo;generic&rsquo; 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 &ldquo;point of call&rdquo;
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-&gt;\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.
&lt;argument&gt; \bleah 
                  
l.5 \blah{\bleah}
                 , folks
</pre>
<p>The prompt accepts single-character commands: the list of what&rsquo;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&eacute;cis message, sometimes accompanied by a hint on what to do to
work round the problem in the short term.  If you simply type &lsquo;return&rsquo;
(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>