6

Please consider the following MWE:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(-},  % hasn't  effect ?
                  table-space-text-post={***},% hasn't  effect ?
                  input-symbols={( )},
                  explicit-sign,
                  parse-numbers=false,
                 ]|}
\hline
  1.248\textsuperscript{***}  \\
(-0.124)                        \\
\hline
\end{tabular}
\end{document}

It gives

enter image description here

Is there a way to obtain usable result?

1 Answer 1

6

The issue can be solved by putting the parentheses (pre and post part) in braces:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(},
                  table-space-text-post={\textsuperscript{***}},
                  explicit-sign,
                 ]|}
\hline
  1.248\textsuperscript{***} \\
{(}-0.124{)}                 \\
\hline
\end{tabular}
\end{document}

It compiles without warnings about overfull \hboxes.

Result

The curly braces protect the parentheses symbols for being parsed as uncertainty symbols. The input symbols for the uncertainty can be changed to avoid the curly braces in the table body:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=-1.3,
                  table-space-text-pre ={(},
                  table-space-text-post={\textsuperscript{***}},
                  explicit-sign,
                  input-open-uncertainty={[},
                  input-close-uncertainty={]},
                 ]|}
\hline
  1.248\textsuperscript{***} \\
(-0.124)                     \\
\hline
\end{tabular}
\end{document}

If you want to get rid of the additional braces in the table body, then the parentheses

1
  • this works!!! I very like the second solution, it is very convenient at table writing :-)
    – Zarko
    Commented Apr 14, 2017 at 6:36

You must log in to answer this question.

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