我需要在表格上添加腳註,如下例所示,取自物理評論 B:
自從物理。 Rev. B 是用 LaTeX 寫的(修訂版),我相信這對於任何課程都應該是可能的。我正在將經典論文與 ArsClassica 包一起使用。我已經使用小型頁面實現了非常相似的目標:
\begin{table}
\begin{minipage}{\textwidth}
\centering
\begin{tabular}{l c c c c c c}
\toprule
& $a$ (\si{\angstrom}) & $c/a$ & $u$ & $B_0$ (\si{\giga\pascal}) & $B_0'$ & $E_g$ (\si{\electronvolt})\\
\midrule
GGA & \num{3.126} & \num{1.602} & \num{0.382} & \num{191} & \num{3.67} & \num{4.10}\\
GGA\footnote{\cite{Stampfl1999}.} & \num{3.113} & \num{1.619} & \num{ 0.380} & \num{192} & \num{3.69} & \num{4.25}\\
GGA\footnote{\cite{Zoroddu2001}.} & \num{3.110} & \num{1.606} & \num{0.382} & - & - & - \\
Exp.\footnote{\cite{Stampfl1999}.} & \num{3.111} & \num{1.601} & \num{0.385} & \num{185}-\num{212} & \num{5.7}-\num{6.3}& \num{6.28} \\
Exp.\footnote{\cite{Schulz1977}.} & \num{3.110} & \num{1.601} & \num{0.382} & \num{202} & - & - \\
\bottomrule
\end{tabular}
\end{minipage}
\caption{Caption on top.}
\end{table}
這是結果:
然而,在這裡你可以發現一個大問題:由於我使用了 width 的小頁\textwidth
,腳註沒有與表格對齊(如範例所示)。有可能實現這種對齊嗎?如何?
根據伯納德的回答,我使用了這個:
\begin{table}
\centering
\begin{threeparttable}
\caption{Comparison of calculated binding energy and bond lengths for \ce{O2} and \ce{N2} with experimental and other theoretical values.}
\begin{tabular}{l c c c c}
\toprule
& $E_b^\text{\ce{O2}}$ (\si{\electronvolt}) & $d_\text{\ce{O}-\ce{O}}$ (\si{\angstrom})& $E_b^\text{\ce{N2}}$ (\si{\electronvolt}) & $d_\text{\ce{N}-\ce{N}}$ (\si{\angstrom})\\
\midrule
GGA & \num{-5.855} & \num{1.215} & \num{-10.138} & \num{1.096} \\
GGA\tnote{a}& - & - & \num{-9.867}& \num{1.105}\\
GGA\tnote{b} & - & - & \num{-10.558} & \num{1.113}\\
Exp.\tnote{c} & \num{-5.12} & \num{1.21} & - & - \\
Exp.\tnote{a} & - & - & \num{-9.9}& \num{1.10}\\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[a] \cite{Stampfl1999}.
\item[b] \cite{Zoroddu2001}.
\item[c] \cite{Wang2008}.
\end{tablenotes}
\end{threeparttable}
\end{table}
然而,在我看來,標題有一個問題,它顯然受限於表格的相同長度:
答案1
您可以使用 來做到這一點threeparttable
,它定義了一個同名環境和一個tablenotes
環境。如果將標題放在table
和threeparttable
環境之間,標題的寬度將為textwidth
;如果你把它裡面 threeparttable
,它的寬度將是表格的實際寬度:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{booktabs, caption}
\captionsetup{labelfont=sf, width =\textwidth}
\usepackage{siunitx}
\usepackage[flushleft]{threeparttable}
\begin{document}
\begin{table}[!htbp]
\centering
\caption{Caption on top. A long long long and very very silly caption . A long long long and very very silly caption.}
\begin{threeparttable}
\begin{tabular}{l c c c c c c}
\toprule
& $a$ (\si{\angstrom}) & $c/a$ & $u$ & $B_0$ (\si{\giga\pascal}) & $B_0'$ & $E_g$ (\si{\electronvolt}) \\
\midrule
GGA & \num{3.126} & \num{1.602} & \num{0.382} & \num{191} & \num{3.67} & \num{4.10} \\
GGA\tnote{a} & \num{3.113} & \num{1.619} & \num{ 0.380} & \num{192} & \num{3.69} & \num{4.25} \\
GGA\tnote{b} & \num{3.110} & \num{1.606} & \num{0.382} & -- & -- & -- \\
Exp.\tnote{c} & \num{3.111} & \num{1.601} & \num{0.385} & \num{185}-\num{212} & \num{5.7}-\num{6.3} & \num{6.28} \\
Exp.\tnote{d} & \num{3.110} & \num{1.601} & \num{0.382} & \num{202} & -- & -- \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[a]\cite{Stampfl1999}
\item[b]\cite{Zoroddu2001}
\item[c]\cite{Stampfl1999}
\item[d]\cite{Schulz1977}
\end{tablenotes}
\end{threeparttable}
\label{table2}
\end{table}
\begin{table}[!htbp]
\centering
\begin{threeparttable}
\caption{Caption on top. A long long long and very very silly caption . A long long long and very very silly caption.}
\begin{tabular}{l c c c c c c}
\toprule
& $a$ (\si{\angstrom}) & $c/a$ & $u$ & $B_0$ (\si{\giga\pascal}) & $B_0'$ & $E_g$ (\si{\electronvolt}) \\
\midrule
GGA & \num{3.126} & \num{1.602} & \num{0.382} & \num{191} & \num{3.67} & \num{4.10} \\
GGA\tnote{a} & \num{3.113} & \num{1.619} & \num{ 0.380} & \num{192} & \num{3.69} & \num{4.25} \\
GGA\tnote{b} & \num{3.110} & \num{1.606} & \num{0.382} & -- & -- & -- \\
Exp.\tnote{c} & \num{3.111} & \num{1.601} & \num{0.385} & \num{185}-\num{212} & \num{5.7}-\num{6.3} & \num{6.28} \\
Exp.\tnote{d} & \num{3.110} & \num{1.601} & \num{0.382} & \num{202} & -- & -- \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\item[a]\cite{Stampfl1999}
\item[b]\cite{Zoroddu2001}
\item[c]\cite{Stampfl1999}
\item[d]\cite{Schulz1977}
\end{tablenotes}
\end{threeparttable}
\label{table2}
\end{table}
\end{document}
答案2
OP 評論說他喜歡我的回答在圖形的 \caption 中使用 \footnote,儘管他/她對自動計算寬度感興趣minipage
。在這裡我展示瞭如何做到這一點。我將tabular
內容放入\def
以便於回憶,然後將其放入臨時\hbox
.然後我可以使用\wd0
寬度minipage
,並且只需調用tabular
其中定義的巨集的內容即可。
\documentclass[12pt]{article}
\usepackage{boxhandler}
\begin{document}
This is an alternate way to do a footnote in a table, with the minipage
environment.
\begin{table}[ht]
\def\tblcontent{\footnotesize\begin{tabular}{|l|c|c|}
\hline
Title & Column 1 & Column 2\\
\hline
First Test & 1.234 & 5.389\footnote{\scriptsize This is the
footnote text blah blah blah blahty blah}\\
\hline
Second Test & 3.894 & 1.586~~\\
\hline
\end{tabular}}
\setbox0=\hbox{\tblcontent}
\centering
\caption{Caption goes here}
\begin{minipage}{\wd0} % GUESS (OR CALCULATE) MINIPAGE WIDTH
\renewcommand\footnoterule{} % ELIMINATE LITTLE LINE SEPARATER
\tblcontent
\vspace{-2ex} % SHIFT FOOTNOTE UP
\end{minipage}
\end{table}
\end{document}