I couldn't figure out why I was getting the errors LaTeX warning: Citation '...' on page X undefined on input line Y
and empty bibliography on line Z
in a document I was working on. I kept removing code until all that was left was the minimum for generating references and the problem was still there.
I have narrowed it down to this:
The following MWE compiles correctly (shows reference table with link from citation in text to table).
\documentclass[a4paper]{scrartcl}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{dirac,
title = {The Principles of Quantum Mechanics},
author = {Paul Adrien Maurice Dirac},
isbn = {9780198520115},
series = {International series of monographs on physics},
publisher = {Clarendon Press},
keywords = {physics}
}
\end{filecontents*}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname}
\begin{document}
\section{test}
this is a reference. \cite{dirac}
\printbibliography
\end{document}
however, if I add the key year = {1981}
to the bibliography entry so it reads:
@book{dirac,
title = {The Principles of Quantum Mechanics},
author = {Paul Adrien Maurice Dirac},
isbn = {9780198520115},
series = {International series of monographs on physics},
publisher = {Clarendon Press},
keywords = {physics},
year = {1981}
}
the document does not compile with references any more!
I get these warnings:
LaTeX Warning: Citation 'dirac' on page 1 undefined on input line 23.
LaTeX Warning: Empty bibliography on input line 25.
I am using the commands
xelatex main.tex
biber main
xelatex main.tex
xelatex main.tex
to compile, but I get the same problem using pdflatex
too.
This is the output of biber
when the year key is not present (references compiled correctly):
INFO - This is Biber 2.14
INFO - Logfile is 'main.blg'
INFO - Reading 'main.bcf'
INFO - Found 1 citekeys in bib section 0
INFO - Processing section 0
INFO - Globbing data source 'main'
INFO - Globbed data source 'main' to main
INFO - Looking for bibtex format file 'main' for section 0
INFO - LaTeX decoding ...
INFO - Found BibTeX data source './main.tex'
WARN - BibTeX subsystem: /var/folders/0v/640gnlsn7757klpyxs64hlz00000gn/T/biber_tmp_Nl1z/main.tex_18596.utf8, line 4, warning: 93 characters of junk seen at toplevel
INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'nty/global//global/global' of type 'entry' with template 'nty' and locale 'en-US'
INFO - No sort tailoring available for locale 'en-US'
INFO - Writing 'main.bbl' with encoding 'UTF-8'
INFO - Output to main.bbl
INFO - WARNINGS: 1
and here is the output of biber
when the year key is present (references broken):
INFO - This is Biber 2.14
INFO - Logfile is 'main.blg'
INFO - Reading 'main.bcf'
INFO - Found 1 citekeys in bib section 0
INFO - Processing section 0
INFO - Globbing data source 'main'
INFO - Globbed data source 'main' to main
INFO - Looking for bibtex format file 'main' for section 0
INFO - LaTeX decoding ...
INFO - Found BibTeX data source './main.tex'
(I have updated tex live manager with tlmgr update --self --all
and tried "rm -rf `biber --cache`" but the problem is still there)
\addbibresource{\jobname.bib}
, with your input you are actually reading the tex-file.\addbibresource{\jobname}
, Biber tries to parse the.tex
file as data source, which leads to junk warnings.\addbibresource{\jobname.bib}
would have been correct.