当使用带有标签的内容内的脚注时,footnotebackref 与 amsart 发生冲突

当使用带有标签的内容内的脚注时,footnotebackref 与 amsart 发生冲突

梅威瑟:

\documentclass{amsart}
\usepackage{footnotebackref}
\begin{document}
\begin{equation}\label{eq:1}
    1=1\footnote{1}
\end{equation}
\ref{eq:1}
\end{document}

这会产生错误,因为方程的标签被覆盖: 在此处输入图片描述

我怎样才能解决这个问题?

编辑:

\documentclass{amsart}
\usepackage{xpatch}
\usepackage{hyperref}
%\usepackage{cleveref} %I get wrong hyperlinks with and without cleveref
\usepackage{footnotebackref}

\makeatletter
\edef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}
\xpretocmd{\@adminfootnotes}{\let\@makefntext\BHFN@OldMakefntext}{}{}
\renewcommand\@makefntext[1]{%
  \@ifundefined{@makefnmark}
    {}
    {%
     \renewcommand\@makefnmark{%
       \mbox{%
         \textsuperscript{%
           \normalfont
           \hyperref[\BackrefFootnoteTag]{\@thefnmark}%
         }%
       }\,%
     }%
     \BHFN@OldMakefntext{#1}%
  }%
}
\makeatother
\begin{document}

\footnote{Test1}

\begin{align}\label{eq:1}
    1=1\protect\footnotemark
\end{align}

Test\footnotetext{\label{fn2}This is footnote} eq.~\ref{eq:1}
%\cref{fn2}
\end{document}

给出的输出看起来不错,但第二个脚注的反向引用超链接到第一个脚注 :( 如何修复?我是否实现了玛蒂·尤维回答错误的?

答案1

希望以下内容MWE能够帮到您:

\documentclass{amsart}
\usepackage{xpatch}
\usepackage{hyperref}
\usepackage{footnotebackref}

\makeatletter
\edef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}
\xpretocmd{\@adminfootnotes}{\let\@makefntext\BHFN@OldMakefntext}{}{}
\renewcommand\@makefntext[1]{%
  \@ifundefined{@makefnmark}
    {}
    {%
     \renewcommand\@makefnmark{%
       \mbox{%
         \textsuperscript{%
           \normalfont
           \hyperref[\BackrefFootnoteTag]{\@thefnmark}%
         }%
       }\,%
     }%
     \BHFN@OldMakefntext{#1}%
  }%
}
\makeatother
\begin{document}

\begin{align}\label{eq:1}
    1=1\protect\footnotemark
\end{align}

\footnotetext{This is footnote}\ref{eq:1}
\end{document}

PS:想法借鉴自其中一篇egreg文章......

输出

在此处输入图片描述

编辑

\documentclass{amsart}
\usepackage{xpatch}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{footnotebackref}

\makeatletter
\edef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}
\xpretocmd{\@adminfootnotes}{\let\@makefntext\BHFN@OldMakefntext}{}{}
\renewcommand\@makefntext[1]{%
  \@ifundefined{@makefnmark}
    {}
    {%
     \renewcommand\@makefnmark{%
       \mbox{%
         \textsuperscript{%
           \normalfont
           \hyperref[\BackrefFootnoteTag]{\@thefnmark}%
         }%
       }\,%
     }%
     \BHFN@OldMakefntext{#1}%
  }%
}
\makeatother
\begin{document}

\begin{align}\label{eq:1}
    1=1\protect\footnotemark
\end{align}

Test\footnotetext{\label{fn1}This is footnote} eq.~\ref{eq:1}
\cref{fn1}
\end{document}

在此处输入图片描述

相关内容