这是表格
\documentclass{article}
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,
amsmath,
siunitx}
\usepackage{txfonts}
\begin{document}
\begin{table}
\caption{Estimated mass of the three Itokawa particles with taking into account their porosity}
\label{Tab3}
\centering
\begin{tabular}{@{} l CCCCC @{}}
\toprule
Sample & Silicate density (g/ (\mu m^3)) & Volume (\mu m^3) & Estimated mass (g) & Porosity (%) & Estimated mass with considering the porosity (g) \\
\midrule
RA-QD02-0014 & 2.196 \times 10^(-12) & 125921 &2.7652 \times10^(-7) & 0.7 & 2.7458 \times 10^(-7) \\
RA-QD02-0023 & 2.196 \times 10^(-12) & 781081 & 1.7153 \times10^(-6) & 0.0 & 1.7153 \times 10^(-6) \\
RA-QD02-0047 & 2.196 \times 10^(-12) & 148570 & 3.2626\times 10^(-7) & 0.0 & 3.2626 \times 10^(-7) \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
和错误
! Misplaced \noalign. \midrule ->\noalign {\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global \@... l.283 \midrule ?
答案1
你应该使用siunitx
便利设施。我建议为表格列添加图例,而不是那些长标题。
\documentclass{article}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,amsmath,siunitx}
\usepackage{newtxtext,newtxmath}% better than txfonts
\sisetup{per-mode=symbol}
\begin{document}
\begin{table}[htp]
\caption{Estimated mass of the three Itokawa particles with taking into account their porosity}
\label{Tab3}
\centering
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
S[table-format=1.3e-2]
S[table-format=6.0]
S[table-format=1.4e-1]
S[table-format=1.1]
S[table-format=1.4e-1]
@{}
}
\toprule
Sample &
{SD (\si{\gram\per\micro\meter\cubed})} &
{V (\si{\micro\meter\cubed})} &
{EM (\si{\gram})} &
{P (\%)} &
{EMP (\si{\gram})} \\
\midrule
RA-QD02-0014 & 2.196e-12 & 125921 & 2.7652e-7 & 0.7 & 2.7458e-7 \\
RA-QD02-0023 & 2.196e-12 & 781081 & 1.7153e-6 & 0.0 & 1.7153e-6 \\
RA-QD02-0047 & 2.196e-12 & 148570 & 3.2626e-7 & 0.0 & 3.2626e-7 \\
\bottomrule
\addlinespace
\multicolumn{6}{@{}l@{}}{SD: Silicate density; V: Volume; EM: Estimated mass; P: Porosity;}\\
\multicolumn{6}{@{}l@{}}{EMP: Estimated mass with considering the porosity} \\
\end{tabular*}
\end{table}
\end{document}
答案2
除了修复明显的错误(请记住,%
在 TeX 和 LaTeX 中是注释字符)之外,您还应该
使用指数符号更好地排版小数字——我建议你使用包
\num
的宏siunitx
更好地排版科学单位——我建议你使用包
\si
中的宏siunitx
,把单位单独放在一行上允许至少一个单元格标题中出现换行符,以使表格材料适合文本块的宽度。我建议您加载包
tabularx
,使用tabularx
环境而不是环境tabular
,并将包的X
列类型的居中版本应用于最终数据列。最后但同样重要的是,不要加载过时的
txfonts
软件包。相反,加载newtxtext
和newtxmath
软件包。
此外,在标题和各个单元格标题中请尽量使用较少的文字。
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs,siunitx}
\usepackage{newtxtext,newtxmath} % 'txfonts' is obsolete
\begin{document}
\begin{table}
\caption{Estimated mass of Itokawa particles taking
into account their porosity}
\label{Tab3}
\sisetup{round-mode=places,round-precision=3} % apply automatic rounding
\setlength\tabcolsep{3pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} l cccc C @{}}
\toprule
Sample & Silicate density
& Volume
& Estimated mass
& Porosity
& Estimated mass given porosity \\
& (\si{g\per\micro\meter\cubed})
& (\si{\micro\meter\cubed})
& (g)
& (\%) %% not (%)
& (g)\\
\midrule
RA-QD02-0014 & \num{2.196e-12} & 125921 & \num{2.7652e-7} & 0.7 & \num{2.7458 e-7} \\
RA-QD02-0023 & \num{2.196e-12} & 781081 & \num{1.7153e-6} & 0.0 & \num{1.7153 e-6} \\
RA-QD02-0047 & \num{2.196e-12} & 148570 & \num{3.2626e-7} & 0.0 & \num{3.2626 e-7} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}