短标题中未找到引用

短标题中未找到引用

我正在试验短标题中的引文问题。如果我运行以下 MWE,则会按预期找到三个引文,但如果我通过启用注释在文档中添加一些文本(任何文本),则\lipsum找不到任何引文,参考书目为空,并且的参数\fullcite以文本形式显示在图表列表中。

\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}

我做错什么了吗?

答案1

这确实看起来有点神秘。这让我觉得citerequest布尔值的作用比宣传的要多一些。根据 §4.11.5浮标和 TOC/LOT/LOF 中的追踪器,第 239 页,biblatex文档

如果在浮动体中给出引文(通常在图表或表格的标题中),学术反向引用(如“ibidem”)或基于页面跟踪器的反向引用将变得模棱两可,因为浮动体是(物理和逻辑上)位于文本流之外的对象,因此此类引用的逻辑不太适用于它们。为了避免任何此类歧义,所有浮动体中的引文和页面跟踪器都暂时禁用。此外,这些跟踪器以及反向引用跟踪器(backref)在目录、图表列表和表格列表中都暂时禁用。

实际上,这个布尔值似乎能够禁用整个 cite 命令,因为它影响了 的定义\blx@citation

在 toc/lof 中切换citerequest回 true 似乎可以解决我们的问题。

\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}

一个更短的、潜在的(但实际上不是)更危险的解决方案是

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

也就是说,删除涉及的 if 构造citerequest

相关内容