
我在我的文件中製作了一個表格,一切對我來說看起來都很好。問題是,當具有混合符號的數字出現在列中時,它們不會對齊。
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\begin{document}
{\footnotesize
\begin{table}
\caption{ A table here for some values of energies ($cm^{-1}$)
\label{Energy_table} }
\begin{tabular}{p{0.25cm} p{1.60cm} p{1.0cm} p{1.0cm} p{1.0cm} p{0.001cm} p{1.60cm} p{1.1cm} p{1cm}p{1cm}}
\toprule
&\multicolumn{3}{c}{$A_{0}$} & & \multicolumn{3}{c}{$B_{1}$}\\ \cline{2-5} \cline{7-10}
$m$ & Theory & $\Delta^{a}$ & $\Delta^{b}$& $\Delta^{c}$ & & This work& $\Delta^{a}$ & $\Delta^{b}$& $\Delta^{c}$ \\ \cline{1-5} \cline{7-10}
1 & 297.4623 & -0.072 & -0.071 & -0.071 & & & 5.667 & 2.625 & \\
2 & 984.5495 & -0.092 & -0.059 & -0.099 & & 2814.507 & -0.032 & -0.043 & -0.039 \\
\multicolumn{8}{c}{} \\
&\multicolumn{3}{c}{$C_{0}$} & & \multicolumn{3}{c}{$D_{1}$}\\ \cline{2-5} \cline{7-10}
$n$ & This work & $\Delta^{a}$ & $\Delta^{b}$& $\Delta^{c}$ & & This work& $\Delta^{a}$ & $\Delta^{b}$& $\Delta^{c}$ \\ \cline{1-5} \cline{7-10}
0 & 46.5495 & -0.099 & -0.099 & -0.099 & & 2814.507 & -0.032 & -0.043 & -0.039 \\
& & & & & & & & &\\
& & & & & & & & &\\
& & & & & & & & & \\
\bottomrule
\end{tabular}
\end{table}}
\end{document}
如何根據小數正確對齊。
(我試圖遵循這個答案,但無法編譯。我不明白這個答案中關於如何設定列數的命令! 對齊表中的數值)
答案1
透過包含該siunitx
套件,您可以使用 S 列而不是p
。
\begin{table}
\caption{ A table here for some values of energies (\si{\per\centi\meter})
\label{Energy_table} }
\begin{tabular}{SSSSSSSSSS}
\toprule
&\multicolumn{3}{c}{$A_{0}$} & & \multicolumn{3}{c}{$B_{1}$}\\ \cline{2-5} \cline{7-10}
{$m$} & {Theory} & {$\Delta^{a}$} & {$\Delta^{b}$} & {$\Delta^{c}$} & & {This work} & {$\Delta^{a}$} & {$\Delta^{b}$} & {$\Delta^{c}$} \\ \cline{1-5} \cline{7-10}
1 & 297.4623 & -0.072 & -0.071 & -0.071 & & & 5.667 & 2.625 & \\
2 & 984.5495 & -0.092 & -0.059 & -0.099 & & 2814.507 & -0.032 & -0.043 & -0.039 \\
\multicolumn{8}{c}{} \\
&\multicolumn{3}{c}{$C_{0}$} & & \multicolumn{3}{c}{$D_{1}$}\\ \cline{2-5} \cline{7-10}
{$n$} & {This work} & {$\Delta^a$} & {$\Delta^b$} & {$\Delta^c$} & & {This work} & {$\Delta^{a}$} & {$\Delta^{b}$} & {$\Delta^{c}$} \\
\cline{1-5} \cline{7-10}
0 & 46.5495 & -0.099 & -0.099 & -0.099 & & 2814.507 & -0.032 & -0.043 & -0.039 \\
& & & & & & & & &\\
& & & & & & & & &\\
& & & & & & & & & \\
\bottomrule
\end{tabular}
\end{table}
注意{}
文字周圍的內容。我覺得桌子可以做得漂亮很多,但為了避免混亂,我沒有做太多改變。另外,我不確定你到底想展示什麼,所以我最終可能會造成更多的傷害而不是好處。
siunitx
我也在標題中使用了該包,以便該單元格式正確,而不是用斜體排版。
其他人的後續問題:什麼時候需要指定table-format
?