表格的 Latex 代码:如何合并行和列

表格的 Latex 代码:如何合并行和列

我无法编写此表的乳胶代码。 我尝试了以下代码:

\begin{array}{ | l | l | l | l | l | l | l | }
\hline
    \  & \  & \  & \  & \  & \  & \  \\ \hline
    \  & \  & \  & \  & \  & \  & \  \\ \hline
    \  & \  & \  & \  & \  & \  & \  \\ \hline
    USA sample &  &  & Italian sample &  &  & \  \\ \hline
    Sign & Capabilities & Magnitude & Sign & Capabilities & Magnitude & \  \\ \hline
    Positive & Active Listening & 7.34 & Positive & Fluency of Ideas & 7.93 & \  \\ \hline
     & Speech Recognition & 6.97 &  & Operation Analysis & 2.46 & \  \\ \hline
     & Deductive Reasoning & 5.72 &  & Problem Sensitivity & 2.95 & \  \\ \hline
     & Coordination & 4.41 &  &  &  &  \\ \hline
     & System Evaluation & 3.45 &  &  &  &  \\ \hline
    Negative & Social Perceptiveness & -9.39 & Negative & Social Perceptiveness & -3.681 &  \\ \hline
     & Originality & -6.14 &  & Originality & -3.47 &  \\ \hline
     & Speech Clarity & -5.65 &  & Complex Problem Solving & -2.76 &  \\ \hline
     & Oral Comprehension & -3.87 &  & Spatial Orientation & -2.5499999999999998 & \  \\ \hline
     & Visualization & -3.62 &  & Finger Dexterity & -2.0979999999999999 & \  \\ \hline
     & Spatial Orientation & -1.17 &  & \  & \  & \  \\ \hline
    Non-significant & Problem Sensitivity & -2.12 & Non-significant & Oral Comprehension & -2.3090000000000002 & \  \\ \hline
     & Fluency of Ideas & -1.9 &  & Deductive Reasoning & -2.09 & \  \\ \hline
     & Oral Expression & -1.04 &  & Manual Dexterity & -2.08 & \  \\ \hline
     & Manual Dexterity & -0.155 &  & Visualization & -1.22 & \  \\ \hline
     & Finger Dexterity & 0.95499999999999996 &  & Coordination & -0.4 & \  \\ \hline
     & Operation Analysis & 0.27 &  & Speech Clarity & 0.23 & \  \\ \hline
     & Complex Problem Solving & 1.84 &  & Oral Expression & 0.245 & \  \\ \hline
     &  &  &  & Speech Recognition & 1.37 & \  \\ \hline
     &  &  &  & System Evaluation & 1.4 & \  \\ \hline
     &  &  &  & Active Listening & 2.3199999999999998 & \  \\ \hline
\end{array}

但它并不正确,因为它没有像我希望的那样合并行。有人可以提供提示或建议吗?

在此处输入图片描述

答案1

只有一个版本(我的观点)如何使其成为适合文档的表格:

桌子

我已完成以下操作:

  • tabular代替array(这不是数学)
  • 使用booktabs包,删除所有垂直规则和大多数水平规则
  • 删除所有不必要的重复(包括多余的列和行)
  • 通过将小数位数减少到 2 位来使用更统一的布局(S可以设置列类型以执行自动舍入)
  • 将数字与小数点对齐

代码:

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[margin=1cm]{geometry}

\begin{document}
\begin{table}
\centering
\caption{Your caption here}
\sisetup{table-format=-1.2, round-mode=places}
\begin{tabular}{ l lS lS }
    \toprule
    Sign & \multicolumn{2}{c}{USA sample} & \multicolumn{2}{c}{Italian sample}\\ 
    \cmidrule(lr){2-3}\cmidrule(lr){4-5}
     & Capabilities & {Magnitude} & Capabilities & {Magnitude}\\ \midrule
    Positive & Active Listening & 7.34 & Fluency of Ideas & 7.93 \\ 
     & Speech Recognition & 6.97 &  Operation Analysis & 2.46\\ 
     & Deductive Reasoning & 5.72 & Problem Sensitivity & 2.95\\ 
     & Coordination & 4.41 &  &  \\ 
     & System Evaluation & 3.45 &  & \\\addlinespace
    Negative & Social Perceptiveness & -9.39 & Social Perceptiveness & -3.681\\ 
     & Originality & -6.14 &  Originality & -3.47 \\ 
     & Speech Clarity & -5.65  & Complex Problem Solving & -2.76 \\ 
     & Oral Comprehension & -3.87 &  Spatial Orientation & -2.5499999999999998 \\ 
     & Visualization & -3.62 &  Finger Dexterity & -2.0979999999999999 \\ 
     & Spatial Orientation & -1.17 &  & \\ \addlinespace
    Non-significant & Problem Sensitivity & -2.12 & Oral Comprehension & -2.3090000000000002 \\ 
     & Fluency of Ideas & -1.9 &  Deductive Reasoning & -2.09 \\ 
     & Oral Expression & -1.04 &  Manual Dexterity & -2.08 \\ 
     & Manual Dexterity & -0.155 & Visualization & -1.22 \\ 
     & Finger Dexterity & 0.95499999999999996 &  Coordination & -0.4 \\ 
     & Operation Analysis & 0.27 &  Speech Clarity & 0.23 \\ 
     & Complex Problem Solving & 1.84  & Oral Expression & 0.245 \\ 
     &  &   & Speech Recognition & 1.37 \\ 
     &  &   & System Evaluation & 1.4 \\ 
     &  &   & Active Listening & 2.3199999999999998 \\
    \bottomrule
\end{tabular}
\end{table}
\end{document}

相关内容