![表格未对齐负数和正数](https://linux22.com/image/478151/%E8%A1%A8%E6%A0%BC%E6%9C%AA%E5%AF%B9%E9%BD%90%E8%B4%9F%E6%95%B0%E5%92%8C%E6%AD%A3%E6%95%B0.png)
\begin{table}[b]%
\centering
\caption{determined \emph{hkl} indices and their corresponding.}%
\begin{tabular}{@{}llllll@{}}
\toprule
\multicolumn{6}{c}{\textbf{MO}\\
\midrule
\emph{h} &\emph{k} &\emph{l} & (obs) & (Calc) & Difference\\
\hline
0 & -1 & 0 & 10.3508 & 10.3893 & -0.0385 \\
1 & 1 & 0 & 16.1424 & 16.167 & -0.0246 \\
0 & 0 & 2 & 19.6878 & 19.7087 & -0.0209 \\
-1 & -1 & 2 & 22.4105 & 22.35 & 0.0605 \\
-3 & -1 & 1 & 31.6149 & 31.6054 & 0.0095
\bottomrule
\end{tabular}
\end{table}
答案1
正如您“发现”的那样,l
列类型对列内容执行左对齐。
为了将数字对齐到各自的(显式或隐式)小数标记,您可以加载siunitx
包并使用其S
列类型(见下文)或dcolumn
panckage 及其D
列类型。
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx} % for "S" column type
\begin{document}
\begin{table}[b]%
\centering
\caption{determined \emph{hkl} indices and their corresponding \dots}%
\begin{tabular}{@{}
S[table-format=-1.0]
S[table-format=-1.0]
S[table-format= 1.0]
S[table-format= 2.4]
S[table-format= 2.4]
S[table-format=-1.4]
@{}}
\toprule
\multicolumn{6}{c}{\textbf{MO}}\\
\cmidrule{1-6} % \cmidrule is thinner than \midrule
{\emph{h}} & {\emph{k}} & {\emph{l}} & {(obs)} & {(Calc)} & {(Diff.)} \\
\midrule % not "\hline"
0 & -1 & 0 & 10.3508 & 10.3893 & -0.0385 \\
1 & 1 & 0 & 16.1424 & 16.167 & -0.0246 \\
0 & 0 & 2 & 19.6878 & 19.7087 & -0.0209 \\
-1 & -1 & 2 & 22.4105 & 22.35 & 0.0605 \\
-3 & -1 & 1 & 31.6149 & 31.6054 & 0.0095 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}