5

I have been trying to understand what is behind this warning:

Package biblatex Warning: Patching footnotes failed. (biblatex) Footnote detection will not work. 

which is produced by, for example, this code:

% !TeX program = lualatex \DocumentMetadata{ uncompress, lang=en, tagging=on, pdfstandard=UA-2, pdfstandard=A-4f, tagging-setup={math/setup={mathml-SE,mathml-AF}, extra-modules={verbatim-mo, verbatim-af}} } \documentclass[12pt]{report} \usepackage{setspace} \usepackage{biblatex} \begin{document} Example. \end{document} 

Searching on this forum for similar issues, I am led to believe this has to do with the (re)definition of \@footnotetext. What confounds me, however, is that I can only produce this warning if I simultaneously set up the \DocumentMetadata, include setspace, and use biblatex. In other words, if I remove either the \DocumentMetadata or setspace then I no longer get this warning.

(I don't know if this is worth mentioning, but for what it's worth, I originally also use hyperref in the document where I found this issue-- its inclusion seems to have no bearing on this behavior).

6
  • It looks like you need the package biblatex to trigger the warning, but you don't need the citation (nor the example.bib file). Commented yesterday
  • yes, of course. I will remove that from my example since it is nonessential. Commented yesterday
  • does this actually cause any problems? or is it just the warning you're concerned about? Commented yesterday
  • @cfr I am also facing this issue. It's probably just about the warning. Commented yesterday
  • 1
    unless you need the footnote changes biblatex provides, I would just load setspace after biblatex or ignore the warning. Commented yesterday

1 Answer 1

7

Refs.: GitHub #1470, #1471

latex-lab does this:

\AddToHook{begindocument} { \cs_set_eq:NN \@footnotetext \fnote_footnotetext:n } 

This means that, in the usual course of things, it silently overwrites any changes made to \@footnotetext in the class or preamble. In other words, it waits until Biblatex has made whatever changes it deems necessary. Then it silently replaces the altered definition with its own.

So Biblatex happily patches footnotes, but those changes are discarded at the start of the document environment. Since Biblatex doesn't know that, it doesn't issue any warning.

However, latex-lab also does the following

\AddToHook{package/setspace/after} {\let \@footnotetext \fnote_footnotetext:n \AddToHook{fntext}[setspace]{\let\baselinestretch\setspace@singlespace}} 

So if setspace is loaded, immediately afterwards, latex-lab overwrites the definition of \@footnotetext which setspace just modified and then adds code to emulate that patch.

If biblatex is loaded later in the preamble, it finds the new latex-lab footnote code, which it cannot patch, so you get a warning.

Note that the only difference in the actual footnote code used in the document is that, with setspace, code is added to emulate that package's changes to footnotes. Aside from that change, we get latex-lab's code in both cases. That is, regardless, you do not get any patches applied by biblatex. The only difference is whether you get a warning about that (with setspace loaded earlier) or not (without setspace or with setspace loaded later).

If you do not experience any actual problems as a result of this, I'd recommend just ignoring the warning for now. (I would suggest reporting it, but I'm pretty sure that will already have been done.) If you do not like the clutter, load setspace after biblatex and it will disappear.

\usepackage{biblatex} \usepackage{setspace} 

But I stress again: this won't actually change the code used in the document.

If we actually need the patched functionality biblatex provides, we have to add

\toggletrue{blx@footnote} 

into the code just before the footnote text is parsed and, possibly,

\togglefalse{blx@footnote} 

after.

If you are loading setspace, it is probably enough to use

\makeatletter \AddToHook{begindocument}{% \AddToHook{fntext}[biblatexhack]{\toggletrue{blx@footnote}}% } \makeatother 

For example, if using authoryear-icomp, which uses constrict for ibid citations, this does not work correctly without the patch, but seems OK with it:

left without patch; right with

The image on the right shows the effect of applying the patch, which I believe to be the expected behaviour.

\DocumentMetadata{ uncompress, lang=en, tagging=on, pdfstandard=UA-2, pdfstandard=A-4f, tagging-setup={math/setup={mathml-SE,mathml-AF}, extra-modules={verbatim-mo, verbatim-af}} } \documentclass[12pt]{report} \usepackage{setspace} \usepackage[style=authoryear-icomp]{biblatex} \bibliography{biblatex-examples} \makeatletter \AddToHook{begindocument}{% \AddToHook{fntext/begin}[biblatexhack]{\toggletrue{blx@footnote}}% \AddToHook{fntext/end}[biblatexhack]{\togglefalse{blx@footnote}}% } \makeatother \pagestyle{empty} \begin{document} Example\footnote{% \Autocite{aksin}.% }. Example\footnote{% \Autocite{aksin}.% }. Example\footnote{% Feetnotes are not a thing.% }. Example\footnote{% Feetnotes are not a thing.% }. Example\footnote{% Feetnotes are not a thing.% }. Example\footnote{% \Autocite{aksin}.% }. \end{document} 
15
  • 1
    I will check with my test files and ping you if I can reproduce it. Commented yesterday
  • 1
    @niru see edit above. if you prefer not to see the warning, just load biblatex before setspace and biblatex will not know its patches got clobbered. ignorance is bliss :-). Commented yesterday
  • 1
    @wsmith that is trickier. the best thing would probably be to use \FirstAidNeeded from latex-lab to apply the fix only for the current version of biblatex. if you apply it unconditionally, you'll get an error if an update to biblatex removes the toggle. that way, the user will also get warned if the fix is not longer used. Commented yesterday
  • 1
    @wsmith too late ;) github.com/plk/biblatex/issues/1470 Commented yesterday
  • 1
    @wsmith please see edit, because I think it is better to do this inside the footnote and toggle it off afterwards. that is, I think this is less likely to run amok. Commented yesterday

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.