Have you ever tried to add a footnote to a table inside the tabular
environment? Even though the index is printed, the search for the actual footnote will be in vain.
One way to overcome this issue is by using longtable. The package handles footnotes really well. But it may be an overkill if your table is small.
Also, I read the tabularx
package also handles footnotes correctly, I haven’t tested it though.
Another, more appropriate solution would be using the minipage environment. Here is an example:
\begin{minipage}{6cm} \begin{tabular}{|l|c|c|} \hline A & 1 & 2 \footnote{This is a footnote.} \\ \hline B & 2 & 1 \\ \hline C & 3 & 3 \\ \hline \end{tabular} \end{minipage}
Obviously, the footnote is placed right below the table, which may or may not be what you want. In addition, since minipage
is not a floating environment, adding a caption inside the minipage
environment gives the following error message: “LaTeX Error: \caption outside float”. If you want to send the footnote to the bottom of the page and replace the index with a number rather than a alphabetic character, you may use the minipage*
-environment of the footnote package:
\documentclass[12pt]{article} \usepackage{footnote} \begin{document} \begin{minipage*}{6cm} \begin{tabular}{|l|c|c|} \hline A & 1 & 2 \footnote{This is a footnote.} \\ \hline B & 2 & 1 \\ \hline C & 3 & 3 \\ \hline \end{tabular} \end{minipage*}
The code above places the footnote where and how we want it, but the issue with the caption remains.
What finally saved my day was having a look at the documentation of the footnote package. It provides the savenotes
environment, which collects all footnotes inside the tabular
where they get stuck and “releases” them at the end. Here is an example:
\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}
Update: conflict with xcolor package
There is a conflict between the xcolor
and the footnote
packages. You can fix it by first loading the xcolor
package.
The error you will see is either:
Missing } inserted.
or
Extra }, or forgotten \endgroup
