0

I'm having a problem with bibliography updating which, so far as I can see, differs from previous questions on this site.

The problem is this. Suppose I cite two different works in a document, and compile the pdf. I end up with a bibliography containing the info pertaining to both works. So far so good. But if I then decide I don't want to cite one of the works and delete all the in-text citations to that work, the cited work still appears in the bibliography. In other words, my bibliography always updates when I add new citations, but never updates when I delete them. The only way I can get rid of unwanted bibliographic entries is by adding previously uncited works!

Here's a MWE:

\documentclass[12pt]{article}

\usepackage[margin=30mm]{geometry}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @book{Adams1998,
        address = {Stanford},
        author = {Adams, Ernest W.},
        file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Adams - 1998 - A Primer of Probability Logic.pdf:pdf},
        publisher = {CSLI Publications},
        title = {{A Primer of Probability Logic}},
        year = {1998}
    }

    @incollection{Cotnoir2018,
        address = {Cham},
        author = {Cotnoir, Aaron J.},
        booktitle = {Pluralisms in Truth and Logic},
        doi = {10.1007/978-3-319-98346-2_13},
        editor = {Wyatt, Jeremy and Pedersen, Nikolaj J. L. L. and Kellen, Nathan},
        file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Cotnoir - 2018 - Logical Nihilism.pdf:pdf},
        pages = {301--329},
        publisher = { Palgrave Macmillan},
        title = {{Logical Nihilism}},
        url = {https://doi.org/10.1007/978-3-319-98346-2{\_}13},
        year = {2018}
    }

    @article{Steinberger2019,
        author = {Steinberger, Florian},
        doi = {10.5840/jphil201911611},
        file = {:Users/James/Documents/St Andrews/Philosophy/MPhil/MPhil Thesis/Readings/Normativity/Three Ways Logic is Normative Steinberger.pdf:pdf},
        issn = {0022-362X},
        journal = {The Journal of Philosophy},
        month = {mar},
        number = {1},
        pages = {5--31},
        title = {{Three Ways in Which Logic Might Be Normative}},
        url = {http://www.pdcnet.org/oom/service?url{\_}ver=Z39.88-2004{\&}rft{\_}val{\_}fmt={\&}rft.imuse{\_}id=jphil{\_}2019{\_}0116{\_}0001{\_}0005{\_}0031{\&}svc{\_}id=info:www.pdcnet.org/collection},
        volume = {116},
        year = {2019}
    }
\end{filecontents}

\usepackage[style=apa, natbib=true, doi=false, url=false]{biblatex}
\addbibresource{/Users/James/Documents/MWEs/Bibliography Formatting.bib}
\AtEveryBibitem{\clearfield{number}}
\DeclareFieldFormat[article]{volume}{\apanum{#1}}
\setlength\bibitemsep{1.5\itemsep}



\title{Test Document}

\begin{document}


\maketitle

Suppose I cite \citet{Adams1998} and \citet{Steinberger2019}.


\printbibliography

\end{document}

This outputs:

enter image description here

But now if I delete one citation as follows:

\documentclass[12pt]{article}

\usepackage[margin=30mm]{geometry}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @book{Adams1998,
        address = {Stanford},
        author = {Adams, Ernest W.},
        file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Adams - 1998 - A Primer of Probability Logic.pdf:pdf},
        publisher = {CSLI Publications},
        title = {{A Primer of Probability Logic}},
        year = {1998}
    }

    @incollection{Cotnoir2018,
        address = {Cham},
        author = {Cotnoir, Aaron J.},
        booktitle = {Pluralisms in Truth and Logic},
        doi = {10.1007/978-3-319-98346-2_13},
        editor = {Wyatt, Jeremy and Pedersen, Nikolaj J. L. L. and Kellen, Nathan},
        file = {:Users/James/Library/Application Support/Mendeley Desktop/Downloaded/Cotnoir - 2018 - Logical Nihilism.pdf:pdf},
        pages = {301--329},
        publisher = { Palgrave Macmillan},
        title = {{Logical Nihilism}},
        url = {https://doi.org/10.1007/978-3-319-98346-2{\_}13},
        year = {2018}
    }

    @article{Steinberger2019,
        author = {Steinberger, Florian},
        doi = {10.5840/jphil201911611},
        file = {:Users/James/Documents/St Andrews/Philosophy/MPhil/MPhil Thesis/Readings/Normativity/Three Ways Logic is Normative Steinberger.pdf:pdf},
        issn = {0022-362X},
        journal = {The Journal of Philosophy},
        month = {mar},
        number = {1},
        pages = {5--31},
        title = {{Three Ways in Which Logic Might Be Normative}},
        url = {http://www.pdcnet.org/oom/service?url{\_}ver=Z39.88-2004{\&}rft{\_}val{\_}fmt={\&}rft.imuse{\_}id=jphil{\_}2019{\_}0116{\_}0001{\_}0005{\_}0031{\&}svc{\_}id=info:www.pdcnet.org/collection},
        volume = {116},
        year = {2019}
    }
\end{filecontents}

\usepackage[style=apa, natbib=true, doi=false, url=false]{biblatex}
\addbibresource{/Users/James/Documents/MWEs/Bibliography Formatting.bib}
\AtEveryBibitem{\clearfield{number}}
\DeclareFieldFormat[article]{volume}{\apanum{#1}}
\setlength\bibitemsep{1.5\itemsep}



\title{Test Document}

\begin{document}


\maketitle

Suppose I cite \citet{Adams1998}.


\printbibliography

\end{document}

This outputs:

enter image description here

But the Steinberger entry in the bibliography should have disappeared! If it's of any relevance, I'm using Biblatex and Biber. Thanks!

  • 1
    After deleting the citation commands, how did you compile the file? You will need to run pdflatex, biber and then pdflatex again before the bibliography is correct (replace pdflatex by whichever latex program is relevant for you). – Andrew Swann Feb 17 at 13:16
  • 1
    it is biber that generates the bibliography, so if you do not re-run biber the list will not change. – David Carlisle Feb 17 at 13:23
  • Hi both, I'm a complete amateur so I didn't know what it means to re-run biber. I found an answer here: tex.stackexchange.com/questions/154751/…. But I now have a follow-up question: is there a way to automate this so when I hit the `Build and View' command in TexStudio it automatically re-runs biber? The linked answer alludes to this, but doesn't say how to do it. Thanks! – James Skinner Feb 17 at 13:55
  • 2
    I know nothing about texstudio sorry but if you have a bibliography then you must have run biber at some point so you just need to do that again. Presumably it has an option to show you what command runs, or you can do what I would do simply change to that directory in a commandline shell and type biber yourdocumentname – David Carlisle Feb 17 at 15:26
1

This is sort of expected.

There are several steps involved in generating bibliographies and citations in LaTeX with .bib files and these involve running LaTeX (pdfLaTeX, LuaLaTeX, XeLaTeX, ...) and Biber (or BIbTeX). Question mark or bold citation key instead of citation number explains brilliantly what needs to happen and you should definitely read Paul Stanley's answer, but the upshot is that

  • LaTeX writes the requested citations to a temporary file (for Biber that is the .bcf file),
  • then Biber reads the .bcf file and then compiles the necessary information from the .bib files and writes the sorted data into the .bbl file,
  • finally LaTeX reads the bib data from the .bbl file and creates citations and the bibliography.

So the process involves (at least) running LaTeX, then Biber, then LaTeX again.

This procedure explains what you see. In your example you cite Adams1998 and Steinberger2019. On the first LaTeX run LaTeX writes to the .bcf file that you cited Adams1998 and Steinberger2019. Then you run Biber and Biber reads your .bib file and generates a .bbl file containing the data for Adams1998 and Steinberger2019. Finally you run LaTeX again : LaTeX reads the .bbl file, resolves the citations with that data and produces a bibliography.

If you now remove one of the citations so that only the citation to Adams1998 remains and you rerun only LaTeX, the .bbl file will still contain all the information from the previous run when you requested Adams1998 and Steinberger2019. In particular the data for Steinberger2019 is still present and will result in a bibliography entry.

In fact biblatex warns you about that. The .log file contains the lines

LaTeX Warning: There were undefined references.


Package biblatex Warning: Please (re)run Biber on the file:
(biblatex)                dropcitetest
(biblatex)                and rerun LaTeX afterwards.

If we were really picky we might point out that "There were undefined references" is not quite right, since all citations/references are defined. The issue is rather that we ended up with a situation where one citation too many is defined. But this is a standard message that is parsed by some editors and other tools, so it has its uses to trigger automated re-runs.

The message even tells you how to resolve the issue: Run Biber and then LaTeX again. This is enough because the LaTeX run will have written to the .bcf that you only want Adams1998. The subsequent Biber run will read only Adams1998 from the .bib and will write its data to the .bbl. Then the LaTeX run will read in the .bbl and will produce a bibliography without Steinberger2019.

Always read the .log output and if the .log suggests you take a certain action, it usually is a good idea to take that action.


In TeXstudio you can rerun Biber and LaTeX manually from the Tool menu.

Apparently TeXstudio's heuristic (which often runs LaTeX and Biber for you automatically) does not pick up that Biber should be re-run in this situation and only triggers the rerun if you add a previously uncited reference. This is something you can bring up with the TeXstudio developers: https://github.com/texstudio-org/texstudio/issues.

I find that the tool latexmk detects these things very reliably and gives very good results for documents using biblatex and Biber.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.