我想要一个带有标题和一些脚注的表格。我决定使用 threeparttable。当我\tnote{1}
在表格行之一中使用代码时,它会正确显示1。但是当我在表格的标题中使用此代码时,它不会显示任何内容。根据这个 pdf,
\tnote 命令也可以在标题中给出,但它们不会出现在表格列表中。
这仅仅是一个不受支持的功能,还是我做错了什么?这是我的表格(精简版):
\begin{table}[h]
\caption{List of bridges.\tnote{1}}
\label{tb:listbridges}
\begin{center}
\begin{threeparttable}
\begin{tabular}{llll}
\toprule
\textbf{Name} & \textbf{Span (m)} & \textbf{Location} & \textbf{Year} \\ \midrule
Bridge 1 & 255 & Place 1 & 2010 \\
\\ \bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Adapted from data received from ...
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{table}
答案1
标题必须删除里面环境threeparttable
。
\documentclass{article}
\usepackage{threeparttable,booktabs}
\begin{document}
\begin{table}[htp]
\centering % no center environment
\begin{threeparttable}
\caption{List of bridges.\tnote{1}}
\label{tb:listbridges}
\begin{tabular}{llll}
\toprule
\textbf{Name} & \textbf{Span (m)} & \textbf{Location} & \textbf{Year} \\
\midrule
Bridge 1 & 255 & Place 1 & 2010 \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Adapted from data received from ...
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
当处于环境之外时,命令\tnote
会简单地吞噬其参数threeparttable
。
答案2
我想指出的是,如果您使用threeparttablex
and longtable
,则可以将表格注释插入到您想要的任何位置。语法略有不同:表格注释在TableNotes
环境开头的环境中声明ThreePartTable
,并使用命令插入\insertTableNotes
。这是一个演示:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{caption}
\usepackage{threeparttablex, longtable, booktabs}
\begin{document}
\begin{table}[!h]
\centering
\begin{threeparttable}
\caption{List of bridges.\tnote{1}} \label{tb:listbridges}
\begin{tabular}{llll}
\toprule
\textbf{Name} & \textbf{Span (m)} & \textbf{Location} & \textbf{Year} \\ \midrule
Bridge 1 & 255 & Place 1 & 2010 \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Adapted from data received from ...
\end{tablenotes}
\end{threeparttable}
\end{table}
%%
\begin{ThreePartTable}
\setTableNoteFont{\footnotesize}
\begin{TableNotes}\footnotesize
\item[1] Adapted from data received from ...
\end{TableNotes}
\begin{longtable}{llll}
\caption{List of bridges.\tnote{1}} \label{tb:listbridges}\\[-1ex]
\insertTableNotes\\[0.5ex]
\toprule
\endfirsthead
\endhead
\bottomrule
\endfoot
\bottomrule
\insertTableNotes\\
\endlastfoot
\textbf{Name} & \textbf{Span (m)} & \textbf{Location} & \textbf{Year} \\ \midrule
Bridge 1 & 255 & Place 1 & 2010 \\
\end{longtable}
\end{ThreePartTable}
\end{document}