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.
- The message. The line that starts with
!is the error itself. This is the text to search for. - The position. The line that starts with
l.and a number is the source line. TeX prints it in two halves, split at the point it had reached. The mistake is nearly always the last thing on the upper half. - The help text. The sentences after that are TeX's own explanation. It is terse, but it often names the fix.
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
- Undefined control sequence: TeX met a command name it has no definition for. Usually the name is misspelled or the package that defines it is not loaded.
- Missing $ inserted: TeX found something that only works in math mode while it was setting ordinary text, so it switched to math mode on its own.
- File `x.sty' not found: LaTeX asked for a package, class or input file and could not find it in the project folder or in the TeX distribution.
- Missing \begin{document}: LaTeX found something to print before \begin{document}. The line is usually there; something printable sits above it.
- LaTeX Error: Environment x undefined: A \begin{...} names an environment LaTeX has no definition for.
- Runaway argument: TeX was reading the argument of a command and ran out of file or paragraph before it found the closing brace.
- Paragraph ended before \x was complete: TeX was reading a command's argument and reached a blank line before the closing brace.
- Too many }'s / Missing } inserted: Two messages for one problem: braces that do not pair up. One reports a closing brace too many, the other a group that was never closed.
- Extra alignment tab has been changed to \cr: A table or matrix row has more & separators than the column specification allows.
- Misplaced alignment tab character &: TeX found an & outside a table or alignment. For an ampersand in text, type \&.
Warnings that change the PDF
- Citation `x' undefined: LaTeX found a \cite key with no bibliography entry to match on this run, so the PDF shows a question mark where the citation should be.
- Overfull \hbox: TeX could not break a paragraph without letting one line stick out past the right margin. The number in the message says by how much.
Where your editor shows the log
Every editor keeps the full log somewhere, and most also show a summary with one entry per message.
- ModernTex: when a build fails, the Build button shows the error count and the last good PDF stays on screen. The Build Results panel lists each error, warning and note in plain language, Compile › Next Issue steps through them, and Raw Log shows the full LaTeX log. See ModernTex.
- Overleaf: the logs panel, opened with the button next to Recompile, lists each error and warning with its file and line, and the editor marks the line in the gutter. The unprocessed log is at the bottom of that panel.
- TeXShop: the console window shows the log as it is written and stops at the error. Goto Error moves the source window to the line.
- A terminal: the same text is printed as TeX runs, and the complete log is in the
.logfile next to your source.
If the message you are looking at comes from the bibliography, the guide to common BibTeX errors covers the .bib side.