失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Latex表格内容过长 最简单自动换行方法

Latex表格内容过长 最简单自动换行方法

时间:2021-08-12 00:12:46

相关推荐

Latex表格内容过长 最简单自动换行方法

在用Texstudio编写表格,遇到表格无法换行的问题,查了一大堆方法都不好用,最后参考icode9上的一篇博文才找到最简便的方法,分享给大家。

错误情况

可以看到,第二列内容太长,导致第三列的内容都被挤没了

以下是我的代码,我曾经尝试\begin{tabularx}{\textwidth}{lXXX} 以及/tabincell{c}{haha// heihei//zeze} 的方法都改不动,相信大家应该遇到类似问题。

\begin{tabular}{ccc}\toprule Biodiversity quality grade & Feature description \centering & Adjustment coefficient \\ \hlineHigh & The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent & 2 \\High & The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent & 1 \\High& The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent & 0 \\High & The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent & 1 \\High & The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent The ecosystem is in excellent & 2 \\ \bottomrule\label{t2}\end{tabular}

调整情况

以上是我的最终效果,可以看到表格都显示出来了,而我只是对\begin{tabular}{ccc}\toprule 进行了调整:

\begin{tabular}{cp{8cm}c}\topruleBiodiversity quality grade & Feature description \centering

其中,原本{ccc}对应3列,我对其中一个c(这里是第二列)固定了长度,改写为p{8cm},这样写以后,表内内容会自动换行。同时,使用p会导致对应列内容左对齐,如果需要居中,在文本后加入\centering就可实现。

如果帮助到大家,希望能给我点个赞~

如果觉得《Latex表格内容过长 最简单自动换行方法》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。