11

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.

2
  • 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=(,table-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. Mar 20, 2012 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, 2012 at 13:56

2 Answers 2

12

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}
3
  • 2
    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. Mar 20, 2012 at 14:31
  • 3
    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, 2012 at 14:45
  • 3
    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. Mar 20, 2012 at 15:28
1

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".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .