我有 5 幅图像需要放置(使用 subfigure 环境),我想将它们放在两列中(一列有 3 幅图像,另一列有 2 幅图像),或者放在两行中(同上),并使用第 6 幅图像占用的空白处来放置标题。我该怎么做?
谢谢!
答案1
您可以使用subfigure
作为子图,并使用minipage
作为标题:
\documentclass{article}
\usepackage{graphicx, subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\hfill
\begin{minipage}{.3\textwidth}
\caption{a figure with six subfigures and a caption placed beside one of the subfigures}
\end{minipage}
\end{figure}
\end{document}
\documentclass{article}
\usepackage{graphicx, subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\par
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{test subfigure}
\end{subfigure}\quad
\begin{minipage}{.3\textwidth}
\caption{a figure with six subfigures and a caption placed beside one of the subfigures}
\end{minipage}
\end{figure}
\end{document}
如果需要,使用环境的可选参数来获取所需的对齐。