1

I am stuck on writing the latex code of this table. I have tried the following code:

\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}

But it is not correct because it doesn't merge the row(s) as I would like. Can someone provide hints or suggestions?

enter image description here

  • 1
    Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – dexteritas Jan 13 '18 at 16:43
  • You don't have to sign with your name since it automatically appears in the lower right corner of your post. – dexteritas Jan 13 '18 at 16:43
  • 2
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jan 13 '18 at 16:45
  • 2
    You could use \multirow and \multicolumn (see e.g. Combining multirow and multicolumn) – dexteritas Jan 13 '18 at 16:48
4

Just one version (my view) how to make it a table that even fits into a document:

table

I've done the following:

  • use tabular instead of array (it is not math)
  • use booktabs package, remove all vertical rules and most horizontal rules
  • remove all unnecessary duplication (incl. extra columns and rows)
  • use a more uniform layout by reducing the amount of decimal places to 2 (the S column type can be set up to perform automatic rounding)
  • align numbers on decimal markers

Code:

\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}
  • @RobertaBenetti If this answered your question, feel free to accept this answer by ticking the checkmark symbol on the left. – TeXnician Jan 14 '18 at 8:12
  • Hey sorry to bother you again! I have a correlation matrix made by 18 element and I need to rotate it in vertical. Do you have any suggestion? I attach the code I used below. Many many thanks. – Roberta Benetti Jan 15 '18 at 10:53
  • @RobertaBenetti Please just ask a new question here. This forum works by using the question-answer mechanism. – TeXnician Jan 15 '18 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.