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?
Best Answer
The
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:The
S
column uses thec
column internally. To replace this withp{<width>}
you have to manually place the internal column definition ofS
into\tabularxcolumn
. The following code worked in my tests.