Latex中表格(3)

Latex中的表格

这篇主要说Latex中表格出现多行或者多列单元格的形式.

一、多行或多列单元格

可能用到的宏包

  • \usepackage{booktabs}
  • \usepackage{multirow}

代码:

\begin{table}[h!]
\centering
\caption{Your caption here}
\begin{tabular}{c c c c c c c c c c}
\toprule
\multirow{2}{*}{$p$} & \multicolumn{3}{c}{$b=1$} & \multicolumn{3}{c}{$b=4$} & \multicolumn{3}{c}{$b=8$} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10}
 & $(q+1)b$ & $m$ & \# mv & $(q+1)b$ & $m$ & \# mv & $(q+1)b$ & $m$ & \# mv \\
\midrule
2 & 23 & 3 & 140 & 44 & 2 & 230 & 72 & 2 & 364 \\
3 & 36 & 3 & 163 & 56 & 3 & 261 & 81 & 2 & 386 \\
4 & 51 & 4 & 202 & 73 & 4 & 298 & 96 & 3 & 421 \\
5 & 92 & 4 & 253 & 113 & 4 & 342 & 130 & 4 & 469 \\
6 & 124 & 5 & 316 & 157 & 4 & 398 & 174 & 4 & 523 \\
7 & 160 & 7 & 408 & 216 & 4 & 465 & 233 & 4 & 589 \\
\bottomrule
\end{tabular}
\end{table}

最终执行结果
在这里插入图片描述
简单说明:

  • \usepackage{booktabs} 用于更好地控制表格线条的样式。
  • \usepackage{multirow} 用于单元格跨行。
  • \cmidrule(lr){...} 用于在表格中插入水平线,并为每个多列块添加水平线。
  • \toprule\midrule\bottomrule 分别表示表格的顶部、中部和底部的水平线。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值