Purplelink
← All guides

LaTeX error messages, explained

Twelve messages that LaTeX prints when a document does not compile cleanly. Each page shows the real log output, what it means, the causes in order of likelihood and the fix for each.

LaTeX error messages were written for people who know how TeX works inside, which is why Missing $ inserted can turn out to be about an underscore and Runaway argument? about a forgotten brace. Each page below starts from the exact text in the log. Every log excerpt on these pages is real output: I wrote a small file that triggers the message, compiled it with pdfLaTeX from TeX Live 2026, and copied the lines from the .log file. The corrected version of each file was compiled as well.

How to read an error in the log

An error in the log has three parts. This is the log for a misspelled command:

! Undefined control sequence.
l.3 The effect is \textbf{large} and \emhp
                                          {robust} across samples.
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Warnings look different. They start with LaTeX Warning: or, for line-breaking problems, with Overfull or Underfull, and they carry the line number inside the message.

Fix the first error first

After an error TeX guesses at a repair and carries on, and when the guess is wrong the lines that follow fail too. A single missing brace can produce twenty messages. Fix the first one in the log, compile again, and read the log again from the top. To reproduce a message outside your project, save a small example as a .tex file and compile it with the LaTeX to PDF tool.

Errors that stop the build

Warnings that change the PDF

Where your editor shows the log

Every editor keeps the full log somewhere, and most also show a summary with one entry per message.

If the message you are looking at comes from the bibliography, the guide to common BibTeX errors covers the .bib side.

Frequently asked questions

What does the l. number mean in a LaTeX log?
It is the line of the source file TeX was reading when it reported the error. The text after the number is that line, split in two at the exact point TeX had reached. For most errors the mistake is the last thing before the split.
Why does one mistake produce many LaTeX errors?
After an error TeX guesses at a repair and keeps going, and a wrong guess makes the following lines fail too. Fix the first error in the log, compile again, and most of the others usually disappear.
Do I have to fix LaTeX warnings?
Warnings do not stop the build, but two of them change the PDF: an undefined citation prints a question mark in place of the reference, and an overfull box pushes text into the margin. Clear both before you submit.