[LaTex 技巧] 表格:字数太多时自动换行(及强制换行方法)

您所在的位置:网站首页 excel导出成word表格字太多 [LaTex 技巧] 表格:字数太多时自动换行(及强制换行方法)

[LaTex 技巧] 表格:字数太多时自动换行(及强制换行方法)

2024-07-10 03:12| 来源: 网络整理| 查看: 265

文章目录 前言具体流程如何强制换行参考文献

前言

如题。在表格中,一个格子中文字太多,会直接溢出到文档外面… 如何自动换行,让文字合理的显示,便是本文要解决的问题。

具体流程

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} \\ \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*}%

备注:关键在于:{lXXX} 以及 tabularx。

显示效果如下: 在这里插入图片描述

这就看着很舒服了。

如何强制换行

基于以上代码,使用\newline就可以在表格内强制换行(而不是使用\\)。

参考文献 Automatic line breaks in LaTeX tablesHow to add a forced line break inside a table cell


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3