![一页上排列多个子图](https://linux22.com/image/365174/%E4%B8%80%E9%A1%B5%E4%B8%8A%E6%8E%92%E5%88%97%E5%A4%9A%E4%B8%AA%E5%AD%90%E5%9B%BE.png)
答案1
在一个figure
环境中安排尽可能多的subfloat
(subfig
包)和caption
您需要的包。以下代码用于minipages
分配图形。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\begin{minipage}{.5\textwidth}
\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{First row, first column}
\end{minipage}
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{First row, second column}
\end{minipage}\\[2cm]
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{Second row, first column}
\end{minipage}
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{Second row, second column}
\end{minipage}
\end{figure}
\end{document}
答案2
您可以将多个minipage
环境组合在一起,例如\subcaptionbox
在一个环境中组合figure
:
\documentclass{article}
\usepackage{subcaption}
\usepackage{mwe}% for example-image
\begin{document}
\begin{figure}
\begin{minipage}{.5\linewidth}
\subcaptionbox{First
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
\subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
\subcaptionbox{Third
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
\caption{This is the first figure}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\subcaptionbox{First
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
\subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
\subcaptionbox{Third
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
\caption{This is the second figure}
\end{minipage}
\bigskip
\begin{minipage}{.5\linewidth}
\subcaptionbox{First
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
\subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
\subcaptionbox{Third
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
\caption{This is the third figure}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\subcaptionbox{First
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
\subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
\subcaptionbox{Third
subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
\caption{This is the forth figure}
\end{minipage}
\end{figure}
\end{document}
注意:每个浮点数floatrow
只允许一个\caption
,除非你使用,例如\ffigbox
。floatrow
有关更多信息,请参阅手册第 1.2 节。
答案3
使用tabularx
和subfig
包的替代方法......
\documentclass{article}
\usepackage{graphicx}% for example-image
\usepackage{subfig}
\usepackage{tabularx}
%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{figure}
\begin{tabularx}{\linewidth}{@{}
*{2}{>{\centering\arraybackslash}X}
@{} }
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
\caption{This is the first figure}
&
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
\caption{This is the second figure}
\\
%
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
\caption{This is the third figure}
&
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}
\subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
\caption{This is the forth figure}
\end{tabularx}
\end{figure}
\end{document}