自定义子图安排

自定义子图安排

在此处输入图片描述

我有 (08) 张图片需要放在一页中,并按上图所示的格式排列。请帮忙处理这个问题。

答案1

由于您似乎拥有相同宽度的图形,因此使用起来很容易subcaption;我在共享子标题的子图之间设置了一个四边形,并在列之间设置了两个四边形。

\documentclass{article}

\usepackage{calc}
\usepackage{graphicx}
\usepackage{subcaption}

\newlength{\subfigurewidth}

\begin{document}

\begin{figure}[htp]

\setlength{\subfigurewidth}{.25\dimexpr\textwidth-4em}

\centering

\begin{subfigure}{2\subfigurewidth+1em}
\centering

\includegraphics[width=\subfigurewidth]{example-image}%
\hfill
\includegraphics[width=\subfigurewidth]{example-image}%

\caption{Subtitle A}
\end{subfigure}%
\hfill
\begin{subfigure}{2\subfigurewidth+1em}
\centering

\includegraphics[width=\subfigurewidth]{example-image}%
\hfill
\includegraphics[width=\subfigurewidth]{example-image}%

\caption{Subtitle B}
\end{subfigure}

%% end of first row
\bigskip

\begin{subfigure}{2\subfigurewidth+1em}
\centering

\includegraphics[width=\subfigurewidth]{example-image}%
\hfill
\includegraphics[width=\subfigurewidth]{example-image}%

\caption{Subtitle C}
\end{subfigure}%
\hfill
\begin{subfigure}{2\subfigurewidth+1em}
\centering

\includegraphics[width=\subfigurewidth]{example-image}%
\hfill
\includegraphics[width=\subfigurewidth]{example-image}%

\caption{Subtitle D}
\end{subfigure}

\caption{Title}

\end{figure}

\end{document}

在此处输入图片描述

添加“初始位置”和“最终位置”标签的方法如下

\documentclass{article}

\usepackage{calc}
\usepackage{graphicx}
\usepackage{subcaption}

\newlength{\subfigurewidth}
\newcommand{\taggedincludegraphics}[3][]{%
  \begingroup\footnotesize
  \begin{tabular}[t]{@{}c@{}}
  \includegraphics[#1]{#2}\\
  #3
  \end{tabular}%
  \endgroup
}

\begin{document}

\begin{figure}[htp]

\setlength{\subfigurewidth}{.25\dimexpr\textwidth-4em}

\centering

\begin{subfigure}{2\subfigurewidth+1em}
\centering

\taggedincludegraphics[width=\subfigurewidth]{example-image}{Initial position}%
\hfill
\taggedincludegraphics[width=\subfigurewidth]{example-image}{Final position}%

\caption{Subtitle A}
\end{subfigure}%
\hfill
\begin{subfigure}{2\subfigurewidth+1em}
\centering

\taggedincludegraphics[width=\subfigurewidth]{example-image}{Initial position}%
\hfill
\taggedincludegraphics[width=\subfigurewidth]{example-image}{Final position}%

\caption{Subtitle B}
\end{subfigure}

%% end of first row
\bigskip

\begin{subfigure}{2\subfigurewidth+1em}
\centering

\taggedincludegraphics[width=\subfigurewidth]{example-image}{Initial position}%
\hfill
\taggedincludegraphics[width=\subfigurewidth]{example-image}{Final position}%

\caption{Subtitle C}
\end{subfigure}%
\hfill
\begin{subfigure}{2\subfigurewidth+1em}
\centering

\taggedincludegraphics[width=\subfigurewidth]{example-image}{Initial position}%
\hfill
\taggedincludegraphics[width=\subfigurewidth]{example-image}{Final position}%

\caption{Subtitle D}
\end{subfigure}

\caption{Title}

\end{figure}

\end{document}

在此处输入图片描述

相关内容