4

I am using biblatex author year style and in my text I have an @ which biber does not like giving me error as below:

ERROR - BibTeX subsystem: C:\Users\TEMPLE~1.000\AppData\Local
\Temp\biber_tmp_kM22\658097ff4c951e70db95e86474283432_17340.utf8, line 25, 
syntax error: found "using", expected one of: start of entry ("{" or "(") or 
quoted string ({...} or "...")

Below is the code. To run: step1: pdflatex step 2: biber step3: pdflatex.

If you delete the symbole @ in the text the code works fine and we see the bibliography at the end.

\documentclass{book}
 % to run: step1: pdflatex step 2: biber step3: pdflatex
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{mybook,
author       = { my author},
date         = { 2020},
title        = {my title},
publisher    = {city:press},
}
\end{filecontents}
\addbibresource{\jobname}
\begin{document}
I can not print  @ when using biblatex.(\textcite{mybook})
\printbibliography
\end{document}
5
  • \@ wont work either with biber – Aria Dec 16 '20 at 5:21
  • 1
    That is kind of a weird error. Try \addbibresource{\jobname.bib} – David Purton Dec 16 '20 at 5:26
  • 2
    Ooooh. I see. without the extension it picks up \jobname.tex and tries to use that as a data source. \jobname.tex is obviously not a valid bib file, so biber errors. – David Purton Dec 16 '20 at 5:29
  • 1
    Thank you @DavidPurton You solved the problem. – Aria Dec 16 '20 at 5:29
  • @DavidPurton If you like you can write the solution below then I accept it. – Aria Dec 16 '20 at 5:46
7

\addbibresource requires a full file name, so you should use \addbibresource{\jobname.bib}.

Without this biber picks up \jobname.tex and tries to use this as a bib file. Obviously, this isn't a valid bib file, so biber generates an error. In particular, biber doesn't like the @ because that character is meant to mark the start of a bib record.

I have a feeling that biblatex used to allow \addbibresource{\jobname} but the documentation always specified the extension to be provided, so maybe a recent code clean up tightened the requirements.

1
  • 3
    I think \addbibresource has always needed the .bib file extension. It was added in version 1.2 back in 2011 and the documentation explicitly mentions having to include the extension as you say. I saw \addbibresource{\jobname} as a trick to avoid the .bib file (so that Biber reads the .tex file and ignores everything but the bib entries as junk) in the biblatex-nejm documentation and apparently it has used that since 2011, so I'd guess there was no change here. – moewe Dec 16 '20 at 7:15

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.