The question was answered by the developer on comp.text.tex and I thought I share it here to answer the question:
Well. In next version, thank to Bruno
Le Floch rewritting process, there is
no \tabucolumn command:
\newcolumntype Z{ XS[m,
tight-spacing=true,round-mode=places,
round-precision=2] }
X[options]{S[option]} is implemented
as XS[ X option , S option] but both
still work.
\tabucolumn indeed has no signifiance:
I put it there due to some potential
parsing problems of the tabu preamble.
Problems that no more exist thank to B
Le Floch.
XS ( or X[..]{S[...]} ) is always
centered: there is no point to set the
horizontal alignment for S and s
columns: the alignment can't be
chosen.
\begin{tabu} to \linewidth {X[l,m,1.2]ZZZZZ}
Avoid X[l,m,1.2] -> for XS columns
the comma is "reserved" to separate
the options of X with the options for
S. Thus it's good practice not to use
any delimiter for X options :
X [1.2 lm] (and more readable imho)
\hline
Water vapour*& 18.01534& -2.418379e+8& 1.886964e+5&
2.605& 572.4\\
\hline
\end{tabu}
Now the problem of the vertical
alignment: ;-)
The problem is not tabu but siunitx
(sorry ;-( ): siunitx leaves too much
fixed space before the numbers,
because the S column mechanism
proceeds with "fixed width". To be
able to adjust the spacing, the S
column should read the whole tabular
and then choose the spacing depending
on the "natural length" of each
typeset number in each column.
This is what is done inside tabu X,
but tabu cannot adjust the spacing
made by siunitx: the spaces are inside
a box, and tabu can't destroy the box
(and thereafter re-align the numbers !
)
If you try with:
\newcolumntype Z{X[-1
m]{S[tight-spacing =
true,round-mode=places,
round-precision=2]}}
\begin{tabu} to \linewidth {X[lm] |
*5{Z|}} \hline Water vapour* & 18.01534 & -2.418379e+8 & 1.886964e+5 &
2.605& 572.4\\ \hline \end{tabu}
There is no more problems of
alignment. But the columns width are
not the same. You can understand the
problem with :
\newcolumntype Z{S[tight-spacing =
true,round-mode=places,
round-precision=2]}
\begin{tabu} to \linewidth {X[-1 lm] |
*5{Z|}} \hline Water \par vapour* & 18.01534 & -2.418379e+8 & 1.886964e+5 &
2.605& 572.4\\ \hline \end{tabu}
This shows that siunitx needs more
space than the X coefs allow. Hence
the line break inside the X[m] ( ie m
) column.
So: change your margin, or
artificially raise the tabu width:
\newcolumntype Z{X[m]{S[tight-spacing
= true,round-mode=places,
round-precision=2]}}
\hskip-10mm \begin{tabu} to 500pt
{X[-1 lm] | *5{Z|}} \hline Water \par
vapour* & 18.01534 & -2.418379e+8 &
1.886964e+5 &
2.605& 572.4\\ \hline \end{tabu}
Here there is no more problem. (for
future version 2.9 at least)
Simplifying your example a bit, I think you want something like
\documentclass{article}
\usepackage{booktabs,etoolbox,multirow,siunitx}
\robustify\itshape
\begin{document}
\begin{table}
\sisetup{table-format = 1.2, detect-all}
\begin{tabular}
{
>{\rule{1.2em}{0em}}
r@{ }
l
S
S
S[table-space-text-post = \textsuperscript{a}]
S[table-space-text-post = \textsuperscript{b}]
}
\toprule
\multicolumn{2}{c}{\multirow{2}{*}{Position}} &
\multicolumn{2}{c}{Computed} &
\multicolumn{2}{c}{Experimental} \\
& &
{\textbf{201a}} & {\textbf{201b}} & {\textbf{201a}} & {\textbf{201b}} \\
\cmidrule[\lightrulewidth](r){1-2}
\cmidrule[\lightrulewidth](lr){3-4}
\cmidrule[\lightrulewidth](l){5-6}
2 & & 2.47 & 2.48 & 2.45 & 2.33 \\
3 & $\alpha$ & 1.87 & 1.29 & \itshape 1.87{\textsuperscript{a}} & 1.30 \\
3 & $\beta$ & 1.70 & 2.12 & {\bfseries 1.60--1.75} & 2.10 \\
10 & Me & 1.06 & 0.92 & 1.10 &
\itshape 1.01{\textsuperscript{b}} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
The key here is to use \itshape
to alter the formatting while retaining siunitx
S
column alignment, plus setting up so space for the superscript using table-space-text-post
.
I've also cut down on the use of \multicolumn
, as {...}
will escape thing from siunitx
more clearly. siunitx
treats anything inside a wrapping set of braces as 'text', so for example
& {\bfseries 1.60--1.75} &
typesets the material without parsing the number: the alignment of 'text' is governed by the table-text-alignment
key. (You could alternatively use \multicolumn
and \tablenum
, but that seems overly complex here.)
The table-space-text-post
setting reserves 'some space' for additional material after the number. It needs to be wide enough when typeset to hold the largest item you will have after the text in a column. Usually, this is simply a case of picking something representative, although if the letter width varies a lot in your font then that may be an issue. I've used superscript a
and b
as they are the only things in those columns: I guess if you have an m
or w
to fit in you'll need to use them as they are wider!
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 thebooktabs
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).