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 696 times

balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

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

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
  1. \begin{table}
  2. \centering
  3. \caption{Composition of AA2099}\label{2099comp}
  4. \smallskip
  5. \begin{minipage}{3.3cm}
  6. \centering
  7. \begin{tabular}{cc}
  8. \hline\hline
  9. Element & wt\% \\ \hline\hline
  10. Al\footnote{PHTTTT!!!} & bal \\
  11. Cu & 2.69 \\
  12. Li & 1.8 \\
  13. Zn\footnote{blahblah} & 0.6 \\
  14. Mg & 0.3 \\
  15. Mn & 0.3 \\
  16. Zr & 0.08 \\ \hline
  17. \end{tabular}\par
  18. \vspace{-0.75\skip\footins}
  19. \renewcommand{\footnoterule}{}
  20. \end{minipage}
  21. \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:
  1. \usepackage{threeparttable}

and this in the body of the document:
  1. \begin{table}
  2. \centering
  3. \caption{Composition of AA2099}\label{2099comp}
  4. \smallskip
  5. \begin{threeparttable}
  6. \begin{tabular}{cc}
  7. \hline\hline
  8. Element & wt\% \\ \hline\hline
  9. Al\tnote{a} & bal \\
  10. Cu & 2.69 \\
  11. Li & 1.8 \\
  12. Zn\tnote{b} & 0.6 \\
  13. Mg & 0.3 \\
  14. Mn & 0.3 \\
  15. Zr & 0.08 \\ \hline
  16. \end{tabular}
  17. \begin{tablenotes}
  18. \item[a] PHTTTT!!!
  19. \item[b] blahblah
  20. \end{tablenotes}
  21. \end{threeparttable}
  22. \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:
  1. \usepackage{ctable}

and this in the body of the document:
  1. \ctable[
  2. caption=Composition of AA2099,
  3. label=2099comp,
  4. %mincapwidth=3 cm,
  5. captionskip=\smallskipamount]{cc}%
  6. {\tnote[a]{PHTTTT!!!}
  7. \tnote[b]{blahblah}}
  8. { \hline\hline
  9. Element & wt\% \\ \hline\hline
  10. Al\tmark[a] & bal \\
  11. Cu & 2.69 \\
  12. Li & 1.8 \\
  13. Zn\tmark[b] & 0.6 \\
  14. Mg & 0.3 \\
  15. Mn & 0.3 \\
  16. 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

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

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

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 6 guests