Latex生成两种效果的表格

常见的使用Latex生成两种效果的表格,其实现区别在于生成横线的方式不同:

  • 第一种是直接使用\hline生成横线
  • 第二种是使用\toprule顶部线,\midrule中间线,\bottomrule底部线

第一种生成的表格比较紧凑,代码如下,效果如下图所示:

\begin{table}[hp] %%参数: h:放在此处 t:放在顶端 b:放在底端 p:在本页
	\renewcommand\arraystretch{1.2}
	%\setlength{\abovecaptionskip}{0.cm}
	%\setlength{\belowcaptionskip}{-0.cm}
	\centering  % 显示位置为中间
	\textbf{Table 2}~~Parameters description.\\  %%表的标题
	\begin{tabular}{p{45pt}l|ll|l} %第一列设置宽度为45pt 全为左对齐 没有分割线
		%\setlength{\tabcolsep}{20mm}
		\hline  % 表格的横线
		%\toprule % 顶部线
		Parameters & & Definitions & Value & Source \\%[3pt]只改一行    %%表格第一行标题 % 表格中的内容,用&分开,\\表示下一行
		\hline  % 表格的横线
		%\midrule % 中部线
		$\beta_{1}$   & & xxxxabcdxxx           & 1 &  Estimation \\    %%表格内容
		%\midrule
		\multirow{2}[2]{*}{$\alpha_{3}$} & & aaa1 & \multirow{2}[2]{*}{1} &  \multirow{2}[2]{*}{Estimation} \\
		& & bbb2                  &   &             \\
		$d_{1}$       & & xxxxabcdxxx           & 1 &  Estimation \\
		\multirow{3}[2]{*}{$1/\theta(t)$}& $\theta_{0}$ & 1aaa            & 1 &  Estimation \\
		& $\theta_{1}$ & 2bbb            & 1 &  Estimation \\
		& $\theta_{2}$ & 3ccc            & 1 &  Estimation \\
		%\bottomrule % 底部线
		\hline  % 表格的横线
	\end{tabular}
\end{table}

效果如下:
在这里插入图片描述
想要生成双线,只需要在相应位置使用两次\hline即可,效果如下:
图2

第二种生成的表格比较宽松,四周有空隙,代码如下,效果如下图图所示:

\begin{table}[hp] %%参数: h:放在此处 t:放在顶端 b:放在底端 p:在本页
	\renewcommand\arraystretch{1.2}
	%\setlength{\abovecaptionskip}{0.cm}
	%\setlength{\belowcaptionskip}{-0.cm}
	\centering  % 显示位置为中间
	\textbf{Table 2}~~Parameters description.\\  %%表的标题
	\begin{tabular}{p{45pt}l|ll|l} %第一列设置宽度为45pt 全为左对齐 没有分割线
		%\setlength{\tabcolsep}{20mm}
		%\hline  % 表格的横线
		\toprule % 顶部线
		Parameters & & Definitions & Value & Source \\%[3pt]只改一行    %%表格第一行标题 % 表格中的内容,用&分开,\\表示下一行
		%\hline  % 表格的横线
		\midrule % 中部线
		$\beta_{1}$   & & xxxxabcdxxx           & 1 &  Estimation \\    %%表格内容
		%\midrule
		\multirow{2}[2]{*}{$\alpha_{3}$} & & aaa1 & \multirow{2}[2]{*}{1} &  \multirow{2}[2]{*}{Estimation} \\
		& & bbb2                  &   &             \\
		$d_{1}$       & & xxxxabcdxxx           & 1 &  Estimation \\
		\multirow{3}[2]{*}{$1/\theta(t)$}& $\theta_{0}$ & 1aaa            & 1 &  Estimation \\
		& $\theta_{1}$ & 2bbb            & 1 &  Estimation \\
		& $\theta_{2}$ & 3ccc            & 1 &  Estimation \\
		\bottomrule % 底部线
		%\hline  % 表格的横线
		%\hline
	\end{tabular}
\end{table}

效果如下:
在这里插入图片描述
如果中间需要多个横线,可以多次使用\midrule。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值