At my work place we have an official LaTeX document class that we are supposed to use. I am writing a report using this class and biblatex for my references. It works great, except for one quirk: in the list of figures, citations appearing within captions are replaced by the label of the corresponding bibtex entry. To illustrate, consider the following MWE, with the class file stripped down to the very bare minimum:
\begin{filecontents*}{\jobname.bib}
@Article{foo1970,
author = {Foo, B. and others},
title = {Frobtzing the frob},
journal = "J.\ Frob.",
year = 1970}
\end{filecontents*}
\begin{filecontents*}{mweclass.cls}
\def\fileversion{2.0}
\def\filedate{2010/06/15}
\def\docdate {2010/06/15}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mweclass}[\filedate\space v\fileversion\space MWE class]
\ProcessOptions\relax
\LoadClassWithOptions{article}
\AtBeginDocument{
\listoffigures
\clearpage
}
\end{filecontents*}
\documentclass{mweclass}
\usepackage[backend=biber,style=authoryear]{biblatex}
\usepackage[demo]{graphicx}
\addbibresource{\jobname.bib}
\begin{document}
\begin{figure}
\centering
\includegraphics{test}
\caption{This cites \textcite{foo1970}.}
\end{figure}
\printbibliography[heading=bibnumbered]
\end{document}
If I compile this (with pdflatex), I get this:
However, if I move the \AtBeginDocument command out of the class file and I put it right before \begin{document}, I get the expected result:
I have tried \protecting the \textcite command, but it does not make any difference.
As per @moewe's suggestion, I also tried adding the following snippet to the class file (from his/her answer to this question):
\AtEndPreamble{%
\addtocontents{toc}{%
\booltrue{citerequest}\relax}%
\addtocontents{lof}{%
\booltrue{citerequest}\relax}%
\addtocontents{lot}{%
\booltrue{citerequest}\relax}}
but unfortunately it makes no difference as long as the \AtBeginDocument command appears in the class file (and actually results in some undefined references).
What's up with this? How do I convince pdflatex to put the same text in the list of figures and in the figure caption?


.bibfile I had on my PC) and it is only with your custom class (which you don't show) that it doesn't work. Please try to isolate which bit of your custom class causes the behaviour as otherwise we will have to resort to speculations not knowing your class at all. – moewe Oct 19 '16 at 22:34\AtBeginDocumentto insert your\listoffiguresbefore you loadbiblatex... – Paul Gaborit Oct 20 '16 at 07:16\RequirePackage{biblatex}(which would force all users to use biblatex)? – Arek' Fu Oct 20 '16 at 07:38