Marie
Marie

Reputation: 349

Extra space between text of first and second rows in LaTex tabular environment

How to remove the extra space between the text of the first and second rows? Thanks in advance!

\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}

\begin{document}
\begin{tabular}{m{13em}m{1cm}m{1cm}m{1cm}m{13em}m{1cm}m{1cm}m{1cm}}  \hline
    & A & B & C & & D & E & F \\ \hline
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & & \\ 
\hspace{3mm} Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\hspace{3mm} Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\

\end{tabular}
\end{document}

enter image description here

Upvotes: 1

Views: 11251

Answers (1)

Your table is defined with 9 columns, but in the second row you use 10. You will get an error about this, so you shouldn't even look at what might or might not be a valid pdf.

If the error is fixed, the table will look like this:

\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}

\begin{document}
\begin{tabular}{m{13em}m{1cm}m{1cm}m{1cm}m{13em}m{1cm}m{1cm}m{1cm}}  \hline
    & A & B & C & & D & E & F \\ \hline
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & \\ 
\hspace{3mm} Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\hspace{3mm} Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\

\end{tabular}
\end{document}

enter image description here

Instead of hard-coding the widths of all columns, it might be easier to use the tabularx package (and maybe the booktabs package for better spacing):

\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{tabularx}{\linewidth}{XlllXlll}  
\toprule
    & A & B & C & & D & E & F \\ 
\midrule
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & \\ 
\quad Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\quad Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\
\bottomrule
\end{tabularx}
\end{document}

enter image description here

Normally I would also suggest to use @{}XlllXlll@{} to remove the space in front and after the columns, but for this specific example, this lead to a really bad linebreak

Upvotes: 4

Related Questions