0

I'm trying to produce a longtable with standardized betas, significance stars as well as standard error (SE). I want the numbers to be rounded with a precision of 2 (digits post-decimal). In my input, I wrote the SE in parethesis. Now I'm trying to have the siunitx-package to round those numbers, which, unfortunately, produces a weird overlap of the parenthesis with the numbers. This is my working example:

\documentclass[10pt,ngerman,english]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{geometry}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{multirow,booktabs,setspace,caption}
\usepackage{tikz}
\usepackage{soul}
\usepackage{caption}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{float}

\pagestyle{empty}

\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt}
\captionsetup[figure]{labelsep=period,labelfont=it,justification=justified,
  singlelinecheck=false,font=doublespacing}
  
\begin{document}

\sisetup{detect-mode,
        tight-spacing           = true,
        group-digits            = false,
        input-signs             = + -,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        round-mode              = places,
        table-number-alignment  = center,
        round-precision         = 2,
        add-integer-zero        = false}
    
\captionsetup{width=.75\textwidth}
\begin{longtable}{l*{6}{S[table-format=0.3]}}
            
%%% headers and footers
\caption{This is my caption}\\
\toprule
& \multicolumn{2}{c}{Model 1} & 
  \multicolumn{2}{c}{Model 2} & 
  \multicolumn{2}{c}{Model 3} \\ 

\cmidrule(l){2-7}

&\multicolumn{2}{c}{\textit{Stand.Coeff.(SE)}} & 
 \multicolumn{2}{c}{\textit{Stand.Coeff.(SE)}} & 
 \multicolumn{2}{c}{\textit{Stand.Coeff.(SE)}} \\ 
\midrule
\endfirsthead

\multicolumn{7}{l@{}}{\footnotesize (cont'd on following page)}\\
\endfoot

\bottomrule
\multicolumn{7}{@{}l}{$^+$ Fixed parameter}
\endlastfoot\\

%%% body of longtable
&\multicolumn{6}{c}{\textbf{Factor Loadings}}\\
  \multicolumn{7}{l}{\textbf{CONSTRUCT 1}}\\
     \hspace {.25cm}Variable 1              & .610*** & (.091) & .570*** & (.093) & .590*** &(.102)\\
     \hspace {.25cm}Variable 2              & .610*** & (.091) & .570*** & (.093) & .590*** &(.102)\\
     \hspace {.25cm}Variable 3              & .610*** & (.091) & .570*** & (.093) & .590*** &(.102)\\
     
\end{longtable}
\end{document}

enter image description here

Thanks in advance.

3
  • You are printing 3 digits .. but the precision is 2 ... Not overlap .... just an extra spaxce for the missing character ... try: table-format=0.2
    – koleygr
    Commented Jan 27, 2021 at 15:19
  • 1
    Thanks for pointing me into the right direction. ´´´table-format=1.2´´´ did the trick.
    – Jan
    Commented Jan 27, 2021 at 15:38
  • Welcome @Jan ... Happy TeXing...
    – koleygr
    Commented Jan 27, 2021 at 15:47

1 Answer 1

1

Mostly off-topic, but anyway ... I would write your table on the following way:

\documentclass[10pt,ngerman,english]{article}
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{booktabs, longtable, multirow, tabularx, threeparttable}
\usepackage{caption}
\captionsetup[table]{skip=1ex,
                     labelsep=newline,  
                     textfont=it, justification=justified,
                     singlelinecheck=false}
\captionsetup[figure]{labelsep=period, labelfont=it,justification=justified,
                      singlelinecheck=false,
                      font=doublespacing}% why?
\NewExpandableDocumentCommand\mcc{O{1}m}{\multicolumn{#1}{c}{#2}}
\NewExpandableDocumentCommand\mcl{O{1}m}{\multicolumn{#1}{l}{#2}}
\NewExpandableDocumentCommand\mcr{O{1}m}{\multicolumn{#1}{r}{#2}}

\pagestyle{empty}
\begin{document}

\sisetup{add-integer-zero        = false,
         input-signs             = + -,
         input-open-uncertainty  = ,
         input-close-uncertainty = ,
         round-mode              = places,
         round-precision         = 2,
         table-format            = 0.2,
        }

\begin{longtable}{ll*{3}{@{\qquad}
                         S[table-space-text-post=***]
                         S[table-space-text-pre=(,
                           table-space-text-post=)]}
                 }
\captionsetup{margin=22mm} % <---- set manually after three compilation
%%% headers and footers
\caption{This is my caption}
\label{tab:longtable}                                                       \\
    \toprule
    && \mcc[6]{\emph{Standard Coefficients (SE)}}                           \\ 
    \cmidrule(l){3-8}  
    && \mcc[2]{Model 1}
            &  \mcc[2]{Model 2}
                    &   \mcc[2]{Model 3}                                    \\
    \cmidrule(l){3-4}
    \cmidrule(l){5-6}
    \cmidrule(l){7-8}
\endfirsthead
\caption[]{This is my caption}                                              \\
    \toprule
    && \mcc[6]{\emph{Standard Coefficients (SE)}}                           \\
    \cmidrule(l){3-8}
    && \mcc[2]{Model 1}
            &  \mcc[2]{Model 2}
                    &   \mcc[2]{Model 3}                                    \\
    \cmidrule(l){3-4}
    \cmidrule(l){5-6}
    \cmidrule(l){7-8}
    \bottomrule
\endhead
    \bottomrule
    \mcl[8]{$^+$ Fixed parameter}                                           \\
    \mcr[8]{\footnotesize (cont'd on following page)}                       \\
\endfoot
    \midrule[\heavyrulewidth]
    \mcl[8]{$^+$ Fixed parameter}                                           \\
\endlastfoot
%%% body of longtable
    && \mcc[6]{\textbf{Factor Loadings}}                                    \\
    \midrule
\mcl[8]{\textbf{CONSTRUCT 1}}                                               \\
    & Variable 1 & .610*** & (.091) & .570*** & (.093) & .590*** & (.102)   \\
    & Variable 2 & .610*** & (.091) & .570*** & (.093) & .590*** & (.102)   \\
    & Variable 3 & .610*** & (.091) & .570*** & (.093) & .590*** & (.102)   \\
\end{longtable}
\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 .