josephwright / josephwright/siunitx

Compatability issues \tablenum and package colortbl

Open
#823 2 comments 0 reactions 1 assignee View on GitHub

@josephwright is already working on this.

Since Sep 3, 2025.

Dominant language
TeX
Stars
407
Forks
29
Avg merge
11h 20m
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.