我正在尝试排列以下 MWE 的子图像 (a) 和 (b),使它们在顶部对齐。我尝试了以下方法,如解决方案中所述如何实现子图中图像的顶部对齐?但该解决方案仅适用于一个subfloatrow
。
如何通过多个来实现subfloatrow
?
\documentclass{article}
\usepackage[showframe, margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{floatrow}
\begin{document}
\thisfloatsetup{style=plain}
\begin{figure}
\ffigbox[\textwidth]
{
\thisfloatsetup{heightadjust=all
}
\begin{subfloatrow}[2]\useFCwidth
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\includegraphics[width=0.5\textwidth,height=4.5cm]{example-image-a}}
\hspace{10pt}
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\includegraphics[width=0.4\textwidth,height=5.5cm]{example-image-b}}
\vspace{20pt}
\end{subfloatrow}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
\vspace{10pt}
\end{subfloatrow}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
\end{subfloatrow}
}
{\caption{Caption of all figures} \label{fig:}
}
\end{figure}
\end{document}
答案1
使图像具有相同的高度以使标题保持在一行上:
\documentclass{article}
\usepackage[showframe, margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{floatrow}
\begin{document}
\thisfloatsetup{style=plain}
\begin{figure}
\ffigbox[\textwidth]
{
\thisfloatsetup{heightadjust=all
}
\begin{subfloatrow}[2]\useFCwidth
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\begin{minipage}[T][5.5cm][t]{.5\textwidth}
\includegraphics[width=\textwidth,height=4.5cm]{example-image-a}
\end{minipage}}
\hspace{10pt}
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\begin{minipage}[T][5.5cm][t]{.4\textwidth}
\includegraphics[width=\textwidth,height=5.5cm]{example-image-b}
\end{minipage}}
\vspace{20pt}
\end{subfloatrow}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
\vspace{10pt}
\end{subfloatrow}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
\end{subfloatrow}
}
{\caption{Caption of all figures} \label{fig:}
}
\end{figure}
\end{document}
答案2
如果加载了子标题,为什么还要使用 floatrow?有了子标题,事情就简单多了:
\documentclass{article}
\usepackage[showframe, margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{floatrow}
%\usepackage[export]{adjustbox}
\begin{document}
\thisfloatsetup{style=plain}
\begin{figure}
\begin{subfigure}[T]{.5\textwidth}
\includegraphics[width=\textwidth,height=4.5cm]{example-image-a}
\caption{}
\end{subfigure}
\hfill
\begin{subfigure}[T]{.4\textwidth}
\includegraphics[width=\textwidth,height=5.5cm]{example-image-b}
\caption{}
\end{subfigure}
\vspace{10pt}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
\vspace{10pt}
\end{subfloatrow}
\thisfloatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
\end{subfloatrow}
\caption{Caption of all figures}
\label{fig:}
\end{figure}
\end{document}
答案3
这可行(稍微简化了您的代码,添加了主标题垂直间距的调整),但您必须编译两次:
\documentclass{article}
\usepackage[showframe, margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{floatrow}
\begin{document}
\begin{figure}
\floatsetup{valign=t, heightadjust=all,}%captionskip =0ex
\ffigbox[\textwidth]%
{\begin{subfloatrow}[2]\useFCwidth
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\includegraphics[width=0.5\textwidth,height=4.5cm]{example-image-a}}
\hspace{10pt}
\ffigbox[\FBwidth][\FBheight][t]
{\caption{} \label{}}
{\includegraphics[width=0.4\textwidth,height=5.5cm]{example-image-b}}
\vspace{20pt}
\end{subfloatrow}
\floatsetup{capbesideposition={left,top},
capbesidesep=none,
}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
\vspace{20pt}
\end{subfloatrow}
\begin{subfloatrow}[1]
\fcapside[\FBwidth]
{\caption{} \label{}}
{\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
\end{subfloatrow}
\vskip -6em
}%
{\caption{Caption of all figures} \label{fig:}}
\end{figure}
\end{document}