I have a minipage for two side-by-side images. However, the caption of the right picture runs into a second line. This causes the image to shift up. I want to know how to keep the bottom of the images flush and let the caption push into a new line below.
My file:
\begin{document}
.
.
\begin{figure}[H]
\centering
\makebox[0pt]{
\begin{minipage}{0.5 \textwidth} \centering
\includegraphics[width=2.9in]{A.png}
\caption{The letter A}
\end{minipage} \hfill
\begin{minipage}{0.5 \textwidth} \centering
\includegraphics[width=2.9in]{B.jpg}
\caption{The letter B follows the letter A as the next letter in the alphabet}
\end{minipage}}
\end{figure}
.
.
\end{document}
Note: The \makebox[0pt]
is used to center the minipage to the document.
Best Answer
I can't compile your
mwe
, so I made my own to demonstrate the most common solution to this problem.This way, we avoid the
\makebox
command, and keep everything a little simpler:The key point is the when you create the
minipage
, you want the[t]
option so that the two minipages align relative to the top instead of to the center as they do by default.\usepackage{mwe}
is used only for the example images, you don't need it in your document.In the name of completeness, here's an example showing images with different aspect ratios:
The reason this (counterintuitively) works is because
\includegraphics
anchors the bottom left corner of the image to the baseline of the text, andminipage
uses that text baseline for alignment, so as far asminipage
is concerned all that matters is aligning the first baselines of text. The amount of image above this point doesn't matter. However, if there is text above the image, you'll end up being out of alignment.