1

I'm using BibLaTeX (in TeXStudio) to generate a .bib file. Even when I explicitly run BibLaTex (Tools > Bibliography, in TeXStudio; Bibliography is set to BibLaTeX), my citations do not update unless I delete the .bib file, forcing it to create a new .bib file. Is there a way to avoid this?

The pertinent aspects of my code:

documentclass[]{article}
\usepackage[sorting=none, citestyle=numeric-comp]{biblatex}  
\begin{filecontents}{cites.bib}

%generic citation, as an example
@ARTICLE{NameYear,  
    author = {Name},
    title = {Sciencey Title Here},
    journal = {Science},
    year = {2016},
    volume = {1},
    pages = {1--5},
    number = {16},
    doi = {10.1002/xx.2012},
}
\end{filecontents}
\bibliography{cites}
\begin{document}
Example Text.\cite{NameYear}.

\section*{\centering{References}}
\printbibliography 
\end{document}

Thanks for your help!

Edit: Added to code to make compilable.

NMJD
  • 113
  • Can you please make your code compilable, e.g. add a documentclass and \begin and \end{document}? Do you get any warnings or error messages when compiling? – samcarter_is_at_topanswers.xyz Dec 19 '16 at 18:08
  • I tried with `\documentclass{article}

    \usepackage[sorting=none, citestyle=numeric-comp]{biblatex}
    \begin{filecontents}{cites.bib}

    %generic citation, as an example @ARTICLE{NameYear,
    author = {Name}, title = {Sciencey Title Here}, journal = {Science}, year = {2016}, volume = {1}, pages = {1--5}, number = {16}, doi = {10.1002/xx.2012}, } \end{filecontents}

    \bibliography{cites} \begin{document}

    Example Text.\cite{NameYear}.

    \section*{\centering{References}} \printbibliography \end{document}` and this works fine.

    – samcarter_is_at_topanswers.xyz Dec 19 '16 at 18:09
  • Welcome to TeX.SX! I assume by deleting the .bib file you mean deleting the .bbl file? Can you check what is executed when running BibLaTeX. biblatex is a package, to generate citations you should be using either biber (preferred) or bibtex with the backend=bibtex being passed to the biblatex package. – Dai Bowen Dec 19 '16 at 18:11
  • @samcarter This compiles fine for me, but if I compile, then add a reference, compile latex, compile bibliography, and compile latex, my new reference does not appear. – NMJD Dec 19 '16 at 18:18
  • @DaiBowen I meant the cites.bib file generated, but it's possible that deleting the .bbl would also work. I checked the log, which says: This is BibTex, Version 0.99d (TeX Live 2010) – NMJD Dec 19 '16 at 18:25
  • You are remembering to run pdflatex bibtex pdflatex pdflatex in order to make updated citations appear in the PDF as per Question mark or bold citation key instead of citation number – Dai Bowen Dec 19 '16 at 18:27
  • 1
    Are you using filecontents in your actual document? Without having \usepackage{filecontents}, existing files will not be overwritten. – Torbjørn T. Dec 19 '16 at 18:28
  • @DaiBowen In TeXstudio, I was running: Build & View, Bibliography, Build & View, Build & View

    @TorbjørnT. I did not have \usepackage{filecontents} in my actual document! I've added it now, and this fixed the problem. Thank you!

    – NMJD Dec 19 '16 at 18:33

1 Answers1

3

It is probably not normal to use the filecontents environment to generate the .bib file, but if you want to have everything contained in one file, it is fine.

However, in the default implementation of the environment there is one important caveat: If the file already exists, nothing happens. In other words, the file will not be updated.

Getting around that is easy though: Add \usepackage{filecontents} before your filecontents environment, this packages redefines the environment so that files are updated.

Torbjørn T.
  • 206,688