【笔记】latex做表格

  • Post author:
  • Post category:其他


这里写自定义目录标题

	\begin{table}[width=.9\linewidth,cols=4,pos=h]
		\caption{This is a test caption. This is a test caption. This is a test
			caption. This is a test caption.}\label{tbl1}
		\begin{tabular*}{\tblwidth}{@{}LLLL@{} }
			\toprule
			Methods & Images & Type & Targets\\
			\midrule
			\multirow{3}{*}{Rectangular box} & \multirow{3}{*}{1655} & Rust & 6387 \\
			& & Others & 2003 \\
			& & Mid-late & 677 \\
			\bottomrule
		\end{tabular*}
	\end{table}

在这里插入图片描述

前面一定要加

			& & Others & 2003 \\
			& & Mid-late & 677 \\

不可以这样,会到前面去

			Others & 2003 \\
			Mid-late & 677 \\

在这里插入图片描述



表格换行,用这个搞定

在这里插入图片描述

\begin{table}[width=.9\linewidth,cols=6,pos=h]
	\caption{Attributes of the four datasets}\label{tbl1}
	\begin{tabular*}{\tblwidth}{@{}LLLLLL@{} }
		\toprule
		\makecell{Dataset\\Comb.} & \makecell{Train\\set}  & Valset & \makecell{Dataset\\Comb.} & \makecell{Train\\set} & \makecell{Val\\set} \\
		\midrule
		1 & \multicolumn{2}{c}{W} & 5 & W & \multirow{3}{*}{R+C} \\
		2 & \multicolumn{2}{c}{W+S} & 6 & W+S \\
		3 & \multicolumn{2}{c}{R+C} & 7 & W+S+R+C \\
		
		4 & \multicolumn{2}{c}{W+S+R+C}\\
		\bottomrule
	\end{tabular*}
\end{table}

用\cline,下一行与line的间距会显得很挤

在这里插入图片描述

用\cmidrule就好很多

在这里插入图片描述

在这里插入图片描述



版权声明:本文为weixin_42362903原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。