LaTeX error "Bibliography not compatible with author-year citations": cause and fix
natbib is in its default author-year mode, but the bibliography only provides numbers: its entries carry no author and year in the form natbib needs for citations like "Knuth (1984)". The error is reported for a line of the .aux file, not of your document, and natbib continues with numbers.
Why it happens
- A numeric BibTeX style is combined with
\usepackage{natbib}without options, for exampleIEEEtran,ieeetr,acmorsiam. - The bibliography is written by hand in
thebibliography, with entries of the form\bibitem{key}.
How to fix it
- For numbered citations, load the package as
\usepackage[numbers]{natbib}. - For author-year citations, use a style made for
natbib:plainnat,abbrvnatorunsrtnat. - In a hand-written bibliography, give author and year in the optional argument:
\bibitem[Knuth(1984)]{knuth1984}. - With the standard styles
plain,unsrt,abbrvandalphathe error does not occur, becausenatbibswitches to numbers for them on its own.
A document that produces the message
\documentclass{article}
\usepackage{natbib}
\begin{document}
The algorithm is described in \cite{knuth1984}.
\bibliographystyle{IEEEtran}
\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.
The corrected document
\documentclass{article}
\usepackage[numbers]{natbib}
\begin{document}
The algorithm is described in \cite{knuth1984}.
\bibliographystyle{IEEEtran}
\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.
Related pages
- Package
natbib - How-to Citation styles in LaTeX
- How-to Create a bibliography in LaTeX with BibTeX
- How-to Cite sources in LaTeX