One quick thing
We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.
\errors{latex}
50 common errors explained — what causes them, how to fix them, and working code examples. Bookmark this for when LaTeX inevitably surprises you.
! LaTeX Error: File 'XXX' not found.
LaTeX tried to read a file (via \input{}, \include{}, \includegraphics{}, or similar) but couldn't locate it. LaTeX searches the current directory and its TeX installation paths.
Use the full relative path from the .tex file location. For images, ensure the file extension matches exactly. When using \includegraphics, place images in the same folder as the .tex file or specify the path explicitly.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{logo} % File 'logo' not found
\input{chapters/intro} % Wrong path
\end{document}\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{images/logo.png} % Correct path + extension
\input{chapters/intro.tex} % Correct path
\end{document}! LaTeX Error: Unknown graphics extension: .XXX.
You tried to include an image with a file format that the current LaTeX engine doesn't support. Different engines support different image formats.
For pdflatex: use .pdf, .png, or .jpg images. For XeLaTeX/LuaLaTeX: same plus .eps via epstopdf. Convert unsupported formats beforehand. You can also omit the extension and let LaTeX pick the best format automatically.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
% pdflatex doesn't support .eps
\includegraphics{figure.eps}
\end{document}\documentclass{article}
\usepackage{graphicx}
\begin{document}
% Use PDF, PNG, or JPG with pdflatex
\includegraphics{figure.pdf}
% Or let LaTeX choose:
% \includegraphics{figure}
\end{document}FormaTeX smart compile: FormaTeX smart compile detects EPS images and automatically switches to an engine with epstopdf support, or converts the image format before compiling.
! Package inputenc Error: Unicode char U+XXXX not set up for use with LaTeX.
Your document contains a Unicode character (accented letter, emoji, special symbol, etc.) that pdfLaTeX can't handle. pdfLaTeX uses 8-bit encodings and requires special packages to support Unicode input.
The simplest fix is to switch to XeLaTeX or LuaLaTeX with \usepackage{fontspec} — they support Unicode natively. Alternatively, add \usepackage[utf8]{inputenc} to pdfLaTeX for basic Latin Unicode support.
\documentclass{article}
% pdflatex — no Unicode support configured
\begin{document}
Café, naïve, résumé, 日本語
\end{document}\documentclass{article}
% Option 1: XeLaTeX / LuaLaTeX (full Unicode)
\usepackage{fontspec}
% Option 2: pdfLaTeX with UTF-8 (limited Unicode)
% \usepackage[utf8]{inputenc}
% \usepackage[T1]{fontenc}
\begin{document}
Café, naïve, résumé
\end{document}FormaTeX smart compile: FormaTeX smart compile detects non-ASCII characters in the source and automatically switches from pdfLaTeX to XeLaTeX with fontspec enabled.
! LaTeX Error: Cannot determine size of graphic (no BoundingBox).
LaTeX could not determine the dimensions of an included graphic because the file lacks a BoundingBox comment. This happens when EPS files are included in pdfLaTeX mode, or when an image file is corrupted.
Convert EPS files to PDF using epstopdf (run epstopdf figure.eps to get figure.pdf). For pdflatex, use .pdf, .png, or .jpg files. Load the epstopdf package to automate this conversion on-the-fly.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
% pdflatex cannot use EPS without conversion
\includegraphics{figure.eps}
\end{document}\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf} % auto-converts EPS to PDF
\begin{document}
\includegraphics{figure.eps} % epstopdf converts it on-the-fly
% Or manually convert first:
% \includegraphics{figure.pdf}
\end{document}FormaTeX smart compile: FormaTeX smart compile detects EPS files included with pdfLaTeX and automatically converts them using epstopdf before compiling.
LaTeX Warning: Citation 'XXX' on page N undefined.
A \cite{key} command references a bibliography key that doesn't exist in the current .bib file, or BibTeX/Biber has not been run. This produces [?] in the output instead of the citation number.
Run the full compilation sequence: pdflatex → bibtex → pdflatex → pdflatex. Check that the key in \cite{key} exactly matches the key in your .bib file. Verify the \bibliography{} path points to the correct .bib file.
\documentclass{article}
\begin{document}
See~\cite{smith2024} for details.
\bibliography{refs}
\bibliographystyle{plain}
\end{document}% refs.bib must contain:
% @article{smith2024,
% author = {Smith, John},
% title = {My Paper},
% year = {2024},
% }
\documentclass{article}
\begin{document}
See~\cite{smith2024} for details.
\bibliography{refs}
\bibliographystyle{plain}
\end{document}LaTeX Warning: Reference 'XXX' on page N undefined.
A \ref{key} or \pageref{key} command references a label that doesn't exist yet, or LaTeX needs to be run twice to resolve cross-references. The output shows ?? instead of the reference number.
Compile the document twice: the first pass writes labels to the .aux file, and the second pass reads them. If ?? still appears, check that the \label{key} exists and matches the \ref{key} exactly (case-sensitive).
\documentclass{article}
\begin{document}
\section{Introduction}
% Forgot \label here
See Section~\ref{sec:intro} for more.
\end{document}\documentclass{article}
\begin{document}
\section{Introduction}\label{sec:intro}
See Section~\ref{sec:intro} for more.
\end{document}LaTeX Font Warning: Font shape 'OT1/XXX/m/n' undefined.
LaTeX requested a specific font shape (a combination of encoding, family, series, and shape) that isn't available in the current TeX installation. LaTeX substitutes the closest available font, which may change the document's appearance.
Install the missing font package via your TeX distribution (tlmgr install packagename for TeX Live). If using XeLaTeX/LuaLaTeX with fontspec, check that the system font name matches exactly.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Nonexistent Font Name} % Font not on system
\begin{document}
Hello
\end{document}\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman} % Standard TeX font, always available
\begin{document}
Hello
\end{document}! LaTeX Error: File 'XXX.sty' not found.
LaTeX cannot find the style file for a package you tried to load with \usepackage{}. The package is either not installed in your TeX distribution, has a different name, or is a custom package not in the current directory.
Install the missing package: run tlmgr install packagename (TeX Live) or use MiKTeX's package manager. Check the exact package name on CTAN. For custom packages, place the .sty file in the same directory as your .tex file.
\documentclass{article}
\usepackage{nonexistentpackage} % Not installed
\begin{document}
Hello
\end{document}\documentclass{article}
% Install via: tlmgr install booktabs
\usepackage{booktabs}
\begin{document}
Hello
\end{document}FormaTeX smart compile: FormaTeX smart compile automatically installs missing CTAN packages from the full TeX Live distribution before compiling your document.
! Package tikz Error: I did not find the library 'XXX'.
A TikZ library referenced with \usetikzlibrary{} doesn't exist or is spelled incorrectly. TikZ functionality is split into libraries that must be loaded explicitly.
Check the TikZ/PGF manual for the correct library name. Common libraries: arrows.meta, decorations.pathmorphing, calc, positioning, shapes, fit, external. pgfplots graphs require \usepackage{pgfplots} separately.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrow} % Wrong: should be 'arrows' or 'arrows.meta'
\begin{document}
\begin{tikzpicture}
% ...
\end{tikzpicture}
\end{document}\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\begin{document}
\begin{tikzpicture}
\node (a) {A};
\node[right of=a] (b) {B};
\draw[-{Stealth}] (a) -- (b);
\end{tikzpicture}
\end{document}LaTeX Warning: There were undefined references.
The document has bibliography references that were never resolved. This usually means the BibTeX or Biber processor was not run as part of the compilation sequence, so the reference data was never collected.
For traditional BibTeX: run pdflatex → bibtex main → pdflatex → pdflatex. For biblatex with Biber: run pdflatex → biber main → pdflatex → pdflatex. Delete .aux files if you get persistent undefined reference warnings after the full sequence.
% Only ran: pdflatex main.tex
% Missing: bibtex main -> pdflatex -> pdflatex% Full BibTeX sequence:
% 1. pdflatex main.tex
% 2. bibtex main
% 3. pdflatex main.tex
% 4. pdflatex main.tex
% Full biblatex+biber sequence:
% 1. pdflatex main.tex
% 2. biber main
% 3. pdflatex main.tex
% 4. pdflatex main.texPackage hyperref Warning: Hyper reference '...' on page N undefined.
The hyperref package found a \hyperref[key]{text} or \autoref{key} reference to an anchor that doesn't exist in the document. The link will point nowhere in the PDF.
Ensure every \hyperref[key]{} or \autoref{key} has a matching \label{key} in the document. Compile twice to resolve cross-references. Check that no \includeonly{} is excluding the file with the label.
\documentclass{article}
\usepackage{hyperref}
\begin{document}
See \autoref{fig:result} for the result.
% But there is no \label{fig:result} anywhere!
\end{document}\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{figure}[h]
\centering
% ... figure content ...
\caption{Results}\label{fig:result}
\end{figure}
See \autoref{fig:result} for the result.
\end{document}