LaTeX技巧653:如何隔开LaTeX表格邻近\cline表格线?

您所在的位置:网站首页 表格内怎么添加下划线条 LaTeX技巧653:如何隔开LaTeX表格邻近\cline表格线?

LaTeX技巧653:如何隔开LaTeX表格邻近\cline表格线?

2024-07-09 01:01| 来源: 网络整理| 查看: 265

原文链接:http://www.latexstudio.net/archives/700.html

LaTeX制作表格,若是需要做局部画线的表格,会用到如下的命令\cline,示例如下:

                              

代码如下:

\begin{tabular}{lrrrrrrr} \hline \multicolumn{2}{c}{level1} \multicolumn{2}{c}{level2} \multicolumn{2}{c}{level3} \\ \cline{3-8} type ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 \\ \hline Section ; 2.3 ; 2.288 ; 0.009 ; 1.779 ; 0.008 ; 0.338 ; 2.1\\ Period ; 2.8 ; 3.309 ; 0.002 ; 4.060 ; 0.000 ; 0.866 ; 2.3\\ \hline \end{tabular}

若是我们需要的效果是:

                                  

用下面的代码:

\begin{tabular}{lrrrrrrr} \hline ; ; \multicolumn{2}{c}{level1} ; \multicolumn{2}{c}{level2} ; \multicolumn{2}{c}{level3} \\ \cline{3-4} \cline{5-6} \cline{7-8} type ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 \\ \hline Section ; 2.3 ; 2.288 ; 0.009 ; 1.779 ; 0.008 ; 0.338 ; 2.1\\ Period ; 2.8 ; 3.309 ; 0.002 ; 4.060 ; 0.000 ; 0.866 ; 2.3\\ \hline \end{tabular}

显示的效果仍旧是上面的表格效果。 【解决方案】 我们可以使用booktabs里所提供的命令\cmidrule 命令,上面的效果实现的代码如下:

\begin{tabular}{lrrrrrrr} \hline ; ; \multicolumn{2}{c}{level1} ; \multicolumn{2}{c}{level2} ; \multicolumn{2}{c}{level3} \\ \cmidrule(r){3-4} \cmidrule(r){5-6} \cmidrule(r){7-8} \noalign{\smallskip} type ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 \\ \hline Section ; 2.3 ; 2.288 ; 0.009 ; 1.779 ; 0.008 ; 0.338 ; 2.1\\ Period ; 2.8 ; 3.309 ; 0.002 ; 4.060 ; 0.000 ; 0.866 ; 2.3\\ \hline \end{tabular}


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3