LaTeX Warning: There were undefined references.

The end-of-run summary: some \ref or \cite did not resolve. Find the individual "Reference ... undefined" or "Citation ... undefined" lines above it.

Help centre › LaTeX errors › References and bibliography · Warning: the document still compiles

What the log says

LaTeX Warning: Reference `tab:data' on page 3 undefined on input line 58.
...
LaTeX Warning: There were undefined references.

Also printed as: Package natbib Warning: There were undefined citations.

What it means

This line comes at the very end of the log and adds no new information: it says that earlier in the same run at least one cross-reference or citation could not be resolved. The line to act on is the individual warning above it, which names the label or key and the input line.

Causes and fixes

Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.

1. A \ref names a label that does not exist

Find the "Reference '…' on page … undefined" warning above the summary, then correct the label in the \ref or add the missing \label.

Fails
\documentclass{article}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{lr} Sample & 4.2 \\ \end{tabular}
\caption{Measured data}\label{tab:data}
\end{table}
Table~\ref{tab:dta} lists the data.
\end{document}
Fixed
\documentclass{article}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{lr} Sample & 4.2 \\ \end{tabular}
\caption{Measured data}\label{tab:data}
\end{table}
Table~\ref{tab:data} lists the data.
\end{document}

2. A \cite names a key that is not in the bibliography

Without natbib, undefined citations are counted in the same summary. Find the "Citation '…' on page … undefined" warning and correct the key or add the entry to the .bib file. With natbib the summary reads "There were undefined citations" instead.

Fails
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
  author  = {Smith, Jane and Brown, Paul},
  title   = {Measuring Things Carefully},
  journal = {Journal of Measurement},
  year    = {2020},
  volume  = {12},
  pages   = {1--10}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
Earlier work \cite{smith2002} measured this.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}
Fixed
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
  author  = {Smith, Jane and Brown, Paul},
  title   = {Measuring Things Carefully},
  journal = {Journal of Measurement},
  year    = {2020},
  volume  = {12},
  pages   = {1--10}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
Earlier work \cite{smith2020} measured this.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}

3. The document has not been compiled enough times

After adding a label or citation, LaTeX needs a second pass (and BibTeX or biber before it for citations). If the summary disappears after compiling again, nothing was wrong.

In Manulyx

The editor attaches this summary to the individual warnings it counts, so you see the labels and keys to fix rather than one extra line. Manulyx runs the extra passes and BibTeX or biber itself.

Write in Manulyx for free · Journal templates

More in references and bibliography

Every example on this page was compiled with pdfLaTeX and BibTeX to check that it fails and is fixed as described. All LaTeX errors