我有两个大小不等的图形(图 1 较宽,图 1 较短),我想将两个子图垂直居中对齐,但保持子标题在顶部对齐(请参见附图)。可以使用 subcaption 包来实现这一点,而无需修改图形本身吗? (图片更新)
%preamble
\usepackage[singlelinecheck=false, aboveskip=-3pt]{subcaption}
%document
%version1----
\begin{figure}
\captionsetup[subfigure]{labelformat=simple, position = top}
\captionsetup{font={onehalfspacing},skip=-10pt}
\subcaptionbox{}[0.5\textwidth]{\includegraphics[width=0.5\linewidth]{fig1.pdf}}
\subcaptionbox{}[0.5\textwidth]{\includegraphics[width=0.5\linewidth]{fig2.pdf}}
\end{figure}
\clearpage
%version2----
\begin{figure}[hb]
\captionsetup[subfigure]{labelformat=simple}
\captionsetup{font={onehalfspacing},skip=-10pt}
\begin{subfigure}[c]{0.49\textwidth}
\caption{}
\includegraphics[width=\textwidth]{fig1.pdf}
\end{subfigure}
\begin{subfigure}[c]{0.49\textwidth}
\caption{}
\includegraphics[width=\textwidth]{fig2.pdf}
\end{subfigure}
答案1
你可能会喜欢这个解决方案:
\documentclass{article}
\usepackage{graphicx}
\usepackage[singlelinecheck=false, aboveskip=-3pt]{subcaption}
\renewcommand{\thesubfigure}{\Alph{subfigure}}
\begin{document}
\begin{figure}[htbp]
\captionsetup[subfigure]{labelformat=simple}
\begin{subfigure}{\textwidth}
\valign{\hsize=0.49\hsize \linewidth=\hsize #\cr
\caption{}
\vfill
\includegraphics[height=2cm,width=\hsize]{example-image}
\vfill
\cr\noalign{\hfill}
\caption{}
\vfill
\includegraphics[width=\hsize]{example-image}
\vfill
\cr
}
\end{subfigure}
\end{figure}
\end{document}