0

The code below is adapted from the excellent work in another answer. However, I'm trying to adapt it to my specific use-case and am having two issues:

  • I'd rather use parentheses instead of brackets. In other words, I'd like it to appear as 0.4 (-1.8, 2.5) instead of 0.4 [-1.8, 2.5]. However, I get Package siunitx Error: Invalid numerical input '(-1.791145'. when I substitute >{{(}} for >{{[}}.
  • The >, @ and < directives also operate on the header columns, leaving a strange [ , ] above the Mean (95% CI) cell.
\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{
    >{\em}l
    S[round-mode=places, round-precision=1, table-format= -1.1]
    >{{[}}
    S[round-mode=places, round-precision=1, table-format= -1.1,table-space-text-pre={[}] 
    @{,\,}
    S[round-mode=places, round-precision=1, table-format= -1.1,table-space-text-post={]}]
    <{{]}}
    S[round-mode=places, round-precision=2, table-format=1.2] 
    S[round-mode=places, round-precision=2, table-format=1.2] 
}

\toprule
{} & \multicolumn{5}{c}{dB re. 40/s conv.} \\
\cmidrule(lr){2-6}
{} & & & & \multicolumn{2}{c}{Probability} \\
 \cmidrule(lr){5-6}
{{}}&\multicolumn{3}{c}{Mean (95\% CI)}&{$<\pm 2.5dB$}&{$<\pm 5dB$} \\
\midrule
oranges  &          0.410188 & -1.791145 &  2.505052 &     0.967500 &   0.999875 \\
bananas   &          0.006144 & -2.185644 &  2.184911 &     0.973375 &   0.999875 \\
\bottomrule
\end{tabular}

\end{document}

screenshot of code output

  • Welcome to TeX.SX! Could you please make your example document compilable, by adding the missing \documentclass and \usepackages (a minimal working example (MWE)). – Phelype Oleinik Dec 3 '19 at 0:43
  • The number of braces associated with the S specifier are creating the problem---tex.stackexchange.com/a/493771/197451 – js bibra Dec 3 '19 at 1:46
  • Thank you. That solved my first question. – Brad Dec 13 '19 at 0:35
  • @PhelypeOleinik: I have added a MWE. – Brad Dec 13 '19 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.