Skip to content

Compatability issues \tablenum and package colortbl #823

@ArsaiGit

Description

@ArsaiGit

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}
Image

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}
Image

Specs

  • System: Windows 10 64bit
  • Distribution: MikTeX (up-to-date)
  • Version siunitx: 3.4.14
  • Version colortbl: 1.0k

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions