4

biblatex issues the following warning when used with the linguex package.

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

This is because the linguex redefines \footnotetext in order to support numbered examples in footnotes and endnotes.

However, redefining \footnotetext makes it impossible (difficult?) for biblatex to patch footnotes in order to support ibid and ibidem citations.

According to an answer (here), this is a warning we can safely ignore as long as we're not using an ibid citation style.

But what if a user wants to use both linguex and some ibid citation style? Is there a way to make biblatex override whatever has been done to \footnotetext?

MWE:

\documentclass{article}

\usepackage{linguex}

\usepackage
[
  backend = biber,
  style   = authoryear-ibid,
]
{biblatex}

\begin{document}
\end{document}
n.r.
  • 4,942
  • Without a working example, it is tough, but maybe load linguex thus: \let\svfootnotetext\footnotetext\usepackage{linguex}\let\footnotetext\svfootnotetext. This will restore the definition of \footnotetext to that which preexisted the loading of linguex. – Steven B. Segletes Sep 02 '16 at 16:06
  • This won't work. \let works with a pointer to \footnotetext, whereas those packages redefine whatever that pointer points to. – n.r. Sep 02 '16 at 16:10
  • \let does not work with a pointer, but makes an actual copy. Now the problem may be that what gets changed is not \footnotetext, but subsidiary routine(s). In that case, this procedure needs to be applied to the actual routine(s) that are changed by linguex. – Steven B. Segletes Sep 02 '16 at 16:10
  • You're right. It turns out that linguex redefines \@footnotetext. So, the following should go after loading it: \makeatletter \let\@footnotetext\predefinedfootnotetext \makeatother – n.r. Sep 02 '16 at 16:22
  • But then you destroy the redefinition of linguex. – Ulrike Fischer Sep 02 '16 at 16:48
  • Well, unless biblatex finds out another way to patch footnotes, we need to choose between ibid footnotes or footnotes with numbered examples. I choose ibid footnotes. – n.r. Sep 02 '16 at 16:52
  • Note that the footnote detection only really becomes important if you use \footnote{... \cite{} ...}; if you only use \footcite you should be fine. You should also be fine if you only ever cite in footnotes. – moewe Sep 02 '16 at 16:59

3 Answers3

4

You can get the best of both worlds:

\documentclass{article}

\usepackage
[
  backend = biber,
  style   = authoryear-ibid,
]
{biblatex}
\usepackage{linguex}

\makeatletter
\let\linguex@footnotetext\@footnotetext
\let\@footnotetext\predefinedfootnotetext
\AtBeginDocument{%
  \let\predefinedfootnotetext\@footnotetext
  \let\@footnotetext\linguex@footnotetext
}
\makeatother

\addbibresource{biblatex-examples.bib}

\setlength{\textheight}{5cm} % just to get a smaller image

\begin{document}

Lorem \cite{worman} ipsum\footcite{sigfridsson} dolor\footnote{\cite{sigfridsson}}

Text and text\footnote{A different example would be:
\ex. This is the first level of embedding 
  \a. This is the second level
  \b. This is still the second level, but:
    \a. This is the third level 
    \b. This is not the end. 
    \b. This is the end.\par}.

\end{document}

Explanation.

linguex lets \predefinedfootnotetext to be \@footnotetext; then it redefines \@footnotetext in terms of the original. However, when at begin document, biblatex tries to patch \@footnotetext and it fails. Thus we can provisionally restore the meaning of \@footnotetext for the patch and then reapply the redefinition by linguex when the patch has been done.

Make a feature request to the biblatex team so they also support linguex, which is quite easy as they just need to patch \predefinedfootnotetext in the case the package is loaded, just like they provide for some other case in which the command to patch is different.

enter image description here

egreg
  • 1,121,712
  • I'm not following. When at begin document we let \@footnotetext be \linguex@footnotetext, why doesn't this override the patch that biblatex has just applied? – n.r. Sep 02 '16 at 18:00
  • I'm trying to understand why this works. Does it make any difference whether biblatex is loaded earlier than linguex, as your example, rather than later, as in mine? – n.r. Sep 02 '16 at 18:22
  • @n.r. It shouldn't matter. Look at the redefinition of \@footnotetext performed by linguex and you'll understand why this works. – egreg Sep 02 '16 at 19:21
  • Now I see it. \@footnotetext will expand to, among other things, a \predefinedfootnotetext as modified by biblatex. – n.r. Sep 02 '16 at 19:28
  • @n.r. Right. And the modification happens \AtBeginDocument. – egreg Sep 02 '16 at 19:58
  • Patched in biblatex 3.5 – PLK Sep 03 '16 at 17:18
  • Tested. The patch works. – n.r. Sep 03 '16 at 18:40
2

You can restore the footnote detection capabilities with

\makeatletter
\long\def\@footnotetext#1{\@noftnotefalse\predefinedfootnotetext{\toggletrue{blx@footnote}#1}%
         \@noftnotetrue}
\makeatother

That will not get rid of the warning, though, but it can now be safely ignored.

MWE

\documentclass{article}

\usepackage{linguex}

\usepackage[backend = biber, style = authoryear-ibid]{biblatex} \addbibresource{biblatex-examples.bib}

\makeatletter \long\def@footnotetext#1{@noftnotefalse\predefinedfootnotetext{\toggletrue{blx@footnote}#1}% @noftnotetrue} \makeatother

\begin{document} Lorem \cite{worman} ipsum\footcite{sigfridsson} dolor\footnote{\cite{sigfridsson}} \end{document}

gives

1 Sigfridsson and Ryde 1998.

2 ibid

in foonotes, while without the modification you'd get

1 Sigfridsson and Ryde 1998.

2 Sigfridsson and Ryde 1998.

moewe
  • 175,683
  • What exactly does blx@footnote flag to biblatex? – n.r. Sep 02 '16 at 17:05
  • @n.r. It is the toggle to check if we are in a footnote. If it is true biblatex knows that we are in a footnote. Some of the predefined commands already set the toggle accordingly (that's why \footcite works), but we need to set it to true within \footcitetext - here the patching comes in. – moewe Sep 02 '16 at 17:42
  • I wonder if this is the sole modification that biblatex makes on \@footnotetext. Because if it is, then there must be a more relaxed way to patch \@footnotetext, say, by merely prepending \toggletrue{blx@footnote} to whatever \@footnotetext would expand to, and thus avoid unnecessarily breaking the ibid feature. – n.r. Sep 02 '16 at 17:46
  • @n.r. As far as I can see biblatex only inserts \toggletrue{blx@footnote} after \color@begingroup in footnotetext-like commands. I suppose one needs to make sure the grouping is right and that is why biblatex patches commands like it does right now. – moewe Sep 02 '16 at 17:53
1

This is how to get rid of biblatex warning:

\documentclass{article}
\usepackage{linguex}

\makeatletter
\let\@footnotetext\predefinedfootnotetext
\makeatother

\usepackage[backend=biber, style=authoryear-ibid]{biblatex}    
\begin{document}
\end{document}

We revert \@footnotetext back to its standard definition using \predefinedfootnotetext, which is provided by linguex itself.

Notice, however, that in this way we'll no longer be able to use linguex in footnotes, and will need to resort to something like enumerate environments to get numbered examples in footnotes.

n.r.
  • 4,942