Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Appendix B: Commands and errors

Section 3: Errors and warnings

LATEX describes what it’s typesetting while it does it, and if it encounters something it doesn’t understand or can’t do, it will display a message saying what’s wrong. It may also display warnings for less serious conditions.

Don’t panic if you see error messages: it’s very common for beginners as well as seasoned users to mistype or mis-spell commands, forget curly braces, type a forward slash instead of a backslash, or use a special character by mistake. Errors are easily spotted and easily corrected in your editor, and you can then run LATEX again to check you have fixed everything. Some of the most common errors are described in § B.3.1 below with an explanation of how to fix them.

Some editors show hotlinks in the LATEX log window where you can click on an error message and the cursor will jump to the line in your document where the error was spotted.

There is an extensive guide to how to handle errors in LATEX in (Beeton, 2017) (her presentation from TUG 2017) which also has a lot of useful information about how to work with LATEX in general.

B.3.1 Error messages

dontpanic-orig

The format of an error message is always the same. Error messages begin with an exclamation mark at the start of the line, and give a description of the error, followed by another line starting with the number, which refers to the line-number in your document file which LATEX was processing when the error was spotted. Here’s an example, showing that the user mistyped the \tableofcontents command:

! Undefined control sequence.
l.6 \tableofcotnetns

When LATEX finds an error like this, it displays the error message and pauses. You must type one of the following letters to continue:

KeyMeaning
xStop immediately and exit the program.
qCarry on quietly as best you can and don’t bother me with any more error messages.
eStop the program but re-position the text in my editor at the point where you found the error (this only works if you’re using an editor which LATEX can communicate with).
hTry to give me more help.
i(followed by a correction) means input the correction in place of the error and carry on (this is only a temporary fix to get the file processed. You still have to make that correction in the editor).

Some systems (Emacs is one example) run LATEX with a ‘non-stop’ switch turned on, so it will always process through to the end of the file, regardless of errors, or until a limit is reached.

B.3.2 Warnings

Warnings don’t begin with an exclamation mark: they are just comments by LATEX about things you might want to look into, such as overlong or underrun lines (often caused by unusual hyphenations, for example), pages running short or long, and other typographical niceties (most of which you can ignore until later).

Unlike other systems, which try to hide unevennesses in the text — usually unsuccessfully — by interfering with the letter-spacing, LATEX takes the view that the author or editor should be able to contribute. While it is certainly possible to set LATEX’s parameters so that the spacing is sufficiently sloppy that you will almost never get a warning about badly-fitting lines or pages, you will almost certainly just be delaying matters until you start to get complaints from your readers or publishers.

B.3.3 Examples

Only a few common error messages are given here: those most likely to be encountered by beginners. If you find another error message not shown here, and it’s not clear what you should do, ask for help.

Most error messages are self-explanatory, but be aware that the place where LATEX spots and reports an error may be later in the file than the place where it actually occurred. For example if you forget to close a curly brace which encloses, say, italics, LATEX won’t report this until something else occurs which can’t happen until the curly brace is encountered (eg the end of the document!) Some errors can only be righted by humans who can read and understand what the document is supposed to mean or look like.

Newcomers — remember to check the list of special characters: many errors when you are learning LATEX are due to accidentally typing a special character when you didn’t mean to. This disappears after a few hours as you get used to them.

B.3.3.1 Too many }’s

! Too many }'s.
l.6 \date December 2024}

The reason LATEX thinks there are too many }’s here is that the opening curly brace is missing after the \date control sequence and before the word December, so the closing curly brace is seen as one too many (which it is!).

In fact, there are other things which can follow the \date command apart from a date in curly braces, so LATEX cannot possibly guess that you’ve missed out the opening curly brace — until it finds a closing one!

B.3.3.2 Undefined control sequence

! Undefined control sequence.
l.6 \dtae
         {December 2024}

In this example, LATEX is complaining that it has no such command (‘control sequence’) as \dtae. Obviously it’s been mistyped, but only a human can detect that fact: all LATEX knows is that \dtae is not a command it knows about — it’s undefined.

Mistypings are the commonest source of error. If your editor has drop-down menus to insert common commands and environments, use them!

B.3.3.3 Runaway argument

Runaway argument?
{December 2024 \maketitle 
! Paragraph ended before \date was complete.
<to be read again>
                   \par 
l.8

In this error, the closing curly brace has been omitted from the date. It’s the opposite of the error in § B.3.3.1 above, and it results in \maketitle trying to format the title page while LATEX is still expecting more text for the date! As \maketitle creates new paragraphs on the title page, this is detected and LATEX complains that the previous paragraph has ended but \date is not yet finished.

B.3.3.4 Capacity exceeded

! TeX capacity exceeded, sorry [parameter stack size=5000].

This is rather more serious: it means TEX has completely run out of memory. This will happen if you try to push the system too far, like getting it to read lines which are unreasonably long, or macros which are too complex to fit in memory (or more likely just badly-written). I had it happen once (admittedly on an older system) with an author who had written a single paragraph over 37 pages long. I suggested this was perhaps a style that was unfair on his readers...but in fact the current version of LATEX is capable of handling the longest known footnote at 173 pages without any strain (Flynn, 2023).

B.3.3.5 Underfull hbox

Underfull \hbox (badness 1394) in paragraph 
at lines 28--30
[][]\LY1/brm/b/n/10 Bull, RJ: \LY1/brm/m/n/10 
Ac-count-ing in Busi-
[94]

This is a warning that LATEX cannot stretch the line wide enough to fit, without making the spacing bigger than its currently permitted maximum. The badness (0–10,000) indicates how severe this is (here you can probably ignore a badness of 1394). It says what lines of your file it was typesetting when it found this, and the number in square brackets is the number of the page onto which the offending line was printed.

The codes separated by slashes are the typeface and font style and size used in the line according to the definitions of the fontname package.

B.3.3.6 Overfull hbox

[101]
Overfull \hbox (9.11617pt too wide) in paragraph 
at lines 860--861
[]\LY1/brm/m/n/10 Windows, \LY1/brm/m/it/10 see 
\LY1/brm/m/n/10 X Win-

And the opposite warning: this line is too long by a shade over 9pt. The chosen hyphenation point which minimises the error is shown at the end of the line (Win-). Line numbers and page numbers are given as before. In this case, 9pt is too much to ignore (over 3mm or more than ″), and a manual correction needs making (such as a change to the hyphenation), or the flexibility settings need changing (outside the scope of this book).

B.3.3.7 Missing package

! LaTeX Error: File `paralisy.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:

When you use the \usepackage command to request LATEX to use a certain package, it will look for a file with the specified name and the filetype .sty. In this case the user has mistyped the name of the paralist package, so it’s easy to fix. However, if you get the name right, but the package is not installed on your machine, you will need to download and install it before continuing (see Chapter 3 ‘Plugins and support’ above).