我正在用LaTeX创建一个涉及几个表的报告。由于表格中的单元格数据超出了页面的宽度,我被困在了这一点上。我可以以某种方式将文本换行,使其落入表格的同一单元格中的下一行吗?
这跟桌子的宽度有什么关系吗?但是当它超出了页面的宽度时,会有什么不同吗?
发布于 2009-04-26 14:32:47
使用p{width}作为列说明符,而不是l/r/c。
\begin{tabular}{|p{1cm}|p{3cm}|}
This text will be wrapped & Some more text \\
\end{tabular}
编辑:(基于评论)
\begin{table}[ht]
\centering
\begin{tabular}{p{0.35\linewidth} | p{0.6\linewidth}}
Column 1 & Column2 \\ \hline
This text will be wrapped & Some more text \\
Some text here & This text maybe wrapped here if its tooooo long \\
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
我们得到:
发布于 2010-02-19 09:11:12
另一种选择是在需要文本换行的每个单元格中插入一个小页,例如:
\begin{table}[H]
\begin{tabular}{l}
\begin{minipage}[t]{0.8\columnwidth}%
a very long line a very long line a very long line a very long line
a very long line a very long line a very long line a very long line
a very long line a very long line a very long line %
\end{minipage}\tabularnewline
\end{tabular}
\end{table}
发布于 2014-01-20 22:43:30
我喜欢tabulary
包的简单性:
\usepackage{tabulary}
...
\begin{tabulary}{\linewidth}{LCL}
\hline
Short sentences & \# & Long sentences \\
\hline
This is short. & 173 & This is much loooooooonger, because there are many more words. \\
This is not shorter. & 317 & This is still loooooooonger, because there are many more words. \\
\hline
\end{tabulary}
在本例中,您将相对于\textwidth排列表格的整个宽度。例如,0.4个。然后,剩下的工作将由包自动完成。
https://stackoverflow.com/questions/790932
复制相似问题