jabref - Changing from natbib to BibLaTex bibliography result in major errors - TeX

I am using Overleaf to write my master thesis. I have used natbib package (works fine) but I want to change to biblatex to be able to use different styles. I am using JabRef as a bibliography manager, by uploading my bibliography as a bib file on Overleaf. As I mentioned, this works fine when using natbib, but when I changed the commands to biblatex and compile I sometimes get error messages saying "undefined on input line 3" and the citations marked as just bold citekeys in the document, and sometimes i get a fatal error and no pdf produced with lots of errors:

Compile Error. Sorry, your LaTeX code couldn't compile for some reason. Please check the errors below for details, or view the raw log.

*Runaway argument? {Inheritance is involved in up to one third of colon cancer cases. Hi\ETC. ! File ended while scanning use of \field. \par

l.70 \begin{document} I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better typeE' or `X' now and fix your file.

acknowledgements/acknowledgements.tex, line 9 Illegal parameter number in definition of \NewCount.

               *1 l.9 \begin{itemize}
                You meant to type ## instead of #, right? Or maybe a } was forgotten somewhere earlier, and things are all screwed up?

I'm going to assume that you meant ##.**

++++ the errors go on and on.

This is the my code in the main document:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage[english]{babel}
\DeclareUnicodeCharacter{2212}{-}
\usepackage{csquotes}
\usepackage{newcent}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{xcolor}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{multirow}
\usepackage{multicol}
%AKRONYM
\usepackage{acronym}
%NOMENKLATUR
\usepackage{nomencl}
\renewcommand{\nomname}{\LARGE{Nomenclature}}
\makenomenclature
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage[export]{adjustbox}
\usepackage{wrapfig}
\usepackage{subfiles}
\usepackage{setspace}
\usepackage{tocloft}
\setlength\cftparskip{0pt}
\setlength{\cftbeforesecskip}{1pt}
\setlength{\cftbeforechapskip}{6pt}
\usepackage{titlesec}
\titlespacing{\subsubsection}{0pt}{\parskip}{-\parskip}
%\setcounter{secnumdepth}{3}
%\titlespacing*{\section}
%{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
%\titlespacing*{\subsection}
%{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}

%BIBLIOGRAFI
%NATBIB
%\usepackage[square,numbers,round,sort&compress]{natbib}
%BIBLATEX
\usepackage[backend=biber,citestyle=nature, sorting=none, natbib=true]{biblatex}
\include{thesis.preamble}
\addbibresource{bibliografimaster.bib}
\begin{document}
\title{\LARGE {\bf } Haplotype analysis \\
 \vspace*{6mm}
}
\maketitle
\preface
\body
\part{Part 1}
\part{Part 2}
\input{Method/Method}
\input{Results/Results.tex}
\addcontentsline{toc}{chapter}{Bibliography}
%NATBIB
%\bibliographystyle{unsrt} 
%\bibliography{bibliografimaster.bib}
%BIBLATEX
\printbibliography
\newpage
\addcontentsline{toc}{chapter}{Appendix}
{\Huge\textbf{Appendix}} 
\appendix
% appendices come here
\input{Appendix/appendix.tex}
\end{document}

I have included the code i use both for natbib citation style and for biblatex (with percent in front of natbib so its not used). I have also removed all the natbib commands to see if this makes any change, but it doesn't. The natbib commands I use works fine, so I just wanted to include them to show what I have done and that these arguments works.

I have probably included lots of irrelevant commands in my working example, but I wonder if any of the arguments I have used can explain why natbib seems to work and not biblatex?

I have made a working example using the same bib file using biblatex (the same commands i used in my master project above), and this works fine.

\documentclass{article}
\usepackage[utf8]{inputenc}
\title{TesterReferanser}
\author{SS}
\date{January 2019}
\usepackage[backend=biber,citestyle=nature, sorting=none, natbib=true]{biblatex}
\addbibresource{bibliografimaster.bib}
\begin{document}
\maketitle
\section{Introduction}
må teste referanser \cite{RN272}.
\printbibliography
\end{document}

Result in nice citations and bibliography!!

Therefore, i believe that some other commands i have used in the preamble is the reason for the error message.

I would be so grateful is someone can help me with this. What am i missing??

1 Answer

  1. Jackson- Reply

    2019-11-14

    The reported error

    Runaway argument?
    {Inheritance is involved in up to one third of colon cancer cases. Hi\ETC.
    ! File ended while scanning use of \field.
    <inserted text> 
                    \par 
    l.36 \begin{document}
    

    is usually thrown when a non-verbatim field in your .bib file contains an unescaped % character. The exact location of the error is in the .bbl file, which contains something along the lines of

      \field{abstract}{Lorem ipsum % dolor}
    

    the error occurs at the beginning of the document, when the .bbl file is read.

    Since % is a comment character in TeX, TeX will ignore everything after the % and in particular will not see the closing curly brace. That missing brace then causes the error. The error is even thrown if you don't want to print that particular field. The mere fact that it is a field known to biblatex's data model is enough.

    BibTeX-based bibliography solutions like natbib have less issues with unescaped %s in fields. If the field is not printed, an unescaped special character is no problem whatsoever, because it is never written to a file that is read by TeX. If the field is printed, the output will very probably be wrong and there might be errors, but that is not a sure thing.

    A short Google search of the text in the error message leads us to https://doi.org/10.1016/j.ddmec.2008.05.004 and indeed the abstract there reads

    Inheritance is involved in up to one-third of colon cancer cases. Highly penetrant inherited syndromes account for approximately 3%, while more common, but less penetrant inherited factors play a role in the remainder. Approaches to recognizing each of these categories and syndromes, using genetic testing for diagnosis where indicated, and accomplishing proper cancer screening and surveillance will be outlined in this review.

    and contains a %character. Even worse the .bib file exported by Elsevier looks as follows

    @article{BURT2007293,
    title = "Inheritance of colorectal cancer",
    journal = "Drug Discovery Today: Disease Mechanisms",
    volume = "4",
    number = "4",
    pages = "293 - 300",
    year = "2007",
    issn = "1740-6765",
    doi = "https://doi.org/10.1016/j.ddmec.2008.05.004",
    url = "http://www.sciencedirect.com/science/article/pii/S1740676508000369",
    author = "Randall Burt",
    abstract = "Inheritance is involved in up to one-third of colon cancer cases. Highly penetrant inherited syndromes account for approximately 3%, while more common, but less penetrant inherited factors play a role in the remainder. Approaches to recognizing each of these categories and syndromes, using genetic testing for diagnosis where indicated, and accomplishing proper cancer screening and surveillance will be outlined in this review."
    }
    

    The % in 3% is not escaped. That is an error!

    A correct entry would look like

    \documentclass[british]{article}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{babel}
    \usepackage{csquotes}
    
    \usepackage[style=authoryear, backend=biber]{biblatex}
    
    
    \usepackage{filecontents}
    \begin{filecontents}{\jobname.bib}
    @article{burt,
      author   = {Randall Burt},
      title    = {Inheritance of colorectal cancer},
      journal  = {Drug Discovery Today: Disease Mechanisms},
      volume   = {4},
      number   = {4},
      pages    = {293-300},
      doi      = {10.1016/j.ddmec.2008.05.004},
      date     = {2007-12},
      abstract = {Inheritance is involved in up to one third of colon cancer
                  cases. Highly penetrant inherited syndromes account for
                  approximately 3\%, while more common, but less penetrant
                  inherited factors play a role in the remainder.
                  Approaches to recognizing each of these categories and
                  syndromes, using genetic testing for diagnosis where
                  indicated, and accomplishing proper cancer screening and
                  surveillance will be outlined in this review.},
    }
    \end{filecontents}
    
    \addbibresource{\jobname.bib}
    \addbibresource{biblatex-examples.bib}
    
    
    \begin{document}
    \cite{sigfridsson,burt}
    \printbibliography
    \end{document}
    

    In general I recommend not to export the abstract field to the .bib file. It does more harm than good and is almost never printed, so all it does is bloat the .bib and .bbl files.

    To remove a field in JabRef go to "Edit > Set/clear/rename fields". Under "Field name" insert abstract, then choose whether you want to remove the field for all entries or only selected entries and finally choose "Clear fields" in the last section.

    Screenshot of JabRef's "Set/clear/rename fields" dialogue, all selections as described above

    If you then click "OK", all abstract fields will be cleared. You can then save the changes.

    See also http://help.jabref.org/en/SetClearRenameFields

    If you don't want to fix all wrong abstract fields manually and can't or don't want to turn off exporting the field in JabRef, Prevent biber from choking on "%" characters in abstract? describes how to get rid of the field on the fly before it can do any damage.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>