## LaTeX forum ⇒ General ⇒ Adding footnotes to Tables

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

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

balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am
Use the threeparttable or ctable packages, they're done for that (and more in the case of ctable).

B.A.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 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.

Posts: 9
Joined: Mon Sep 24, 2007 10:28 pm
Thanks so much! I got it working. Good suggestions.

paulvanderheijden
Posts: 4
Joined: Sun Feb 17, 2008 2:34 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?

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am
I get both tables centered. Please, could you provide a complete minimal working example, not just a code snippet?