![格式化双列文档中的表格](https://linux22.com/image/350197/%E6%A0%BC%E5%BC%8F%E5%8C%96%E5%8F%8C%E5%88%97%E6%96%87%E6%A1%A3%E4%B8%AD%E7%9A%84%E8%A1%A8%E6%A0%BC.png)
我正在尝试撰写包含表格的 IEEE 格式的论文。这是一份两列文档。但是当我尝试创建表格时,它与另一列中的材料重叠,如下图所示:
该表的代码如下:
\begin{table}[!ht]
\begin{center}
\caption{Actors vs Positional Dynamicity (based on Closeness Centrality) in Different LSNs} \label{pos1}
\begin{tabular}{|c||c| c| c| c| c|}
\hline
Actor No. & LSN 1 & LSN 2 & LSN 3 & ... & LSN 60 \\ [0.5ex]
\hline\hline
1 &0.205602 &0.262515 & 0.247979 &... & 0.170467 \\
\hline
2 &0.00961852 &0.0200901 & 0.0207746 &... & 0.107013 \\
\hline
3 &0.1271 & 0.170967 & 0.199928 &... &0.173208 \\
\hline
4 & 0.00263733 & 0.00524802 & 0.00787202 &... &0.0100803 \\
\hline
5 & 0.00300429 &0.00597824 & 0.00673418 &... & 0.00706005 \\
\hline
... & ... & ... & ... &... . &... \\
\hline
1899 &0.00994494 &0.00968842 & 0.0216411 &...&0.0610909 \\
\hline
\end{tabular}
\end{center}
\end{table}
有什么方法可以通过修改上述代码来调整表格大小,以使其不与其他列相交?
答案1
我建议你 (a) 删除所有垂直线和大部分水平线,使用包的线条绘制宏来绘制booktabs
剩余的几条线,使表格看起来更开放;(b) 使用tabular*
环境并让 LaTeX 计算出允许的列间空白量。你可能还想使用包siunitx
及其S
列类型来对齐小数点上的数字。
\documentclass[twocolumn]{IEEEtran}
\usepackage{lipsum,booktabs,siunitx}
\newcolumntype{T}[1]{S[table-format=#1,group-digits=false]}
\begin{document}
\lipsum[2] % filler text
\begin{table}[!ht]
% let LaTeX figure out optimal amount of intercolumn whitespace:
\setlength\tabcolsep{0pt}
\caption{Actors vs.\ Positional Dynamicity (based on
Closeness Centrality) in Different LSNs} \label{pos1}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}c*{3}{T{1.8}}cT{1.8}}
\toprule
Actor No. & {LSN 1} & {LSN 2} & {LSN 3} & $\cdots$ & {LSN 60} \\
\midrule
1 &0.205602 &0.262515 & 0.247979 & $\cdots$ & 0.170467 \\
2 &0.00961852 &0.0200901 & 0.0207746 & $\cdots$ & 0.107013 \\
3 &0.1271 & 0.170967 & 0.199928 & $\cdots$ & 0.173208 \\
4 & 0.00263733 & 0.00524802 & 0.00787202 & $\cdots$ & 0.0100803 \\
5 & 0.00300429 &0.00597824 & 0.00673418 & $\cdots$ & 0.00706005\\
$\cdots$ & $\cdots$ & $\cdots$ & $\cdots$ & $\cdots$ & $\cdots$ \\
1899&0.00994494 &0.00968842 & 0.0216411 & $\cdots$ & 0.0610909 \\
\bottomrule
\end{tabular*}
\end{table}
\lipsum[2-10] % more filler text
\end{document}