如何让表格中的数字按小数点和等号分别对齐??

发布于 2021-04-03 13:53:58

想问一下,下面的表格如何按小数点和等号分别对齐啊?红色椭圆所示

c10efa0a6f737fe614bad6b3f8eba063.png

下面是代码:

\documentclass{ctexbook}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{amsmath}
\begin{document}
\begin{center}
\begin{tabular*}{\textwidth}{c@{\extracolsep{\fill}}cc}
\toprule 
序号 & 第1列 & 第2列\tabularnewline
\midrule 
\multirow{2}*{2} & $\dfrac{1}{\sqrt{3}}=0.577~350~269 2$ & 1\tabularnewline
 & $-\dfrac{1}{\sqrt{3}}=-0.577~350~269 2$ & 1\tabularnewline
\midrule 
\multirow{3}*{3} & $-\left(\dfrac{3}{5}\right)^{1/2}=-0.774~596~669 2$ & $\dfrac{5}{9}=0.555~555~555 6$\tabularnewline
 & 0.0 & $\dfrac{8}{9}=0.888~888~888~9$\tabularnewline
 & $\left(\dfrac{3}{5}\right)^{1/2}=0.774~596~669~2$ & $\dfrac{5}{9}=0.555~555~555~6$\tabularnewline
 \midrule
\multirow{4}*{4} & 0.861~136~311~6 & 0.347~854~845 1\tabularnewline
& 0.339~981~043~6 & 0.652~145~154~9\tabularnewline
& $-$0.339~981~043~6 & 0.652~145~154~9\tabularnewline
& $-$0.861~136~311~6 & 0.347~854~845~1\tabularnewline
\midrule
\multirow{5}*{5} & 0.906 179 845 9 & 0.236 926 885 0\tabularnewline
&0.538 469 310 1 & 0.478 628 670 5\tabularnewline
& 0.0 & 0.568 888 888 9\tabularnewline
& $-$0.538 469 310 1 & 0.478 628 670 5\tabularnewline
& $-$0.906 179 845 9 & 0.236 926 885 0\tabularnewline
\bottomrule
\end{tabular*}
\end{center}
\end{document}

另外,使用multirow宏包,序号2和3的垂直对齐也不理想,是我用错了吗?
感激!

查看更多

关注者
0
被浏览
1.5k
2 个回答
如果您有什么不同意见,您是对的,我是错的。
这家伙很懒,什么也没写!

大错特错,这代码是真的 Shit mountain……

  • 排版数字请用 siunitx 宏包的 \num
  • 小数点对齐请用 @{.}+对齐达到,或者 dcolumn 宏包
  • 公式对齐请合并单元格再 aligned
20号楼的房客
20号楼的房客 2021-04-03
这家伙很懒,什么也没写!

dcolumn宏包用了一下,不能实现等号对齐。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览