# Footnote in Longtable

Maybe many of you have such problem. You have a table and want to have a reference inside, but it doesn’t work. Propably you get this or similar error:

name{Hfootnote.7} has been referenced but does not exist, replaced by a fixed one

This happens, because hyperref has problems with its counters, when they are inside of a table environment.

I searched the net for a couple of hours with no real solution. Mostly it says, don’t use footnote in table. But it’s much more nice to have. With some inspiration from some boards I came up with this solution which works fine for me.

\usepackage[colorlinks]{hyperref}
\usepackage[style=authortitle,backref=true]{biblatex}
\usepackage{longtable}

% center data in paragraph column
\newcolumntype{C}{>{\centering\arraybackslash}p{0.7\linewidth}}

\begin{document}

%start a new counter
\newcounter{manualFootnote}

%set value to the actual value of the footnote counter
\setcounter{manualFootnote}{\value{footnote}}

%increase counter by one
\stepcounter{manualFootnote}

\begin{longtable}{c | C}
my custom &amp; footnote\footnotemark[\value{manualFootnote}]\\
\hline \stepcounter{manualFootnote}
another custom &amp; footnote\footnotemark[\value{manualFootnote}]\\
\end{longtable}

%decrease counter again to get number for first counter
\addtocounter{manualFootnote}{-1}

%print the text for the reference, \textcite{} is from biblatex and takes a reference from the biliography
\footnotetext[\value{manualFootnote}]{\textcite{myRef}}

%increase counter for the second footnote
\stepcounter{manualFootnote}

%print the second footnote text
\footnotetext[\value{manualFootnote}]{\textcite{myRef2}}

%increase the real footnote counter by 2 for the two footnotes in the table
\addtocounter{footnote}{2}
\end{document}


Hyperref will not mark these created footnotes as links, but I think it’s not a big deal.

I’m just a beginner with latex, so if you think you have a better solution leave me a comment.

• badmash

I just signed up to your blogs rss feed. Will you post more on this subject?

• http://tylkowski.net Matthias Tylkowski

latex in general or which topic?