文章目录
- 前言
- 具体流程
- 如何强制换行
- 参考文献
前言
如题。在表格中,一个格子中文字太多,会直接溢出到文档外面… 如何自动换行,让文字合理的显示,便是本文要解决的问题。
具体流程
1)添加package (备注:在
1 2 | % for table \usepackage{tabularx} |
2)在正文中添加如下格式的表格:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | \begin{table*}[!htbp] \centering \begin{tabularx}{\textwidth}{lXXX} \toprule & \textbf{``long sentence ''} & \textbf{long sentence } & \textbf{Notes} \\ \midrule Motivation & 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 \\ \midrule Methodology & & & \\ \bottomrule \end{tabularx}% \label{tab:addlabel}% \caption{A table with line breaks} \end{table*}% |
备注:关键在于:
显示效果如下:
这就看着很舒服了。
如何强制换行
基于以上代码,使用
参考文献
- Automatic line breaks in LaTeX tables
- How to add a forced line break inside a table cell