Problem description
The presence of the colortbl package somehow breaks the number alignment inside tables performed by \tablenum when \multicolumn is used (might also happen with \multirow, but I did not test this). Since the package colortbl only needs to be loaded for this effect, it is by extension also caused by using \usepackage[table]{xcolor} or \documentclass[xcolor={table}]{beamer}.
No error or warning is raised. The order of the packages does not seem to matter.
I am unsure if this is a problem with siunitx oder with colortbl, so please let me know if this the latter applies, and I will direct this problem towards the colortbl package.
In any case I would be grateful for any insight on what the problem is and how to fix it. Thanks in advance for any help.
MWE
Without the package colortbl involved, everything is aligned as expected, regardless of chosen column orientation:
\documentclass{scrarticle}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{c c}
\hline
Text 1 & Text 2 \\
\hline
A1 & B1 \\
\multicolumn{2}{l}{\tablenum{34.556E5}} \\
A3 & B3 \\
\multicolumn{2}{r}{\tablenum{22.5}} \\
A5 & B5 \\
\multicolumn{2}{c}{\tablenum{0.078E-3}} \\
\hline
\end{tabular}
\end{document}
If the package colortbl is loaded (regardless by which means) the alignment fails:
\documentclass{scrarticle}
\usepackage{siunitx}
\usepackage[table]{xcolor} % or directly via \usepackage{colortbl}
\begin{document}
\begin{tabular}{c c}
\hline
Text 1 & Text 2 \\
\hline
A1 & B1 \\
\multicolumn{2}{l}{\tablenum{34.556E5}} \\
A3 & B3 \\
\multicolumn{2}{r}{\tablenum{22.5}} \\
A5 & B5 \\
\multicolumn{2}{c}{\tablenum{0.078E-3}} \\
\hline
\end{tabular}
\end{document}
Specs
- System: Windows 10 64bit
- Distribution: MikTeX (up-to-date)
- Version
siunitx: 3.4.14
- Version
colortbl: 1.0k
Problem description
The presence of the
colortblpackage somehow breaks the number alignment inside tables performed by\tablenumwhen\multicolumnis used (might also happen with\multirow, but I did not test this). Since the packagecolortblonly needs to be loaded for this effect, it is by extension also caused by using\usepackage[table]{xcolor}or\documentclass[xcolor={table}]{beamer}.No error or warning is raised. The order of the packages does not seem to matter.
I am unsure if this is a problem with
siunitxoder withcolortbl, so please let me know if this the latter applies, and I will direct this problem towards thecolortblpackage.In any case I would be grateful for any insight on what the problem is and how to fix it. Thanks in advance for any help.
MWE
Without the package
colortblinvolved, everything is aligned as expected, regardless of chosen column orientation:If the package
colortblis loaded (regardless by which means) the alignment fails:Specs
siunitx: 3.4.14colortbl: 1.0k