LaTeX forum ⇒ Graphics, Figures & TablesPossible 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

Postby kaiserkarl13 » Fri Jan 11, 2019 2:45 am

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,
  1. \begin{minipage}{\linewidth}
  2. \begin{tabular}{l l}
  3. \hline
  4. Hello & world!\footnote{This is a long footnote that will overhang the table} \\
  5. Hello & again! \\
  6. \hline
  7. \end{tabular}
  8. \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
  1. \begin{minipage}{78.19461pt}
  2. \begin{tabular}{l l}
  3. \hline
  4. Hello & world!\footnote{This is a long footnote that will overhang the table} \\
  5. Hello & again! \\
  6. \hline
  7. \end{tabular}
  8. \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?

Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests