I'm encountering a strange problem when trying to pass a LaTeX3 object (a token list) as table column specifier. LaTeX issues an error
Package array Error: Illegal pream-token (\l_my_tl): `c' used.
Below is a minimal example that reproduces the problem. Interestingly, the problem disappears if the line \usepackage{array}
is commented out.
\documentclass{article}% ===>> The problem disappears if this line is commented out: \usepackage{array} % <<=== % Uncomment for older versions of latex% \usepackage{xparse} \ExplSyntaxOn\NewDocumentCommand{\mytabular}{}{% \tl_set:Nn \l_my_tl { l c } % Same error if we use a string instead of a token list. % \str_set:Nn \l_my_str { l c } \begin{tabular}{\l_my_tl} Header1 & Header2 \\ Row1 & Row2 \\ \end{tabular} % Here with an additional vertical alignment specifier. % Issues a similar error as above. \begin{tabular}[t]{\l_my_tl} Header1 & Header2 \\ Row1 & Row2 \\ \end{tabular}}\ExplSyntaxOff\begin{document}\mytabular\end{document}
What is going on here? Is this a bug of array
? What to do about it?