FormaTeX
WarningFiles & Resources

Reference Undefined (Missing Label)

LaTeX Warning: Reference 'XXX' on page N undefined.

What this error means

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.

Common causes

  • The \label{key} command is missing from the document
  • LaTeX was only compiled once — cross-references need two passes
  • Typo in the \ref{} key that doesn't match any \label{}
  • The label is in an \include{}d file that was excluded with \includeonly{}

How to fix it

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).

Code examples

Causes the error
\documentclass{article}
\begin{document}

\section{Introduction}
% Forgot \label here

See Section~\ref{sec:intro} for more.

\end{document}
Fixed
\documentclass{article}
\begin{document}

\section{Introduction}\label{sec:intro}

See Section~\ref{sec:intro} for more.

\end{document}

Related errors

Test the fix live

Paste your LaTeX into the playground and compile instantly.

Una cosa rápida

Registramos el uso anónimo — visitas a páginas, uso de funciones, eventos de compilación — para entender qué funciona y qué no. Sin publicidad, sin datos personales, sin compartir con terceros.

Política de cookies