我插入了两行图像,\subcaptionbox
但它们之间的垂直空间仍然存在,该空间最初由第一列图像的索引占据。
我怎样才能减少这个区域的空间?
我的代码:
\begin{figure}[h!]
\captionsetup[subfigure]{position=b}
\centering
\caption{my-images}
\label{fig:images}
\subcaptionbox*{
\label{img-0}}
{\includegraphics[width=2.2cm]{img-0.jpg}}\hspace{0.5em}
\subcaptionbox*{
\label{img-1}}
{\includegraphics[width=2.2cm]{img-1.jpg}}\hspace{0.5em}
\subcaptionbox*{
\label{img-2}}
{\includegraphics[width=2.2cm]{img-2.jpg}}
\subcaptionbox{
\label{img-10}}
{\includegraphics[width=2.2cm]{img-0.jpg}}\hspace{0.5em}
\subcaptionbox{
\label{img-11}}
{\includegraphics[width=2.2cm]{img-1.jpg}}\hspace{0.5em}
\subcaptionbox{
\label{img-12}}
{\includegraphics[width=2.2cm]{img-2.jpg}}
\end{figure}
答案1
我会将每个子图的元素堆栈放在 中tabular
。这样您就可以使用 轻松控制间隙\\[<len>]
:
\documentclass[draft]{article}
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}[ht]
\captionsetup[subfigure]{position=b}
\centering
\caption{my-images}\label{fig:images}
\setlength{\tabcolsep}{0pt}% Remove column gap in tabular
\subcaptionbox{\label{img-0}}{%
\begin{tabular}{c}
\includegraphics[width=2.2cm]{img-00.jpg} \\[.5\normalbaselineskip]
\includegraphics[width=2.2cm]{img-10.jpg}
\end{tabular}}%
\hspace{0.5em}%
\subcaptionbox{\label{img-1}}{%
\begin{tabular}{c}
\includegraphics[width=2.2cm]{img-01.jpg} \\[.5\normalbaselineskip]
\includegraphics[width=2.2cm]{img-11.jpg}
\end{tabular}}%
\hspace{0.5em}%
\subcaptionbox{\label{img-2}}{%
\begin{tabular}{c}
\includegraphics[width=2.2cm]{img-02.jpg} \\[.5\normalbaselineskip]
\includegraphics[width=2.2cm]{img-12.jpg}
\end{tabular}}%
\end{figure}
\end{document}
上述建议是基于 a\subcaptionbox*
和 a\label
看起来是多余的这一事实。但是,如果您确实希望保留这种布局,可以插入负垂直空间以减少两行之间的间隙:
\begin{figure}[ht]
\captionsetup[subfigure]{position=b}
\centering
\caption{my-images}\label{fig:images}
\subcaptionbox*{.}{..}%
\hspace{0.5em}%
\subcaptionbox*{.}{..}%
\hspace{0.5em}%
\subcaptionbox*{.}{..}%
\vspace{-0.5\baselineskip}
\subcaptionbox{\label{.}}{..}%
\hspace{0.5em}%
\subcaptionbox{\label{.}}{..}%
\hspace{0.5em}%
\subcaptionbox{\label{.}}{..}%
\end{figure}