Take the 2-minute tour ×
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.

I'd like to add parenthesis around some columns in a table, using the siunitx package. I'm using the > and < column specifiers, and they seem to work... except in the last column, where some additional space is inserted. This is sample code:

\documentclass{article}
\usepackage{siunitx}
\begin{document}

\sisetup{table-format = 1.2,table-auto-round = true}

\begin{tabular}
  {l*{4}{S@{~}
         >{{(}}
         S[table-format=1.1,
           table-figures-exponent=1,table-sign-exponent=true,
           scientific-notation=true,
           table-space-text-pre=(,table-space-text-post=)]
         <{{)}}
        }
  }
A & 1.234&0.987e-4  & 4.567&0.654e-5  \\
B & 2.345&0.876e-3  & 5.678&0.543e-3  \\
C & 3.456&0.765     & 6.789&0.432     \\
\end{tabular}

\end{document}

And the result:

enter image description here

As you can see, there's an unwanted space before the closing parenthesis in the second column.

Am I doing something wrong? Is there a better way of inserting the parentheses (or anything else)?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The manual mentions that there can be some issues with the very last cell. The usual way around this is to use the TeX \cr primitive to end the cell:

\documentclass{article}
\usepackage{siunitx}
\begin{document}

\sisetup{table-format = 1.2,table-auto-round = true}

\begin{tabular}
  {l*{2}{S@{~}
         >{{(}}
         S[table-format=1.1e-1,
           scientific-notation=true,
           table-space-text-pre=(,table-space-text-post=)]
         <{{)}}
        }
  }
A & 1.234&0.987e-4  & 4.567&0.654e-5  \cr
B & 2.345&0.876e-3  & 5.678&0.543e-3  \cr
C & 3.456&0.765     & 6.789&0.432     \cr
\end{tabular}

\end{document}

(I've tided up your table-format a bit, too.)

share|improve this answer
    
Thanks, that's section "7.13 Adding items after the last column of a tabular", for the record, I see it now. Thanks for the table-format hint too. –  Jellby Jul 25 '13 at 9:56
    
Adding a fake column? –  egreg Jul 25 '13 at 13:46
add comment

Your Answer

 
discard

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.