siunitx
siunitx copied to clipboard
The decimal marker in bold number is not align with asymmetrical number format in table.
In the example in the 9.13 Tables with heading rows, the number is symmetrical, i.e., 3.3. But if we set a number like 3.6, the decimal marker are not aligned.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{siunitx}
\begin{document}
\robustify\bfseries
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.3]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456 \\
23.45
\\
123.4
\\
3.456 \\
\end{tabular}
\qquad
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.6]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456789 \\
23.45
\\
123.4
\\
3.456 \\
\end{tabular}
\qquad
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.6]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456 \\
23.45
\\
123.4
\\
3.456789 \\
\end{tabular}
\end{document}

I've thought about this a bit. The entire way that siunitx does alignment means we need to know the target width - which goes wrong if you have a variable font width. I think this really needs a feature to add formatting to the model.
The current effect is still very satisfactory, just add table-model-setup=\bfseries. Here is the complete code below. But I suddenly found that if table-model-setup=\bfseries is used, then the decimal separator is not really centered. For the case of the first symmetric column, if table-model-setup=\bfseries is not added, it is true alignment. I don't know if there was a bug in table-model-setup's implementation.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{siunitx}
\begin{document}
\robustify\bfseries
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.3, table-model-setup = \bfseries]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456 \\
23.45
\\
123.4
\\
3.456 \\
\end{tabular}
\qquad
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.6, table-model-setup = \bfseries]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456789 \\
23.45
\\
123.4
\\
3.456 \\
\end{tabular}
\qquad
\begin{tabular}
{@{}S[text-series-to-math, table-format = 3.6, table-model-setup = \bfseries]@{}}
\rowcolor[gray]{0.9}
\bfseries 123.456 \\
23.45
\\
123.4
\\
3.456789 \\
\end{tabular}
\end{document}
I'm going to need to think about this one.