Latex 如何对子图进行分组

Latex 如何对子图进行分组

嗨,我想在 Latex 中执行以下操作。我该怎么做?

在此处输入图片描述

答案1

使用floatrowsubcaption

\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}

相关内容