## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Possible package/environment for tables with footnotes in them

Information and discussion about graphics, figures & tables in LaTeX documents.
kaiserkarl13
Posts: 612
Joined: Tue Mar 25, 2008 5:02 pm

### Possible package/environment for tables with footnotes in them

I tinkered around the last day or so to write a (short) package to make an environment that does "automatic" tables with footnotes under them. Some people call these "table notes." It basically stores the width of the table in the .aux file, then on the next run updates the width of the enclosing minipage to "hug" the table.

The primary purpose for this is to get the footnotes to have proper margins. For example,
\begin{minipage}{\linewidth}  \begin{tabular}{l l}  \hline  Hello & world!\footnote{This is a long footnote that will overhang the table} \\  Hello & again! \\  \hline  \end{tabular}\end{minipage}

will produce a footnote that goes well beyond the boundary of the table. Alternatively, one could add \centering inside the minipage, which would mean the footnote underruns both sides of the table. The only way I know of to do this "naturally" (i.e., with \footnote and without using packages like threeparttable that require a bit more manual control of things) is to manually set the width to the width of the table (which of course requires tweaking when the table's content changes).

With the new environment, the footnotes are always exactly the same as the width of the table itself (at least, they are after the second and subsequent runs). One can then apply centering (etc.) to the table, including footnotes, as a whole, which is typically what is desired. The result using the example above with this new environment (which I call "mptabular" for obvious reasons) produces the equivalent of
\begin{minipage}{78.19461pt}  \begin{tabular}{l l}  \hline  Hello & world!\footnote{This is a long footnote that will overhang the table} \\  Hello & again! \\  \hline  \end{tabular}\end{minipage}

Except that the user does not have to explicitly enter (or know) the width of the minipage.

The question I have is this: would this package be of interest to the community? If so, is it a duplication of something already out there, or does this functionality not yet exist?