Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What exactly does \addbibresource do that \bibliography does not? I am aware of the advantages mentioned here which concern, for example, the use of an optional argument and the possibility of specifying remote resources. However, nothing I've come across to date really explains the following.

The manual for biblatex explains a useful-sounding feature for users who want to change their citation keys without breaking existing documents:

ids field (comma-separated list of entrykeys)

Citation key aliases for the main citation key. An entry may be cited by any of its aliases and biblatex will treat the citation as if it had used the primary citation key. This is to aid users who change their citation keys but have legacy documents which use older keys for the same entry. This field is consumed by the backend processing and does not appear in the .bbl.

I took this to mean that adding an ids field containing the old key to a renamed entry in my .bib file would enable me to cite the entry with either the old key or the new one.

However, I could not get this to work. Here is a minimal example showing the problem.

\documentclass{article}

\usepackage{filecontents}
\usepackage[backend=biber]{biblatex}
  \bibliography{my}

\begin{filecontents}{my.bib}
    @article{somebody-sgt,
      ids       =   {someone-sgt},
      author    =   {Somebody, Someone},
      title     =   {Some Great Title},
      journal   =   {Best Journal},
      year      =   3019,
      pages     =   {32--39},
      volume    =   3,
      number    =   4}
\end{filecontents}

\begin{document}

Here is some text with a citation \autocite{somebody-sgt}. Here is some more text using the old key \autocite{someone-sgt}.

\printbibliography

\end{document}

When I run this through pdflatex, biber, pdflatex, pdflatex, I get the following error message in the output:

LaTeX Warning: There were undefined references.

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

Rerunning the compilation sequence makes no difference to either error or output:

wrongful output

I periodically returned to this problem but I just could not figure out any way to make it work. Nor could I figure out any plausible reading of the manual which would suggest the feature was designed to do something completely different.

This has bugged me for a long time. So much so that I decided to ask this question. However, it turns out that unlike my initial code, the following code works as I'd expected:

\documentclass{article}

\usepackage{filecontents}
\usepackage[backend=biber]{biblatex}
  \addbibresource{my.bib}

\begin{filecontents}{my.bib}
    @article{somebody-sgt,
      ids       =   {someone-sgt},
      author    =   {Somebody, Someone},
      title     =   {Some Great Title},
      journal   =   {Best Journal},
      year      =   3019,
      pages     =   {32--39},
      volume    =   3,
      number    =   4}
\end{filecontents}

\begin{document}

Here is some text with a citation \autocite{somebody-sgt}. Here is some more text using the old key \autocite{someone-sgt}.

\printbibliography

\end{document}

which produces:

rightful output

So now I'm curious. The documentation mentions no specific requirements for using ids that I can find excepting the requirement to use biber. However, it seems to require \addbibresource. But, in that case, more is going on than is indicated in the answer to the question I referenced above. This is not a remote database, no optional argument is required. Really, the set up could not be much simpler.

I am also hoping that I may learn why \addbibresource has to be so much more annoying to use than bibliography! This is basically why I have continued to use the latter - everything I'd read suggested the advantages of the former were not ones I currently had any use for, so the ease of using the latter trumped. I have a complex set up which involves loading quite a number of .bib files. This means that specifying them one at a time would be quite a pain. (I've not yet decided if it is worth the benefit of getting the ids feature to work.)

share|improve this question

closed as off-topic by moewe, Peter Jansson, Jesse, Svend Tveskæg, Claudio Fiandrino Feb 14 at 10:12

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
I think we'll need to see some logs here. For me, both of you examples give the same result, with both references correct but that (misleading) log warning, provided I start with a clean directory when changing from one to the other. What I do find is that running pdflatex, biber, pdflatex (all 'good'), biber, pdflatex does give one undefined citation, i.e. things are not 'stable' irrespective of the choice of \bibliography/\addbibresource. That pattern repeats: I suspect a bug. –  Joseph Wright Feb 2 at 7:56
2  
Also, if you look at the code then \bibliography is just a wrapper around the same internals as \addbibresource, and there is no reason to expect differences in fundamental behaviour. –  Joseph Wright Feb 2 at 7:58
    
There seems to be a bug with these key aliases, as they do not appear to stabilise. I found this behaviour with \bibliography as well as \addbibresource (as Joseph Wright says: internally, \bibliography is really just a trimmed-down version of \addbibresource). –  moewe Feb 2 at 13:07
1  
This is a bug. I'm looking into it. –  PLK Feb 2 at 16:31
5  
This question appears to be off-topic because it is about a bug in the software (biblatex/biber), that was fixed by the developers, see github.com/plk/biblatex/issues/201. –  moewe Feb 14 at 9:01

Browse other questions tagged or ask your own question.