我在使用下表时遇到 TeX 错误,但我不知道为什么......
\begin{table}[htbp]
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed.}
\begin{tabular}{lrrrrrr}
& \multicolumn{1}{l}{\bar{N}_{all}} & \multicolumn{1}{l}{\sigma_{N_{all}}} & \multicolumn{1}{l}{\bar{N}_{mig}} & \multicolumn{1}{l}{\sigma_{N_{mig}}} & \multicolumn{1}{l}{\bar{N}_{sca}} & \multicolumn{1}{l}{\sigma_{N_{sca}}} \\
Min M_E & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.4 & 0.81 \\
superearths & 1.6 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
d-burning & 0.25 & 0.52 & 0 & 0 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\end{tabular}%
\label{tab: System values for different planet types in all HJ Systems}%
\end{table}%
有人能帮忙吗?谢谢!
答案1
欢迎!错误消息试图告诉您需要在表格的几个位置使用数学模式。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed.}
\begin{tabular}{lrrrrrr}
& \multicolumn{1}{l}{$\bar{N}_\mathrm{all}$} &
\multicolumn{1}{l}{$\sigma_{N_\mathrm{all}}$} &
\multicolumn{1}{l}{$\bar{N}_\mathrm{mig}$} &
\multicolumn{1}{l}{$\sigma_{N_\mathrm{mig}}$} &
\multicolumn{1}{l}{$\bar{N}_\mathrm{sca}$} &
\multicolumn{1}{l}{$\sigma_{N_\mathrm{sca}}$} \\
$\min M_E$ & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.4 & 0.81 \\
superearths & 1.6 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
$d$-burning & 0.25 & 0.52 & 0 & 0 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\end{tabular}%
\label{tab: System values for different planet types in all HJ Systems}%
\end{table}%
\end{document}
答案2
我建议对表格的布局做些改进。
- 将表格放在三部分表环境,这是一种将标题与表格对齐的简单方法
- 使用书签绘制一些水平线
- 使用希尼奇以使用小数排版列。或者,您可以使用大批并
\newcolumntype
构建一个右对齐的数学列,然后通过添加零来规范化所有数字,这样你就有相同的小数位数(0.40,0.00ETC。)(见示例2)。 - 拆除左、右侧轴承 (
@{}
) - 始终将其放在-command
label
内部caption
(最佳实践)。
示例 1 -希尼奇
\documentclass{article}
\usepackage{amsmath, booktabs, threeparttable, array}
\usepackage{siunitx}
\begin{document}
\begin{table}
\begin{threeparttable}
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed\label{tab:System-values}}
\begin{tabular}{@{}l
*{6}{S[table-format=4.2]}
@{}}
\toprule
& $\bar{N}_\mathrm{all}$ &
$\sigma_{N_\mathrm{all}}$ &
$\bar{N}_\mathrm{mig}$ &
$\sigma_{N_\mathrm{mig}}$ &
$\bar{N}_\mathrm{sca}$ &
$\sigma_{N_\mathrm{sca}}$ \\
\midrule
$\min M_E$ & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.4 & 0.81 \\
superearths & 1.6 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
$d$-burning & 0.25 & 0.52 & 0 & 0 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\bottomrule
\end{tabular}%
\end{threeparttable}
\end{table}%
\end{document}
示例 2 -大批和\newcolumntype
\documentclass{article}
\usepackage{amsmath, booktabs, threeparttable, array}
\newcolumntype{Z}{>{$}r<{$}}
\begin{document}
\begin{table}
\begin{threeparttable}
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed\label{tab: System values for different planet types in all HJ Systems}}
\begin{tabular}{@{}l*{6}{Z}@{}}
\toprule
& \bar{N}_\mathrm{all} &
\sigma_{N_\mathrm{all}} &
\bar{N}_\mathrm{mig} &
\sigma_{N_\mathrm{mig}} &
\bar{N}_\mathrm{sca} &
\sigma_{N_\mathrm{sca}} \\
\midrule
$\min M_E$ & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.40 & 0.81 \\
superearths & 1.60 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
$d$-burning & 0.25 & 0.52 & 0.00 & 0.00 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\vspace{2cm}
\begin{table}
\begin{threeparttable}
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed\label{tab:System-values}}
\begin{tabular}{@{}l
*{6}{S[table-format=4.2]}
@{}}
\toprule
& $\bar{N}_\mathrm{all}$ &
$\sigma_{N_\mathrm{all}}$ &
$\bar{N}_\mathrm{mig}$ &
$\sigma_{N_\mathrm{mig}}$ &
$\bar{N}_\mathrm{sca}$ &
$\sigma_{N_\mathrm{sca}}$ \\
\midrule
$\min M_E$ & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.4 & 0.81 \\
superearths & 1.6 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
$d$-burning & 0.25 & 0.52 & 0 & 0 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\bottomrule
\end{tabular}%
\end{threeparttable}
\end{table}%
\end{document}
答案3
此外薛定谔的猫的答案,我建议使用siunitx
和进行以下布局booktabs
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Here are all average values, as well as the standard deviation to them, of the different planet types in all systems of the population J39 with HJ listed.}
\begin{tabular}{l
*{2}{S[table-format=4.2]}
*{2}{S[table-format=2.2]}
*{2}{S[table-format=4.2]}}
\toprule
& {$\bar{N}_\mathrm{all}$} &
{$\sigma_{N_\mathrm{all}}$} &
{$\bar{N}_\mathrm{mig}$} &
{$\sigma_{N_\mathrm{mig}}$} &
{$\bar{N}_\mathrm{sca}$} &
{$\sigma_{N_\mathrm{sca}}$} \\
\midrule
$\min M_E$ & 5.81 & 4.88 & 10.39 & 3.74 & 2.23 & 1.25 \\
earthlike & 1.31 & 1.71 & 2.52 & 1.81 & 0.4 & 0.81 \\
superearths & 1.6 & 2.45 & 3.43 & 2.73 & 0.13 & 0.35 \\
giants & 1.19 & 0.89 & 0.87 & 1.01 & 1.43 & 0.68 \\
$d$-burning & 0.25 & 0.52 & 0 & 0 & 0.43 & 0.63 \\
AMD & 1247.54 & 4292.39 & 10.95 & 43.72 & 2154.01 & 5402.85 \\
\bottomrule
\end{tabular}%
\label{tab: System values for different planet types in all HJ Systems}%
\end{table}%
\end{document}