Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a simple, elegant solution to add footnotes in a table (tabular)? Preferably, the solution can also support the cleveref package.

EDIT: My intended effect is that, the footnotes should be displayed at the bottom of the page, just as regular footnotes are. However, I've checked out ctable package but found no such feature. Am I missing something?

share|improve this question
4  
Have a look at Footnotes in tables. If this helps, we would close this question as a duplicate. To avoid closing, you could edit your question so that it's different, if it's the case. –  Stefan Kottwitz Nov 17 '11 at 19:18
    
@StefanKottwitz I've checked that out. But I don't think it contains sufficient details for me to follow. –  Covi Nov 17 '11 at 19:28
    
@Covi As quinmars says in his answer, some more detail on what you want would be useful. Footnotes in tables are generally regarded as a 'bad thing' if they are not visually 'part' of the table, but you may of course need this. –  Joseph Wright Nov 17 '11 at 20:49

4 Answers 4

up vote 5 down vote accepted

The usual advice is not to have 'standard' footnotes in tables: if the float ends up on a different page to the footnotes then things are very confusing. With that important proviso, an approach which can be taken is to save the footnotes in the table environment and reinsert them afterwards. You could overwrite the standard \footnote macro to do this, but I feel it's best not to. A possible approach:

\documentclass{article}
\newcommand*{\savedfootnotes}{}
\newcommand*{\resetsavedfootnotes}{\global\let\savedfootnotes\empty}
\newcommand{\tablefootnote}[1]%
  {%
    \footnotemark
    \xdef\savedfootnotes%
      {\unexpanded\expandafter{\savedfootnotes}\noexpand\footnotetext{#1}}%
  }
\edef\endtable%
  {%
    \aftergroup\noexpand\savedfootnotes
    \aftergroup\noexpand\resetsavedfootnotes
    \unexpanded\expandafter{\endtable}%
  }
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{table}
  \begin{tabular}{c}
    A \\
    B\tablefootnote{Stuff} \\
  \end{tabular}
\end{table}
\end{document}
share|improve this answer

Use the tablefootnote package and \tablefootnote{...} inside the table:

\documentclass{article}
\usepackage{hyperref}
\usepackage{tablefootnote}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ c  c }
Test1\tablefootnote{Footnote 1} & Test2\tablefootnote{Footnote 2} \\ 
\end{tabular}
\caption{This is a table.\label{FirstTable}}
\end{table}

A pagebreak:

\pagebreak

and a second page, so that you can see that the hyperlinks really work.

\end{document}

\listfiles result:

     *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
   float.sty    2001/11/08 v1.3d Float enhancements (AL)
placeins.sty    2005/04/18  v 2.2
rotating.sty    2009/03/28 v2.16a rotated objects in LaTeX
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/message (HO)
 ltxcmds.sty    2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
hyperref.sty    2011/12/04 v6.82m Hypertext links for LaTeX
hobsub-hyperref.sty    2011/04/23 v1.4 Subsetting bundle oberdiek (HO)
hobsub-generic.sty    2011/04/23 v1.4 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2011/04/23 v1.4 Subsetting bundle oberdiek (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2011/06/15 v1.14 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/07/28 v0.19 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/04/04 v1.12 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2011/01/30 v1.2 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/04/23 v1.7 Hooks at very end of document (HO)
atbegshi.sty    2011/01/30 v1.15 At begin shipout hook (HO)
refcount.sty    2011/06/22 v3.3 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
kvoptions.sty    2010/12/23 v3.10 Keyval support for LaTeX options (HO)
  pd1enc.def    2011/12/04 v6.82m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2006/04/12 v3.3 Verb mode for urls, etc.
 hpdftex.def    2011/12/04 v6.82m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
tablefootnote.sty    2012/01/01 v1.0f Table foot notes (HMM)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
supp-pdf.mkii
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Managing graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 nameref.sty    2010/04/30 v2.40 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
share|improve this answer
    
Thanks. I decided to give it a try and I followed the README document to manually install the package. However, even after initexmf --update-fndb, neither pdflatex nor latex could compile. I'm using MikTex. Have any ideas? –  Covi Nov 19 '11 at 0:02
    
@Covi: 1. Already the compilation of the example did not work (vs. compilation when used in your document), right? 2. Due to a \numexpr tablefootnote requires e-TeX. That is included in MikTex, isn't it? Placing \listfiles before \begin{document} will list the used files, including etex.sty (if found!) at the end of the log-file. I'll add the result I got at the end of the answer. 3. Was there an error-message given? Which one? –  Stephen Nov 19 '11 at 15:31
    
@Covi: The tablefootnote package has been updated (latest version: 2012/01/01 v1.0f) and no longer requires eTeX and neither the packages amstext, setspace and subcaption. I updated the \listfiles result of the (pdflatex) compiled tablefootnote-example.tex, which is provided by the package. Please check whether compilation is possible for you now. (In the file list etexcmds.sty, etoolbox.sty, and etex.sty are contained, because eTeX was availabe.) –  Stephen Jan 12 '12 at 19:50

I have successfully used the ctable package. It provides a way to display tables and is a sort of combination of the table and tabular environment. Infact it is using the tabular environment, but it is not an extension to that itself.

Maybe you can specify in more detail what you want to do. Do you want to have the tabular inside of a table floating environment? Do you expect the footnotes to appear at the bottom of the table or at the bottom of the page or even at the end of the chapter/book?

EDIT: As Joseph Wright already mention, the footnotes in a table or figure should be a visible belong to the table or figure. As far as I know the ctable package only supports such 'table notes'. In this FAQ the author mention some technics to achieve footnotes at the bottom. I haven't tried one of them, so I cannot tell you which one works best.

share|improve this answer
    
Thanks. Yes, I'd like to have a tabular inside a table. And the footnotes should appear at the bottom of that page (just as regular footnotes do). –  Covi Nov 17 '11 at 23:09
    
Please have a look at my edit. –  Covi Nov 18 '11 at 5:04

Use ftnxtra package:

\documentclass{article}
\let\mytabular\tabular
\let\endmytabular\endtabular
\usepackage{ftnxtra}
\let\tabular\mytabular
\let\endtabular\endmytabular
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|}\hline
One&Two\\ \hline
Three\footnote{This is a footnote.}&Four\\ \hline
\end{tabular}
\caption{This is a table.}
\end{table}
\end{document}
share|improve this answer
    
Unfortunately, it does not work with hyperlinked footnotes (i.e. the hyperlink (hyperref-package) form a footnote-mark in a table does not lead to the footnote-text). –  Stephen Nov 30 '11 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.