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'm trying to create a standard regression table with standard errors in parentheses below the coefficients, while using siunitx to align the numbers on the decimal point, and to round the numbers.

I use the option input-symbols=() to make siunitx ignore the parentheses, which works fine for alignment, but the numbers in parentheses are not rounded:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{l*{2}{S[input-symbols=(),round-mode=figures,round-precision=1]}} 
\hline
& \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} \\
\hline
X & 0.0131     & 0.00265{***} \\
  & (0.000731) & (0.000547)   \\
\hline
\end{tabular}
\end{document}

If I instead put the parentheses in curly brackets, the rounding works, but the left paranthesis ends up left aligned in the table cell:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{l*{2}{S[round-mode=figures,round-precision=1]}} 
\hline
  & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} \\
\hline
X & 0.0131         & 0.00265{***}   \\
  & {(}0.000731{)} & {(}0.000547{)} \\
\hline
\end{tabular}
\end{document}

Is there a way to get rounding to work with parantheses? I have the latest version of siunitx, 2.4j.

share|improve this question
    
Tinkering a bit more, I've found that adding the options table-align-text-pre=false,table-align-text-post=false,table-space-text-pre=(,t‌​able-space-text-post=) and wrapping all parentheses in curly brackets gives me the output I want. Still, it would be very nice if this was possible without the curly brackets and the extra options. –  standard_error Mar 20 '12 at 12:50
    
Maybe have a look at this answer to a question I asked some time ago: tex.stackexchange.com/a/46186/11984 –  Jörg Mar 20 '12 at 13:56
add comment

2 Answers

up vote 5 down vote accepted

The following appears to work:

\documentclass{article}

\usepackage{siunitx}
    \sisetup{
        detect-mode,
        tight-spacing           = true,
        group-digits            = false,
        input-signs             = ,
        input-symbols           = ,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        table-align-text-pre    = false,
        round-mode              = figures,
        round-precision         = 1,
        table-space-text-pre    = (,
        table-space-text-post   = ),
        }

\begin{document}
\begin{tabular}{l*{2}{S}} 
\hline
& \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} \\
\hline
X & 0.0131     & 0.00265*** \\
  & (0.000731) & (0.000547)   \\
\hline
\end{tabular}
\end{document}
share|improve this answer
1  
Yes, this works perfectly! Just to clarify for others who might have this problem, the key options for solving this problem are input-open-uncertainty =, input-close-uncertainty = , table-align-text-pre = false. –  standard_error Mar 20 '12 at 14:31
1  
I think the key option is to omit ( ) from the input-symbols, because you define parenthesis in this case with the table-space-text-preand table-space-text-post option –  Jörg Mar 20 '12 at 14:45
1  
Actually, it works even excluding the table-space-pre=(and table-space-post=)-commands. I think they only help with getting the column width right. –  standard_error Mar 20 '12 at 15:28
add comment

From the siunitx manual:

A common means to display negative numbers in financial situations is to place them in brackets. This can be carried out automatically using the bracket-negative-numbers option.

this may offer a very clean "work-around".

share|improve this answer
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.