siunitx align numrange
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).
\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}
I had the same question and I tryed a lot of ways, so there is the way how I solve it:
1. Split the last column in 3 different columns
2. The last 3 columns must be in the format S
, c
and S
3. Reduce the gap between the columns to 1ex
4. In the last 3 columns write your ranges: the lower value in one column, your range-phrase
in other column and the upper value in the last column
Your MWE:
\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[table-format=3.1, table-text-alignment=center] %<-- Columns splited
@{\hspace{1ex}} %<-- Column separation
c %<-- Columns splited
@{\hspace{1ex}} %<-- Column separation
S[table-format=3.1, table-text-alignment=center] %<-- Columns splited
}
& Mean & SD & Median & \multicolumn{3}{c}{Range}\\ %I just used multicolumn for the splited columns
\hline
\%vo2max \si{\mL/\minute} & 66.0 & 16.5 & 66.9 & 30.3 & -- & 115.8 \\ %<- I use the \si option for the units
& & & 54.6 & 30.3 & -- & 77.7 \\ %<- Ranges splited and separated by your own range-phrase
& & & 69.9 & 43.8 & -- & 115.8 \\
\hline
\end{tabular}
\end{table}
\end{document}