負の小数点が表にありません。siuntix を使用して小数点の位置を揃えます。

負の小数点が表にありません。siuntix を使用して小数点の位置を揃えます。

この表内の数字を、小数点が常に下になるように揃えようとしています。これは siunitx パッケージで機能するようです。ただし、2 つの問題に遭遇しました。

  1. 2 番目の列の負の数の小数点 (ただし、小数点は最後から 2 番目の列に表示されます)。

  2. コード内の小数点の前に 0 を追加していないのに、コンパイル後にテーブルにゼロが表示されます。これを解消するにはどうすればよいでしょうか?

ご協力ありがとうございました!

\documentclass[12pt]{scrreprt}

\usepackage{booktabs}
\usepackage{siunitx} 
\sisetup{input-decimal-markers={.}}
\usepackage{threeparttable}
\begin{document}

\begin{table}[h]
            \caption{new table}
            \label{tab:1a}
            \footnotesize
            \begin{threeparttable}
            \begin{tabular}{lcS[table-format=2.2]%
            S[table-format=4.2]%
            S[table-format=4.2]%
            S[table-format=4.2]%
            S[table-format=4.2]}
            \multicolumn{7}{l}{\textit{Correlations between perceived usefulness and active cognitive load for cognitive}} \\
            \multicolumn{7}{l}{\textit{and metacognitive strategies (total scores)}} \\
            \\
            \toprule
                                                            & N       & 1                & 2          & 3        & 4         & 5            \\
            \midrule
            1. Mean usefulness C.            & 96      &                  &            &          &           &               \\
            \midrule
            2. Mean active CL for C.          & 96      & -.07   &            &          &           &               \\
            \midrule
            3. Mean usefulness for M.     & 83      & .18\tnote{*}    & .25\tnote{*}       &          &           &               \\
            \midrule
            4. Mean active CL for M.      & 83      & -.13            & .67\tnote{**}      & .09      &           &               \\
            \midrule
            5. Mean usefulness for A.        & 83      & .77\tnote{**}    & .12       & .77\tnote{*}    & -.02     &                \\
            \midrule
            6. Mean active CL for A.         & 83      & -.10            & .91\tnote{**}      & .19 \tnote{*}     & .92\tnote{**}     & .06  \\
            \bottomrule \\
        %   \multicolumn{7}{l}{*. Correlation is significant at the 0.05 level (1-tailed).}        \\
        %   \multicolumn{7}{l}{**. Correlation is significant at the 0.01 level (1-tailed).}                                                             
            \end{tabular}
            \begin{tablenotes}
            \item[*] Correlation is significant at the 0.05 level (1-tailed).
            \item[**] Correlation is significant at the 0.01 level (1-tailed).
            \end{tablenotes}
            \end{threeparttable}
        \end{table}

\end{document}

現在のテーブル

答え1

数字にはマイナス記号が付く可能性があり、整数部には1桁、小数部には2桁あるため、仕様は次のようになります。

S[table-format=-1.2]
S[table-format=1.2]

それぞれ。表の上部に配置するテキストにはキャプションを使用し、最初の列のピリオドを削除します。

は幅がゼロなので\tnote、 をいくらか拡大します\tabcolsep\footnotesize不要だと思うので、コメントアウトしました。

先頭のゼロに注意してください良い習慣であり、省略することは良い習慣ではありません。

\documentclass[12pt]{scrreprt}

\usepackage{booktabs}
\usepackage{siunitx} 
\sisetup{input-decimal-markers={.}}
\usepackage{threeparttable}
\begin{document}

\begin{table}[htp]
\centering
%\footnotesize

\begin{threeparttable}

\caption{Correlations between perceived usefulness and active cognitive load 
for cognitive and metacognitive strategies (total scores)}
\label{tab:1a}

\addtolength{\tabcolsep}{3pt}

\begin{tabular}{
  @{}
  l
  c
  S[table-format=-1.2]
  S[table-format=1.2]
  S[table-format=1.2]
  S[table-format=-1.2]
  S[table-format=1.2]
  @{}
}
\\
\toprule
& N & {1} & {2}  & {3} & {4} & {5} \\
\midrule
1. Mean usefulness C & 96  &  &&  &   &   \\
\midrule
2. Mean active CL for C  & 96  & -.07   &&  &   &   \\
\midrule
3. Mean usefulness for M & 83  & .18\tnote{*}& .25\tnote{*}   &  &   &   \\
\midrule
4. Mean active CL for M  & 83  & -.13& .67\tnote{**}  & .09  &   &   \\
\midrule
5. Mean usefulness for A & 83  & .77\tnote{**}& .12   & .77\tnote{*}& -.02 &\\
\midrule
6. Mean active CL for A & 83  & -.10& .91\tnote{**}  & .19 \tnote{*} & .92\tnote{**} & .06  \\
\bottomrule
\end{tabular}

\begin{tablenotes}
\item[*] Correlation is significant at the 0.05 level (1-tailed).
\item[**] Correlation is significant at the 0.01 level (1-tailed).
\end{tablenotes}

\end{threeparttable}

\end{table}

\end{document}

ここに画像の説明を入力してください

あなたかもしれないオプションで小数点の前のゼロを削除します

print-zero-integer=false

\sisetup

ここに画像の説明を入力してください

答え2

編集: OP コメントを考慮します。現在、小数は先頭の整数ゼロなしです。

次の形式の表が気に入るかもしれません:

ここに画像の説明を入力してください

パッケージを使用して設定されます tabularray:

\documentclass[12pt]{scrreprt}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
  \ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {3}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

\begin{document}
    \begin{table}[h]
    \SetTblrStyle{foot}{font=\footnotesize}
    \sisetup{print-zero-integer=false}  % <--- for remove zero integers
\begin{talltblr}[
caption = {New table},
  label = {tab:1a},
note{*} = {Correlation is significant at the 0.05 level (1-tailed).},
note{**} = {Correlation is significant at the 0.01 level (1-tailed).},
                ]{
    colsep = {4 pt},
    colspec = {@{} l  X[c, si={table-format=2.0}]%
                      X[c, si={table-format=-1.2{**}}]
                 *{2}{X[c, si={table-format= 1.2{**}}]}
                      X[c, si={table-format=-1.2{*}}]
                      X[c, si={table-format= 1.2}]
               @{}  },
    rowsep  = 0pt,
    row{eachtwo} = {abovesep=3pt},
    row{1,2} = {rowsep=2pt},
    hspan=minimal
                  }
\SetCell[c=7]{j, font=\itshape}
     Correlations between perceived usefulness and active cognitive load for cognitive and metacognitive strategies (total scores)        
                            &         &         &         &         &         &             \\
     \toprule
                            & {{{N}}} & {{{1}}} & {{{2}}} & {{{3}}} & {{{4}}} &  {{{5}}}    \\
     \midrule
1. Mean usefulness C.       & 96      &         &         &         &         &             \\
2. Mean active CL for C.    & 96      & -.07    &         &         &         &             \\
3. Mean usefulness for M.   & 83      &  .18\TblrNote{*}  
                                                & .25\TblrNote{*}
                                                          &         &         &             \\
4. Mean active CL for M.    & 83      & -.13    & .67\TblrNote{**}
                                                          & .09     &         &             \\
5. Mean usefulness for A.   & 83      &  .77\TblrNote{**}
                                                & .12     & .77\TblrNote{*}
                                                                    & -.02    &             \\
6. Mean active CL for A.    & 83      & -.10    & .91\TblrNote{**}
                                                          & .19\TblrNote{*}
                                                                    & .92\TblrNote{*}
                                                                              & .06         \\
    \bottomrule
\end{talltblr}
    \end{table}
\end{document}

関連情報