错误的页码显示(hyperref、尾注的组合)

错误的页码显示(hyperref、尾注的组合)

我的代码(感谢John Kormylo 需要尾注编号的超链接(尾注编号是页码)为实现“以印刷pagenumber代替endnote数字”的目标,他提出了以下几点建议:

\documentclass{book}
\usepackage{lipsum,ragged2e}
\usepackage{endnotes}%
\usepackage{hyperref}
\usepackage{etoolbox}

\makeatletter
\def\enoteformat{%
\def\makeenmark{\@makeenmark}%
\leftskip\z@\RaggedRight\parindent=\z@\parskip\z@\def\@textsuperscript{}%
  \@hangfrom{\leavevmode{\hbox to 20\p@{\hyperlink{page.\@theenmark}{\makeenmark}\hss}\ignorespaces}}}%
\def\enoteheading{\chapter*{Notes}%
}%
\def\enotesize{\fontsize{9}{12}\selectfont}%
\let\theendnote=\thepage
\def\makeenmark{\relax}%
\makeatother

\begin{document}
\chapter{Chapter 1}

\lipsum[1-2]

This is just for check, indication of first endnote\endnote{End note on first page\label{test}} This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check This is just for check 
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check This is just for check This is just for check
This is just for check indication of second endnote\endnote{End note on second page\label{test}} This is just for check This is just for check This is just for check This is just for check 

\chapter{Chapter 2}

\lipsum[1-1]\endnote{End note on third page\label{second}}

\clearpage

\theendnotes

\end{document}

第一个尾注位于第一页,页码显示正确,第二个尾注位于第二页,但只显示第一页,但应该显示为2,请参考屏幕截图:

在此处输入图片描述

如果文本段落从一页延伸到另一页,就会出现此问题......

请告知如何获取准确的页码...

现在我明白了给予\thepage并不是更好的方法,有人可以建议用什么其他替代方法来完成我的任务吗,即打印相应的page numbersendnote不是实际的endnote计数器,请......

答案1

如果你删除,%\let\theendnote=\thepage你将得到你想要的结果: 在此处输入图片描述

相关内容