
소수점이 항상 서로 아래에 오도록 이 테이블 내의 숫자를 정렬하려고 합니다. 이것은 siunitx 패키지에서 작동하는 것 같습니다. 그러나 나는 두 가지 어려움을 겪었습니다.
두 번째 열의 음수에 대한 소수점(소수점은 마지막 두 번째 열에 표시되지만)
코드에서 소수점 앞에 0을 추가하지 않았음에도 불구하고 테이블은 컴파일된 후 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
숫자에는 빼기 기호(정수 부분에 한 자리, 소수 부분에 두 자리)가 있을 수 있으므로 사양은 다음과 같습니다.
S[table-format=-1.2]
S[table-format=1.2]
각기. 표 상단에 배치한 텍스트에 캡션을 사용하고 첫 번째 열에서 마침표를 제거하겠습니다.
a는 \tnote
너비가 0을 사용하므로 \tabcolsep
. 불필요한 것 같아서 \footnotesize
댓글로 달았습니다.
앞에 0이 있다는 점에 유의하세요.~이다좋은 습관을 갖고 그것을 생략하는 것은 아닙니다.
\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}
너~할 것 같다옵션을 사용하여 소수 구분 기호 앞의 0을 제거하십시오.
print-zero-integer=false
안에 \sisetup
. 당신은 얻을 것이다
답변2
편집하다: OP 코멘트가 고려됩니다. 이제 십진수에는 앞에 정수 0이 없습니다.
다음과 같은 형식의 테이블이 마음에 드실 것입니다.
패키지 를 사용하여 설정됩니다 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}