I have a, to me, confusing LaTeX error: The compiler says that my document is missing the \begin{document} instruction, but of course it is not missing at all. This is the error message:
No \begin{document} command was found. Make sure you have included \begin{document} in your preamble, and that your main document is set correctly. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.1 \begin{thebibliography}{} .You're in trouble here. Try typing to proceed. If that doesn't work, type X to quit.
The Overleaf-help states this can happen if you do not include the \documentclass[]{} instruction but i have included as well. This error started to appear after in put a new source in my bibliography, that is why i believe the bibliography is the real problem. I use Jabref for managing my bibliography and I manually include the information needed for the source in Jabref, I do not automatically import stuff. One source seems to cause problems as Jabref always tells me that the information was changed by a different programm and i should check if I want to save the changes (of course nothing changed).
Here is the preamble of my document:
\documentclass[a4paper,11pt]{article}
\usepackage[a4paper, left=4cm, right=3cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\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}
\bibliographystyle{apacite}
\bibliography{bachelor.bib}
\begin{document}
Note: the bibliography uses bibtex style. I do not know if that causes a problem with the APA style I am forced to use. I do not use any other .tex files, just the main document and the .bib file.
\printbibliographycommand at the end of the document, but before the\end{document}instruction. I use glossaries and as far as I know they the\makeglossariesinstruction need to be the last before\begin{document}.I did your solution and placed the
– Lilian Korba Jul 07 '22 at 20:45\bibliography{filename}rght after the\begin{document}instruction (with and without the extension), but unfortunately it did not solve the problem. Do you have any other ideas?\printbibliographyis from the packagebiblatex. You're not usingbiblatexas far as I can see, so\bibliographyhas to be inside thedocumentenvironment. – Torbjørn T. Jul 07 '22 at 20:49\bibliography, try recompiling from scratch. (click the arrow next to the compile button -> bottom of the drop down menu). You also need to cite something from the bibliography (with e.g.\cite{foo}) for the bibliography to appear, have you done that? – Torbjørn T. Jul 07 '22 at 20:52\usepacke{biblatex}into the preamble and moved the\bibliographystyle{apacite}and\bibliography{bachelor.bib}to the end of the document but before\appendix. I tried to recompile but Overleaf still cannot produce a PDF file. I watched an Overleaf tutorial and for the apacite package the instruction\printbibliographydoes not seem to be necessary.I found something interesting: apacite is not compatible with biblatex, according to the compiler. When i remove the
– Lilian Korba Jul 07 '22 at 21:13\usepackage{biblatex}instruction, the compiler marks a figure as error....\centering \includegraphics[width=0.5\linewidth]{duolingo_links.jpeg} \caption{Gebrauch von Gamification-Elementen bei DuoLingo (Teil 1) \cite{lingobild}} \label{fig:duolingo1} \end{figure}``` The line with the caption is considered faulty. The compiler says: >Illegal parameter number in definition of \reserved@. Argument of \caption@ydblarg has an extra }. Runaway argument?– Lilian Korba Jul 07 '22 at 21:16}of\caption{}. Back to the bibliography stuff, if you use biblatexthen you use\addbibresource{filename.bib}in the preamble and\printbibliographywhere you want to add the bibliography. If not (which is your case), you add\bibligraphystyle{foo} \bibliography{filename}where you want to add the bibliography, and do not include\printbibliography`. – Torbjørn T. Jul 07 '22 at 21:22\caption@ydblarg. I dont see a missing bracket in the caption line. – Lilian Korba Jul 07 '22 at 21:28\protect\cite...as in https://tex.stackexchange.com/a/227839/586 – Torbjørn T. Jul 07 '22 at 21:31\protect\cite{}helped solve it a bit. Now Overleaf says something else: now it says in that caption line:Argument of \@@cite has an extra }. Runaway argument?Overleaf says this for all citations now, also those which are not on figures. I dont know why he says @@ – Lilian Korba Jul 07 '22 at 21:47\@@citeis an "internal" macro that\citeuses. But I don't know what happens, I suggest you post a new question where you include a complete, minimal example that demonstrates the error. By "minimal and complete" I mean a complete document from\documentclassto\end{document}that reproduces the error, but one that includes only the necessary parts to do so (see https://tex.meta.stackexchange.com/a/4408/ for some more on such MWEs -- minimal working examples). – Torbjørn T. Jul 07 '22 at 22:04