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 ...
随机推荐
- Jenkins上svn更新策略说明
- Python 时间戳和日期相互转换
转载地址:http://liyangliang.me/posts/2012/10/python-timestamp-to-timestr/ 在写Python的时候经常会遇到时间格式的问题,每次都是上 ...
- 洛谷 P2868 [USACO07DEC]观光奶牛Sightseeing Cows
题目描述 Farmer John has decided to reward his cows for their hard work by taking them on a tour of the ...
- setup命令
setup——配置网络(centos) 命令所在路径:usr/bin/setup 示例1: # setup
- JAVA小基础
JAVA的jsp程序中,jar如果不能再引用的时候加入到lib文件夹而选择外部引用,可能会导致jar不能被找到的问题. string.format的占位符一般使用%s表示字符串的意思,与C#的{0}这 ...
- JAVA并发编程:相关概念及VOLATILE关键字解析
一.内存模型的相关概念 由于计算机在执行程序时都是在CPU中运行,临时数据存在主存即物理内存,数据的读取和写入都要和内存交互,CPU的运行速度远远快于内存,会大大降低程序执行的速度,于是就有了高速缓存 ...
- 使用Timer组件制作计时器
实现效果: 知识运用: Timer组件的interval属性 //获取或设置Timer组件Tick事件发生的时间间隔 public int Interval {get;set} NumericUpDo ...
- MySQL 外键 表的查询
自增补充 这是查看怎么创建的表, \G示旋转90度显示表的内容 表的自增的关键是** AUTO_INCREMENT=3**,在表中添加数据后,这个会自动改变,通过alert可以改变这个默认值 mysq ...
- python之生成器的初识
1. 生成器的定义 生成器的本质就是迭代器.python社区生成器和迭代器是一种 2. 生成器和迭代器区别 迭代器: 都是Python给你提供的已经写好的工具或者通过数据转化得来的 生成器: ...
- springmvc的第一个程序
文中用的框架版本:spring 3,hibernate 3,没有的,自己上网下. web.xml配置: <?xml version="1.0" encoding=" ...