[英]Extra space between text of first and second rows in LaTex tabular environment
如何刪除第一行和第二行文本之間的多余空格? 提前致謝!
\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}
您的表定義為 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}
與其對所有列的寬度進行硬編碼,不如使用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}
通常我還建議使用@{}XlllXlll@{}
來刪除列前后的空格,但是對於這個特定的例子,這會導致一個非常糟糕的換行符
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.