简体   繁体   English

LaTex 表格环境中第一行和第二行文本之间的额外空格

[英]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}

在此处输入图像描述

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.您的表定义为 9 列,但在第二行中使用 10。您将收到一个错误,因此您甚至不应该查看可能是或可能不是有效的 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}

在此处输入图像描述

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):与其对所有列的宽度进行硬编码,不如使用tabularx package (也许使用booktabs package 以获得更好的间距)更容易:

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

在此处输入图像描述

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通常我还建议使用@{}XlllXlll@{}来删除列前后的空格,但是对于这个特定的例子,这会导致一个非常糟糕的换行符

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM