宏包:
\usepackage{booktabs}%三线表
\usepackage{float}%提供float浮动环境
\usepackage{multirow}%提供跨行命令\multirow{}{}{}
\usepackage{makecell}%保证竖线连接自然
\begin{table}
\centering %表格居中
\renewcommand\arraystretch{1.3} %表格高度
\setlength{\tabcolsep}{1.5mm}{ %表格宽度
\begin{tabular}{c|ccccccc} %c表示数据居中, |表示竖线
\toprule %在表格最上方绘制横线
&&&&&&&&\\
\midrule %在表格中间绘制第二条线
&&&&&&&&\\
\bottomrule %添加表格底部粗线
\end{tabular} }
\end{table}
表格的引用:
\begin{table}
\centering %表格居中
\caption{表格}
\label{tab1}
\renewcommand\arraystretch{1.3} %表格高度
\setlength{\tabcolsep}{1.5mm}{ %表格宽度
\begin{tabular}{c|ccccccc} %c表示数据居中, |表示竖线
\toprule %在表格最上方绘制横线
&&&&&&&&\\
\midrule %在表格中间绘制第二条线
&&&&&&&&\\
\bottomrule %添加表格底部粗线
\end{tabular} }
\end{table}
引用时运用 \ref{tab1} 即可.
表格内容跨行:
内容& \multirow{2}{*}{1}& \multirow{2}{*}{2}& \multirow{2}{*}{3}& \multirow{2}{*}{4}& \multirow{2}{*}{5}& \multirow{2}{*}{6}& \multirow{2}{*}{7} \\%表格宽度参数采用*代表自动宽度
跨行&&&&&&&\\
表格总结列:
\begin{table}
\centering
\begin{tabular}{c|cc}
\Xhline{2pt}
& & \\
\Xcline{2-3}{0.4pt} %从第2列开始画横线
& & \\
\Xhline{1pt}
& & \\
& & \\
\Xhline{2pt}
\end{tabular}
\end{table}
这样竖着的线就不会有空白.