將註腳轉換為尾註的問題

將註腳轉換為尾註的問題

我正在使用endnotes套件來創建尾註,並且由於我現有的文本正文已經包含大量腳註,I use \let\footnote=\endnote因此將腳註轉換為尾註。

    \documentclass{article}
    \usepackage{endnotes}
    \usepackage{hyperref}
    \let\footnote=\endnote
    \begin{document}
    Sample text.\footnote{Sample footnote}.
    \theendnotes
    \end{document}

但是,雖然原始腳註很好地交叉引用,但轉換並沒有保留這一點。有沒有辦法在保留交叉引用的同時進行轉換?

答案1

為了使用hyperref尾註,您可以使用enotez。您所要做的就是加載enotez而不是endnotes並使用\printendnotes而不是\theendnotes

\documentclass{article}
\usepackage[backref]{enotez}      % <-- instead of \usepackage{endnotes}
\usepackage{hyperref}
\let\footnote=\endnote

\begin{document}
    Sample text.\footnote{Sample footnote}.
\printendnotes           % <-- instead of \theendnotes
\end{document}

編輯:如果您希望從註釋向後引用文本中的標記,請使用該選項backref

更新:較新版本的enotez設定有所不同(請參閱評論中的備註)

\documentclass{article}

\usepackage{enotez}
\setenotez{backref=true} % <-- options are set like this nowadays  

\usepackage{hyperref}
\let\footnote=\endnote

\begin{document}
    Sample text.\footnote{Sample footnote}.
\printendnotes           
\end{document}

相關內容