Inspired by the following post \bfseries and alignment in table, I want to create a table where some of the entries are highlighted in bold, and further, the numbers should be aligned on the dot. I defined the boldentry command as desribed on the post, but for some reason the numbers are not perfectly aligned in this case. What is the problem in the code below?
\documentclass[b5paper,10pt,authoryear,longnamesfirst]{memoir}
\usepackage{booktabs,siunitx}
\usepackage[flushleft]{threeparttablex}
\newcommand{\MS}[1] {
\multicolumn{1}{c}{#1}}
\newcommand{\boldentry}[2]{%
\multicolumn{1}{S[table-format=#1,
mode=text,
text-rm=\fontseries{b}\selectfont
]}{#2}}
\begin{document}
\sisetup{detect-weight=true,detect-inline-weight=math}
\begin{table}
\scriptsize
\caption{A caption}
\begin{threeparttable}
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}*{9}{S[table-
format=1.3]}}
\toprule
& \MS{A} & \MS{B} & \MS{C} & \MS{D} & \MS{E} & \MS{F} & \MS{G} &
\MS{H} & \MS{I}\\
\midrule
A & \boldentry{1.3}{1.004}&\boldentry{1.3}{1.000}&\boldentry{1.3}
{1.008}&\boldentry{1.3}{1.000}&\boldentry{1.3}{0.989}&\boldentry{1.3}
{1.008}&1.070 & \boldentry{1.3}{0.981}&1.025\\
B & 1.025 & 1.012 & 1.016 & \boldentry{1.3}{1.000}&\boldentry{1.3}
{0.967}&\boldentry{1.3}{0.968}&\boldentry{1.3}{0.982}&\boldentry{1.3}
{0.961}&1.077\\
C& 1.009 & 1.001 & 1.002 & 1.000 & 0.986 & 0.985 & 0.991 &
\boldentry{1.3}{0.973}&0.998\\
D & 1.009 & 1.010 & 1.001 & 1.000 & 0.951 & 0.959 & 0.975 &
\boldentry{1.3}{0.931}&1.015\\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\setlength\labelsep{0pt}
\scriptsize
\item A footnote
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
\scriptsize
to egreg's code in the post you linked, his table is not aligned either... It might be because at script size, bold numbers are actually significantly narrower than normal ones (it's even more visible with\tiny
).