首先,MWE:
\documentclass[12pt]{article}
\usepackage{parskip}
\usepackage{amsmath}
\usepackage{upgreek}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{table}
\caption{Table showing the measured count rates per megabecquerel of activity for each of the three windows, to three significant figures. The quoted uncertainty corresponds to one standard deviation.}\label{tab:results1} \vspace{3 mm}
\centering
\begin{tabular}{
l
S[table-format=9.0]@{\;\( \pm \)}
S[table-format=3.0]
}
\toprule
Window & \multicolumn{2}{r}{Count rate (${\mathrm{min^{-1}\cdot MBq^{-1}}}$)} \\ \midrule
Open & 59700000 & 2700000 \\
${^{99}\mathrm{Tc^m}}$ & 6100000 & 270000 \\
${^{223}\mathrm{Ra}}$ & 35100000 & 1500000 \\
TEST & 123000 \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}
\begin {center}
\begin{tabular}{c D{,}{\pm}{-1} D{,}{\pm}{-1} D{,}{\pm}{4.4} }
\toprule
Window & \multicolumn{2}{r}{Count rate (${\mathrm{min^{-1}\cdot MBq^{-1}}}$)} \\ \midrule
Open & 59700000\, , \,2700000 \\
${^{99}\mathrm{Tc^m}}$ & 6100000\, , \,\;270000 \\
${^{223}\mathrm{Ra}}$ & 35100000\, , \,1500000 \\
TEST & 123000 \\
\bottomrule
\end{tabular}
\caption{Summary of statistics from analysis of all three samples.}
\end {center}
\end{table}
\end{document}
我的问题是如何\pm
在表格列中围绕符号获得良好的对齐,同时保留不带\pm
符号的列条目的能力。
在我使用的两种方法中,siunitx 非常出色(而且据我所知,它是表格对齐的推荐标准)。dcolumn 方法感觉有点不靠谱,对齐也不正确(需要进一步手动插入空格来修复,这很不雅观,也很烦人)。
我现在使用的 siunitx 方法的问题在于,它会插入一个\pm
我不需要的事件。我猜这里的窍门是将零作为错误放入,但这看起来不太优雅(脚注:这只是一个玩具表;在现实生活中,没有不确定性的数字是观察到的(数据)事件数,而需要不确定性的数字是预期的事件数)。
答案1
我会在同一栏中输入不确定性
\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[version=4]{mhchem}
\sisetup{separate-uncertainty}
\begin{document}
\begin{table}
\centering
\caption{Table showing the measured count rates per megabecquerel
of activity for each of the three windows, to three significant
figures. The quoted uncertainty corresponds to one standard
deviation.}\label{tab:results1}
\medskip
\begin{tabular}{
l
S[table-format=8.0(7)]
}
\toprule
Window & {Count rate} \\
& {(\si{min^{-1}.MBq^{-1}})} \\
\midrule
Open & 59700000 \pm 2700000 \\
\ce{^{99}Tc^m} & 6100000 \pm 270000 \\
\ce{^{223}Ra} & 35100000 \pm 1500000 \\
TEST & 123000 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
列标题最好分成两行,这样它就不会比列宽
化学元素可以用
mhchem
和来更好地命名\ce
测量单位应作为参数输入
\si
如果某种风格迫使您正确对齐不确定性,我认为它不siunitx
支持它,因此您需要做更多的工作。
\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[version=4]{mhchem}
\usepackage{collcell}
\begin{document}
\begin{table}
\centering
\caption{Table showing the measured count rates per megabecquerel
of activity for each of the three windows, to three significant
figures. The quoted uncertainty corresponds to one standard
deviation.}\label{tab:results1}
\medskip
\begin{tabular}{
l
>{\collectcell\num}r<{\endcollectcell}
@{${}\pm{}$}
>{\collectcell\num}r<{\endcollectcell}
}
\toprule
Window & \multicolumn{2}{c}{Count rate} \\
& \multicolumn{2}{c}{(\si{min^{-1}.MBq^{-1}})} \\
\midrule
Open & 59700000 & 2700000 \\
\ce{^{99}Tc^m} & 6100000 & 270000 \\
\ce{^{223}Ra} & 35100000 & 1500000 \\
TEST & \multicolumn{1}{r@{\phantom{${}\pm{}$}}}{\num{123000}} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}