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.
\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}\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.
\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}\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
- The .blg file lists every key BibTeX could not find as "Warning--I didn't find a database entry for ...", which is quicker than reading the .log.
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
- LaTeX Warning: Reference `<label>' on page <n> undefinedA \ref, \eqref or \pageref names a label LaTeX has not seen: a typo, a missing \label, or a part excluded by \includeonly. Prints ?? in the PDF.
- LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.Some label's number or page changed during this run, so references printed from the old .aux may be wrong. Compile again; if it never settles, look for a loop.
- 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.
- 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.
- 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