3

I have a table with various values. I want to have them aligned on decimal point and rounded to 4 significant digits. This seems to work fine except for the negative numbers. enter image description here

% !TEX TS-program = XeLaTeX
\documentclass[letterpaper, 12pt]{report}
\usepackage{caption} 
\usepackage{amsmath}  % American Mathmatical Societey
\usepackage{booktabs}   % for nice tables
\usepackage{pslatex} %Times font
% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx} 
\sisetup{
    detect-mode,
    tight-spacing       = true,
    group-digits        = false ,
    input-signs         = ,
            input-symbols       = ( ) [ ] - + *,
    input-open-uncertainty  = ,
    input-close-uncertainty = ,
    table-align-text-post   = false,
            bracket-negative-numbers,
            round-mode = places,
            round-precision = 3,
            negative-color = red
    }

\begin{document}
\begin{table}[p]
\centering
\caption{Results of Regression Analysis: \\  (Dependent Variable =      Dropout Rate)}
\label{tab:regress}
\begin{tabular}{@{}lSSSSSS}
\toprule
 &   &  {Robust} &   &   &   &    \\ 
 Variable & {Coeff} & {Std Err} &   {t} &   {P>t} &     \multicolumn{2}         {c}{[95\% Conf. Interval]}   \\ 
\midrule
 Per Pupil K &  -0.174 &    0.026841 &  -6.48 &     0 &     -0.2265755     &    -0.1213346  \\   \addlinespace
 North South &   &   &   &   &   &    \\  
 South &    -0.037 &    0.123 &     -0.31 &     0.76 &  -0.279&     0.203  \\  
 Alaska Hawaii &    2.138685 &  1.364939 &  1.57 &  0.117 &     -0.5372051 &    4.814576  \\  \addlinespace
 Locale &    &   &   &   &   &    \\  
 Large City &   2.196757 &  0.6684642 &     3.29 &  0.001 &     0.8862684 &     3.507246  \\  
 Mid Size City &    1.424357 &  0.2531437 &     5.63 &  0 &     0.9280816 &     1.920631  \\  
 Urban Fringe of Lg. &  -0.1878159 &    0.1173635 &     -1.6 &  0.11 &  -0.4179009 &    0.0422691  \\  
 Urban Fringe Of Med. &     0.0142511 &     0.1131159 &     0.13 &  0.9 &   -0.2075067 &  -0.4179009    \\ \midrule
 Obs & 4,923 &&&&& \\
 $R^2$ & 0.257 &&&&& \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
2
  • 1
    It's because of input-signs and input-symbols. Apr 13, 2018 at 10:55
  • 3
    Why are you using input-signs = ,? Apr 13, 2018 at 10:55

1 Answer 1

3

Here is a work-around, with some improvements: your table is too wide for standard pages, so I loaded geometry to have more sensible margins, reduced the value of \tabcolsep and replaced the obsolete pslatex with newtxtext,newtxmath, based on the times-clone TeX Gyre Termes I also loaded makecell which allows for line breaks in standard cells.

\documentclass[letterpaper, 12pt]{report}
\usepackage{geometry}
\usepackage{caption}
\usepackage{amsmath} % American Mathmatical Societey
\usepackage{booktabs} % for nice tables%
%\usepackage{pslatex} %Times font obsolete
\usepackage{newtxtext, newtxmath}
\usepackage{makecell, array}
% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx}
\sisetup{
    detect-mode,
    tight-spacing = true,
    group-digits = false ,
    input-signs =- ,
    input-symbols = ( ) [ ] - + *,
    input-open-uncertainty = ,
    input-close-uncertainty = ,
    table-align-text-post = false,
            bracket-negative-numbers,
            round-mode = places,
            round-precision = 3,
            negative-color = red,
    table-space-text-pre = $-$,
    table-align-text-pre = false
    }

\begin{document}

\begin{table}[p]
\centering\setlength{\tabcolsep}{3.5pt}
\caption{Results of Regression Analysis: \\ (Dependent Variable = Dropout Rate)}
\label{tab:regress}
\begin{tabular}{@{}l*{6}{S}@{}}
\toprule
 Variable & {Coeff} & {\makecell{Robust\\Std Err}} & {t} & {P${} >{} $t} & \multicolumn{2} {c}{\makecell{[95\,\% Conf. \\ Interval]}} \\
\midrule
 Per Pupil K & -0.174 & 0.026841 & -6.48 & 0 & {$-$} 0.2265755 & {$-$} 0.1213346 \\ \addlinespace
 North South & & & & & & \\
 South & -0.037 & 0.123 & -0.31 & 0.76 & -0.279& 0.203 \\
 Alaska Hawaii & 2.138685 & 1.364939 & 1.57 & 0.117 & {$-$}0.5372051 & 4.814576 \\ \addlinespace
 Locale & & & & & & \\
 Large City & 2.196757 & 0.6684642 & 3.29 & 0.001 & 0.8862684 & 3.507246 \\
 Mid Size City & 1.424357 & 0.2531437 & 5.63 & 0 & 0.9280816 & 1.920631 \\
 Urban Fringe of Lg. & {$ - $}0.1878159 & 0.1173635 & -1.6 & 0.11 & {$-$}0.4179009 & 0.0422691 \\
 Urban Fringe Of Med. & 0.0142511 & 0.1131159 & 0.13 & 0.9 & {$-$}0.2075067 & {$-$}0.4179009 \\ \midrule
 Obs & 4,923 &&&&& \\
 $R^2$ & 0.257 &&&&& \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

You must log in to answer this question.

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