LaTeX Warning: Citation `<key>' on page <n> undefined

A \cite key has no entry in the built bibliography: a key typo, a missing \bibliography line, a broken .bib entry, or BibTeX has not run yet.

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

What the log says

LaTeX Warning: Citation `smith2021' on page 1 undefined on input line 12.
...
LaTeX Warning: There were undefined references.

Also printed as: Package natbib Warning: Citation `<key>' on page <n> undefined

What it means

LaTeX looked up the key in the .aux file and found no matching entry from the bibliography. In the PDF the citation prints as [?] (or (?) with author-year styles). The document still compiles; the citation is simply missing until the key resolves.

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. The key in \cite does not match any key in the .bib file

Keys are case-sensitive and must match exactly: Smith2020 and smith2020 are different keys. Open the .bib file, find the entry, and copy its key (the text after @article{) into the \cite command.

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}
As shown by \cite{smith2021}, the effect is small.
\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}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}

2. \bibliographystyle or \bibliography is missing

With BibTeX the document needs both: \bibliographystyle{plain} (or the journal's style) and \bibliography{refs} naming the .bib file without its extension. Without them BibTeX stops with "I found no \bibstyle command" or "I found no \bibdata command" and writes no bibliography, so every citation is undefined.

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}
As shown by \cite{smith2020}, the effect is small.
\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}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}

3. BibTeX or biber has not run since the citation was added

A new citation needs the bibliography program to run, then LaTeX twice more. If you compile by hand, run pdflatex, bibtex (or biber for biblatex), then pdflatex twice; latexmk does all of this for you.

4. The .bib entry is broken, so BibTeX skipped it

Look in the .blg file (the BibTeX log) for "I was expecting a ',' or a '}'" or "Repeated entry" near the entry. BibTeX skips a malformed entry, so its key never reaches the bibliography. Fix the entry and compile again.

5. A biblatex document compiled with BibTeX instead of biber

\usepackage{biblatex} uses biber by default. Run biber, not bibtex, on the document; if you must use BibTeX, load \usepackage[backend=bibtex]{biblatex}.

Finding the line when the line number does not help

In Manulyx

Manulyx runs BibTeX or biber and the extra passes itself when you compile, so a new citation resolves on the next compile. When the bibliography itself failed, the editor lists the undefined citations under that cause rather than as separate problems.

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