本系列文章由 @yhl_leo 出品,转载请注明出处。

文章链接: http://blog.csdn.net/yhl_leo/article/details/52692655


简单整理一下表格中的分级表,以三线表Table 1为例:

这种非常规的一行一列的结构,尤其是表头部分,每个子表头下,又细分了三个子表头,这种用法也是很常见的,实现方法如下:

% Table 1

\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\begin{table*}\centering
\caption{Caption}
\ra{1.2}
\begin{tabular}{rrrrcrrrc}\toprule
& \multicolumn{3}{c}{$w = 8$} & \phantom{abc}& \multicolumn{3}{c}{$w = 16$} & \phantom{abc} \\
\cmidrule{2-4} \cmidrule{6-8}
& $t=0$ & $t=1$ & $t=2$ && $t=0$ & $t=1$ & $t=2$ \\ \midrule
$dir=1$\\
$c$ & 0.0790 & 0.1692 & 0.2945 && 0.3670 & 0.7187 & 3.1815\\
$c$ & -0.8651& 50.0476& 5.9384&& -9.0714& 297.0923& 46.\\
$c$ & 124.2756& -50.9612& -14.2721&& 128.2265& -630.5455& -381.0930\\
$dir=0$\\
$c$ & 0.0357& 1.2473& 0.2119&& 0.3593& -0.2755& 2.1764\\
$c$ & -17.9048& -37.1111& 8.8591&& -30.7381& -9.5952& -3.0000\\
$c$ & 105.5518& 232.1160& -94.7351&& 100.2497& 141.2778& -259.7326\\
\bottomrule
\end{tabular}
\end{table*}

其中\multicolumn{3}{c}{text}是一种常用的合并多列并居中的方法,依次为基础,如果想把Table 1改成显示表格边界线,按照以往的套路,我们把:

\begin{tabular}{rrrrcrrrc}

修改成:

\begin{tabular}{|r|r|r|r|c|r|r|r|c|}

结果却成了Table 2的样式:

啊?这么丑,绝对不是我想要的!

于是再改:

% Table 3

\begin{table*}\centering
\caption{Caption}
\ra{1.2}
\begin{tabular}{|r|r|r|r|r|r|r|}\hline
& \multicolumn{3}{c|}{$w = 8$}& \multicolumn{3}{c|}{$w = 16$} \\
\cline{2-4} \cline{5-7}
& $t=0$ & $t=1$ & $t=2$ & $t=0$ & $t=1$ & $t=2$ \\ \hline \hline
$dir=1$ & & & & & &\\
$c$ & 0.0790 & 0.1692 & 0.2945 & 0.3670 & 0.7187 & 3.1815\\
$c$ & -0.8651& 50.0476& 5.9384& -9.0714& 297.0923& 46.\\
$c$ & 124.2756& -50.9612& -14.2721& 128.2265& -630.5455& -381.0930\\
$dir=0$ & & & & & &\\
$c$ & 0.0357& 1.2473& 0.2119& 0.3593& -0.2755& 2.1764\\
$c$ & -17.9048& -37.1111& 8.8591& -30.7381& -9.5952& -3.0000\\
$c$ & 105.5518& 232.1160& -94.7351& 100.2497& 141.2778& -259.7326\\
\hline
\end{tabular}
\end{table*}

这里要留意\multicolumn{3}{c|}{$w = 8$}中的c|,虽然在\begin{tabular}{|r|r|r|r|r|r|r|}定义了表格边界,但是由于\multicolumn的使用,在右边界上的规则在此处不再成立,因此需要再次声明右边界,而不声明就是Table 4的样子:

LaTeX Hierarchical Tables的更多相关文章

  1. Extended paging tables to map guest physical memory addresses from virtual memory page tables to host physical memory addresses in a virtual machine system

    A processor including a virtualization system of the processor with a memory virtualization support ...

  2. Database Design Guidelines

    Database Design Guidelines Principles Support popular databases Name Style Table Name Style: Pascal ...

  3. Virtualizing memory type

    A processor, capable of operation in a host machine, including memory management logic to support a ...

  4. Virtualizing physical memory in a virtual machine system

    A processor including a virtualization system of the processor with a memory virtualization support ...

  5. SQLAlchemy技术手册

    一.ORM 框架简介 对象-关系映射(Object/Relation Mapping,简称ORM),是随着面向对象的软件开发方法发展而产生的.面向对象的开发方法是当今企业级应用开发环境中的主流开发方法 ...

  6. Footnotes for tables in latex - 为latex的table加上footnotes

    参考: Footnotes for tables in LaTeX Footnote in tabular environment Footnotes for tables in latex - 为l ...

  7. LaTeX排版设置图表的位置 Positioning images and tables

    Positioning images and tables LATEX is an editing tool that takes care of the format so you only hav ...

  8. LaTeX:Figures, Tables, and Equations 插入图表和公式

    Figures To insert a figure in a LaTeX document, you write lines like this: \begin{figure} \centering ...

  9. LaTeX插入图表方法 Lists of tables and figures

    Lists of tables and figures A list of the tables and figures keep the information organized and prov ...

随机推荐

  1. 升级CentOS内核 - 2.6升级到3.10/最新内核

    ##记得切换到root用户执行升级操作. [root@localhost ~]# uname -a ##旧版 Linux localhost.localdomain 2.6.32-279.el6.i6 ...

  2. 如何清除SharePoint Server 配置缓存

    日常运维中您可能需要清除SharePoint 2010/2013/2016中的过期配置缓存.例如,有时计时器作业往往会卡住,并在这种情况下清除缓存.您可以手动清除SharePoint配置缓存或者使用P ...

  3. 在SAP C4C里触发SAP ERP的ATP check和Credit check

    在C4C里创建一个新的Sales Quote: 添加三个行项目: 执行action "Request External Pricing"会从ERP更新pricing信息,触发ATP ...

  4. Android(java)学习笔记112:Activity中的onCreate()方法分析

    1.onCreate( )方法是android应用程序中最常见的方法之一: 翻译过来就是说,onCreate()函数是在activity初始化的时候调用的,通常情况下,我们需要在onCreate()中 ...

  5. 掘金 里面 写文章 带目录的时候 用#(空格)标题 后面用## title,一个页面只有一个H1

    掘金 里面 写文章 带目录的时候 用#(空格)标题 后面用## title,一个页面只有一个H1

  6. JS Math方法、逻辑

    Math.PI; // 返回 3.141592653589793 Math.round(x) 的返回值是 x 四舍五入为最接近的整数. Math.pow(x, y) 的返回值是 x 的 y 次幂. M ...

  7. Java写诗程序

    import java.util.Random; public class test_word { public static void main(String[] args) { System.ou ...

  8. FTPClient:enterLocalPassiveMode()方法简单说明

    问题:在Java程序中,使用FTPClient下载FTP文件的时候,可以下载到FTP服务器上的文件夹,但是里面的文件没有下载到本地. 分析:这个涉及到FTP在使用的过程中,客户端和服务端连接过程中,端 ...

  9. Return Largest Numbers in Arrays-freecodecamp算法题目

    Return Largest Numbers in Arrays(找出多个数组中的最大数) 要求 大数组中包含了4个小数组,分别找到每个小数组中的最大值,然后把它们串联起来,形成一个新数组. 思路 用 ...

  10. Linux - mkdir -p a/b/c

    mkdir -p a/b/c -p  会循环创建