我正在用 Latex 写一个表格。我想让表格+-
列居中对齐$N_{s}$
。我写了如下代码,但没有对齐。
我已经导入了一个包\sisetup{separate-uncertainty}
但没有帮助。
\begin{table}[htbp]
\begin{center}
%\label{tab:ul_data}
\caption{\label{tab:ul_data} Summary of the reconstruction efficiency ($\epsilon$), signal yields ($N_{S}$), signal significance ($\mathcal{S}$) and upper limit (U.L.) on the signal yield ($N_{pl}^{UL}$) and branching fraction ($\mathcal{B}$) at 90\% confidence level for \textcolor{red}{each mode}.}
%\resizebox{12cm}{!}{%
\begin{tabular}{c c c c c c}
\hline \hline
Decay mode & $\epsilon$ (\%)& $N_S$ &\textcolor{red}{$\mathcal{S}$ ($\sigma$)}&$N_{pl}^{UL}$ & $\mathcal{B} \times 10^{-7}$ \\ [0.5ex]
\hline \hline
\noalign{\smallskip}\hline\noalign{\smallskip}
$D^{0} \rightarrow pe^{-}$ & 10.16 &\phantom{0}$-6.43 \pm 8.5$ & \textemdash& 16.2 & $ < 5.10 $ \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow pe^{-}$ & 10.19 & $-18.4 \pm 23$ & \textemdash& 22.0 & $< 6.94 $ \\ [1ex]
%\hline
$D^{0} \rightarrow \bar{p}e^{+}$ & \phantom{0}9.72 & \phantom{0}$-4.7 \pm 23$ & \textemdash& 21.6 & $< 7.10 $ \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow \bar{p}e^{+}$ & \phantom{0}9.62 & $7.1 \pm 9.0$ & 0.60& 23.0 & $< 7.64 $ \\ [1ex]
%\hline
$D^{0} \rightarrow p\mu^{-}$ & 10.75 & $11.0 \pm 23$ & 0.95& 17.1 & $<5.06$ \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow p\mu^{-}$ & 10.71 &$-10.8 \pm 27$ & \textemdash& 20.5 & $<6.12 $ \\ [1ex]
%\hline
$D^{0} \rightarrow \bar{p}\mu^{+}$ & 10.52 &\phantom{0}$-4.5 \pm 14$ & \textemdash& 21.0 & $<6.32$ \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow \bar{p}\mu^{+}$ & 10.45 & \phantom{4}$16.7 \pm 8.8$ & 1.56& 21.4 & $<6.55$ \\ [1ex]
\hline \hline
\end{tabular}
\end{center}
\end{table}
答案1
你可以使用这个siunitx
包。这不仅能让你对齐符号+-
,还能让你停下来手动调整数字的对齐方式:
\documentclass{article}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{siunitx}
\sisetup{uncertainty-mode = separate}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Summary of the reconstruction efficiency ($\epsilon$), signal yields ($N_{S}$), signal significance ($\mathcal{S}$) and upper limit (U.L.) on the signal yield ($N_{pl}^{UL}$) and branching fraction ($\mathcal{B}$) at 90\% confidence level for \textcolor{red}{each mode}.}
\label{tab:ul_data}
\begin{tabular}{c S[table-format=2.2] S[table-format=-2.2+-2.2] S[table-format=1.2] S[table-format=2.1] S[table-format=<1.2]}
\hline \hline
{{Decay mode}} & {{$\epsilon$ (\%)}}& {{$N_S$}} &
{{\textcolor{red}{$\mathcal{S}$($\sigma$)}}}
&{{$N_{pl}^{UL}$}} & {{$\mathcal{B} \times 10^{-7}$}} \\ [0.5ex]
\hline \hline
$D^{0} \rightarrow pe^{-}$ & 10.16 & -6.43 \pm 8.5 & {{\textemdash}}& 16.2 & < 5.10 \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow pe^{-}$ & 10.19 & -18.4 \pm 23 & {{\textemdash}}& 22.0 & < 6.94 \\ [1ex]
%\hline
$D^{0} \rightarrow \bar{p}e^{+}$ & 9.72 & -4.7 \pm 23 & {{\textemdash}}& 21.6 & < 7.10 \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow \bar{p}e^{+}$ & 9.62 & 7.1 \pm 9.0 & 0.60& 23.0 & < 7.64 \\ [1ex]
%\hline
$D^{0} \rightarrow p\mu^{-}$ & 10.75 & 11.0 \pm 23 & 0.95& 17.1 & <5.06 \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow p\mu^{-}$ & 10.71 &-10.8 \pm 27 & {{\textemdash}}& 20.5 & <6.12 \\ [1ex]
%\hline
$D^{0} \rightarrow \bar{p}\mu^{+}$ & 10.52 &-4.5 \pm 14 & {{\textemdash}}& 21.0 & <6.32 \\ [1ex]
%\hline
$\bar{D}^{0} \rightarrow \bar{p}\mu^{+}$ & 10.45 & 16.7 \pm 8.8 & 1.56& 21.4 & <6.55 \\ [1ex]
\hline \hline
\end{tabular}
\end{table}
\end{document}