多表 cline 断开连接

多表 cline 断开连接
\usepackage{multirow}
\usepackage{array}

\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline
}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother


\begin{table}[h]
\renewcommand{\arraystretch}{1.5}
\caption{Summary of statistical analysis results (*: $p$\,\textless\,.05, **: $p$\,\textless\,.01, ***: $p$\,\textless\,.001).}
\label{SecondEXPResultTable}
\resizebox{1\textwidth}{!}{%
\begin{tabular}{l||ccl"l||ccl}
\thickhline
\textbf{Measure} &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} &
  \textbf{Measure} &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} \\ \thickhline
\multirow{2}{*}{\textbf{Distraction}} &
  \multirow{2}{*}{$\alpha$\,=\,.91} &
  \multirow{2}{*}{$\chi^2$\,=\,33.97, $p$\,$<$\,.001} &
  \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}DF $>$ TP***\\ DF $>$ STP***\end{tabular}} &
  \textbf{Spatial Presence} &
  $\alpha$\,=\,.9 &
  $\chi^2$\,=\,6.97, $p$\,$<$\,.05 &
  DF $>$ TP*** \\ \cline{5-8}
 &
   &
   &
   &
  \textbf{AR Implausibility} &
  $\alpha$\,=\,.67 &
  $\chi^2$\,=\,8.75, $p$\,$<$\,.05 &
  DF $>$ TP** \\ \hline
\textbf{Visual Inconsistency} &
  $\alpha$\,=\,.61 &
  $\chi^2$\,=\,0.63, $p$\,$>$\,0.1 &
   &
  \textbf{Animalism} &
  $\alpha$\,=\,.87 &
  $\chi^2$\,=\,9.28, $p$\,$>$\,.001 &
  \begin{tabular}[c]{@{}c@{}}DF $<$ TP*\\ DF $<$ STP*\end{tabular} \\ 
  \thickhline
\end{tabular}
\vspace{-2em}
}
\end{table}

在此处输入图片描述

上图是我的问题。Cline{5-8} 命令没有连接到它旁边的边界线。

我认为,newcolumntype{"} 会产生问题。有一个 \hskip。

但我不知道如何修复它。因为我需要这个命令来画粗线。

我只想连接(cline)直到下一个边界线。

答案1

Mico 的答案有一点变化,更加注重表格两半的分离,第 4 列和第 8 列对齐以及第 2 列和第 6 列对齐<,以及略有不同的列宽。>=

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably

\usepackage{makecell}

\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}

\begin{table}[h]
\caption{caption text}
\label{key}
\begin{tabularx}{\textwidth}{@{} Yccl Yccl @{}}
\toprule
Measure & \multicolumn{3}{c}{Tests} & Measure & \multicolumn{3}{c@{}}{Tests} \\
\cmidrule(lr){2-4} \cmidrule(l){6-8}
& Cronbach & Friedman & Post-hoc & & Cronbach & Friedman & Post-hoc \\
\cmidrule(r){1-4} \cmidrule(l){5-8}

Distraction &
  $\alpha=.91$ &
  \makecell{$\chi^2=33.97$,\\ $p<.001$} &
  \makecell[l]{DF$>$TP${}^{***}$\\ DF$>$STP${}^{***}$} &
Spatial presence &
  $\alpha=.9$\phantom{0} &
  \makecell{$\chi^2=6.97$,\\ $p<.05$} &
  DF$>$TP${}^{***}$ \\ 
  \addlinespace % \cmidrule{5-8}
  & & & &
AR implausibility &
  $\alpha=.67$ &
  \makecell{$\chi^2=8.75$,\\ $p<.05$} &
  DF$>$TP${}^{**}$ \\ 
\addlinespace % \midrule
Visual inconsistency &
  $\alpha=.61$ &
  \makecell{$\chi^2=0.63$,\\ $p>0.1$} & &
Animalism &
  $\alpha=.87$ &
  \makecell{$\chi^2=9.28$,\\ $p>.001$} &
  \makecell[l]{DF$<$TP${}^{*}$\\ DF$<$STP${}^{*}$} \\ 
\bottomrule
\end{tabularx}

\smallskip
Statistical significance levels: ${}^{*}$\   $p<.05$; 
                                 ${}^{**}$\  $p<.01$; 
                                 ${}^{***}$\ $p<.001$
\end{table}

\end{document}

这是另一个小的变化:

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably

\usepackage{makecell}
\usepackage{booktabs}

\begin{document}

\begin{table}[h]
\caption{caption text}
\label{key}
\centering
\begin{tabular}{lcccl}
\toprule
Measure & \multicolumn{4}{c}{Tests} \\
\cmidrule{2-5}
& Cronbach & \multicolumn{2}{c}{Friedman} & \makecell{Post-hoc} \\
\midrule 

Distraction &
  $\alpha=.91$ &
  $\chi^2=33.97$, & $p<.001$ &
  DF$>$TP${}^{***}$,  DF$>$STP${}^{***}$ \\

Visual inconsistency &
  $\alpha=.61$ &
  $\chi^2=0.63$,\phantom{0} & $p>0.1$\phantom{0} & \\
  
Spatial presence &
  $\alpha=.9$\phantom{0} &
  $\chi^2=6.97$,\phantom{0} &  $p<.05$\phantom{0} &
  DF$>$TP${}^{***}$ \\ 
  
AR implausibility &
  $\alpha=.67$ &
  $\chi^2=8.75$,\phantom{0} & $p<.05$\phantom{0} &
  DF$>$TP${}^{**}$ \\ 

Animalism &
  $\alpha=.87$ &
  $\chi^2=9.28$,\phantom{0} & $p>.001$ &
  DF$<$TP${}^{*}$,  DF$<$STP${}^{*}$ \\ 
\bottomrule
\multicolumn{5}{l}{Statistical significance levels: ${}^{*}$\   $p<.05$;  ${}^{**}$\  $p<.01$;  ${}^{***}$\ $p<.001$}
\end{tabular}

\end{table}

\end{document}

答案2

我会花大部分时间让表格更清晰易读,比如不使用\resizebox、允许单元格换行、不在\textbf标题中使用 以及为标题材料提供更多视觉结构。哦,我还会使用更少的水平线——甚至根本不使用垂直线。

以下截图对比了 OP 代码生成的表格和通过实施上述建议可能生成的表格。我敢说,第二种方法更有可能吸引读者真正研究表格的内容。

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably

\usepackage{multirow,array,graphicx}
\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother

%% new code, for second table
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}\hsize=#1\hsize}X}
\newcolumntype{C}[1]{>{\Centering\hspace{0pt}\hsize=#1\hsize}X}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}


\begin{table}[h]
\renewcommand{\arraystretch}{1.5}
\caption{Summary of statistical analysis results (*: $p<.05$; **: $p<.01$; ${}^{***}$: $p<.001$).}
\label{SecondEXPResultTable}

\resizebox{1\textwidth}{!}{%
\begin{tabular}{l||ccl"l||ccl}
\thickhline
\textbf{Measure} &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} &
  \textbf{Measure} &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} \\ \thickhline
\multirow{2}{*}{\textbf{Distraction}} &
  \multirow{2}{*}{$\alpha=.91$} &
  \multirow{2}{*}{$\chi^2=33.97$, $p<.001$} &
  \multirow{2}{*}{%
      \begin{tabular}[c]{@{}c@{}}
        DF $>$ TP***\\ 
        DF $>$ STP***
      \end{tabular}} &
  \textbf{Spatial Presence} &
  $\alpha=.9$ &
  $\chi^2=6.97$, $p<.05$ &
  DF $>$ TP*** \\ \cline{5-8}
  & & & &
  \textbf{AR Implausibility} &
  $\alpha=.67$ &
  $\chi^2=8.75$, $p$\,$<$\,.05 &
  DF $>$ TP** \\ \hline
\textbf{Visual Inconsistency} &
  $\alpha=.61$ &
  $\chi^2=0.63$, $p$\,$>$\,0.1 &
   &
  \textbf{Animalism} &
  $\alpha=.87$ &
  $\chi^2=9.28$, $p$\,$>$\,.001 &
  \begin{tabular}[c]{@{}c@{}}
     DF $<$ TP*\\ 
     DF $<$ STP*
  \end{tabular} \\ 
  \thickhline
\end{tabular}
\vspace{-2em}
}
\end{table}



\begin{table}[h]
\setlength\tabcolsep{3pt} % default: 6pt
\caption{Second try.\strut}
\label{Second}


\begin{tabularx}{\textwidth}{@{} 
     L{0.97}C{0.96}C{0.97}C{1.10} 
     L{0.99}C{0.99}C{0.99}C{1.03} @{}}
\toprule
Measure & \multicolumn{3}{c}{Tests} & Measure & \multicolumn{3}{c@{}}{Tests} \\
\cmidrule(lr){2-4} \cmidrule(l){6-8}
& Cronbach & Friedman & Post-hoc & & Cronbach & Friedman & Post-hoc \\
\midrule

Distraction &
  $\alpha=.91$ &
  $\chi^2=33.97$, $p<.001$ &
  \mbox{DF$>$TP${}^{***}$} \mbox{DF$>$STP${}^{***}$} &
Spatial presence &
  $\alpha=.9$ &
  $\chi^2=6.97$, $p<.05$ &
  DF$>$TP${}^{***}$ \\ 
  \addlinespace % \cmidrule{5-8}
  & & & &
AR implausibility &
  $\alpha=.67$ &
  $\chi^2=8.75$, $p<.05$ &
  DF$>$TP${}^{**}$ \\ 
\addlinespace % \midrule
Visual inconsistency &
  $\alpha=.61$ &
  $\chi^2=0.63$, $p>0.1$ & &
Animalism &
  $\alpha=.87$ &
  $\chi^2=9.28$, $p>.001$ &
  \mbox{DF$<$TP${}^{*}$} \mbox{DF$<$STP${}^{*}$} \\ 
\bottomrule
\end{tabularx}

\smallskip
Statistical significance levels: ${}^{*}$\   $p<.05$; 
                                 ${}^{**}$\  $p<.01$; 
                                 ${}^{***}$\ $p<.001$
\end{table}

\end{document}

答案3

的间隙\cline是由"类型的列引起的,您在设置中没有考虑到这一点。我宁愿使用和包\cline提供的标准可能性,而不是您的行定义。由于您没有提供有关文档包布局的任何信息,我使用`standalone 并仅关注表格:arraymakecell

\documentclass[margin=3mm]{standalone}
\usepackage{array, makecell, multirow}

\begin{document}
%\begin{table}[h]
\renewcommand{\arraystretch}{1.5}
%\caption{Summary of statistical analysis results (*: $p < .05$, **: $p < .01$, ***: $p < .001$).}

%\label{SecondEXPResultTable}

\begin{tabular}{l||ccl !{\vrule width 1pt} l||ccl}
    \Xhline{1pt} % defined in makecell
\textbf{Measure} 
    &   \textbf{Cronbach test} 
        &   \textbf{Friedman test} 
            &   \textbf{Post-hoc test} 
                &   \textbf{Measure} 
                    &   \textbf{Cronbach test} 
                        &   \textbf{Friedman test} 
                            &   \textbf{Post-hoc test}  \\ 
    \Xhline{1pt}
\multirow{2}{*}{\textbf{Distraction}} 
    &   \multirow{2}{*}{$\alpha$\,=\,.91} 
        &   \multirow{2}{*}{$\chi^2$\,=\,33.97, $p$\,$<$\,.001} 
            &   $\mathrm{DF} > \mathrm{TP}$***
                &   \textbf{Spatial Presence} 
                    &   $\alpha$\,=\,.9 
                        &   $\chi^2$\,=\,6.97, $p$\,$<$\,.05 
                            &   DF $>$ TP*** \\ 
    \cline{5-8}
    &   &   &   $\mathrm{DF} > \mathrm{STP}$***
                &   \textbf{AR Implausibility} 
                    &   $\alpha$\,=\,.67 
                        &   $\chi^2$\,=\,8.75, $p$\,$<$\,.05 
                            &   DF $>$ TP** \\ 
    \hline
\textbf{Visual Inconsistency} 
    &   $\alpha = .61$ 
        &   $\chi^2 = 0.63,\ p >0.1$ 
            &   &   \textbf{Animalism} 
                    &   $\alpha = .87$ 
                        &   $\chi^2 = 9.28,\ p > .001$ 
                            &   \makecell{DF $<$ TP*\\ DF $<$ STP*} \\
    \Xhline{1pt}
\end{tabular}
%\end{table}
\end{document}

在此处输入图片描述

附录: 您的表格非常宽,因此您可以考虑将列标题写成两行,并使用较小的表格字体大小:

\documentclass{article}
\usepackage[showframe,  % in real document delete this option
            margin=20mm]{geometry}

\usepackage{array, makecell, multirow}
\renewcommand\theadfont{\bfseries\footnotesize\linespread{0.84}\selectfont}

\begin{document}
\begin{table}[ht]
\caption{Summary of statistical analysis results (*: $p < .05$, **: $p < .01$, ***: $p < .001$).}
\label{SecondEXPResultTable}
    \centering
    \renewcommand{\arraystretch}{1.5}
    \setlength\tabcolsep{3pt}
    \small
\begin{tabular}{@{}l||lll !{\vrule width 1pt} l||lll @{}}
    \Xhline{1pt}
\thead{Measure} 
    &   \thead{Cronbach\\ test} 
        &   \thead{Friedman\\ test} 
            &   \thead{Post-hoc\\ test} 
                &   \thead{Measure} 
                    &   \thead{Cronbach\\ test} 
                        &   \thead{Friedman\\ test} 
                            &   \thead{Post-hoc\\ test}  \\ 
    \Xhline{1pt}
\multirow{2}{*}{\textbf{Distraction}} 
    &   \multirow{2}{*}{$\alpha = .91$} 
        &   \multirow{2}{*}{$\chi^2 = 33.97$***}
            &   $\mathrm{DF} > \mathrm{TP}$***
                &   \textbf{Spatial Presence} 
                    &   $\alpha = .9$ 
                        &   $\chi^2 = 6.97$*
                            &   $\mathrm{DF} > \mathrm{TP}$*** \\ 
    \cline{5-8}
    &   &   &   $\mathrm{DF} > \mathrm{STP}$***
                &   \textbf{AR Implausibility} 
                    &   $\alpha = .67$ 
                        &   $\chi^2 =8.75$*
                            &   $\mathrm{DF} > \mathrm{TP}$** \\ 
    \hline
\thead{Visual\\ Inconsistency} 
    &   $\alpha = .61$ 
        &   $\chi^2 = 0.63$**
            &   &   \textbf{Animalism} 
                    &   $\alpha = .87$ 
                        &   $\chi^2 = 9.28$***
                            &   \makecell[l]{$\mathrm{DF} < \mathrm{TP}$*\\ 
                                             $\mathrm{DF} < \mathrm{STP}$*} \\
    \Xhline{1pt}
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

(灰线表示文本边框)

答案4

正如其他答案所说,原帖的表格确实太宽了。不过,我在这里提供了一个解决方案,可以在表格中按原样绘制所需的规则。我不关心表格是否适合当前文本块的大小。

\documentclass{article}

\usepackage{geometry}
\geometry{left=2.2cm,right=2.2cm,top=2cm,bottom=2cm,papersize={29.7cm,21cm}}
\usepackage{nicematrix}
\usepackage{tikz}
\usepackage{caption}

\makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 1pt
    \futurelet \reserved@a \@xhline
}
\newcolumntype{"}{!{\vrule width 1pt}}
\makeatother

\begin{document}

\begin{table}[h]
\renewcommand{\arraystretch}{1.5}
\caption{Summary of statistical analysis results (*: $p$\,\textless\,.05, **: $p$\,\textless\,.01, ***: $p$\,\textless\,.001).}
\label{SecondEXPResultTable}
\begin{NiceTabular}{>{\bfseries}l||ccl">{\bfseries}l||ccl}[cell-space-limits=2pt]
\thickhline
  Measure &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} &
  Measure &
  \textbf{Cronbach test} &
  \textbf{Friedman test} &
  \textbf{Post-hoc test} \\ \thickhline
  \Block{2-1}{Distraction} &
  \Block{2-1}{$\alpha=.91$} &
  \Block{2-1}{$\chi^2=33.97$, $p<.001$} &
  \Block{2-1}{} DF $>$ TP***  &
  Spatial Presence &
  $\alpha=.9$,
  $\chi^2=6.97$, $p <.05$ &
  DF $>$ TP*** \\ \Hline
   &
   &
   &
  DF $>$ STP*** & 
  AR Implausibility &
  $\alpha=.67$ &
  $\chi^2=8.75$, $p<.05$ &
  DF $>$ TP** \\ \hline
  \Block{}{Visual\\ Inconsistency} &
  $\alpha=.61$ &
  $\chi^2=0.63$, $p>0.1$ &
   &
  Animalism &
  $\alpha=.87$ &
  $\chi^2=9.28$, $p>.001$ &
  \Block{}{DF $<$ TP*\\ DF $<$ STP*} \\ 
  \thickhline
\end{NiceTabular}
\vspace{-2em}
\end{table}

\end{document}

您需要多次编译(因为nicematrix使用 PGF/Tikz 节点)。

上述代码的输出

相关内容