LaTeX warning "Citation `knuth84' on page 1 undefined": cause and fix
A \cite uses a key for which LaTeX has no bibliography entry in this run. The PDF shows [?] in its place; with biblatex it shows the key in bold.
Why it happens
- The key in
\cite{...}differs from the key in the.bibfile by a typo. Biber also treatsKnuth1984andknuth1984as two keys; BibTeX ignores case when it looks up a key. - BibTeX or Biber has not run yet, or LaTeX has not run twice after it. The citations only resolve after the whole sequence.
- The entry is not in the
.bibfile that the document loads. - BibTeX or Biber stopped with an error, for example because it could not find the
.bibfile, and wrote no entries.
How to fix it
- Compare the key in the message with the first field of the entry in the
.bibfile:@book{knuth1984,. - Run the full sequence: LaTeX, then BibTeX or Biber, then LaTeX twice.
- Read the log of BibTeX or Biber, the
.blgfile. For a missing key BibTeX writes "I didn't find a database entry" there. - Check that
\bibliography{...}or\addbibresource{...}names the right file. See I couldn't open database file references.bib and Cannot find 'references.bib'!.
A document that produces the message
\documentclass{article}
\begin{document}
The algorithm is described in \cite{knuth84}.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}File refs.bib:
@book{knuth1984,
author = {Donald E. Knuth},
title = {The TeXbook},
publisher = {Addison-Wesley},
year = {1984}
}Tools run in this order: pdflatex → bibtex → pdflatex → pdflatex.
The corrected document
\documentclass{article}
\begin{document}
The algorithm is described in \cite{knuth1984}.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.