I keep getting spurious spaces when I use the siunitx in a tabular environment in the presence of a percent (%) symbol. I am trying to align at the decimal point.
My code is:
\begin{tabular}{lS}
One & 0.1234\percent \tabularnewline
Two & 1.234\percent \tabularnewline
Three & 12.34\percent \tabularnewline
Four & 123.4\percent \tabularnewline
Five & 1234\percent \tabularnewline
Six & 1234.0\percent \tabularnewline
\end{tabular}
and the resulting output is:
The decimal-point alignment is working but the percent symbol has increasing number of spaces as the whole number part of the number increases.
Is there a way of removing these spaces easily, so that the percent symbols appear right after the number? I can hack it by having the percent symbol appear as a unit in a separate column, i.e.
\begin{tabular}{lSs}
One & 0.1234 & \percent \tabularnewline
but is there a way of having the percent symbol right next to the number as it appears for One, Two and Three above, e.g.
0.1234%
1234%
Thank you!
Best Answer
The
S
column is intended for numbers only: it is not the same as using both arguments to\SI
. Normally, I would suggest either using two separate columns and remove the inter-column padding uisng@{}
:or even better adding this information to the header
If you do want the input as given, you need
free-standing-units
, alter the definition of\percent
and fiddle a bit with the alignment settings