I'm using the tabular features of siunitx (for what it is worth: v1.3 since I'm on TexLive 2009) to align numbers in tables, eg.
\begin{tabular}{ p{1.5cm} S S S }
bla & 1.23 & 4.5 & 67.89 \tabularnewline
\end{tabular}
and that works perfectly fine.
Now I would like to have this table span a specific width, or rather to have several tables to have the same width. For this I would normally use tabularx
\begin{tabularx}{\textwidth}{ p{1.5cm} X X X }
bla & 1.23 & 4.5 & 67.89 \tabularnewline
\end{tabular}
Now, is there a way to combine the two? To have the number formatting and alignment features of siunitx inside an automatically resizing table?
X
column intabularx
is then converted top{<width>}
where width is automatically calculated. You can change this by redefining the\tabularxcolumn
macro like described in the package manual:\renewcommand{\tabularxcolumn}[1]{...}
. I'm sure Joseph Wright (author ofsiunitx
and moderator here) can tell you what to put for...
. I'm couldn't find it out for myself yet. (My LaTeX3-fu is still very weak)siunitx
, which I plan to do for version 2.2 (aiming to work on it next month).siunitx
internals - they are not documented and so are liable to arbitrary changes! Your solution is quite nice, with the only thing I'd say being to use\ExplSyntax(On|Off)
rather than the 'raw'\catcode
approach you've taken. Insiunitx
, I can't just use a 'p' column as I don't know what options are set when the column is defined - I have to wait until I'm inside the cell!tabularx
. Because some time has passed since your comment, I want to ask, whether by now there is a built in possibility to use the S cells, but get a similar behaviour as with X cells.