Home > Coding, LaTeX > LaTeX: adding footnotes in tables (or other floats)

LaTeX: adding footnotes in tables (or other floats)

June 15th, 2009

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:

  1. Include the “fmtcount” package so that you can display the values of counters (e.g., the footnote counter):
    \usepackage{fmtcount}
  2. Immediately before your tabular, increment the footnote counter:
    \addtocounter{footnote}{1}
  3. Next, specify the contents of the footnote:
    \footnotetext[\value{footnote}]{your text here}
  4. 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}

David Underhill Coding, LaTeX , , , , , ,

  1. 2b
    July 9th, 2009 at 02:16 | #1

    Thanks a lot!

  2. August 5th, 2009 at 18:08 | #2

    Thanks a lot! It works fine

  3. August 18th, 2009 at 10:07 | #3

    Its really helpful to solve the problem. Thanks for sharing!!!

  4. Mario
    September 9th, 2009 at 02:28 | #4

    Thank you, helpful.

  5. Brandon Heller
    September 29th, 2009 at 00:42 | #5

    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.

  6. Jason
    October 3rd, 2009 at 23:38 | #6

    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.

  7. Yue
    November 25th, 2009 at 14:51 | #7

    Thank you Jason. The threeparttable worked for me!!

  8. bummen
    December 31st, 2009 at 04:00 | #8

    Excellen share Jason.. thank you very much.. perfect solution

  9. Sami
    January 8th, 2010 at 20:25 | #9

    How to change the style of the footnote to appear the numbers in prackets
    like (1), (2) instead of: 1. 2.
    thanks

  10. February 21st, 2010 at 06:22 | #10

    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.

  1. No trackbacks yet.