Common LaTeX errors, explained and fixed
Each page shows the exact message from the pdfTeX log, what it means, the usual causes, and a broken example you can fix and compile right on the page. The same explanations appear in the TeXpad editor when a compile fails.
- Undefined control sequence
! Undefined control sequence. - Missing $ inserted
! Missing $ inserted. - File `….sty' not found
! LaTeX Error: File `nonexistentpkgxyz.sty' not found. - Runaway argument (Paragraph ended before … was complete)
Runaway argument? ! File ended while scanning use of \textbf. - Environment … undefined
! LaTeX Error: Environment itemise undefined. - \begin{…} on input line … ended by \end{…}
! LaTeX Error: \begin{itemize} on input line 3 ended by \end{document}. - Misplaced alignment tab character &
! Misplaced alignment tab character &. - There's no line here to end
! LaTeX Error: There's no line here to end. - Double subscript (and Double superscript)
! Double subscript. - Illegal unit of measure (pt inserted)
! Illegal unit of measure (pt inserted). - Unicode character … not set up for use with LaTeX
! Package inputenc Error: Unicode character ≤ (U+2264) not set up for use with LaTeX. - Something's wrong--perhaps a missing \item
! LaTeX Error: Something's wrong--perhaps a missing \item. - Missing \begin{document}
! LaTeX Error: Missing \begin{document}. - Too many }'s (Extra }, or forgotten $)
! Too many }'s. - File `figure.png' not found (\includegraphics)
! Package pdftex.def Error: File `figure.png' not found: using draft setting.
Questions
Where do I find the actual error in a LaTeX log?
Look for the first line that starts with an exclamation mark (!). The line after it, starting with l. and a number, shows where TeX stopped. Later errors are often caused by the first one, so fix that first.
Why does one mistake cause many errors?
After an error TeX tries to recover and keeps going, often in the wrong mode, so one missing brace or dollar sign can produce a cascade. TeXpad stops at the first error and explains that one.
Does TeXpad upload my document to explain the error?
No. Compiling and the explanations are rule-based and run in your browser. Nothing is sent to a server.
Free LaTeX tools
- Online LaTeX compiler: paste a .tex file and get the PDF
- Import an Overleaf project: open a project zip, nothing uploaded
- LaTeX symbols cheat sheet: every common command, with a printable PDF
- LaTeX to PDF converter: drop a .tex, download a PDF
- Word to LaTeX: convert a .docx, compile the result
- Markdown to LaTeX: math and tables kept
- LaTeX errors explained: fix the common compile errors, live