[Tex/LaTex] siunitx align numrange

horizontal alignmentsiunitxtables

I have a table in which I use \numrange of the siunitx package.
I would like to center align that column at the range-phrase. If I align it left, it sort of works, but if I align it center, it is not good enough. How can I solve this?

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{siunitx} 


\begin{document}
\begin{table}
\caption{All measured and their estimated outcome variables during 30 minutes of chair exercises}
\label{table:outcomes}
\sisetup{
range-phrase = --
}

\begin{tabular}{
                l
                c
                c
                c
                %S[parse-numbers = false,input-decimal-markers={-},output-decimal-marker = \text{--}]
                S[table-format=3.1, table-text-alignment=center]
                }

\multicolumn{1}{l}{}&
\multicolumn{1}{c}{Mean}&
\multicolumn{1}{c}{SD}&
\multicolumn{1}{c}{Median}&
\multicolumn{1}{c}{Range}\
\hline


\%vo2max (mL/min) & 66.0 & 16.5 & 66.9 & \numrange{30.3}{115.8}\\



&&& 54.6 & \numrange{30.3}{77.7}\\


&&& 69.9 & \numrange{43.8}{115.8} \


\hline




\end{tabular}
\end{table}

\end{document}

Best Answer

The following isn't a direct solution to the problem you're trying to solve. Instead, I suggest you consider pursuing a different solution. Why? Personally, I think that if one tries to present an entire range of numbers in a single column, too much numerical information is being crammed into a confined space. In order to give your readers a chance to really parse and absorb the data you're presenting, it's probably preferable for you to list the minima and maxima in separate columns -- joined, of course, by an overall header that says "Range". The following MWE illustrates what I'm trying to express.

The MWE also uses the \toprule, \midrule, \cmidrule, and \bottomrule macros of the booktabs package to generate well-spaced "rules" (horizontal lines) of varying thickness. These make a table immediately much more professional-looking, compared to what's achievable with \hline and \cline (the basic LaTeX rule-drawing commands).

enter image description here

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{siunitx,booktabs} 
% booktabs package for well-spaced horizontal rules

\begin{document} 
\begin{table}
\caption{All measured and their estimated outcome variables during 30 minutes of chair exercises}
\label{table:outcomes}

\medskip\centering
\sisetup{table-format=2.1}
\begin{tabular}{l SSSS S[table-format=3.1]}
\toprule
& {Mean}&{SD} & {Median}& \multicolumn{2}{c}{Range}\\
\cmidrule{5-6}
& & & & {Lower} & {Upper}\\
\midrule
\%vo2max (mL/min) & 66.0 & 16.5 & 66.9 & 30.3 & 115.8\\
&&& 54.6 & 30.3 &  77.7\\
&&& 69.9 & 43.8 & 115.8 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}