1、表格的跨行与跨列
\usepackage{multirow} %table mutilline
\usepackage{booktabs} %table drawline
跨行
\begin{table}[h]
\centering
\caption{aaa}}
\label{tab:com}
\begin{tabular}{c|c|c|c|c}
\toprule
\multirow{2}{*}{\centering a} &aa &aa &aa &aa \\
&aa & aa& aa& aa \\
\bottomrule
\end{tabular}
\vspace{-0.3cm}
\end{table}
跨列
\begin{table}[htbp]
\caption{跨栏表格}
\centering
\begin{tabular}{lll}
\toprule
&\multicolumn{2}{c}{常用工具} \\
\cmidrule{2-3}
操作系统& 发行版&编辑器\\
\midrule
Windows & MikTeX& TeXnicCenter \\
Unix/Linux & TeXLive & Emacs \\
Mac OS & MacTeX& TeXShop \\
\bottomrule
\end{tabular}
\end{table}
\multirow命令是跨行,前两个参数是竖跨的行数和宽度。
\multicolumn命令是跨列。它的前两个参数指定横跨列数和对齐方式。booktabs 宏包的\cmidrule 命令用于横跨几列的横线。
2、表格添加说明
有时候需要在表格下面对某些符号进行脚注和说明:
\usepackage{threeparttable}
\begin{table}[h!]
\centering
\caption{result.\vspace{-0.2cm}}
\label{tab:kk}
\begin{threeparttable}
\begin{tabular}{c c c c c}
\toprule
A\tnote{1} & B\tnote{1} & B/A & C & R \\
\midrule
1 & 2 & 3 & $4$ &5\\
\bottomrule
\end{tabular}
\begin{tablenotes}\small
\item[1] B and A are nothing.
\end{tablenotes}
\end{threeparttable}
\end{table}
效果如下

没有评论:
发表评论