4

I'm using endnotes package to create endnotes, and since my existing body of text already contains lots of footnotes, I use \let\footnote=\endnote to convert footnotes into endnotes.

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

But while the original footnotes were nicely cross-referenced, the conversion doesn't preserve that. Is there a way to make a conversion while preserving the cross-referencing?

bozidarka
  • 960

1 Answers1

11

In order to make hyperref work with endnotes, you could use enotez. All you have to do is load enotez instead of endnotes and use \printendnotes instead of \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}

Edit: If you want back references from the notes to the mark in the text, then use the option backref

Update: Newer versions of enotez are set differently (see remark in the comments)

\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}

DG'
  • 21,727
  • That works, but I do get an error message ("LaTeX error:"kernel/command-already-defined" "control sequence !\endnote already defined.") This happens regardless of whether I just replace all instances of \footnote with \endnote or if I do it via \let\footnote=\endnote. – bozidarka Feb 15 '15 at 19:19
  • Clearly, it must be due to some other package I'm loading but not sure which one is to blame. – bozidarka Feb 15 '15 at 19:25
  • Looks like it's due to mdwlist but I have no idea why. – bozidarka Feb 15 '15 at 19:30
  • mdwlist is rather old . . . is there any particular reason why you are using it and not enumitem? – DG' Feb 15 '15 at 19:36
  • I want to be able to use \resume{enumerate} \suspend{enumerate} sequencing to coordinate numbered lists. This breaks down with enumitem – bozidarka Feb 15 '15 at 19:46
  • a) enumitem can do \begin{enumerate}[resume] b) you should ask a new question with a new MWE, as this has nothing to do with converting endnotes to footnotes (and hyperref) anymore. – DG' Feb 15 '15 at 19:50
  • right, that might work. i was looking for a minimal change to the body of the text i already have. thanks! – bozidarka Feb 15 '15 at 19:53
  • Does not work for me :( - although I am tryin to do slightly different thing. I do not turn all foonotes into endotes, but rather use \endnote in the document directly. \footnotes are "backlinked" correctly, but not endnotes. – gorn Mar 03 '17 at 14:01
  • @gorn You should ask a new question and post a minimal working example (MWE) – DG' Mar 03 '17 at 15:13
  • This works for me but hyperref works from the numbers in the body of the text to the numbers of endnotes but not vice versa. How to make hyperref work the other way around too? – Sasan Dec 08 '17 at 23:45
  • In the enotez manual on page 4: set the option backref – DG' Dec 09 '17 at 07:18
  • 1
    For anyone trying to do that in 2023 :
    \setenotez{backref=true}
    
    – fyusuf-a Jan 20 '24 at 11:58
  • Thanks @fyusuf-a! I updated the answer – DG' Jan 20 '24 at 21:29