2

Hyperlinks generated with \ref{note} link to the beginning of the pagenote section rather than to the actual note, the way a \ref to a \footnote works. The hyperlink generated by \pagenote itself works fine. Is that a known problem? Is there a workaround?

\documentclass{memoir}

\usepackage{hyperref,blindtext}

\begin{document}
\makepagenote

Hyperlink to \ref{note3} goes to beginning of notes section instead of to note \ref{note3}.

\blindtext\pagenote{\label{note1}\blindtext\par\blindtext}

\blindtext\pagenote{\label{note2}\blindtext\par\blindtext}

\blindtext\pagenote{\label{note3}\blindtext}


\printpagenotes
\end{document}

EDIT: Someone posted this answer but it's now gone, so I'll record it here: the workaround is to insert \phantomsection before the \label command.

1
  • I'll come back to this later on -- with \notebackref in the preamble, the \pagenote generates labels automatically such as pagenote1-1 etc, but it is difficult to remember this
    – user31729
    Commented Jan 2, 2018 at 10:35

2 Answers 2

1

It seems to be a memoir error. Try the following in the preamble.

\makeatletter
\renewcommand\startnoteentrystart[4]{%
  \prenoteinnotes%
  \noteidinnotes{#1}{#2}%
  \@ifmtarg{#2}{\phantomsection\def\@currentlabel{#1}}{}%
  \pagenoteanchor{#4}%
  \pageinnotes{#3}%
  \prenotetext%
}
\makeatother

I added the \phantomsection

0

You need another counter to use \refstepcounter INSIDE the note. Interestingly, \thepagenote is 0 for all the notes.

\documentclass{memoir}

\usepackage{hyperref,blindtext}

\newcounter{mypagenote}

\newcommand{\notelink}[1]% #1=label
{\refstepcounter{mypagenote}\label{#1}}

\begin{document}
\makepagenote

Hyperlink to \ref{note3} goes to beginning of the third note.

\blindtext\pagenote{\notelink{note1}\blindtext\par\blindtext\par}

\blindtext\pagenote{\notelink{note2}\blindtext\par\blindtext}

\blindtext\pagenote{\notelink{note3}\blindtext}


\printpagenotes
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .