# newcolumntype, siunitx, tabu and illegal pream-tokens

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.

-
I can confirm that with TeX Live 2011 it works, but not with the 2012 version; I suspect something related to the newly released siunitx. On the other hand, I don't think that enlarging a table to the line width is necessary: a table should be as wide as it needs to be. –  egreg Sep 5 '12 at 17:05
egreg is right. I reverted to older package versions and found out the following: - siunitx v2.5c (2012/05/03) with expl3 (2011/09/05) from the corresponding l3kernel and l3packages works well - siunitx v2.5g (2012/07/22) with expl3 (2012/07/16) from the corresponding l3kernel and l3packages do not work with the code above –  bz-mof Sep 5 '12 at 17:46

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.

-
I note that tabu has had a new version pending for some time. I may have to add a check for this situation to siunitx. I'll consult with the author of tabu. –  Joseph Wright Sep 5 '12 at 21:07
Thank you very much for this explanation! And of course the code solved my problem. –  bz-mof Sep 5 '12 at 23:03