1

I have a problem with my document. When I compile the PDF Overleaf says that every citation in my document has the following error:

Argument of @@cite has an extra }. Runaway argument?

Sometimes Overleaf also says

Undefined control sequence.

The citations do work but in the PDF document they destroy the captions of the figures and the list of figures - in the list of figures the caption is not displayed but the page and some random number. The citations are made by Jabref. They are not manually created.

\documentclass[a4paper,11pt]{article}
\usepackage[a4paper, left=4cm, right=3cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}  
% \usepackage{biblatex}
\usepackage{lmodern}    
\usepackage{apacite}
\usepackage{titlesec}
\usepackage{dirtytalk}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{threeparttable}
\usepackage{csquotes}
\usepackage[ngerman]{babel}
\linespread{1.5} % Zeilenabstand
\usepackage{tabularx}   
\usepackage{tabulary}
\usepackage{array}
\usepackage{acronym}
\usepackage[extendedfeature=title]{scrextend}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{subcaption} 
\usepackage{inputenc}
\usepackage{amsmath}
\usepackage{listings} 
\usepackage{placeins}
\usepackage{glossaries}
\usepackage{xcolor}
\usepackage{url}
\lstset{language=c++,
    frame=top, frame=bottom,
    basicstyle=\ttfamily\footnotesize,
    tabsize = 4,
    showstringspaces = false,
    keywordstyle =\color{dkblue},
    stringstyle = \color{red},
    commentstyle = \color{dkgreen}
}
\usepackage[colorlinks,
pdfpagelabels,
pdfstartview = FitH,
bookmarksopen = true,
bookmarksnumbered = true,
linkcolor = darkgray,
urlcolor = blue,
plainpages = false,
hypertexnames = false,
citecolor = blue] {hyperref}

\begin{document} \section{example} .....some example text\cite{deterding}.

\bibliographystyle{apacite}
\bibliography{bachelor.bib}

\appendix \end{document}

And here is the entry in the bib-file:

@Article{deterding,
  author = {Sebastian Deterding, Dan Dixon},
  title  = {{From Game Design Elements to Gamefulness: Defining Gamification}},
  year   = {2011},
}

I hope the example is somewhat helpful. Does anyone know what causes this internal error?

  • This is not related to Overleaf, apacite should be loaded after hyperref : https://tex.stackexchange.com/a/180623/21344 – Paul Gessler Jul 07 '22 at 23:40
  • 1
    apacite is one of the few weird packages that must be loaded after hyperref. If you move \usepackage{apacite} to after \usepackage....{hyperref} your test document builds fine. – Willie Wong Jul 07 '22 at 23:42
  • 1
    Actually, comparing in more detail your preamble with the list provided in the question @PaulGessler linked to, you are loading quite a few packages that can benefit from being loaded after hyperref. These include also tabularx, url, and glossaries. – Willie Wong Jul 08 '22 at 00:21

0 Answers0