If I have to pictures of different height and the same width, how can I dock them to the top that both pictures are vertically aligned. This is my code so far:
\begin{figure}[h]
\centering
\subfloat[Part 1]{%
\includegraphics[width=0.4\textwidth]{pic1.png}%
\label{fig:left}%
}
\subfloat[Part 2]{%
\includegraphics[width=0.4\textwidth]{pic2.png}%
\label{fig:middle}%
}
\caption{Stuff will be here.}
\label{fig:default}
\end{figure}
Best Answer
Sub-float package assumes that it is important to vertically align the captions, and therefore typically relies on a baseline alignment of the sub-float content.
Using
adjustbox
'svalign=t
option, the image's (the sub-float content) regularb
aseline alignment could be altered to now be at thet
op. However, you may also want to insert an appropriately-sized companion for the shorter image... do that by using\vphantom{<larger image>}
: