# endnotes with hyperref (resetting the counter) problem

Following with the discussion in Making endnotes clickable links with hyperref, I've the following issue.

If I try to use this method to enable hyperlinks with endnote, everything works fine. But, if in my document I reset the endnote counter to zero at some point(s) (as I'd do if I had several chapters, for instance), when clicking the endnotes inserted after resetting the counter, they get referenced to the endnote list corresponding to the first bunch of endnotes.

A MWE would be:

\documentclass[pdftex]{article}
\usepackage{endnotes}
\usepackage{hyperref}
\usepackage{hyperendnote}
\begin{document}
\noindent

FIRST ENDNOTE\endnote{blabla one}

\newpage A page between two notes. \newpage

\addtoendnotes{\newpage}% so both notes will be on separate pages for testing

\theendnotes

\setcounter{endnote}{0}

Another page with another endnote\endnote{blabla two}

\newpage blabla \newpage

\theendnotes

\end{document}


A related discussion can be found on comp.text.tex, but it seems that it was resolved for the memoir class, and using pagenotes (as supplied by the memoir class), not endnotes.

-
I've ended up reimplementing it differently in memoir, i.e. is no longer using the solution from pagenote, but rather one inspired by endnotes. This version then use a unique counter and labels to provide back references. Hmm, seem to have forgotten about forward references (via hyperref), will fix that in the next release (which is not the one I just released an hour ago) –  daleif Mar 6 '11 at 22:23
@daleif: As the maintainer of memoir, you are probably well versed in the intricacies of the pagenote package. Please have a look at this question. –  lockstep Mar 7 '11 at 0:06
Actually no. I maintain memoir, Will Robertson maintain the rest.. It has turned out that the pagenote approach is very flawed and need to be changed. Will know pagenotes has problems, but he has not gotten to it yet. Actually I know know if the cross referencing work in the current pagenotes in memoir, an extra thing for my TODO list. –  daleif Mar 7 '11 at 9:37
@daleif: I've ended up reimplementing it differently in memoir, i.e. is no longer using the solution from pagenote, but rather one inspired by endnotes. This version then use a unique counter and labels to provide back references. Hmm, seem to have forgotten about forward references (via hyperref), will fix that in the next release (which is not the one I just released an hour ago)