【LaTeX】表格调整行高、列宽、合并显示等操作

常规表格:
在这里插入图片描述
如上图所示,表格内容都太贴了,看着难受!

1. 样式一:

在这里插入图片描述
这样就舒服多了!!!

上述表格的操作:

(1)调整行高:

\usepackage{array}  % 需要该宏包
\renewcommand\arraystretch{1.5}

(2)调整列宽:

\makebox[0.1\textwidth][c]{Model}

上述表格的代码如下:

\begin{table*}
\renewcommand\arraystretch{1.5}
\caption{An Example of a Table}
\centering
\begin{tabular}{ccccc}
\hline
\makebox[0.1\textwidth][c]{Model} & \makebox[0.1\textwidth][c]{AC} & \makebox[0.1\textwidth][c]{P} & \makebox[0.1\textwidth][c]{R} & \makebox[0.1\textwidth][c]{F1}\\
\hline
ResNet-50 & 91.59\% & 91.60\% & 91.57\% & 91.58\% \\

LSTM & 91.37\% & 91.21\% & 91.32\% & 91.26\% \\

GRU & 91.73\% & 91.72\% & 91.74\% & 91.73\% \\
\hline
\end{tabular}
\end{table*}

2. 样式二:

在这里插入图片描述

上述表格的代码如下:

\begin{table*}
\centering
\caption{An Example of a Table}\label{tab_1}
% \centerline{ %表格居中开始
\begin{tabular}{c|c|ccccc} %表格内容居中显示
\hline
 \makebox[0.05\textwidth][c]{T} &
 \makebox[0.05\textwidth][c]{Metric} &
 \makebox[0.1\textwidth][c]{HA} & \makebox[0.1\textwidth][c]{ARIMA} &
 \makebox[0.1\textwidth][c]{GRU}  & \makebox[0.1\textwidth][c]{TGCN}  &
 \makebox[0.1\textwidth][c]{STGCN}  \\
\hline
\multirow{4}{*}{ 5 min } & 
RMSE & 6.8480 & 10.0732 & 4.5984 & 6.4324 & \textbf{4.3775} \\
% \cline{2-7}
\multirow{4}{*}{} & 
MAE & 3.6807 & 7.6776 & \textbf{2.7290} & 4.4480 & 2.8301 \\
% \cline{2-7}
\multirow{4}{*}{} & 
ACC & 0.8834 & 0.8273 & 0.9217 & 0.8905 & \textbf{0.9237} \\
% \cline{2-7}
\multirow{4}{*}{} & 
R2 & 0.5704 & * & \textbf{0.7332} & 0.3131 & 0.6792 \\

\hline
\multirow{4}{*}{ 15 min } & 
RMSE & 7.4438 & 10.0387 & 5.2203 & 5.1259 & \textbf{4.2722} \\
% \cline{2-7}
\multirow{4}{*}{} & 
MAE & 4.0154 & 7.6843 & 3.0593 & 3.1793 & \textbf{2.3770} \\
% \cline{2-7}
\multirow{4}{*}{} & 
ACC & 0.8698 & 0.8281 & 0.9079 & 0.9086 & \textbf{0.9279} \\
% \cline{2-7}
\multirow{4}{*}{} & 
R2 & 0.7087 & * & 0.8583 & \textbf{0.8628} & 0.6741 \\

\hline
\multirow{4}{*}{ 30 min } & 
RMSE & 7.4391 & 9.3389 & 6.2731 & 6.0601 & \textbf{5.3675} \\
% \cline{2-7}
\multirow{4}{*}{} & 
MAE & 4.0076 & 7.6907 & 3.6498 & 3.7471 & \textbf{3.0808} \\
% \cline{2-7}
\multirow{4}{*}{} & 
ACC & 0.8735 & 0.8263 & 0.8874 & 0.8970 & \textbf{0.9065} \\
% \cline{2-7}
\multirow{4}{*}{} & 
R2 & 0.7119 & * & 0.7976 & \textbf{0.8089} & 0.5909 \\
\hline
\end{tabular}
% } %表格居中结束
\end{table*}

了解更多:latex调整表格行高、列宽和表格整体的左右宽度

  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值