我希望能将较长的文本自动拆分成表格,搜索了本站后发现有以下几种方法:
(i).p{dimension}
在 中的使用tabular
,已回答这里
\begin{table}[h]
\begin{tabular}{|l|l|}
\hline
key & \multicolumn{1}{p{4cm}|}{A very long text. A very long text. A very long text. A very long text}\\
\hline
\end{tabular}
\end{table}
正如您所见,我们需要分配dimension
,而不是自动的。
(ii). 使用包tabularx
,回答这里
\begin{table}[h]
\begin{tabularx}{\textwidth}{|l|X|}
\hline
key & A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. \\
\hline
\end{tabularx}
\end{table}
(三)使用包longtable
,回答这里
\begin{longtable}{|l|p{4cm}|}
\hline
key & A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. A very long text. \\
\hline
\end{longtable}
结果如下。
(iv). 其他解决方案?