Formatting table with siunitx: problem with parentheses and signs

It is the option input-symbols = {()} that causes the “misplaced sign token" error.

However, I recommend not to set parse-numbers = false to work around this issue because it disables siunitx’s rounding and digit-grouping features, and it changes the appearance of the asterisk (as you can see from esdd’s screenshots above).

Instead, you should do without including the parentheses in the input-symbol list. Here’s my suggestion:

\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{
    detect-all,
    round-integer-to-decimal = true,
    group-digits             = true,
    group-minimum-digits     = 4,
    group-separator          = {\,},
    table-align-text-pre     = false,
    table-align-text-post    = false,
    input-signs              = + -,
    input-symbols            = {*} {**} {***},
    input-open-uncertainty   = ,
    input-close-uncertainty  = ,
    retain-explicit-plus
}

\begin{document}

\begin{center}
  \begin{tabular}
    {@{}
     l
     S[table-format=+1.5, table-space-text-pre={**}, table-space-text-post={-**}]
     S[table-format=-4.3, table-space-text-pre={**}, table-space-text-post={-**}]
     @{}
    }
    \toprule
                & {Proportion taken} & {Decision category} \\
    \midrule
    Coefficient & -0.116**           &    0.711**          \\
    $t$-test    & (-0.23094)         & (3223.3)            \\
    \bottomrule
  \end{tabular}
\end{center}

\end{document}

This compiles into the following:

LaTeX example table using siunitx


\sisetup{parse-numbers=false} turns off the number parser inside the table environment. Then the numbers will be printed in math mode 'as given'.

\documentclass[12pt,a4paper,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[french,german,english]{babel}                      
\usepackage{array}
\usepackage{multirow}
\usepackage{amsmath, amssymb,mathrsfs}  
\usepackage{siunitx}
\sisetup{
input-symbols = {()},
group-digits  = false,
explicit-sign
}

\begin{document}
\begin{table}[ht]
\centering
\sisetup{parse-numbers=false}
\begin{tabular}{l S S}
  &\multicolumn{1}{c}{Proportion taken}&\multicolumn{1}{c}{Decision category}\\
  Coefficient   &      -0.116** &      0.711** \\
  t-test & (-0.23094) & (3223.3)\\
\end{tabular}
\end{table}

\end{document}

enter image description here

Tags:

Tables

Siunitx