我们如何在 Overleaf 的 longtable 中包装文本?

How do we wrap text in a longtable in Overleaf?

我在 Overleaf 上使用以下语法。但是,第一个 header 溢出到第二列。我也尝试使用 p{0.75\linewidth},但没有用。有什么建议吗?

\documentclass[12pt]{article}
\begin{center}
\begin{table}[h!]
\caption{Table 17}
\begin{tabular}{|m{5cm}|m{1.25cm}|m{1cm}|m{1.25cm}|m{1cm}|m{1.25cm}|m{1cm}|m{1.25cm}|m{1cm}|}
\hline
\multicolumn{1}{|p{5cm}|}{\multirow{2}{*}{\textbf{Land Use/Land Cover Categories}}} & \multicolumn{2}{|c|}{\textbf{1977}} & \multicolumn{2}{|c|}{\textbf{1993}} & \multicolumn{2}{|c|}{\textbf{2006}} & \multicolumn{2}{|c|}{\textbf{2014}} \
\cline{2-9}
 \multicolumn{1}{|c|}{} & \textbf{Area (km2)} & \textbf{Area (\%)} & \textbf{Area (km2)} & \textbf{Area (\%)} & \textbf{Area (km2)} & \textbf{Area (\%)} & \textbf{Area (km2)} & \textbf{Area (\%)} \
 \hline
Dense forest & 149.84 & 10.10 & 164.83 & 11.11 & 55.49 & 3.74 & 71.10 & 4.79\
\hline
Open forest & 107.11 & 7.22 & 110.77 & 7.47 & 99.51 & 6.71 & 112.52 & 7.59\
\hline
\end{tabular}
\end{table}
\end{center}

我试着安排一下,但在 (MWE) 之前了解你的完整 header 是至关重要的。

\documentclass[12pt]{article}
\usepackage{multirow}

\begin{document}

\begin{table}%[h!]
\caption{Table 17}
\begin{tabular}{|p{2.75cm}|p{1.25cm}|p{1cm}|p{1.25cm}|p{1cm}|p{1.25cm}|p{1cm}|p{1.25cm}|p{1cm}|}
\hline
\multirow{2}{*}{\parbox{2.75cm}{\textbf{Land Use/\Land Cover\Categories}}} & %
\multicolumn{2}{|c|}{\textbf{1977}} & \multicolumn{2}{|c|}{\textbf{1993}} & %
\multicolumn{2}{|c|}{\textbf{2006}} & \multicolumn{2}{|c|}{\textbf{2014}}\
\cline{2-9}
 & \textbf{Area (km2)} & \textbf{Area (\%)} & \textbf{Area (km2)} & \textbf{Area (\%)} & %
\textbf{Area (km2)} & \textbf{Area (\%)} & \textbf{Area (km2)} & \textbf{Area (\%)}\
\hline
Dense forest & 149.84 & 10.10 & 164.83 & 11.11 & 55.49 & 3.74 & 71.10 & 4.79\
\hline
Open forest & 107.11 & 7.22 & 110.77 & 7.47 & 99.51 & 6.71 & 112.52 & 7.59\
\hline
\end{tabular}
\end{table}

\end{document}

此代码必须根据页边距(您的未知)等进行相应调整,但目前,它输出此 table: