四、Latex画三线格
首先导入\usepackage{booktabs}包,具体使用如下:
\begin{table*}[!t]
% increase table row spacing, adjust to taste
\renewcommand{\arraystretch}{1.3}
\caption{An Example of three line Table}
\label{table_3}
\centering
\begin{tabular}{llll}
\toprule
%A & N=3 1 &N=5 & N=7 & N=9 \\
%Loss function & Steg-img PSNR(db) & Deco-img PSNR(db) & Steg-img SSIM & Deco-img SSIM \\
Database &Basic model & Antique's model & Our model \\
\midrule
ImageNet &0.831 &0.806 &0.789 \\
COCO &0.795 &0.769 &0.746 \\
\bottomrule
\end{tabular}
\end{table*}
结果如下:
如果觉得表格长度不符合,可以自己调整。
表格太短:
\setlength{\tabcolsep}{7mm}{XXXX} ,调整表格宽度, 效果为”按页面宽度调整表格”。7mm可以自己根据表格调整,一直到文档宽度。
\begin{table*}[h]
% increase table row spacing, adjust to taste
\renewcommand{\arraystretch}{1.3}
\caption{An Example of three line Table}
\label{table_3}
\centering
\setlength{\tabcolsep}{10mm}{
\begin{tabular}{llll}
\toprule
%A & N=3 1 &N=5 & N=7 & N=9 \\
%Loss function & Steg-img PSNR(db) & Deco-img PSNR(db) & Steg-img SSIM & Deco-img SSIM \\
Database &Basic model & Antique's model & Our model \\
\midrule
ImageNet &0.831 &0.806 &0.789 \\
COCO &0.795 &0.769 &0.746 \\
\bottomrule
\end{tabular}}
\end{table*}
效果如下:
2.表格过宽
\resizebox{\textwidth}{15mm}{XXXX} ,根据表格内容自动调整表格宽度。
{15mm}是可以根据自己文章和表格来调整的。
\begin{table}[!t]
% increase table row spacing, adjust to taste
%\renewcommand{\arraystretch}{1.3}
\textbf{Table 2}~~PSNR and SSIM of steganography and decoded information\\
\label{table_1}
\centering
\setlength{\tabcolsep}{1.2mm}{
\begin{tabular}{lllll}
\toprule
Loss function &\tabincell{c}{Steg-img\\PSNR(db)} &\tabincell{c}{Deco-img\\PSNR(db)} &\tabincell{c}{Steg-img\\SSIM} &\tabincell{c}{Deco-img\\SSIM} \\
\midrule
MSE & 27.97 & 26.30 &0.8592 &0.8301 \\
SSIM & 1.0000 &1.0000 &1.0000 &1.0000 \\
MSE+SSIM &7.2632 &14.3913 &21.0323 &27.3171 \\
\bottomrule
\end{tabular}}
\end{table}
tabincell是表格内换行的命令,自定义的,需在文章前添加 \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
效果:
其中第二个表格是正常的,第一个是调整后的表格。