0

The following MWE

\documentclass{article}
\usepackage{titlesec}        
\usepackage{footnotebackref} 
\begin{document}
\section{Whatever\protect\footnote{Problematic footnote}}
\end{document}

gives an error if both the titlesec and footnotebackref packages are loaded (while it works as expected if any of them is removed). I tried using \footnotemark and \footnotetext, to no avail. Any idea on what might be going on and how to fix it? (I do know using footnotes in heads is not advisable, but anyway...)

summer
  • 1,474

1 Answers1

0

Following How to use the footnotebackref package with \footnotemark and \footnotetext?, the solution is to use \footnotemark and \footnotetext with the following redefinition:

\makeatletter
\LetLtxMacro{\BHFN@Old@footnotemark}{\@footnotemark}  
\renewcommand*{\@footnotemark}{%
    \refstepcounter{BackrefHyperFootnoteCounter}%
    \xdef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}%
    \label{\BackrefFootnoteTag}%
    \BHFN@Old@footnotemark
}
\makeatother

(One has also to \protect the \footnotemark). Complete MWE:

\documentclass{article}
\usepackage{titlesec}        
\usepackage{footnotebackref} 
\makeatletter
\LetLtxMacro{\BHFN@Old@footnotemark}{\@footnotemark}
\renewcommand*{\@footnotemark}{%
    \refstepcounter{BackrefHyperFootnoteCounter}%
    \xdef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}%
    \label{\BackrefFootnoteTag}%
    \BHFN@Old@footnotemark
}
\makeatother
\begin{document}
\section{Whatever\protect\footnotemark}
\footnotetext{Problematic footnote}
\end{document}

enter image description here

summer
  • 1,474