![使用子标题包对齐大小不等的图形的标题](https://linux22.com/image/379919/%E4%BD%BF%E7%94%A8%E5%AD%90%E6%A0%87%E9%A2%98%E5%8C%85%E5%AF%B9%E9%BD%90%E5%A4%A7%E5%B0%8F%E4%B8%8D%E7%AD%89%E7%9A%84%E5%9B%BE%E5%BD%A2%E7%9A%84%E6%A0%87%E9%A2%98.png)
我有两个大小不等的图形(图 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}