微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何确保 LaTex 表中的文本换行

如何解决如何确保 LaTex 表中的文本换行

当我从第二列开始在 LaTex 中使用下面的表格代码时,表格列不会坚持此处给出的单元格宽度。随着列的扩展,表格超出了页面宽度。如何解决此问题。

\documentclass[smallextended]{svjour3}
\smartqed
\usepackage{graphicx}
\begin{document}
\begin{table}
\caption{Comparison of Block confirmation rate}
\label{tab:4} 
\begin{tabular}{p{1in} l p{2in} l p{2in} l p{2n} l p{2n}}
\hline\noalign{\smallskip}
No of Organizations participating in Blockchain network [Column 1] & Available Bandwidth in Mbps for each node [10Mbps*1/2n(n-1)] [Column 2] 
 & No of messages of size 560bytes from each node with available bandwidth [Column 3] & No of Blocks (NBCT) (Number of nodes * number of message from column 3)  [Column 4] & Blocks (OBCT) [Column 5] \\
\noalign{\smallskip}\hline
1 & 2 & 3 & 4 & 5 \\
\noalign{\smallskip}\hline
\end{tabular}
\end{table}
\end{document}

解决方法

几个问题:

  • 您的表格有 5 列,但您指定了 9 列,每隔一列左对齐,没有换行符。

  • 2n 不是列宽的有效单位,我怀疑您的意思是 2in

  • 您选择的文档类具有非常窄的文本宽度。即使解决了上述所有问题,也没有足够的可用空间来容纳 5 列,每列 2 列。即使只有 1 英寸,桌子仍然会粘在边缘。要么选择其他文档布局,要么重新考虑表格的布局。

  • 您可能需要查看 siunitx 之类的包以正确排版单位和值....


\documentclass[smallextended]{svjour3}
\smartqed
\usepackage{graphicx}
\begin{document}
\begin{table}
\caption{Comparison of Block confirmation rate}
\label{tab:4} 
\begin{tabular}{p{1in} p{1in} p{1in} p{1in} p{1in}}
\hline\noalign{\smallskip}
No of Organizations participating in Blockchain network [Column 1] 
& Available Bandwidth in Mbps for each node [10Mbps*1/2n(n-1)] [Column 2] 
& No of messages of size 560bytes from each node with available bandwidth [Column 3] 
& No of Blocks (NBCT) (Number of nodes * number of message from column 3)  [Column 4] 
& Blocks (OBCT) [Column 5] \\
\noalign{\smallskip}\hline
1 & 2 & 3 & 4 & 5 \\
\noalign{\smallskip}\hline
\end{tabular}
\end{table}
\end{document}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。