
以下MWE
\documentclass{article}
\usepackage{titlesec}
\usepackage{footnotebackref}
\begin{document}
\section{Whatever\protect\footnote{Problematic footnote}}
\end{document}
titlesec
如果同時載入和包,則會出現錯誤footnotebackref
(如果刪除其中任何一個,它會按預期工作)。我嘗試使用\footnotemark
和\footnotetext
,但無濟於事。知道可能發生什麼情況以及如何解決它嗎? (我確實知道在頭部使用腳註是不可取的,但無論如何...)
答案1
下列的如何將 footnotebackref 套件與 \footnotemark 和 \footnotetext 一起使用?,解決方案是使用\footnotemark
and 並\footnotetext
進行以下重新定義:
\makeatletter
\LetLtxMacro{\BHFN@Old@footnotemark}{\@footnotemark}
\renewcommand*{\@footnotemark}{%
\refstepcounter{BackrefHyperFootnoteCounter}%
\xdef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}%
\label{\BackrefFootnoteTag}%
\BHFN@Old@footnotemark
}
\makeatother
(一已也至\protect
)\footnotemark
。完整的 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}