\begin{table}[h!]
\centering
\caption{Test Data for Liquid limit, this are the measurements necessary that we needed to get in order to calculate the moisture content of our soil sample.}
\begin{tabu}{*{5}{x[c]}}
\toprule
\textbf{Property} & \textbf{Unit} & \textbf{Test 1} & \textbf{Test 2} & \textbf{Test 3} \\
\midrule
Blows & - & 25 & 17 & 15 \\
Oven Can ID & - & Red #2 & Green #2 & Yellow #2 \\
Mass of Oven Can & g/lb & 62.78 & 62.68 & 62.65 \\
Mass of Oven Can and Wet Soil & g/lb & 75.24 & 78.48 & 77.68 \\
Mass of Oven Can and Dry Soil & g/lb & 73.3 & 76 & 75.3 \\
\bottomrule
\end{tabu}
\label{tab:measurements}
\end{table}
答案1
您有几个错误:x
在列中应该规范X
并且#
在正文中应该转义。
\documentclass{article}
\usepackage{tabu}
\usepackage{booktabs}
\begin{document}
\begin{table}[htp!]
\centering
\caption{Test Data for Liquid limit, this are the measurements necessary
that we needed to get in order to calculate the moisture content of our soil sample.}
\label{tab:measurements}
\begin{tabu}{*{5}{X[c]}}
\toprule
\textbf{Property} & \textbf{Unit} & \textbf{Test 1} & \textbf{Test 2} & \textbf{Test 3} \\
\midrule
Blows & -- & 25 & 17 & 15 \\
Oven Can ID & - & Red \#2 & Green \#2 & Yellow \#2 \\
Mass of Oven Can & g/lb & 62.78 & 62.68 & 62.65 \\
Mass of Oven Can and Wet Soil & g/lb & 75.24 & 78.48 & 77.68 \\
Mass of Oven Can and Dry Soil & g/lb & 73.3 & 76 & 75.3 \\
\bottomrule
\end{tabu}
\end{table}
\end{document}
应该\label
在 旁边(或里面)\caption
,这不是错误,但这样更合乎逻辑。也是[h!]
错误的。
不过,有两点需要说明:
输出结果不太吸引人:尤其是第一列,真的很糟糕;
该
tabu
包在某些情况下有效(例如这个),但它有缺陷并且无人维护。
\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{table}[htp!]
\centering
\caption{Test Data for Liquid limit, this are the measurements necessary
that we needed to get in order to calculate the moisture content of our soil sample.}
\label{tab:measurements}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{4}{c} @{}}
\toprule
\textbf{Property} & \textbf{Unit} & \textbf{Test 1} & \textbf{Test 2} & \textbf{Test 3} \\
\midrule
Blows & -- & 25 & 17 & 15 \\
Oven Can ID & -- & Red \#2 & Green \#2 & Yellow \#2 \\
Mass of Oven Can & g/lb & 62.78 & 62.68 & 62.65 \\
Mass of Oven Can and Wet Soil & g/lb & 75.24 & 78.48 & 77.68 \\
Mass of Oven Can and Dry Soil & g/lb & 73.3 & 76 & 75.3 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
标准类是为表格下方的标题设置的;如果您使用不同的类,则可能会为表格上方的标题设置,否则,将caption
标题加载或移动到预期的位置。
使用tabular*
标准环境,无需将第一列中的条目拆分到多行。
与使用连字符来表示缺失数据相比,使用短破折号更好。