2

This is a bit urgent. I'm getting an error on my file (it complies on Overleaf but not on pdflatex), and I cannot figure out how to fix this. I've checked the documentation, and a lot of other stack overflow questions, but I can't figure this out.

Any suggestions?

Full error:


! Package biblatex Error: Patching \addtocontents failed.

See the biblatex package documentation for explanation.
Type  H <return>  for immediate help.

I don't actually use addtocontents anywhere, and I'm getting this error at \begin(document).

\documentclass{IOS-Book-Article}
\usepackage[utf8]{inputenc}

\makeatletter
\let\c@author\relax
\makeatother

\usepackage{graphicx}
\graphicspath{ {./images/} }

\usepackage{mathptmx}
\usepackage{stmaryrd}
\usepackage{array}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{bbold}

\usepackage{multirow}

\usepackage[compact]{titlesec}
\usepackage[dvipsnames]{xcolor}

\usepackage[backend=biber, style=vancouver, doi=false, isbn=false, url=false]{biblatex}

\addbibresource{references2.bib}
\AtBeginBibliography{\footnotesize}

...


\printbibliography
\end{document}
5
  • 1
    No one will be able to help you unless you provide your source file that is causing the trouble. Try to reduce it to a minimal working example that you can post as part of the question. Oct 23 '20 at 11:17
  • And where exactly is that document class available?
    – daleif
    Oct 23 '20 at 11:41
  • The document class is available in an attached CLS file, which I cannot edit (it's provided by the publisher iospress.nl/service/authors/… )
    – D.Geek
    Oct 23 '20 at 11:43
  • Is this a problem with the CLS file, rather than my code? That's what I have been able to conclude, at least.
    – D.Geek
    Oct 23 '20 at 12:06
  • The example .tex file that comes in the .zip file you point to has its bibliography generated with manual thebibliography. thebibliography is completely incompatible with biblatex and I find no mention of biblatex anywhere in the documentation. The workflow of some (many/most) publishers is incompatible with biblatex. My usual advice is to avoid biblatex in submissions to publishers/journals unless they explicitly ask you to use it. (See also tex.stackexchange.com/q/12175/35864.)
    – moewe
    Oct 23 '20 at 14:23
1

For strange reasons, the class does

\long\def\addtocontents#1#2{}

which is pretty useless because it doesn't even define \tableofcontents and alike commands so it's not a problem having \addtocontents do something.

You can avoid the error by replacing \addtocontents with its kernel meaning and do what the class wants later on (even if useless).

I'd avoid calling titlesec because the submission might be rejected for not being compliant.

\let\latexaddtocontents\addtocontents
\documentclass{IOS-Book-Article}
\let\addtocontents\latexaddtocontents

\usepackage[utf8]{inputenc}

\makeatletter
\let\c@author\relax
\AtBeginDocument{\let\addtocontents\@gobbletwo\setcounter{author}{0}}
\makeatother

\usepackage{graphicx}
\graphicspath{ {./images/} }

%\usepackage{mathptmx}
\usepackage{stmaryrd}
\usepackage{array}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{bbold}

\usepackage{multirow}

%\usepackage[compact]{titlesec}
\usepackage[dvipsnames]{xcolor}

\usepackage[backend=biber, style=vancouver, doi=false, isbn=false, url=false]{biblatex}

\addbibresource{references2.bib}
\AtBeginBibliography{\footnotesize}

\begin{document}

abc

\end{document}

I also added \setcounter{author}{0} because the class defines the counter for the purpose of \maketitle, but then it is needed by biblatex and in the body the value should start at zero as biblatex expects.

6
  • That fixed it, thank you!
    – D.Geek
    Oct 23 '20 at 12:16
  • "I'd avoid calling titlesec because the submission might be rejected for not being compliant." How likely is that, do you think? Otherwise there's a half a page worth of content I need to extract from somewhere in my paper.
    – D.Geek
    Oct 23 '20 at 12:17
  • @D.Geek If I were the copy editor, I'd immediately strip off that line and, if the paper exceeds the page limit, at least send it back for editing.
    – egreg
    Oct 23 '20 at 12:19
  • Thanks, that saved me a lot of pain I imagine.
    – D.Geek
    Oct 23 '20 at 13:14
  • Additionally, would you happen to know why sometimes the compiler simply refuses to recognise the bib file and its codes?
    – D.Geek
    Oct 23 '20 at 13: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.