转载
使用Latex创建表格的一些语法
表格占2列或1列
1
2
3
4
5
6
7
8
9
10
11\begin{table*}[htb]
\centering
\caption{Performance comparison of different approaches for traffic flow forecasting.}
\resizebox{0.95\textwidth}{!}{ % If your table exceeds the column or page width, use this command to reduce it slightly
\begin{tabular}{c|c|ccccccccc}
.....
.....
\end{tabular}
}
\label{table2}
\end{table*}其中
*表示表格占2列,如果表格太宽,即使占了2列,表格还是溢出边界,使用\resizebox来调整表格的宽度,这里将表格变成原来的0.95倍,这样表格中的字体就会自动变小,表格左右宽度也会变窄。在表格后面有
[htb],完整的版本应该是[htbp],表示表格的浮动[h]:here表格放在当前位置[t]:top表格放在页面的首部[b]:bottom表格放在页面的底部[p]:将表格放在浮动对象的页面上
如果表格只占1列,不使用
*,同时表格的宽度可以变成0.45,如下所示:1
2
3
4
5
6
7
8
9
10
11\begin{table}[htb]
\centering
\caption{Performance comparison of different approaches for traffic flow forecasting.}
\resizebox{0.45\textwidth}{!}{ % If your table exceeds the column or page width, use this command to reduce it slightly
\begin{tabular}{c|c|ccccccccc}
.....
.....
\end{tabular}
}
\label{table2}
\end{table}列设置
{c|c|ccccccccc}其中1个c表示一列,格式为居中,这是列必选参数。下面是对齐方式:l表示左对齐c表示居中对齐r表示右对齐
|表示是否需要绘制竖线,||表示画两条紧相邻的竖线。