文章目录
前言具体流程如何强制换行参考文献前言
如题。在表格中,一个格子中文字太多,会直接溢出到文档外面… 如何自动换行,让文字合理的显示,便是本文要解决的问题。
具体流程
1)添加package (备注:在\begin{document}
之前):
% for table\usepackage{tabularx}
2)在正文中添加如下格式的表格:
\begin{table*}[!htbp]\centering\begin{tabularx}{\textwidth}{lXXX}\toprule& \textbf{``long sentence ''} & \textbf{long sentence } & \textbf{Notes} \\\midruleMotivation & long sentence long sentence long sentence long sentence long sentence & long sentence long sentence long sentence long sentence long sentence long sentence long sentencelong sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence& long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence long sentence \\\midruleMethodology& && \\\bottomrule\end{tabularx}%\label{tab:addlabel}%\caption{A table with line breaks}\end{table*}%
备注:关键在于:{lXXX}
以及tabularx
。
显示效果如下:
这就看着很舒服了。
如何强制换行
基于以上代码,使用\newline
就可以在表格内强制换行(而不是使用\\
)。
参考文献
Automatic line breaks in LaTeX tablesHow to add a forced line break inside a table cell如果觉得《[LaTex 技巧] 表格:字数太多时自动换行(及强制换行方法)》对你有帮助,请点赞、收藏,并留下你的观点哦!