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

时间:2020-08-01 17:09:45

标签: latex tabular

如何删除第一行和第二行文本之间的多余空格?预先感谢!

\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

1 个答案:

答案 0 :(得分:2)

您的表由9列定义,但是在第二行中使用10。您会收到关于此的错误信息,因此您甚至不应该查看什么可能是有效的pdf。

如果错误已修复,则表将如下所示:

\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

与其对所有列的宽度进行硬编码,不如使用tabularx包(也许可以使用booktabs包来获得更好的间距)更容易:

\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

通常我也建议使用@{}XlllXlll@{}删除列前后的空间,但是对于此特定示例,这会导致换行符非常糟糕