LaTeX forum ⇒ GeneralAdding footnotes to Tables

LaTeX specific issues not fitting into one of the other forums of this category.
BNPadgett
Posts: 9
Joined: Mon Sep 24, 2007 10:28 pm

Adding footnotes to Tables

Postby BNPadgett » Thu Feb 07, 2008 8:07 am

I have tried adding footnotes to a table using minipage command (I found it on a string in this community). Unfortunately it is not working at all. Below is my code. Suggestions?

Thanks!!!
Attachments
tableexample.tex
(562 Bytes) Downloaded 964 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: Adding footnotes to Tables

Postby balf » Thu Feb 07, 2008 2:57 pm

Use the threeparttable or ctable packages, they're done for that (and more in the case of ctable).

B.A.

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Adding footnotes to Tables

Postby Juanjo » Fri Feb 08, 2008 12:18 am

BNPadgett, the thread to which you refer is this one. Choose one of the following approaches:

1.- Direct approach
\begin{table}
  \centering
  \caption{Composition of AA2099}\label{2099comp}
  \smallskip
  \begin{minipage}{3.3cm}
    \centering
    \begin{tabular}{cc}
      \hline\hline
      Element &  wt\% \\  \hline\hline
      Al\footnote{PHTTTT!!!} &  bal \\
      Cu &       2.69 \\
      Li &        1.8 \\
      Zn\footnote{blahblah} &        0.6 \\
      Mg &        0.3 \\
      Mn &        0.3 \\
      Zr &       0.08 \\  \hline
   \end{tabular}\par
   \vspace{-0.75\skip\footins}
   \renewcommand{\footnoterule}{}
  \end{minipage}
\end{table}

The width of the minipage should be equal or a bit bigger than that of the table. This is the unique parameter you have to fix.
You could put the \caption command inside the minipage environment, but this looks bad for narrow tables.

2.- Using the threeparttable package
Put this in the preamble:
\usepackage{threeparttable}

and this in the body of the document:
\begin{table}
  \centering
  \caption{Composition of AA2099}\label{2099comp}
  \smallskip 
  \begin{threeparttable}
      \begin{tabular}{cc}
         \hline\hline
         Element &  wt\% \\  \hline\hline
         Al\tnote{a} &  bal \\
         Cu &       2.69 \\
         Li &        1.8 \\
         Zn\tnote{b} &        0.6 \\
         Mg &        0.3 \\
         Mn &        0.3 \\
         Zr &       0.08 \\  \hline
     \end{tabular}
     \begin{tablenotes}
       \item[a] PHTTTT!!!
       \item[b] blahblah
     \end{tablenotes}
  \end{threeparttable}
\end{table}

The \caption command can go inside the threeparttable environment, which yields bad results for too narrow tables.

3.- Using the ctable package
Put this in the preamble:
\usepackage{ctable}

and this in the body of the document:
\ctable[
  caption=Composition of AA2099,
  label=2099comp,
  %mincapwidth=3 cm,
  captionskip=\smallskipamount]{cc}%
{\tnote[a]{PHTTTT!!!}
\tnote[b]{blahblah}}
{ \hline\hline
  Element &  wt\% \\  \hline\hline
  Al\tmark[a] &  bal \\
  Cu &       2.69 \\
  Li &        1.8 \\
  Zn\tmark[b] &        0.6 \\
  Mg &        0.3 \\
  Mn &        0.3 \\
  Zr &       0.08 \LL}

By default, the width of the caption is that of the table, which, once again, is problematic for narrow tables. It can be adjusted through the mincapwidth key. Uncomment the corresponding line and try with different values. But, look what happens to the footnotes when you increase mincapwidth to improve the appearance of the caption... Surprise! They move to the left, far away from the table. By the way, since ctable and threeparttable both use the \tnote command, these packages are not compatible without some hack.

Summarizing, test the three alternatives and choose which you want.
Last edited by Juanjo on Sat Feb 09, 2008 10:55 pm, edited 1 time in total.

BNPadgett
Posts: 9
Joined: Mon Sep 24, 2007 10:28 pm

Re: Adding footnotes to Tables

Postby BNPadgett » Sat Feb 09, 2008 9:53 pm

Thanks so much! I got it working. Good suggestions.

paulvanderheijden
Posts: 4
Joined: Sun Feb 17, 2008 2:34 pm

Re: Adding footnotes to Tables

Postby paulvanderheijden » Wed Mar 12, 2008 1:02 pm

Does anyone have a fix for this?

This table goes center aligned:
\begin{table}
\centering
\begin{tabular}{ll}
a & b \\
c & d \\
\end{tabular}
\end{table}

This one does not:
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{ll}
a & b \\
c & d \\
\end{tabular}
\end{threeparttable}
\end{table}

The moment I use threeparttable (with or without tablenotes, with \centering or \begin{center}), the caption stays centered but the table including notes go left aligned. I want the caption and table in the center. How do I fix this?

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Adding footnotes to Tables

Postby Juanjo » Wed Mar 12, 2008 1:19 pm

I get both tables centered. Please, could you provide a complete minimal working example, not just a code snippet?


Return to “General”

Who is online

Users browsing this forum: No registered users and 23 guests