LaTeX: footnotes in tables

Although an apparently widely known LaTeX issue, I came across it just today. Fact is if you use \footnote inside a \tabular environment, the footnote will be “trapped” inside the table, and actually never get displayed at all in the output.

You can find some possible solutions for that at the UK TeX FAQ on the Web.

The trick I’ll comment here is to use \tabularx, which is covered in the link above, and also at J.L. Diaz’s LaTeX blog[es].

The “problem” is that \tabularx requires a fixed table width value to be input by the user, so the following will fail misserably:

\usepackage{tabularx} % required in the preamble
\begin{tabularx}{100mm}{|c|c|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

Why? Because the {c} especification (to center the text inside the cell) makes the affected column as wide as necessary, not more (so will {r} or {l}). The output can be seen below:

The effect of the whole table being actually wider than the sum of the integrating colums could be partially “concealed” if the \hlines were eliminated, but the table would still be actually incorrectly wide, which would make things like aligning the whole table “fail” (to the eye).

Fortunately, the tabularx package provides a way to tell LaTeX that a column must be of the necessary width, so that the sum of colum widths equals the total column width. This is the {X} keyword (notice the capitalization of the “X”). E.g.:

\begin{tabularx}{100mm}{|c|X|} \hline
A & B \\ \hline
C & D \\ \hline
\end{tabularx}

This makes the first column just as wide as needed, not more (the {c}), and then, the second column will be as wide as needed to reach the 100mm. The output:

If multiple columns are given the {X} keyword, they will all have the same width, precisely the one required to meet the total table width.

3 Comments »

  1. LaTeX: footnotes in tables « handyfloss said,

    September 18, 2008 @ 14:34 pm

    […] Entry available at: http://handyfloss.net/2006.09/latex-footnotes-in-tables/ […]

  2. Dre said,

    September 9, 2011 @ 20:07 pm

    This has nothing at all to do with footnotes in tables.

  3. isilanes said,

    September 19, 2011 @ 9:43 am

    I infer you are disappointed because you searched for “footnote table latex”, and found this page, which apparently does not address the problem you have. Well, actually I do give a fix in the first sentence of the third paragraph: use \tabularx. I also give two links that would give a more complete set of workarounds if \tabularx does not suit you.

    The content of my post deals with fixing a problem that arises when using \tabularx (which in turn is used to fix a problem with \tabular). It is my understanding that if a solutions given in the links I provide (using \tabularx) generates a new problem (requiring a fixed with to work properly), then it is not a full solution for the original problem (placing footnotes inside \tabular environment), until this new problem is also fixed (to which I contribute with my post).

RSS feed for comments on this post · TrackBack URI

Leave a Comment