Latex三线表格编辑

Latex三线表格编辑

1.原始表格如图:

在这里插入图片描述

实现代码如下:

\begin{table}[htbp]   
	\centering   #表格居中
	\begin{tabular}{lccc}      #  'l'表示该列靠左,'c'表示该列居中
		\hline & NN & CC & AA \\   #hline就是三线表中的线
		\hline MM & 0.5808 & 0.4700 & 0.1437 \\    #'\\'表示换行, 列用&隔开
		KK & 0.5990 & 0.5333 & 0.0977 \\
		DD & 0.6439 & 0.6300 & 0.1677 \\
		RR & $ \mathbf{0.6845} $ & $ \mathbf{0.7333} $ & $ \mathbf{0.2700} $ \\   
		\hline                                         #\mathbf  表示加粗
	\end{tabular}
	\caption{Caption.}   #标题
\end{table}

增大或者缩小行间距

加入\renewcommand\arraystretch{1.3},花括号中的数字可以根据情况调整,效果图如下:

在这里插入图片描述

代码如下:

\begin{table}[htbp]
	\renewcommand\arraystretch{1.3}
	\centering
	\begin{tabular}{lccc}
		\hline & NN & CC & AA \\
		\hline MM & 0.5808 & 0.4700 & 0.1437 \\
		KK & 0.5990 & 0.5333 & 0.0977 \\
		DD & 0.6439 & 0.6300 & 0.1677 \\
		RR & $ \mathbf{0.6845} $ & $ \mathbf{0.7333} $ & $ \mathbf{0.2700} $ \\
		\hline
	\end{tabular}
	\caption{Caption.}
\end{table}

调整表格宽度

若表格过窄,加入代码\setlength{\tabcolsep}{7mm}{tabular},tabular为\begin{tabular}\end{tabular}内容。数字可以根据情况调整,效果图如下:
在这里插入图片描述

代码如下:

\begin{table}[htbp]
	\renewcommand\arraystretch{1.3}
	\centering
	\setlength{\tabcolsep}{4mm}{
	\begin{tabular}{lccc}
		\hline & NN & CC & AA \\
		\hline MM & 0.5808 & 0.4700 & 0.1437 \\
		KK & 0.5990 & 0.5333 & 0.0977 \\
		DD & 0.6439 & 0.6300 & 0.1677 \\
		RR & $ \mathbf{0.6845} $ & $ \mathbf{0.7333} $ & $ \mathbf{0.2700} $ \\
		\hline
	\end{tabular}}
	\caption{Caption.}
\end{table}

若表格过宽,将setlength{\tabcolsep}{7mm}{tabular}替换为\resizebox{\textwidth}{7mm}{tabular},改变数值即可。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值