Footnote in tabular environment
For some reason (my preferred choice) the tablefootnote
package only works if you wrap the tabular
in a table
float. A way around is to use \footnotemark
and \footnotetext
:
\documentclass{scrartcl}
\begin{document}
before
\begin{tabular}{l}
Content\footnotemark\\
Content continued\footnotemark\\
Content continued further\footnotemark
\end{tabular}
\footnotetext[1]{Footnote}
\footnotetext[2]{Second footnote}
\footnotetext{Third footnote}
after
\end{document}
Note how manual numbering of all but the first footnotetext is necessary. In a longer document, an approach with manually decrementing and incrementing the footnote number might be more viable; that way, the only way you have to watch out for is decrementing by the correct number:
\documentclass{scrartcl}
\begin{document}
before
\begin{tabular}{l}
Content\footnotemark\\
Content continued\footnotemark\\
Content continued further\footnotemark
\end{tabular}
\addtocounter{footnote}{-2}
\footnotetext[1]{Footnote}
\addtocounter{footnote}{1}
\footnotetext{Second footnote}
\addtocounter{footnote}{1}
\footnotetext{Third footnote}
after
\end{document}
another possibility is with the footnote
package and \makesavenoteenv{tabular}
:
\documentclass{scrartcl}
\usepackage{footnote}
\makesavenoteenv{tabular}
\begin{document}
\begin{tabular}{l}
Content\footnote{footnote text}
\end{tabular}
\end{document}
If
one has both tabular-only environment and tabular inside table, it is possibile to load both \makesavenoteenv{tabular}
and \makesavenoteenv{table}
in the preamble, like this:
\documentclass{scrartcl}
\usepackage{footnote}
\makesavenoteenv{tabular}
\makesavenoteenv{table}
\begin{document}
\begin{table}
\begin{tabular}{l}
Content\footnote{footnote text}
\end{tabular}
\end{table}
\begin{tabular}{l}
Content\footnote{footnote text}
\end{tabular}
\end{document}
So to have a more general solution.
Also, a fairly comprehensive list of solutions can be found inside the documentation for the tablefootnote
package, starting from page 3, section "Alternatives".
You can also use threeparttable
package to insert footnotes in the tables.
\documentclass{article}
\usepackage[flushleft]{threeparttable}
\begin{document}
\begin{table}[h]
\caption{Example of test session results}
\label{tab:test_results}
\centering
\begin{threeparttable}
\begin{tabular}{|l|l|l|}
\hline
Mutants & CPU\tnote{1} & Memory\tnote{2} \\ \hline
Mutant-1 & 23 & 15 \\ \hline
Mutant-2 & 32 & 11 \\ \hline
\end{tabular}
\begin{tablenotes}
\item[1] Measured in percentages.
\item[2] Measured in kilobytes (KB).
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}