9

Here's the code:

\documentclass[12pt,letterpaper]{article}

\usepackage{array}

\newcommand{\fntxt}[1]{\footnotetext{#1}}
\newcommand{\fnstep}{\stepcounter{footnote}}
\newcommand{\fnmark}{\footnotemark}

\usepackage{hyperref}

\begin{document}

\begin{tabular}{| c | c |}
\hline
Test1\fnmark & Test2\fnmark \\ \hline
\end{tabular}

\addtocounter{footnote}{-1}
\fntxt{Footnote 1}
\fnstep
\fntxt{Footnote 2}

\end{document}

I pdflatex it twice. The problem is: (1) when I click on the first footnote, I'm "transferred" to the same page, not pointed to the first footnote text; (2) when I click on the second, I'm correctly pointed to the second footnote text.

I've also tried to add more than two footnotes in the tabular. It turns out that only the last reference is working.

What's the reason behind this? How can one fix it?

Thanks a lot.

2 Answers 2

10

The hyperref support for footnotes can be easily broken; here's what the hyperref documentation says about the hyperfootnotes option:

Makes the footnote marks into hyperlinks to the footnote text. Easily broken...

In this thread at comp.text.tex, Heiko Oberdiek says (referring to the same issue discussed here):

It is beyond the scope of hyperref's footnote support. Thus you can either disable it: hyperfootnotes=false or you have to fiddle with internal macros.

And here's the fiddling he announces (and illustrates with an exampe) adapted to your particular situation:

\documentclass[12pt,letterpaper]{article}
\usepackage{hyperref}

\begin{document}

\makeatletter 
\begin{tabular}{cc}
Test1\footnotemark 
  \global\let\saved@Href@A\Hy@footnote@currentHref 
&
Test2\footnotemark 
  \global\let\saved@Href@B\Hy@footnote@currentHref 
\end{tabular}

\addtocounter{footnote}{-1}% 
\let\Hy@footnote@currentHref\saved@Href@A 
\footnotetext{Footnote text}% 
\addtocounter{footnote}{1}% 
\let\Hy@footnote@currentHref\saved@Href@B 
\footnotetext{Footnote text}% 

\makeatother

\end{document}
2
  • Please place Text\footnote{Footnote one} before \makeatletter. The table will float to the top of the page, but the footnote numbers will not be adapted. (The tablefootnote package used in my answer has got the same problem.) Any idea how to solve that? (Except moving the table in the source code before the Text\footnote{Footnote one} or preventing the floating.)
    – Stephen
    Nov 30, 2011 at 18:46
  • @gonzalo-medina is it possible to develop this idea in a new package? This would make easier its use and we can use it in others environments as minipages or \fbox{...}. I say this because you are an expert in (La)TeX programming.
    – skpblack
    Jul 17, 2014 at 2:54
1

If it is OK for you to use the tabular inside of a table environment, you could use the tablefootnote package and just use \tablefootnote{ ... } in the table. (And optionally you can center the table and add a caption.)

\documentclass[12pt,letterpaper]{article}
\usepackage{array}
\usepackage{hyperref}
\usepackage{tablefootnote}
\begin{document}

\begin{table}
%\centering
\begin{tabular}{| c | c |}
\hline
Test1\tablefootnote{Footnote 1} & Test2\tablefootnote{Footnote 2} \\ \hline
\end{tabular}
%\caption{This is a table.\label{FirstTable}}
\end{table}

A pagebreak:

\pagebreak

and a second page, so that you can see that the hyperlinks really work.

\end{document}
2
  • Thanks. I decided to give it a try and I followed the README document to manually install the package. However, even after initexmf --update-fndb, neither pdflatex nor latex could compile. I'm using MikTex. Have any ideas?
    – Covi
    Nov 19, 2011 at 0:33
  • @Covi: Please see at tex.stackexchange.com/questions/35200/footnotes-in-tabulars/…
    – Stephen
    Nov 19, 2011 at 15:34

You must log in to answer this question.

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