LaTeX: adding footnotes in tables (or other floats)
I recently wanted to put a footnote reference inside a table. Unfortunately, LaTeX makes it somewhat difficult to add footnotes inside floats (e.g., tabular). If you try to put a footnote inside a tabular, then pdflatex will show the reference but not the footnote itself! I came across several suggestions for fixing this:
One idea is to put the table in a minipage. This causes the footnote to show up at the bottom of the table (in its own numbering system) — but I wanted the footnote to show up at the bottom of the page like other footnotes!
Another idea was to manually specify the footnote number inside the text and then use the \footnotetext command (outside the tabular) to manually add the footer. Unfortunately, this is not a robust solution since it forces you to manually maintain this footnote number inside the tabular.
Building on the previous idea, I discovered a way to make footnotes appear inside tabulars without breaking the automatic numbering of footnotes. Here is my approach:
- Include the “fmtcount” package so that you can display the values of counters (e.g., the footnote counter):
\usepackage{fmtcount}
- Immediately before your tabular, increment the footnote counter:
\addtocounter{footnote}{1}
- Next, specify the contents of the footnote:
\footnotetext[\value{footnote}]{your text here}
- Finally, add a reference to the footnote inside the table:
$^{\decimal{footnote}}$
You can extend this idea to add multiple footnotes within a single tabular by adjusting the counters (using \addtocounter) appropriately. Here is a complete example of how to add two footnotes inside a single tabular (you can see the PDF output here):
\documentclass[12pt]{article} \usepackage{fmtcount} % displaying latex counters \begin{document} \title{An Example of Footnotes Inside a Tabular} \author{David Gridley Underhill} \maketitle % manually add a footnote which exists inside the table \addtocounter{footnote}{1} \footnotetext[\value{footnote}]{my first footnote} % add another footnote \addtocounter{footnote}{1} \footnotetext[\value{footnote}]{my second footnote} % reset the counter to the first footnote's value \addtocounter{footnote}{-1} \begin{tabular}{|l|l|} \hline % this next row references the first footnote I added above, and then % advances the counter to the next footnote. {\bf First Column} & {\bf Second Column}$^{\decimal{footnote}}$\addtocounter{footnote}{1} \\ \hline % now reference the second footnote from above -- don't increment the footnote % counter beyond the last footnote! X & Y$^{\decimal{footnote}}$ \\ \hline \end{tabular} \end{document}
Thanks a lot!
Thanks a lot! It works fine
Its really helpful to solve the problem. Thanks for sharing!!!
Thank you, helpful.
Thanks for the post, David!
I had a problem where I could see the inline footnote number in the table, but no footnote description was printed at the bottom of the page.
The solution was to move the \footnotetext block out of the table block that enclosed the tabular with my footnote. You might want to update the example with a tabular inside a table to show this.
Thanks for the post. I found it only AFTER I found another solution. I am not for sure which is more robust or which requires less typing. Here is the solution that I found searching TUG.
\usepackage{threeparttable}
\begin{table}
\begin{threeparttable}
\begin{tabular}{cc}
something weird\tnote{a} & something even weirder\tnote{b}
\end{tabular}
\begin{tablenotes}
\item [a] What is so weird?
\item [b] Oh that is what is weird
\end{tablenotes}
\end{threeparttable}
\end{table}
The surrounding table makes sure that table handles the float. There are some options that are provided by the package. Additionally, the package ctable will do something similar. However, ctable requires a totally new syntax structure for building the table. Thus, I used threeparttable and it WORKED.
Thank you Jason. The threeparttable worked for me!!
Excellen share Jason.. thank you very much.. perfect solution
How to change the style of the footnote to appear the numbers in prackets
like (1), (2) instead of: 1. 2.
thanks
It is possible to use \footnotemark which will increase the counter by one automatically and then set the text via \footnotetext{text}. Works fine in my LaTeX-file.