I am putting together a MWE for a question about biblatex, and while doing so, I'm at a loss to understand why this simple MWE fails. When running biber, I get the message WARN - I didn't find a database entry for 'smith1983' (section 0). I am running biber v.2.17 in texlive 2022.
\documentclass{article}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{smith1983,
AUTHOR = "Harry Smith",
TITLE = "My second book",
YEAR = "1983"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{smith1983}
\printbibliography
\end{document}
filecontentsnowadays no longer overwrites by default (your example does give a warning of obsolete package), so you are left with the old\jobname.bib. If the crystal ball is correct, try\begin{filecontents}[overwrite]{\jobname.bib}(and let go of thefilecontentspackage as it doesn't serve you much anyway). – gusbrs Jun 02 '22 at 12:57filecontentsis disabled during compiling, so it rather generates a.bibfile with the same filename as my.texfile. The problem is that if I append anything to the\jobname.bibin my preamble, this is not appended to the.bibfile. So I need to delete the generated.bibfile every time I change anything in\jobname.bib. Btw, what should we now use instead offilecontentswhen creating MWEs for bibliography questions? – Sverre Jun 02 '22 at 13:04[overwrite]argument, as I've said, so you don't need to manually delete anything. – gusbrs Jun 02 '22 at 13:12jobname.bibfile, it just overwrites thefilename.bibfile (which is generated with the same filename as the.texfile). So what is then the purpose of having the\begin{filecontents}{\jobname.bib}and\addbibresource{\jobname.bib}lines? – Sverre Jun 02 '22 at 13:20filecontentsworks as described for me here. – gusbrs Jun 02 '22 at 13:22\begin{filecontents}{\jobname.bib}doesn't write a filejobname.bib. – Sverre Jun 02 '22 at 13:40\jobnameis a macro which stores the name of the file being processed... If you really want a filejobname.bib, you should write\begin{filecontents}[overwrite]{jobname.bib}, but you can use any name there. – gusbrs Jun 02 '22 at 13:50jobname.bibin my directory, so I assumed the packagefilecontentshad created it from{\jobname.bib}. But maybe I just once forgot to add the slash. – Sverre Jun 02 '22 at 13:56