2

Say in chapter 2, page 10 I create a foonote (by doing: \footnote{bla bla....}). When I reference it in Page 10 I get a clickable reference to that footnote. But, in page 12 when I reference this footnote using \footnotemark[\value{footnote}] , I get the number of the footnote correct, but this time its not clickable. How can I fix this?

I am using Windows 7, MikTEX 2.9 and TexMaker. The PDF that I create is OK. But I can't seem to copy any text from the PDF. When I click, a long vertical bar appears. I am using Adobe PDF for viewing.

6
  • 1
    Please add a minimal working example (MWE) that illustrates your problem.
    – doncherry
    Apr 11 '12 at 9:48
  • 2
    As I already mentioned in my answer to the cross-post at LaTeX-Community.org, the hyperref README says that the optional argument of \footnotemark is not supported, since such a reference is not clear, in general.
    – Stefan Kottwitz
    Apr 11 '12 at 12:27
  • 1
    @StefanKottwitz Still being able to link to an already-defined footnote seems like a standard functionality to me which I'd expect to be supported by some package. Apr 11 '12 at 13:28
  • @StephanLehmke It was a general remark as I read the "official" statement in the README. Right, there may be a package which adds this functionality. Or let's write one. ;-)
    – Stefan Kottwitz
    Apr 11 '12 at 15:09
  • @StefanKottwitz See code below ;-) Apr 11 '12 at 15:31
1

It seems that \footnotemark[... is defined by hyperref to just typeset the number while a link is only created when \footnotemark is used without optional argument. Interestingly, in the latter case I was geting a link which lead nowhere.

It seems one must make an explicit mechanism for saving and restoring the link.

Try

\documentclass{article}

\usepackage{hyperref}

\makeatletter

\newcommand\savefootnotemark[1]
{%
  \expandafter\edef\csname fnmark@#1\endcsname%
  {%
    \noexpand\do@fnmark
    {\number\c@footnote}{\unexpanded\expandafter{\Hy@footnote@currentHref}}%
  }%
}

\newcommand\footnoterefmark[1]
{%
  \csname fnmark@#1\endcsname%
}

\newcommand\do@fnmark[2]
{%
  \begingroup
    \c@footnote #1\relax
    \def\@thefnmark{\thefootnote}%
    \leavevmode
    \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
    \hyper@linkstart{link}{#2}%
    \@makefnmark
    \hyper@linkend
    \ifhmode\spacefactor\@x@sf\fi
    \relax
  \endgroup
}  

\makeatother

\begin{document}

xxx

\clearpage

foo\footnote{bar}\savefootnotemark{fnone}.

\clearpage

baz\footnoterefmark{fnone}.\footnote{quux}\savefootnotemark{fntwo}

\clearpage

test1\footnoterefmark{fntwo},test2\footnoterefmark{fnone}.

\end{document}

One should think this is such a common request it must have been done in some package already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.