with hypperef \endnotemark does not link to the endnote but to the first marker

Create issue
Issue #19 open
Former user created an issue

If I compose the following example with pdflatex that the surperscript in page 2 links to page 1 while I expect it t link to the endnote in page 3.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{enotez}
\usepackage[colorlinks]{hyperref}
\usepackage{lipsum}

\title{\texttt{\jobname}}

\begin{document}
\maketitle

\section{Test}
Text\endnote{\lipsum[1]}.
Text\endnote{\lipsum[2]}\label{edn:test}.
Text\endnote{\lipsum[3]}.

\newpage
Text\endnotemark[\ref{edn:test}].

\newpage
\printendnotes

\end{document}

hth, Jerome

Comments (4)

  1. Clemens Niederberger repo owner

    This is indeed a problem although you also have made a mistake: the reference of course links to the place where you put the \label which is indeed on page 1! You’d have to use \endnote{\label{…}…} and place the label to where the note is printed. This won’t work with v2.9 or older, though. In the next release the following will work:

    \documentclass{article}
    \usepackage{enotez}
    \usepackage[colorlinks]{hyperref}
    \usepackage{lipsum}
    
    \begin{document}
    
    \section{Test}
    Text\endnote{\lipsum[1]}.
    Text\endnote{\label{edn:test}\lipsum[2]}.
    Text\endnote{\lipsum[3]}.
    
    \newpage
    
    Text\refendnote{edn:test}
    
    \newpage
    \printendnotes
    
    \end{document}
    

  2. Clemens Niederberger repo owner

    Actually I’m not going to provide \refendnote but its definition would be rather simple:

    \newcommand*\refendnote{\enotezwritemark{\enmarkstyle{\ref{#1}}}}
    

    There is another problem with this: in order to have the correct label \@currentlabel needs to be updated for each note when the list is printed. On the other hand this would confuse nested endnotes as e.g. in issue #10. I’ll reopen this issue for now.

  3. Log in to comment