3

I got my girlfriend to using LaTeX for her Bachelor's thesis and she really likes it. However she still makes mistakes here and there. Normally I can fix them quite easily for her. But this one drives me crazy:

WARN - I didn't find a database entry for '[' (section 0)
WARN - I didn't find a database entry for '1' (section 0)

The TEX file is huge so spotting this by chance is not easy. I tried searching the whole document for {1}, {[}, and with regexes that try to be a little smarter than literal search. I only find a few [1] which are correct but apart from that absolutely nothing that could explain the warning.

The BLG file isn't much more informative either:

[786] Utils.pm:304> WARN - I didn't find a database entry for '[' (section 0)
[787] Utils.pm:304> WARN - I didn't find a database entry for '1' (section 0)

Output: pdflatex, the LOG, the BBL, the BCF and the BLG.

I also tried to find out how to get biber to just tell me the line number to have a look at. I just can't find any means of producing it.

Does anyone have a way for that?

10
  • Which OS are you on? And can we see some code?
    – daleif
    Mar 26, 2021 at 13:59
  • Well, biber won't be able to tell you the line number since the .bcf file it processes does not have line numbers included. (Biber doesn't touch the TeX source.) What happens if you run latex after running Biber? Any missing database entries should leave unresolved citations, which the terminal output from latex should tell you about. Mar 26, 2021 at 14:10
  • I'm running MacOS 10.15. I updated the question with a link to pdflatex' output.
    – primfaktor
    Mar 26, 2021 at 14:25
  • What code would you like to see? The gigantic file? Without knowing where the error lies I can't create a minimal example.
    – primfaktor
    Mar 26, 2021 at 14:27
  • 1
    Or do a bit of binary search: remove a reference in the middel of the thesis from the .bib file, then see if the errors occur before or after the new missing entry. If before, do the same at 1/4th of the text, otherwise at 3/4th, etc.
    – Marijn
    Mar 26, 2021 at 14:38

3 Answers 3

5

The bcf-file is rather long, but it is also well structured, and you are only interested in the cite keys.

So if you search for bcf:citekey you get quite fast to the list of citekeys starting with

  <bcf:citekey order="1">goepel:2020</bcf:citekey>
  <bcf:citekey order="2">boyd:un:2019</bcf:citekey>

There you only have to search for >1< and >[ and you find

<bcf:citekey order="100">lay:2015</bcf:citekey>
<bcf:citekey order="101">[</bcf:citekey>
<bcf:citekey order="102">umweltbundesamt:kyoto</bcf:citekey>
 ....
<bcf:citekey order="137">cusato:2017</bcf:citekey>
<bcf:citekey order="138">1</bcf:citekey>
<bcf:citekey order="139">cusato:2017</bcf:citekey>

which means that the problematic keys are after {lay:2015} and {cusato:2017} which should be not so difficult to find.

A second option to find the citation is to delete the bbl-file. Then LaTeX will warn about every undefined citation and you should see in the log-file

LaTeX Warning: Citation '1' on page 1 undefined on input line 13.
2

Update

From biblatex v3.17 onwards the line number warnings are kept alive even after the Biber run and should be able to tell you more specifically where the problematic citations are. See also https://github.com/plk/biblatex/issues/1117.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
\parencite[vgl.][][254]{sigfridsson}[.]

\parencite[vgl.][]16{worman}

\autocite{geer}

\parencite[vgl.][][254]{sigfridsson}[.]

\printbibliography
\end{document}

now produces

Package biblatex Warning: The following entry could not be found
(biblatex)                in the database:
(biblatex)                1
(biblatex)                Please verify the spelling and rerun
(biblatex)                LaTeX afterwards.


Package biblatex Warning: The following entry could not be found
(biblatex)                in the database:
(biblatex)                [
(biblatex)                Please verify the spelling and rerun
(biblatex)                LaTeX afterwards.

)

LaTeX Warning: Citation '[' on page 1 undefined on input line 11.


LaTeX Warning: Citation '1' on page 1 undefined on input line 13.


LaTeX Warning: Citation '[' on page 1 undefined on input line 17.

Old answer

biblatex currently does not mention the line number for entries that could not be found if they are marked as missing by Biber. If you want to get the line number even in this cases, apply the following redefinition to \blx@citation@entry

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\makeatletter
\def\blx@citation@entry#1#2{%
  \blx@bibreq{#1}%
  \ifinlist{#1}\blx@cites
    {}
    {\listgadd{\blx@cites}{#1}}%
  \blx@auxwrite\@mainaux{}{\string\abx@aux@cite{#1}}%
  \ifinlistcs{#1}{blx@segm@\the\c@refsection @\the\c@refsegment}
    {}
    {\listcsgadd{blx@segm@\the\c@refsection @\the\c@refsegment}{#1}}%
  \blx@auxwrite\@mainaux{}{\string\abx@aux@segm{\the\c@refsection}%
                                               {\the\c@refsegment}%
                                               {\detokenize{#1}}}%
  \blx@ifdata{#1}
    {}
    {\ifcsdef{blx@miss@\the\c@refsection}
       {\ifinlistcs{#1}{blx@miss@\the\c@refsection}
          {\@latex@warning{#2{#1}}}
          {\blx@logreq@active{#2{#1}}}}
       {\blx@logreq@active{#2{#1}}}}%
  \blx@hook@entrykey{#1}}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
\parencite[vgl.][][254]{sigfridsson}[.]

\parencite[vgl.][]16{worman}

\autocite{geer}

\parencite[vgl.][][254]{sigfridsson}[.]

\printbibliography
\end{document}

Then the .log output has

Package biblatex Warning: The following entry could not be found
(biblatex)                in the database:
(biblatex)                1
(biblatex)                Please verify the spelling and rerun
(biblatex)                LaTeX afterwards.


Package biblatex Warning: The following entry could not be found
(biblatex)                in the database:
(biblatex)                [
(biblatex)                Please verify the spelling and rerun
(biblatex)                LaTeX afterwards.

)

LaTeX Warning: Citation '[' on page 1 undefined on input line 34.


LaTeX Warning: Citation '1' on page 1 undefined on input line 36.


LaTeX Warning: Citation '[' on page 1 undefined on input line 40.
1
1

I also had the idea of using binary search, only the other way around to Marijn's suggestion.

I put a non-existing marker citation in the middle of the document and moved that in decreasing log2 steps forward or backward depending on how the order of the biber warnings changed. That way I was able to pin down two paragraphs with the errors:

\parencite[vgl.][][254]{key1}[.]

and

\parencite[vgl.][]16{key2}

With balanced parens both hard to find with regexes if you don't want to reimplement the LaTeX syntax.

I still find it sad that there isn't a parameter/tool that helps you with this.

3
  • biber warned, yes. But only naming the culprit “1”, not where to find it.
    – primfaktor
    Mar 26, 2021 at 16:50
  • @DavidCarlisle you get this message only if no bbl-file exists. Mar 26, 2021 at 17:41
  • @UlrikeFischer yes I was trying to re-create the issue but I now see the log has been posted, I'll clean up comments here, should be able to get the line number from latex though I think, no? Mar 26, 2021 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .