![Latex 如何对子图进行分组](https://linux22.com/image/292939/Latex%20%E5%A6%82%E4%BD%95%E5%AF%B9%E5%AD%90%E5%9B%BE%E8%BF%9B%E8%A1%8C%E5%88%86%E7%BB%84.png)
嗨,我想在 Latex 中执行以下操作。我该怎么做?
答案1
\documentclass{article}
\usepackage{floatrow}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\floatsetup[subfigure]{capbesideposition={left,center}}
\begin{figure}
\ffigbox
{%
\begin{subfloatrow}[3]
\fcapside[\FBwidth]{\caption{}\label{fig:sub1}}{\includegraphics[width=3cm]{example-image-a}}%
\fcapside[\FBwidth]{}{\includegraphics[width=3cm]{example-image-a}}
\fcapside[\FBwidth]{}{\includegraphics[width=3cm]{example-image-a}}
\end{subfloatrow}\vskip10pt%
\begin{subfloatrow}[3]
\fcapside[\FBwidth]{\caption{}\label{fig:sub2}}{\includegraphics[width=3cm]{example-image-b}}
\fcapside[\FBwidth]{}{\includegraphics[width=3cm]{example-image-b}}
\fcapside[\FBwidth]{}{\includegraphics[width=3cm]{example-image-b}}
\end{subfloatrow}%
}
{\caption{A test figure with six subfigures in two rows}\label{fig:test}}
\end{figure}
\end{document}
答案2
一种不使用 subfloat 包但使用 的方法enuitem
。示例显示项目也可以被引用。
\documentclass{article}
\usepackage{graphicx,enumitem}
\newenvironment{figrow}%
{%
\centering\addtocounter{figure}{1}% if caption at bottom
\begin{enumerate}[%
itemsep=2pt,parsep=0em,
label={(\alph*)},
ref={\thefigure.(\alph*)}
]}%
{\end{enumerate}\addtocounter{figure}{-1}}
\begin{document}
The range of figure rows is from \ref{rowone} to \ref{rowfour}
\begin{figure}
\begin{figrow}
\item \label{rowone} \raisebox{-0.5\height}{
\includegraphics[width=.3\linewidth]{example-image-a}
\includegraphics[width=.3\linewidth]{example-image-b}
\includegraphics[width=.3\linewidth]{example-image-c}}
\item \label{rowtwo} \raisebox{-0.5\height}{
\includegraphics[width=.3\linewidth]{example-image-a}
\includegraphics[width=.3\linewidth]{example-image-b}
\includegraphics[width=.3\linewidth]{example-image-c}}
\end{figrow}
\caption{A test figure with six subfigures \ref{rowone} and \ref{rowtwo}}
\end{figure}
\begin{figure}
\begin{figrow}
\item \label{rowthree} \raisebox{-0.5\height}{
\includegraphics[width=.3\linewidth]{example-image-a}
\includegraphics[width=.3\linewidth]{example-image-b}
\includegraphics[width=.3\linewidth]{example-image-c}}
\item \label{rowfour} \raisebox{-0.5\height}{
\includegraphics[width=.3\linewidth]{example-image-a}
\includegraphics[width=.3\linewidth]{example-image-b}
\includegraphics[width=.3\linewidth]{example-image-c}}
\end{figrow}
\caption{A test figure with six subfigures}
\end{figure}
\end{document}