4

I would like to make footnotes inside a minipage that use the global footnote counters and the hyperref package.

I'm having trouble getting hyperref to make the correct references. I imagine I need to change the Hfootnote counter but I haven't had any luck with that and I'm not sure exactly what's going on. I tried adding a \addtocounter{Hfootnote}{-1} and \stepcounter{Hfootnote} but that didn't help.

Below is a minimal example.

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\noindent\ldots{} main text\footnote{Before minipage} \ldots\par
\fbox{\begin{minipage}{.5\linewidth}
    A footnote to use global footnotes.\footnotemark
    A second global footnote.\footnotemark
\end{minipage}}
\addtocounter{footnote}{-1}
\footnotetext{First global footnote inside minipage}
\stepcounter{footnote}
\footnotetext{Second global footnote inside minipage}
\par
\noindent\ldots{} main text\footnote{After minipage} \ldots\par
\end{document}

Clicking on the first footnote inside the minipage does not yeild the expected result.

5

I finally figured it out! The short answer is that Hyperref sucks at footnotes.

Thanks to Gonzalo Medina's answer to a similar question I was able to adapt a workaround. I'm new to tex.stackechange so if I can give any more credit to Medina please let me know how.

Below is the working example.

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\noindent\ldots{} main text\footnote{Before minipage} \ldots\par
\makeatletter
\fbox{\begin{minipage}{.5\linewidth}
    A footnote to use global footnotes.\footnotemark\global\let\saved@Href@A\Hy@footnote@currentHref
    A second global footnote.\footnotemark\global\let\saved@Href@B\Hy@footnote@currentHref
\end{minipage}}
\addtocounter{footnote}{-1}
\let\Hy@footnote@currentHref\saved@Href@A 
\footnotetext{First global footnote inside minipage}
\stepcounter{footnote}
\let\Hy@footnote@currentHref\saved@Href@B
\footnotetext{Second global footnote inside minipage}
\makeatother
\par
\noindent\ldots{} main text\footnote{After minipage} \ldots\par 
\end{document}
  • 1
    This response seems a bit cryptic. Is there a package that makes this easier? – skpblack Jul 16 '14 at 21:47
  • Unfortunately no. The linked answer provides a better explanation, but the short answer is hyperref wasn't designed to work on footnotes. – GDanger Jul 17 '14 at 1:16
  • i tried tablefootnote but it works only into a table (or sidewaystable) environment and no in minipage or \fbox{}. – skpblack Jul 17 '14 at 1:48
  • The above example works with minipage. I'm not sure what you are trying to do, perhaps you should open your own question, then I would be glad to help if I can. – GDanger Jul 17 '14 at 5:01
  • Adding comments using % symbols to your MWE would have helped to make this answer a whole lot less cryptic. – SeSodesa May 17 at 11:30

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.