# Can the siunitx table alignment feature, S, align ratios?

I'd like to align a list of ratios in a column of a table by the colon. Is this possible using siunitx?

For instance ratios like the following.

1:0.9

1:1.0125

1:0.99

-
If the first part of the ratio is always 1: then the answer is yes. –  Qrrbrbirlbel Mar 13 '13 at 22:11
Yes, that is the case. What setting do I need to look at? –  Darling Mar 13 '13 at 22:16

• table-space-text-pre and
• table-align-text-pre.

You need the set a dummy text with the -space- option, so siunitx can reserve the right space in front of the actual number.

The -align- option accepts true (default) or false and sets the alignment of the text (see example).

We only want 1.0 part so be typeset by siunitx, the 1 from 1: would confuse the parer; we need to hide it in braces: {1:} or {1}:.

As you can see in the last table, we can even use different numbers in front of : (though, as it currently stands, they will not be typeset by siunitx).

## Code

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\sisetup{table-format=2.4,table-space-text-pre=1:}
\begin{tabular}{>{{1}:}S}
0.9    \\
1.0125 \\
0.99   \\
13.0
\end{tabular}

\hrulefill

\begin{tabular}{>{{1}:}S[table-align-text-pre=false]}
0.9    \\
1.0125 \\
0.99   \\
13.0
\end{tabular}

\hrulefill

\begin{tabular}{S}
{1:}0.9    \\
{2:}1.0125 \\
{3:}0.99   \\
{4:}13.0
\end{tabular}
\end{document}


-