Code proposed by David Carlisle works out-of-the box, cause has no package dependencies. It's comfortable solution of dealing with footnotes in environments needing \footnotemark+footnotetext.
I have no problems in using it with \vbox and itemize.
However when I try to apply it to centred tabular I encounter problem - footnotes are not rendered, only footmarks:
\documentclass{report}
%Thanks to David Carlisle for pushftn and popftn : https://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
\begin{document}
\pushftn
\begin{table}[htbp]
\begin{center}
\begin{tabular}{ll}
\hline
X & Y \\
\hline
\hline
a & b \footnote{AB} \\
\hline
c & d \footnote{CD} \\
\hline
\end{tabular}
\end{center}
\end{table}
\popftn
\end{document}
What am I doing wrong?
tableenvironment builds a box; so\pushftnmust go inside it. Of course this will fail if the table is typeset as a page float. – egreg Feb 08 '12 at 15:39\begin{center}by\centeringand delete\end{center}. – Stephen Feb 08 '12 at 18:22