我正在尝试在图中 4 行表格的两行之间添加一条线(\hline
或):\hdashline
\documentclass[10pt,twocolumn,letterpaper]{article}
\usepackage{times}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{capt-of}
\usepackage{varwidth}
\usepackage{floatrow}
\usepackage{float}
\usepackage{array}
\usepackage[export]{adjustbox}
\usepackage{subcaption}
\usepackage{cuted}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{arydshln}
\begin{document}
%%%%%%%%% TITLE
\title{Title}
\author{1\\2\\{\tt\small 3}
\and4\\5\\{\tt\small 6}
}
\maketitle
\begin{figure*}
\centering
\hspace{-22pt}
% \setlength{\extrarowheight}{1em}
\setlength\tabcolsep{1.5pt}
\begin{tabular}{>{\footnotesize}p{1.2cm}cccccc}
Input &\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
\\
Output &\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a} \\ \hdashline
\rule{0pt}{10ex}
Input &\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
\\
Output &\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
&\includegraphics[scale=0.2,valign=c]{example-image-a} &\includegraphics[scale=0.2,valign=c]{example-image-a}
\end{tabular}
\caption{More results} \label{figure:more results}
\end{figure*}
\end{document}
有没有办法让线位于间隙中间?而不是粘在顶部?尝试用 替换\rule
,\vspace
但它只移动了文本(第一列),而没有移动数字。谢谢。
答案1
我建议使用该booktabs
功能\addlinespace
。
另外tabular*
,您不必担心空格;它只需要对图片的宽度进行有根据的猜测。
使用scale
并不是最好的方法,因为它取决于图片的原始大小,并且猜测正确的因素通常更加困难。
在代码中我注释掉了一些过时的包和示例不需要的包。
\documentclass[10pt,twocolumn,letterpaper]{article}
%\usepackage{mathptmx} % times is obsolete
\usepackage{newtxtext,newtxmath} % better
%\usepackage{epsfig} % obsolete
\usepackage{graphicx}
%\usepackage{capt-of}
%\usepackage{varwidth}
%\usepackage{floatrow}
%\usepackage{float}
\usepackage{array}
\usepackage[export]{adjustbox}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{subcaption}
%\usepackage{cuted}
\usepackage{arydshln}
\usepackage{booktabs}
\begin{document}
\begin{figure*}
\centering
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
>{\footnotesize}{l}
cccccc
}
Input
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
\\ \addlinespace
Output
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
\\
\addlinespace
\hdashline
\addlinespace
Input
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
\\ \addlinespace
Output
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
&\includegraphics[width=0.14\textwidth,valign=c]{example-image-a}
\end{tabular*}
\caption{More results} \label{figure:more results}
\end{figure*}
\end{document}
答案2
作为对 egreg 的回答的补充,这里有一个\adjustboxset
与 结合使用的变体\adjustimage
,以避免重复\includegraphics
命令的可选参数。为了在相邻的图像行之间以及水平虚线周围添加一些垂直空白,我使用了包。可以通过更改和cellspace
的值来调整空白量:\cellspacetoplimit
\cellspacebottomlimit
\documentclass[10pt,twocolumn,letterpaper]{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[column=0]{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{\cellspacetoplimit}
\usepackage{array}
\usepackage{arydshln}
\begin{document}
\begin{figure*}
\setlength\tabcolsep{0pt}
\adjustboxset{width=0.14\textwidth,valign=c}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} >{\footnotesize}{l}*{6}{0c}}
Input
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
\\
Output
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
\\
\hdashline
Input
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
\\
Output
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
& \adjustimage{}{example-image-a}
\end{tabular*}
\caption{More results} \label{figure:more results}
\end{figure*}
\end{document}