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. Wavatar
    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. Wavatar
    Mario
    September 9th, 2009 at 02:28 | #4

    Thank you, helpful.

  5. Wavatar
    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. Wavatar
    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. Wavatar
    Yue
    November 25th, 2009 at 14:51 | #7

    Thank you Jason. The threeparttable worked for me!!

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

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

  9. Wavatar
    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.

  11. Wavatar
    Vincent Gibbs
    March 24th, 2010 at 08:34 | #11

    Why not just use: \protect\footnotemark[1] then use \footnotetext[1]{your text} where ever you want the foot not to appear.

  12. Wavatar
    Bernardes
    April 24th, 2010 at 23:04 | #12

    Other way very simple is to make:

    \newcommand{\newfootnotemark}[1]{\addtocounter{footnote}{#1} \footnotemark[\value{footnote}]}
    \newcommand{\newfootnotetext}[2]{\addtocounter{footnote}{#1} \footnotetext[\value{footnote}]{#2}}

    in the preamble and to use as

    \begin{table}[htb]
    \centering
    \large
    \setlength{\arrayrulewidth}{2\arrayrulewidth}
    \setlength{\belowcaptionskip}{10pt}
    \caption{\it Caption da Tabela.}
    \begin{tabular}{|l|r|}
    \hline
    \multicolumn{2}{|c|}{\textbf{Mesclar Duas Colunas}} \\
    \hline
    \textbf{Módulo} & \textbf{Dias}\\
    \hline
    Modulo I & 10 \newfootnotemark{1} \\
    \hline
    Módulo II & 5 \newfootnotemark{1}\\
    \hline
    \end{tabular}
    \end{table}

    \newfootnotetext{-1}{Nota do Módulo I.}
    \newfootnotetext{1}{Nota do Módulo II.}

  13. Wavatar
    Bambar
    May 10th, 2010 at 13:54 | #13

    Thank you Jason. It also worked for me. Nice!

  14. Wavatar
    A Okasha
    July 21st, 2010 at 06:00 | #14

    Thanks a lot.
    That’s really help

  15. Wavatar
    Fio
    August 14th, 2010 at 17:50 | #15

    Hi, another much more easy way to get this is simply to put the footnotes in the “longtable” environment instead in the standard “table”, without any other action or command ;-)

  16. Wavatar
    Chris
    September 27th, 2010 at 12:20 | #16

    @Fio After spending hours searching for an easy way to do this, your solution fixed the problem in 60 seconds. Thank you!

  17. Wavatar
    matt
    December 17th, 2010 at 15:24 | #17

    Thanks a lot!

  18. Wavatar
    Pestilence
    January 14th, 2011 at 13:53 | #18

    Thank you! Very helpful :)

  19. Wavatar
    RP
    January 22nd, 2011 at 17:33 | #19

    Hi. I wanted the footnotes at the end of the table but had problems using ctable. Since there were only two footnotes, I decided to add them manually. The references were written at the desired places in math mode, $^1$, $^2$. Then, for the footnote text, each line the bottom at of the table was written as a multicolumn in footnotesize. (I added some raisebox for aesthetics). It worked fine for me.

  20. February 3rd, 2011 at 12:50 | #20

    Hi David,
    Thanks for sharing your solution. Unfortunately, it doesn’t with the \begin{table}…\end{table} surrounding the ‘tabular’ format. Any suggestions?
    Paul

  21. February 15th, 2011 at 05:02 | #21

    @Paul Korir
    Did you try what Bernardes suggested in his comment above? Perhaps that will do the trick.

  22. Wavatar
    Paul Korir
    June 9th, 2011 at 08:52 | #22

    I ended up using \footnotemark to do what I needed. Thanks for the follow-up, though.
    Paul

  23. Wavatar
    Petra
    September 22nd, 2011 at 09:42 | #23

    Neat! Thanks.

  24. Wavatar
    Jay
    December 9th, 2011 at 10:37 | #24

    Kudos Jason. And thank you David.

  1. August 22nd, 2011 at 18:42 | #1