4

I'm experimenting problems with citations in short captions. If I run the following MWE, three citations are found as expected, but if I add some text (any text) in the document by enabling the commented \lipsum, no citation is found, the bibliography is empty and the argument of \fullcite is displayed in the list of figures as text.

\documentclass{book}

\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[backend=biber,style=numeric]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{cosimo, author = "D'Angela, Cosimo", title = "La Cripta della Cattedrale di Taranto", publisher = "Scorpione editrice", year = 1986}
@book{farella, author = "Farella, Vittorio", title = "La citta' vecchia di Taranto", publisher = "Samarcanda edizioni", year = 1988}
@book{polibio, author = "Polibio", title = "Storie", volume = "Libro III", publisher = "Edizioni Rizzoli", year = 1961}
@book{porsia, author = "Porsia, Franco and Scionti, Mauro", title = "Le citta' nella storia d'Italia: Taranto", publisher = "Laterza edizioni", year = 1989}
\end{filecontents}

\begin{document}

\mainmatter

%\lipsum
\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{porsia}]{Long caption.}
  \label{fig:1}
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{farella}]{Long caption.}
  \label{fig:2}
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{cosimo}]{Long caption.}
  \label{fig:3}
\end{figure}

\backmatter
\listoffigures
\printbibliography

\end{document}

Is there something I'm doing wrong?

  • 3
    Puzzling, indeed! – Gonzalo Medina Sep 28 '15 at 16:23
  • If you are interested to create an even more weird phenomenon, try writing only the word lorem where you now have the \lipsum command. In my tests the first two citations worked, but the third failed. This was because the citations to the first two items were written into the .aux file before switching citerequest to false in LoFs, while the third is written after that. – moewe Sep 28 '15 at 17:12
4

This does look a bit mysterious indeed. And it makes me think that the citerequest boolean does a bit more than advertised. According to §4.11.5 Trackers in Floats and TOC/LOT/LOF, p. 239, of the biblatex documentation

If a citation is given in a float (typically in the caption of a figure or table), scholarly back references like ‘ibidem’ or back references based on the page tracker get ambiguous because floats are objects which are (physically and logically) placed outside the flow of text, hence the logic of such references applies poorly to them. To avoid any such ambiguities, the citation and page trackers are temporarily disabled in all floats. In addition to that, these trackers plus the back reference tracker (backref) are temporarily disabled in the table of contents, the list of figures, and the list of tables.

In reality, this boolean seems to be able to disable entire cite commands because it influences the definition of \blx@citation.

Toggling citerequest back to true in the toc/lof seems to resolve our problem.

\documentclass{book}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage[backend=biber,style=numeric]{biblatex}


\makeatletter
\AtEndPreamble{%
  \addtocontents{toc}{%
     \booltrue{citerequest}%
     \boolfalse{citetracker}%
     \boolfalse{pagetracker}%
     \boolfalse{backtracker}\relax}%
  \addtocontents{lof}{%
     \booltrue{citerequest}%
     \boolfalse{citetracker}%
     \boolfalse{pagetracker}%
     \boolfalse{backtracker}\relax}%
  \addtocontents{lot}{%
     \booltrue{citerequest}%
     \boolfalse{citetracker}%
     \boolfalse{pagetracker}%
     \boolfalse{backtracker}\relax}%
  \patchcmd\addtocontents
    {\string\@writefile}
    {\string\@writefile{##1}{\defcounter{refsection}{\the\c@refsection}\relax}%
     \string\@writefile}
    {}
    {\blx@err@patch{\string\addtocontents}}}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{cosimo, author = "D'Angela, Cosimo", title = "La Cripta della Cattedrale di Taranto", publisher = "Scorpione editrice", year = 1986}
@book{farella, author = "Farella, Vittorio", title = "La citta' vecchia di Taranto", publisher = "Samarcanda edizioni", year = 1988}
@book{polibio, author = "Polibio", title = "Storie", volume = "Libro III", publisher = "Edizioni Rizzoli", year = 1961}
@book{porsia, author = "Porsia, Franco and Scionti, Mauro", title = "Le citta' nella storia d'Italia: Taranto", publisher = "Laterza edizioni", year = 1989}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}

\mainmatter

\lipsum
\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{porsia}]{Long caption.}
  \label{fig:1}
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{farella}]{Long caption.}
  \label{fig:2}
\end{figure}

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{whatever}
  \caption[Short caption citing \fullcite{cosimo}]{Long caption.}
  \label{fig:3}
\end{figure}

\backmatter
\listoffigures
\printbibliography

\end{document}

A shorter, potentially - but not actually - more dangerous solution would be to just have

\makeatletter
\def\blx@citation#1#2{\blx@citation@entry{#1}{#2}}
\makeatother

That is, removing the if construct involving citerequest.

  • I applied your first patch to the complex document I was compiling and it worked, thanks. – mmj Sep 28 '15 at 22:17

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.