TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following MWE:



        0.01    & \num{0.01} \\
        0.1     & \num{0.1} \\
        1       & \num{1} \\
        10      & \num{10} \\
        100     & \num{100} \\

Which gives:
enter image description here

Why does the left column display as desired, and the right not?

Secondly, I would like to add a range of numbers of the table.



        0.01        & \num{0.01} \\
        0.1         & \num{0.1} \\
        1           & \num{1} \\
        10          & \num{10} \\
        100         & \num{100} \\
        101--1000   & \numrange{101}{1000}

enter image description here

How would I do that typographically "correct"?

share|improve this question
I've edited the answer to remove the use of LuaTeX-specific packages, which are not needed for the demo. – Joseph Wright Nov 23 '11 at 16:18
up vote 7 down vote accepted

On the first part of the question, the S column aligns numbers, and treats any other input as 'non-numerical'. So when parsing your second column, the \num macro is a 'non-numerical' value, and the cell content is typeset omitted from alignment. Simply don't use \num to indicate numbers within an S column.

On the second part of the question, ranges intermixed with decimal values are hard to align nicely: to be honest, such a table tends to suggest that there is something wrong with what you are attempting to present. That said, something like



  \begin{tabular}{S[table-format = 3.2,table-align-text-post = false]}
        0.01        \\
        0.1         \\
        1           \\
        10          \\
        100         \\
        101{--1000} \\

will work in the case give. The idea here is to ignore the second part of the range for alignment purposes. I've also given a fixed size to the number as a whole, as this gives better alignment in general.

share|improve this answer
Wouldn't {101--1000} be a better choice in the last row? I.e. center it instead of aligning? Then the column will not be too tail heavy – daleif Nov 23 '11 at 16:51
@daleif It depends on the 'real' case (for example, how many ranges). I guess you should post this as an alternative answer (or I can edit it into mine). – Joseph Wright Nov 23 '11 at 16:53
That answer couldn't come more first hand. Thanks! – Ingo Nov 24 '11 at 11:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.