Guide

Common LaTeX errors, and how to fix them.

What each message really means, why it usually happens, and what to change. LatexDo shows these explanations next to the line that caused them.

01

Undefined control sequence

LaTeX met a command it does not know.

  • The command is misspelled, for example \beginn instead of \begin.
  • The package that defines it is not loaded.
  • A command from one document class is used in another.

Check the spelling on the reported line, then load the package that provides the command with \usepackage.

02

Missing $ inserted

A math symbol appears outside math mode.

  • An underscore or caret is used in normal text, as in file_name.
  • A math command such as \alpha is written without dollar signs.
  • A dollar sign that opens math mode is never closed.

Wrap the math in $...$, or escape the character in text, for example file\_name.

03

File not found

LaTeX cannot find a file the document asks for.

  • A package is not installed in your TeX distribution.
  • An image path or file name is wrong, or the capitalisation differs.
  • The file is in another folder than the one LaTeX looks in.

For a .sty file, install the package with your TeX distribution. For an image, check the name and the path relative to the main file.

04

Missing \begin{document}

Text appears before the document starts.

  • Words or stray characters are typed in the preamble.
  • \begin{document} is missing or misspelled.
  • The file being compiled is a chapter, not the main file.

Remove anything that is not a command from the preamble and make sure you compile the main file.

05

Extra alignment tab has been changed to \cr

A table row has more columns than the table declares.

  • There are more & separators in a row than columns in the tabular specification.
  • A row is missing its closing \\, so two rows are read as one.

Count the columns in \begin{tabular}{...} and make every row match, with \\ at the end of each.

06

Runaway argument

A brace or environment was opened and never closed.

  • A closing } is missing.
  • A blank line sits inside an argument that cannot contain one.
  • A \begin has no matching \end.

Look just before the reported line for the unclosed brace or environment and close it.

07

Citation undefined

A \cite key has no matching bibliography entry.

  • The key is misspelled or is missing from the .bib file.
  • The bibliography step has not run yet.
  • The .bib file is not referenced by the document.

Check the key against your .bib file and build again so the bibliography is processed.

08

Overfull \hbox

A line is wider than the text block.

  • A long word, URL or formula cannot be broken.
  • A wide table or image exceeds the text width.

This is a warning, not an error. Rephrase the sentence, allow a break, or scale the table or image to \textwidth.

Let the editor explain the next one.

LatexDo turns the build log into one clear message per problem, with a jump to the line.