next up previous
Next: A Final Reminder Up: Essential LATEX Previous: Letters


When you create a new input file for LATEX you will probably make mistakes. Everybody does, and it's nothing to be worried about. As with most computer programs, there are two sorts of mistake that you can make: those that LATEX notices and those that it doesn't. To take a rather silly example, since LATEX doesn't understand what you are saying it isn't going to be worried if you mis-spell some of the words in your text. You will just have to accurately proof-read your printed output. On the other hand, if you mis-spell one of the environment names in your file then LATEXwon't know what you want it to do.

When this sort of thing happens, LATEX prints an error message on your terminal screen and then stops and waits for you to take some action. Unfortunately, the error messages that it produces are rather user-unfriendly and not a little frightening. Nevertheless, if you know where to look they will probably tell you where the error is and went wrong.

Consider what would happen if you mistyped \begin{itemize} so that it became \begin{itemie}. When LATEX processes this instruction, it displays the following on your terminal:

LaTeX error.  See LaTeX manual for explanation.
              Type  H <return>  for immediate help.
! Environment itemie undefined.
\@latexerr ...for immediate help.}\errmessage {#1}
l.140 \begin{itemie}

After typing the `?' LATEX stops and waits for you to tell it what to do.

The first two lines of the message just tell you that the error was detected by LATEX. The third line, the one that starts `!' is the error indicator. It tells you what the problem is, though until you have had some experience of LATEX this may not mean a lot to you. In this case it is just telling you that it doesn't recognise an environment called itemie. The next two lines tell you what LATEX was doing when it found the error, they are irrelevant at the moment and can be ignored. The final line is called the error locator, and is a copy of the line from your file that caused the problem. It start with a line number to help you to find it in your file, and if the error was in the middle of a line it will be shown broken at the point where LATEX realised that there was an error. LATEX can sometimes pass the point where the real error is before discovering that something is wrong, but it doesn't usually get very far.

At this point you could do several things. If you knew enough about LATEX you might be able to fix the problem, or you could type `X' and press the return key to stop LATEX running while you go and correct the error. The best thing to do, however, is just to press the return key. This will allow LATEX to go on running as if nothing had happened. If you have made one mistake, then you have probably made several and you may as well try to find them all in one go. It's much more efficient to do it this way than to run LATEX over and over again fixing one error at a time. Don't worry about remembering what the errors were--a copy of all the error messages is being saved in a log file so that you can look at them afterwards. See your local guide to find out what this file is called.

If you look at the line that caused the error it's normally obvious what the problem was. If you can't work out what you problem is look at the hints below, and if they don't help consult Chapter 6 of the manual. It contains a list of all of the error messages that you are likely to encounter together with some hints as to what may have caused them.

Some of the most common mistakes that cause errors are

One error can get LATEX so confused that it reports a series of spurious errors as a result. If you have an error that you understand, followed by a series that you don't, then try correcting the first error--the rest may vanish as if by magic.

Sometimes LATEX may write a * and stop without an error message. This is normally caused by a missing \end{document} command, but other errors can cause it. If this happens type \stop and press the return key.

Finally, LATEX will sometimes print warning messages. They report problems that were not bad enough to cause LATEX to stop processing, but nevertheless may require investigation. The most common problems are `overfull' and `underfull' lines of text. A message like:

Overfull \hbox (10.58649pt too wide) in paragraph at lines 172--175
[]\tenrm Mathematical for-mu-las may be dis-played. A dis-played
indicates that LATEX could not find a good place to break a line when laying out a paragraph. As a result, it was forced to let the line stick out into the right-hand margin, in this case by 10.6 points. Since a point is about 1/72nd of an inch this may be rather hard to see, but it will be there none the less.

This particular problem happens because LATEX is rather fussy about line breaking, and it would rather generate a line that is too long than generate a paragraph that doesn't meet its high standards. The simplest way around the problem is to enclose the entire offending paragraph between \begin{sloppypar} and \end{sloppypar} commands. This tells LATEX that you are happy for it to break its own rules while it is working on that particular bit of text.

Alternatively, messages about ``Underfull \hbox'es'' may appear. These are lines that had to have more space inserted between words than LATEX would have liked. In general there is not much that you can do about these. Your output will look fine, even if the line looks a bit stretched. About the only thing you could do is to re-write the offending paragraph!

next up previous
Next: A Final Reminder Up: Essential LATEX Previous: Letters
Kevin Cooper 2002-03-01