Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Which package should I use for proper footnote handling in tabu tables? I thought tabu was supposed to do everything tabularx does, but footnotes do not show up in tabu tables.

Working (using tabularx):

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{5cm}{c}
Cell \footnote{Footnote}
\end{tabularx}
\end{document}

Not working (with tabu):

\documentclass{article}
\usepackage{tabu}
\begin{document}
\begin{tabu}{c}
Cell \footnote{Footnote}
\end{tabu}
\end{document}
share|improve this question
2  
I can confirm this behaviour. Seems to be a bug as far as I understand tabus documentation. The maintainer is Florent Chervet. Does this package have a bug tracker? –  Toscho Apr 25 '13 at 14:42
1  
It works if you load hyperref after tabu and don't use tabu inside table as it is a float. –  cacamailg Apr 25 '13 at 17:29
    
Or you can use the threeparttable (or threeparttablex), which I found to be the best option. –  cacamailg Apr 25 '13 at 17:39
    
@cacamailg: I thought tabu was supposed to be in table; tabu for example doesn't support \caption. –  roelandvanbeek Apr 25 '13 at 19:37
    
Yes I know. Unfortunately it seems there is a bug. You can use \captionof instead of \caption. I will try to provide an example. –  cacamailg Apr 25 '13 at 22:41

2 Answers 2

The code below seem to work:

\documentclass{report}

%Thanks to David Carlisle for pushftn and popftn : http://tex.stackexchange.com/a/43695/7128
\makeatletter
\newtoks\FTN@ftn
\def\pushftn{%
 \let\@footnotetext\FTN@ftntext\let\@xfootnotenext\FTN@xftntext
  \let\@xfootnote\FTN@xfootnote}
\def\popftn{%
 \global\FTN@ftn\expandafter{\expandafter}\the\FTN@ftn}
\long\def\FTN@ftntext#1{%
  \edef\@tempa{\the\FTN@ftn\noexpand\footnotetext
                    [\the\csname c@\@mpfn\endcsname]}%
  \global\FTN@ftn\expandafter{\@tempa{#1}}}%
\long\def\FTN@xftntext[#1]#2{%
  \global\FTN@ftn\expandafter{\the\FTN@ftn\footnotetext[#1]{#2}}}
\def\FTN@xfootnote[#1]{%
   \begingroup
     \csname c@\@mpfn\endcsname #1\relax
     \unrestored@protected@xdef\@thefnmark{\thempfn}%
   \endgroup
   \@footnotemark\FTN@xftntext[#1]}

\makeatother

\usepackage[hyperfootnotes=false]{hyperref}
%\usepackage{hyperref}
\usepackage{varwidth}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{tabu}

\begin{document}

\begin{table}[htbp]
\begin{varwidth}{\textwidth}
\caption{Testing table}
\renewcommand{\footnoterule}{\vspace{-0.5\skip\footins}}
%\renewcommand{\footnoterule}{}
\begingroup\pushftn
\begin{tabu} to \linewidth{lX}
\toprule
a & b\footnote{AB} \\
\midrule
c & d\footnote{CD} \\
\bottomrule
\end{tabu}
\endgroup\popftn
\end{varwidth}
\end{table}

\noindent
Some text 1\footnote{This is a footnote 1.}.
\noindent
Some text 2\footnote{This is a footnote 2.}.

\end{document}
share|improve this answer
    
Is the pushftn thing not the same as \begin{savenotes} provided by the footnote package? –  roelandvanbeek Apr 27 '13 at 10:32
\documentclass{article}
\usepackage{tabu}
\usepackage{hyperref}   % this line is added.
\begin{document}
\begin{tabu}{c}
Cell \footnote{Footnote}
\end{tabu}
\end{document}

As @cacamailg said in comment, "It works if you load hyperref after tabu". Thank you, @cacamailg.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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