This is my question for siunitx users: Is it necessary to specify the input-symbols parameter in the preamble, rather than within S[]?

Why do I ask?

Here's a table produced by my R function outreg in the package rockchalk.

\documentclass[11pt,letterpaper,english]{extarticle}   
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{array}

\usepackage{siunitx}
%following now in each table
\sisetup{
  input-symbols = ( )
}

\begin{document}
\begin{table}
\caption{Still have showAIC argument, as in previous versions}\label{tab:ex5ds}
\centering\begin{tabular}{@{}l*{2}S[input-symbols = ( ),   
                        group-digits = false,   
                        table-format = 3.3,
                        table-number-alignment = center,   
                        table-space-text-pre = (,  
                        table-space-text-post = {***},   
                        table-align-text-pre = false,
                        table-align-text-post = false,
                        parse-units = false]@{}}
\hline
   & \multicolumn{1}{c}{Whichever}& \multicolumn{1}{c}{Whatever}\tabularnewline
 & \multicolumn{1}{c}{Estimate}& \multicolumn{1}{c}{Estimate}\tabularnewline
   & \multicolumn{1}{c}{(S.E.)}& \multicolumn{1}{c}{(S.E.)}\tabularnewline
 \hline
 \hline
  (Intercept)    &403.245*** &29.774*** \tabularnewline
     &  (0.618) &  (0.522)\tabularnewline
  x1      &1.546*& \multicolumn{1}{c}{\phantom{000}.} \tabularnewline
     &  (0.692)   &  \tabularnewline
  x2     & \multicolumn{1}{c}{\phantom{000}.} &3.413** \tabularnewline
       &   &  (0.512)\tabularnewline
 \hline
 N& \multicolumn{1}{c}{100}& \multicolumn{1}{c}{100} \tabularnewline
 RMSE            &6.121  &5.205   \tabularnewline
 $R^2$            &0.048  &0.312   \tabularnewline
 adj $R^2$        &0.039  &0.305   \tabularnewline
 AIC     &617.694 &617.694\tabularnewline
 \hline
\hline

 \multicolumn{3}{l}{${*  p}\le 0.05$${*\!\!*  p}\le 0.01$${*\!\!*\!\!*  p}\le 0.001$}\tabularnewline
 \end{tabular}
 \end{table}
\end{document}

enter image description here

Thanks to the help of members in this group, the output is mostly adequate, IMHO. I cannot know ahead of time how many digits might be used, so I don't rely on table-format to tighten down the alignment. That's why I've got the nagging problems about centering of different sections of table. But this is, honestly, much better than I had before.

I'm asking now about the preamble and sisetup. I want the table markup to be as close to portable as possible, not depending on any preamble details.

I wanted to eliminate entirely the use of sisetup, but if I remove that from this example, it does not compile because the parentheses are not understandable to the compiler:

! siunitx error: "invalid-number"
!
! Invalid numerical input '(0.618)'.
!
! See the siunitx documentation for further information.

Is the preamble sisetup the only correction?

up vote 8 down vote accepted

Your syntax of the tabular preamble is faulty. You are using *{2}S[...] But you should put braces around the second argument so that the optional argument of S is processed too:

\documentclass[11pt,letterpaper,english]{extarticle}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{array}

\usepackage{siunitx}
%following now in each table
\sisetup{
 % input-symbols = ( )
}

\begin{document}

\begin{table}
\caption{Still have showAIC argument, as in previous versions}\label{tab:ex5ds}
\centering\begin{tabular}{@{}l*{2}{S[
                        input-symbols = ( ),
                        group-digits = false,
                        table-format = 3.3,
                        table-number-alignment = center,
                        table-space-text-pre = (,
                        table-space-text-post = {***},
                        table-align-text-pre = false,
                        table-align-text-post = false,
                        parse-units = false
                        ]}@{}}
     &  (0.618) &  (0.522)\tabularnewline
 \end{tabular}
 \end{table}
\end{document}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.