子图的顶部对齐

子图的顶部对齐

由于某种原因,我无法使用subfigure环境选项对图形进行顶部对齐[t]。我在互联网上搜索解决方案,发现对于如此简单和普遍的问题,它们相当复杂...简单的解决方案是什么?

\documentclass[11pt]{article}
\usepackage[draft]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[h!]
\centering

\begin{subfigure}[t]{.49\linewidth}
\centering
\includegraphics[width=1\textwidth]{calCurve.pdf}
\caption{Caption 1}
\end{subfigure}%
\begin{subfigure}[t]{.49\linewidth}
\centering
\includegraphics[scale=0.7]{anova.pdf}
\caption{Caption 2}
\end{subfigure}%
\end{figure}

\end{document}

输出

答案1

你可以掷骰子floatrow

\documentclass[12pt]{article}

\usepackage{caption,floatrow}

\DeclareCaptionSubType[alph]{figure}
\captionsetup[figure]{labelsep=colon}
\captionsetup[subfigure]{labelformat=brace,labelsep=space,labelfont=bf}
\floatsetup[subfigure]{capposition=bottom,heightadjust=all,valign=t}

\begin{document}
\begin{figure}[htp]
  \ffigbox[\FBwidth]
  {\begin{subfloatrow}
      \ffigbox
        {\caption{First subfigure}}%
        {\rule{3cm}{3cm}}

        \ffigbox
        {\caption{Second subfigure with more Text so we have a line break}}%
        {\rule{1.5cm}{1.5cm}}
  \end{subfloatrow}}
  {\caption{Two figures}}
\end{figure}
\end{document}

在此处输入图片描述

相关内容