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 ...
随机推荐
- Python3+Selenium3+webdriver学习笔记6(多窗口切换处理)
#!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverfrom selenium.webdriver.co ...
- sqlserver 查询某表的所有列名
select name + ',' from syscolumns where id = object_id('SEND_TALLY') AND name <> 'PICDATAS'
- 对比java和python对比
对比java和python 对比java和python 2011年04月18日 1.难易度而言.python远远简单于java. 2.开发速度.Python远优于java 3.运行速度.java远优于 ...
- 洛谷 P2383 狗哥玩木棒
题目背景 狗哥又趁着语文课干些无聊的事了... 题目描述 现给出一些木棒长度,那么狗哥能否用给出的木棒(木棒全用完)组成一个正方形呢? 输入输出格式 输入格式: 输入文件中的第一行是一个整数n表示测试 ...
- MyBatis归纳
SqlSessionTemplate详解 SqlSessionTemplate类是MyBatis-Spring的核心.这个类负责管理MyBatis的SqlSession,调用MyBatis的SQL ...
- Leetcode重点 250题-前400 题
删除不常考,面试低频出现题目 删除重复代码题目(例:链表反转206题,代码在234题出现过) 删除过于简单题目(例:100题:Same Tree) 删除题意不同,代码基本相同题目(例:136 & ...
- axure的基本使用方法(侧边导航栏的制作)
1.创建一个动态面板control 2.在home中创建动态面板homepage和movepage并且完成布局 3.给home添加移动事件 4.给按钮添加点击事件 5.大功告成
- 学习JavaScript你必须掌握的8大知识点!
大知识点! 一.JavaScript思维导图之<变量>的学习 二. JavaScript思维导图之<函数基础> 三.JavaScript思维导图之<基本dom操作 ...
- Bzoj 1131[POI2008]STA-Station (树形DP)
Bzoj 1131[POI2008]STA-Station (树形DP) 状态: 设\(f[i]\)为以\(i\)为根的深度之和,然后考虑从他父亲转移. 发现儿子的深度及其自己的深度\(-1\) 其余 ...
- 【Linux】开放指定端口设置
这里以开放tomcat的8080端口为例 1.开放Linux的8080端口 vi /etc/sysconfig/iptables 进入编辑页面,在指定位置新增以下配置 -A INPUT -m stat ...