Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The decimal marker in bold number is not align with asymmetrical number format in table. #659

Open
note286 opened this issue May 2, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@note286
Copy link

note286 commented May 2, 2023

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}

image

@note286 note286 changed the title decimal marker not align with asymmetrical number in table The decimal marker in bold number is not align with asymmetrical number format in table. May 2, 2023
@josephwright josephwright self-assigned this May 3, 2023
@josephwright josephwright added the enhancement New feature or request label Jun 12, 2023
@josephwright
Copy link
Owner

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.

@note286
Copy link
Author

note286 commented Aug 3, 2023

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}

image

@josephwright
Copy link
Owner

I'm going to need to think about this one.

@josephwright josephwright reopened this Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants