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.
\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}\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.
\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}\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
- LaTeX Warning: Label `<label>' multiply defined.Two \label commands use the same name, so every \ref to it shows whichever came last. Rename one, and update the \ref commands that meant it.
- I couldn't open database file <name>.bibBibTeX cannot find the .bib file named in \bibliography. Check the spelling and folder, and write the name without the .bib extension.
- I found no \bibdata commandBibTeX read the .aux file and found no \bibliography, no \cite or no \bibliographystyle. Add the missing command, or run biber for biblatex.
- Repeated entry---line <n> of file <name>.bibTwo .bib entries share one citation key. BibTeX keeps the first and skips the other. Delete the duplicate or give it its own key.
- I was expecting a `,' or a `}'---line <n> of file <name>.bibA .bib entry is malformed, most often a missing comma between fields or a space in the key. BibTeX skips the rest of the entry.
- Package natbib Error: Bibliography not compatible with author-year citations.natbib wants author-year data, but the bibliography style gives only numbers. Use an author-year style such as plainnat, or load natbib with [numbers].
Every example on this page was compiled with pdfLaTeX and BibTeX to check that it fails and is fixed as described. All LaTeX errors