LaTeX Hierarchical Tables
本系列文章由 @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的更多相关文章
- 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 ...
- Database Design Guidelines
Database Design Guidelines Principles Support popular databases Name Style Table Name Style: Pascal ...
- Virtualizing memory type
A processor, capable of operation in a host machine, including memory management logic to support a ...
- Virtualizing physical memory in a virtual machine system
A processor including a virtualization system of the processor with a memory virtualization support ...
- SQLAlchemy技术手册
一.ORM 框架简介 对象-关系映射(Object/Relation Mapping,简称ORM),是随着面向对象的软件开发方法发展而产生的.面向对象的开发方法是当今企业级应用开发环境中的主流开发方法 ...
- Footnotes for tables in latex - 为latex的table加上footnotes
参考: Footnotes for tables in LaTeX Footnote in tabular environment Footnotes for tables in latex - 为l ...
- LaTeX排版设置图表的位置 Positioning images and tables
Positioning images and tables LATEX is an editing tool that takes care of the format so you only hav ...
- LaTeX:Figures, Tables, and Equations 插入图表和公式
Figures To insert a figure in a LaTeX document, you write lines like this: \begin{figure} \centering ...
- LaTeX插入图表方法 Lists of tables and figures
Lists of tables and figures A list of the tables and figures keep the information organized and prov ...
随机推荐
- CAS 配置NLB 负载均衡网络无法连接
在虚拟机与虚拟机.虚拟机与实机之间利用Windows操作系统自带的网络负载均衡功能如选择单播集群模式,网络就无法通讯,NLB不成功. Scenario #1 在虚拟机与虚拟机之间选择多播模式NLB可正 ...
- Python+Selenium之摘取网页上全部邮箱
本文转载:http://blog.csdn.net/u011541946/article/details/68485981 练习场景:在某一个网页上有些字段是我们感兴趣的,我们希望摘取出来,进行其他操 ...
- java面试题(杨晓峰)---第七讲谈谈int和integer有什么区别?
理解装箱和拆箱的过程. 对象由三部分组成:对象头,对象实例,对齐填充. 对象头:一般是十六个字节,分两部分,第一部分:哈希码,锁状态标志,线程持有的锁,偏向线程id,gc分代年龄等,第二部分是类型指针 ...
- 如何处理错误消息Please install the Linux kernel header files
Please install the Linux kernel "header" files matching the current kernel 当我启动minilkube时遇 ...
- codeforecs Gym 100286B Blind Walk
交互式程序,要用到一个函数fflush,它的作用是对标准输出流的清理,对stdout来说是及时地打印数据到屏幕上,一个事实:标准输出是以『行』为单位进行的,也即碰到\n才打印数据到屏幕.这就可能造成延 ...
- HTML5中的SSE(服务器推送技术)
本文原链接:https://cloud.tencent.com/developer/article/1194063 SSE技术详解:一种全新的HTML5服务器推送事件技术 前言 概述 基本介绍 与We ...
- appium---常用的adb命令
在测试android-app的时候,adb命令可以帮助我们解决许多问题 什么是adb Android Debug Bridge,我们一般简称为adb,主要存放在sdk安装目录下的platform-to ...
- Django 从0开始创建一个项目
title: Django 从0开始创建一个项目 tags: Django --- Django 从0开始创建一个项目 创建Django工程及配置 创建工程:django-admin starproj ...
- python3和Python2的区别
一.print函数 python2 的 print 声明已经被 print() 函数取代了,这意味着我们必须包装我们想打印在小括号中的对象 二.通过input()解析用户的输入 python3中inp ...
- 【php】命名空间的影响
命名空间对代码的影响 类(包含抽象类和traits) 接口 常量 函数