[Tex/LaTex] newcolumntype, siunitx, tabu and illegal pream-tokens

siunitxtablestabu

I use tabu with siunitx for making my charts with MikTeX 2.9, tabu 2.8 and now siunitx v2.5g. Since last time using the updater \newcolumn commands like

\newcolumntype D{X[1,c]{%
  S[group-four-digits=true,
  table-format=2.0e1,
  per-mode=symbol]}}
\tabucolumn D

don't work anymore but raise error messages like

Package array Error: Illegal pream-token.

I have no idea how to solve this problem. Can anyone help me?

This is the not-working-anymore minimal example:

\documentclass[a4paper,DIV=12]{scrreprt}
\usepackage[utf8]{inputenc}                 
\usepackage[T1]{fontenc}            
\usepackage[ngerman]{babel}     
\usepackage{siunitx,booktabs}

\usepackage{tabu}
\newcolumntype D{X[1,c]{S[group-four-digits=true,table-format = 2.0e1,per-mode=symbol]}}
\tabucolumn D

\begin{document}
  \begin{tabu} to \linewidth {XDDX}
    \toprule
    one & {two two two two two} & {three three} & four\\
    1.23456 & 1.23456 & 1.23456 & 1.23456 \\
    1.2 & 1.2 & 1.2 & 1.2 \\
    999.9 &999.9 &999.9 &999.9\\
    \bottomrule
  \end{tabu}
\end{document}

Hint: using

\newcolumnD{X[1.c]S[...

(without the curly bracket) as described in other threads does not work, as it is interpreted as columns X and S as substitution for D.

Best Answer

This happens because tabu does something that the LaTeX3 approach specifically forbids: it uses an internal macro from siunitx.

In the revision from v2.5e to v2.5f, the internals of siunitx were marked up as 'private', following the LaTeX3 naming scheme. This does not show up as tabu does a csname-based assignment, and this is silently converted to \relax by TeX. It can be 'fixed' by doing

\ExplSyntaxOn
\cs_new_eq:NN \siunitx_table_collect_begin:Nn \__siunitx_table_collect_begin:Nn
\ExplSyntaxOff

after loading siunitx.