# footnote in table with hyperlinks

Answer to the problem below: I was using latex c.tex; dvipdf c.dvi to compile the pdf, instead I should use pdflatex c.tex, it also showed up that \begin{savenotes} will create links to the top of the page instead of the footnote, so instead of \begin{savenotes} and \footnote I should use \tablefootnote, credit to @cgnieder. Below the original question:

I'm trying achieve footnotes in tables that are hyperlinked (so that you can click on the footnote marker to get to the footnote text. The following example enables me to add footnotes in tables:

\documentclass[12pt]{article}

\usepackage{footnote}

\begin{document}
\begin{savenotes}
\begin{table}[ht]
\centering
\begin{tabular}{|l|c|c|}
\hline
A & 1 & 2 \footnote{This is the first footnote.} \\
\hline
B & 2 & 1 \\
\hline
C & 3\footnote{This is the second footnote.} & 3 \\
\hline
\end{tabular}
\caption{A table caption.}
\end{table}%
\end{savenotes}
\end{document}


However the footnotes markers inside the table are not hyperlinked. Only the last one, outside the table is. Now, when I instead use

...
\usepackage{hyperref}
\usepackage{footnote}
...


That is:

\documentclass[12pt]{article}

\usepackage{hyperref}
\usepackage{footnote}

\begin{document}
\begin{savenotes}
\begin{table}[ht]
\centering
\begin{tabular}{|l|c|c|}
\hline
A & 1 & 2 \footnote{This is the first footnote.} \\
\hline
B & 2 & 1 \\
\hline
C & 3\footnote{This is the second footnote.} & 3 \\
\hline
\end{tabular}
\caption{A table caption.}
\end{table}%
\end{savenotes}
\end{document}


I get closer, the footnote markers are not hyperlinked with a underline, however the hyperlink marker of the last footnote is hyperlinked with a box. I would like all footnote markers to be hyperlinked with a box. How can I achieve this?

Note that the question is not whether or not the footnote and footnote marker appear. I use \begin{savenotes} to do that. Rather the question is why the links are formatted as underscores and not boxes:

or

-
tablefootnote can do this kind of thing... – clemens May 24 '12 at 7:41
I substituted footnote with tablefootnote but it is in fact the same output: The problem is not weather or not the footnote marker and footnote apears but rather how the links are build: Inside the table the link is only an underscore, outside the table it is a box. It is very difficult to click on only the underscore... – Konrad Eisele May 24 '12 at 9:49
Funny! Your code runs with a warning and all the links are boxed for me. Please note that your code does not produce the table in your image (but something else). May be you have to give more details. – Harish Kumar May 24 '12 at 10:29
@Harish the links are boxed for me, too, but footnote one does not get hyperlinked (that's what the warning is about) and footnote two links to footnote one. – clemens May 24 '12 at 10:53
@Konrad I get the empty boxes, too, if I compile latex + dvips + ps2pdf. Maybe you should just try pdflatex c.tex? – clemens May 24 '12 at 11:16

In case you're willing to consider using table notes instead of footnotes, the referable option of threeparttablex would provide a suitable command, \tnotex. While the package is originally designed to work with longtable, it also extends threeparttable environment by some commands, among them \tnotex.

\documentclass[12pt]{article}

\usepackage[referable]{threeparttablex}
\usepackage{footnote}
\usepackage{hyperref}

\begin{document}
\begin{table}[ht]
\centering
\begin{threeparttable}
\begin{tabular}{|l|c|c|}
\hline
A & 1 & 2 \tnote{1} \\
\hline
B & 2 & 1 \\
\hline
C & 3\tnotex{tn:2} & 3 \\
\hline
Line & producing & space. \\
\hline
\end{tabular}
\begin{tablenotes}
\item[1] This is the first note.
\item[2] \label{tn:2} This is the hyperlinked note.
\end{tablenotes}
\end{threeparttable}
\caption{A table caption.}
\end{table}%
\end{document}


-
I tried your example but the output doesnt have any links. Only the footnote and footnote marker. My problem is that I dont get the right link: Inside the table it is only an underscore, outside the table it is a box... I want a box also inside the table. – Konrad Eisele May 24 '12 at 9:51
I've added a screenshot of what I get on compilation. Did you copy and compile the entire code? – dgs May 24 '12 at 10:24
The answer from cgnieder indicates that I have some delta in the latex system I use. His setup outputs i.stack.imgur.com/5lpGN.png , my setup i.stack.imgur.com/xggYv.jpg ... what kind of setup do you use? – Konrad Eisele May 24 '12 at 10:27
Yes, I compiled the entire code, but (on my system) when using your \tnotex I get a "3??" as output and no red link at all... – Konrad Eisele May 24 '12 at 10:32
I suppose you did compile multiple times to allow the references to be updated? You could try if latex=>PS=>PDF works on your system. Should indeed your platform cause the issue, I can't provide any help since I'm mostly on Windows/MikTeX. – dgs May 24 '12 at 11:07

As we found out in the comments to the question if compiled with pdflatex the links are rectangles, i.e. the foodnote marks are inside the link boxes. latex + dvips leads to empty link boxes below the table footnotes instead.

The savenotes environment produces wrong hyperlinks, though. tablefootnote gets them right:

\documentclass[12pt]{article}

\usepackage{tablefootnote}
\usepackage{hyperref}
\begin{document}
\begin{table}[ht]
\centering
\begin{tabular}{|l|c|c|}
\hline
A & 1 & 2 \tablefootnote{This is the first footnote.} \\
\hline
B & 2 & 1 \\
\hline
C & 3\tablefootnote{This is the second footnote.} & 3 \\
\hline
\end{tabular}
\caption{A table caption.}
\end{table}%


I tried your example but I still get the underscore version : i.stack.imgur.com/xggYv.jpg . I'm using a debian-wheezy installation with texlive-latex-extra package. It should be the latest setup... On a old slackware using tablefootnote was not possible... – Konrad Eisele May 24 '12 at 10:16
@Konrad I have TeX Live 2011 and compiled with pdflatex. The screenshot is taken from the view in Okular but it looks the same in Acrobat Viewer – clemens May 24 '12 at 10:32