0

I have a bigger template which includes biblatex

\RequirePackage[backend=biber,
        style=ieee,
        citestyle=numeric-comp,
        sortcites,
        url=true,
        doi=false,
        defernumbers
        ]{biblatex}[2012/08/17]

I use TeXstudio where I set the Default Bibliography Tool to biber. Furthermore, I add the bibliography file via the command \addbibresource{bibliography.bib}. The bib-file is in the same folder as the tex-file. Sadly, the bibliography isn't recognised. I get a warning No file main.bbl. but that's it. I also can't see, that a biber and BibLaTex runs at all.

When I add the bibliography via \bibliography{bibliography} everything works fine. Do you have any hints for me what I'm doing wrong?

Content of the bibliography.bib file (just one dummy entry):

@article{dummy1,
    title = {dummytitle},
    pages = {},
    author = {Doe, John},
    langid = {english},
}
13
  • I suppose the correct command for your setup would be \printbibliography instead of \bibliography{bibliography} Feb 13, 2021 at 14:02
  • No, that's something totally different. \printbibliography just prints the bibliography. I'm struggling with importing the bib data as is (hence, the .bib file).
    – Steradiant
    Feb 13, 2021 at 14:06
  • 1
    show the log-file and the blg-file (if there is one). Feb 13, 2021 at 14:19
  • 1
    Basically \bibliography and \addbibresource are defined using the same underlying helper macros, so I would be very surprised if one worked and the other didn't on the LaTeX side. I can, however, imagine your editor only being able to deal with one of the two when it comes to say, .bib file detection, auto-completion and auto-Biber/BibTeX-run features. But you would have to share with us exactly what you tried, what happened and how it did not work for you. (How exactly do you compile your document? What do your editor's compile settings look like?)
    – moewe
    Feb 13, 2021 at 14:33
  • 1
    With the option defernumbers active it is expected that you need at least two LaTeX runs after the Biber run for the numbers to appear properly. Usually this shouldn't be much of an issue since you probably don't change your citations/bibliography in every run and the temporary files stick around with the relevant details. Whether or not Biber is run automatically and auto-completion of \cite and friends are features of your editor, not LaTeX. Especially if your biblatex declarations are hidden in separate files your editor might not be able to pick them up properly.
    – moewe
    Feb 13, 2021 at 16:09

1 Answer 1

1

On the LaTeX (or rather biblatex) side \addbibresource{<filename>.bib} and \bibliography{<filename>} do very similar things and are implemented in terms of the same auxiliary macros, so there should be no difference whether you use

\addbibresource{<filename>.bib}

or

\bibliography{<filename>}

The former is preferred over the latter, since it allows for additional options and \bibliography is only a legacy interface to support more BibTeX-like code.


The behaviour discussed in the comments is not due to LaTeX, it is purely related to features of your editor (auto-completion of entry keys in \cite commands, auto-running of Biber etc.). Editors usually have their own methods to understand TeX files, but usually this involves parsing the .tex input; it does not involve actually running TeX to see what happens.

Here it may indeed be the case that \bibliography works better than \addbibresource. Since \bibliography is a command defined by the LaTeX kernel, most editors will probably always try to pick it up. It is reasonable to only pick up a command like \addbibresource when the editor 'detects' that biblatex is being used. And that's where things can go wrong. If your editor fails to pick up that you are using biblatex it may not treat \addbibresource as expected. Of course if your editor has no support for biblatex at all, all bets are off.

Depending on your exact document structure, you might be able to help your editor to understand that you load biblatex by removing some line breaks in the biblatex calls (see e.g. https://tex.stackexchange.com/a/106755/35864). But if you load biblatex in a file that is later \input to your preamble or loaded with \usepackage, your editor's file parsing may simply not be able to detect biblatex (see e.g. https://tex.stackexchange.com/a/317858/35864). In that case some editors have a feature to manually declare that you use biblatex (e.g. TeXstudio lets you select .cwl files: https://tex.stackexchange.com/a/262629/35864).

You must log in to answer this question.

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