简体   繁体   中英

Footnotes for tables in LaTeX

When I do \\footnote{} for a value in a table, the footnote doesn't show up. How do I get it to show up? Also, is it possible to get it to show up at the bottom of the table rather than the bottom of the page?

This is a classic difficulty in LaTeX.

The problem is how to do layout with floats (figures and tables, an similar objects) and footnotes. In particular, it is hard to pick a place for a float with certainty that making room for the associated footnotes won't cause trouble. So the standard tabular and figure environments don't even try.

What can you do:

  1. Fake it. Just put a hardcoded vertical skip at the bottom of the caption and then write the footnote yourself (use \\footnotesize for the size). You also have to manage the symbols or number yourself with \\footnotemark . Simple, but not very attractive, and the footnote does not appear at the bottom of the page.
  2. Use the tabularx , longtable , threeparttable[x] (kudos to Joseph ) or ctable which support this behavior.
  3. Manage it by hand. Use [h!] (or [H] with the float package) to control where the float will appear, and \\footnotetext on the same page to put the footnote where you want it. Again, use \\footnotemark to install the symbol. Fragile and requires hand-tooling every instance.
  4. The footnote package provides the savenote environment, which can be used to do this.
  5. Minipage it (code stolen outright , and read the disclaimer about long caption texts in that case):
\begin{figure}
      \begin{minipage}{\textwidth}
        ...
        \caption[Caption for LOF]%
          {Real caption\footnote{blah}}
      \end{minipage}
    \end{figure}

Additional reference: TeX FAQ item Footnotes in tables .

The best way to do it without any headache is to use the \\tablefootnote command from the tablefootnote package. Add the following to your preamble:

\usepackage{tablefootnote}

It just works without the need of additional tricks.

A maybe not-so-elegant method, which I think is just a variation of what some other people have said, is to just hardcode it. Many journals have a template that in some way allows for table footnotes, so I try to keep things pretty basic. Although, there really are some incredible packages already out there, and I think this thread does a good job of pointing that out.

\documentclass{article}
\begin{document}
\begin{table}[!th]
\renewcommand{\arraystretch}{1.3} % adds row cushion
\caption{Data, level$^a$, and sources$^b$}
\vspace{4mm}
\centering
\begin{tabular}{|l|l|c|c|}
  \hline      
  \textbf{Data}  & \textbf{Description}   & \textbf{Level} & \textbf{Source} \\
  \hline      
  \hline
  Data1  &  Description. . . . . . . . . . . . . . . . . .   &  cnty & USGS \\
  \hline
  Data2  &  Description. . . . . . . . . . . . . . . . . .   &  MSA & USGS \\
  \hline
  Data3  &  Description. . . . . . . . . . . . . . . . . .   &  cnty & Census  \\
  \hline  
\end{tabular}
\end{table}
\footnotesize{$^a$ The smallest spatial unit is county, $^b$ more details in appendix A}\\
\end{document}

上面代码的输出

If your table is already working with tabular , then easiest is to switch it to longtable , remembering to add

\usepackage{longtable}

For example:

\begin{longtable}{ll}
  2014--2015 & Something cool\footnote{first footnote} \\
  2016-- & Something cooler\footnote{second footnote}
\end{longtable}

Use minipage environment. Here is an example:

\begin{minipage}{6cm}
\begin{tabular}{|l|c|c|}
    \hline
    A & 1 & 2 \footnote{This is a footnote.} \\
    \hline
    B & 2 & 1 \\
    \hline
    C & 3 & 3 \\
    \hline
\end{tabular}
\end{minipage}

可能最好的解决方案是查看threeparttable/threeparttablex 包。

在此处输入图片说明

you could just add a \\multirow at the end. Here is an example:

\begin{table}[]
    \centering
    \caption{Caption}
    \label{tab:my_label}
    \begin{tabular}{l c c}  
    \toprule
\multirow{2}{*}{Propriedades}                 & \multicolumn{2}{c}{Resultados do modelo} & Dados \\
                                              & MN S    & MN F      &  experimentais \\ \midrule
Resistência de entrada ($R_{in}$), M$\Omega$  & 2,2     & 0,9       & \\
Constante de tempo ($\tau$), ms               & 10,3    & 5,6       & \\
Reobase ($I_{rheo}$), nA                      & 4,5     & 17        & \\
Duração da AHP, ms                            & 137,2   & 66,2      & \\ \bottomrule
\multicolumn{4}{l}{\small *THIS IS A NICE FOOTNOTE.} \\
    \end{tabular}

\end{table}
\begin{figure}[H]
\centering
{\includegraphics[width=1.0\textwidth]{image}}
\caption{captiontext\protect\footnotemark}
\label{fig:}
\end{figure}
\footnotetext{Footnotetext} 

在表格中,我使用了 \\footnotetext。

What @dmckee said.

It's not difficult to write your own bespoke footnote-queuing code. What you need to do is:

  1. Write code to queue Latex code — like a hook in emacs: very standard technique, if not every Latex hacker can actually do this right;
  2. Temporarily redefine \\footnote to add a footnote macro to your queue;
  3. Ensure that the hook gets called when the table/figure exits and we return to regular vertical mode.

If this is interesting, I show some code that does this.

Use "tablenotes"

\begin{table*}

\centering
\caption{}
\begin{tabular}{|c|c|}
--------
\end{tabular}

##################
\begin{tablenotes}
   \item[*] \\Insert footnote here
\end{tablenotes}
################## 

\label{tab: label}
\end{table*}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM