1

To submit my paper, I need to use the Springer document class (link below). It turns out that it creates a conflict between Tikz and '\tableofcontents' which causes the compiler to not create a bibliography (go figure). If I remove either the Tikz declarations, and/or the table of contents command, the bibliography runs just dandy. I spent a while trying to understand where the conflict lies, but it is beyond me.

I stripped my file to the bare minimum, and added a sample bib file. Unfortunately, the class files are too long to post here directly, but here is the link from Springer's webpage (only the svjour3.cls and svglov3.clo files are needed).

main.tex:

\documentclass[smallextended]{svjour3}
%%% Springer class for Math Z

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{positioning,arrows,calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[backend=biber]{biblatex}
\addbibresource{bibliography.bib}

\begin{document}
\title{Bibliography trouble}
\author{GI Joe}

\maketitle

%%%%%%%%%%%%%%%%
\tableofcontents{}
%%%%%%%%%%%%%%%%

\section{One section is enough for trouble}

{\large
The Springer document class creates a clash between Tikz and Table of Contents. \\

No bibliography entry is created for~\cite{A} or~\cite{B}. But if you comment the tikz package declarations (lines 5--7), {\bf OR} if you comment the table of contents command (line 20), the bibliography runs just fine.} \\

\begin{center}{\Large WHY!?}\end{center}

\nocite{*}
\printbibliography

\end{document}

bibliography.bib:

@article {A,
AUTHOR = {Arthur Ashe},
TITLE = {An able acorn},
JOURNAL = {Antarctica J.},
VOLUME = {1},
YEAR = {1901},
NUMBER = {1},
PAGES = {1--2}
}


@incollection {B,
AUTHOR = "Barry Bonds",
TITLE = "Bibliography blunders",
BOOKTITLE = "Bibliography Book",
PAGES = "1--100",
PUBLISHER = "Basic Books",
YEAR = "1901"
}
1
  • Add \addtocontents{toc}{\endgroup} before \end{document}. This is only a work-around, I need to think about it. May 15, 2021 at 20:54

2 Answers 2

2

The problem is that the class tries to write at end document to the toc an \endgroup:

 \AtEndDocument{\addtocontents{toc}{\endgroup}}%

but tikz issues a \clearpage first, and then the write is never executed.

As a work around you can add this to the preamble.

\makeatletter
\providecommand*\protected@iwrite[3]{%
  \begingroup
  \let\thepage\relax
  #2%
  \let\protect\@unexpandable@protect
  \edef\reserved@a{\immediate\write#1{#3}}\reserved@a
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi
}
\AtEndDocument{\let\protected@write\protected@iwrite}

\makeatother

\begin{document}

An alternative with a current latex is to redefine \tableofcontents to use another hook:

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\contentsname}%
    \@starttoc{toc}%
    \addtocontents{toc}{\begingroup\protect\small}%
    \AddToHook{shipout/lastpage}{\addtocontents{toc}{\endgroup}}%
    }

\makeatother
1

The problem seems to be the use of \AtEndDocumet in the svjour3.cls. This code is used for set to small the font size of the contents. A possible workaround is just comment the are problematic lines in svjour3.cls,

1152c1152
<     %\section*{\contentsname}%
---
>     \section*{\contentsname}%
1154,1155c1154,1155
<     %\addtocontents{toc}{\begingroup\protect\small}%
<     %\AtEndDocument{\addtocontents{toc}{\endgroup}}%
---
>     \addtocontents{toc}{\begingroup\protect\small}%
>     \AtEndDocument{\addtocontents{toc}{\endgroup}}%

and set the font size of contents in the main document:

%%%%%%%%%%%%%%%%
\section*{\contentsname}%
{\small
\tableofcontents{}
}
%%%%%%%%%%%%%%%%

Original,

enter image description here

and with the workaround

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .