Intro
在使用 LaTeX 创建表格的时候,我们经常会输入例如1.10
、12.22
等类似的数字。但是不管使用居中对齐、右对齐或者是左对齐,因为数字长短不一,所以小数点处是不对齐的。例如下面两个图:
Solution
使用@{.}
。其中小数点.
可以换做其他符号。
\begin{table}[t]
\centering
\begin{tabular}{l r@{.}l}
\toprule
\textbf{Name} & \multicolumn{2}{l}{\textbf{Birthday}} \\ \midrule
Xovee Xu & 3 & 12 \\
Tim Cook & 11& 1 \\
Michael Jackson & 8 & 29 \\
Santa Claus & 12& 25 \\
Airi Suzuki & 4 & 12 \\
\bottomrule
\end{tabular}
\caption{Demo}
\label{tab:demo}
\end{table}
Reference
- lockstep, Werner. (Mar 20, 2020). Aligning numbers by decimal points in table columns. Retrieved from https://tex.stackexchange.com/questions/2746/aligning-numbers-by-decimal-points-in-table-columns