[Tex/LaTex] Minipage aligning bottom of pictures with multiple-line caption

minipage

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.

\documentclass{article}
\usepackage{mwe}

\begin{document}

\begin{figure}
    \centering
    \begin{minipage}[t]{0.45\textwidth}\centering%
        \includegraphics[width=\textwidth]{example-image-a}
        \caption{The letter A}
    \end{minipage}\hfill
    \begin{minipage}[t]{0.45\textwidth}\centering%
        \includegraphics[width=\textwidth]{example-image-b} 
        \caption{The letter B follows the letter A as the next letter in the alphabet}
    \end{minipage}
\end{figure}

\end{document}

\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:

\documentclass{article}
\usepackage{mwe}

\begin{document}

\begin{figure}
    \centering
    \begin{minipage}[t]{0.45\textwidth}\centering%
        \includegraphics[width=\textwidth]{example-image-a}
        \caption{The letter A}
    \end{minipage}\hfill
    \begin{minipage}[t]{0.45\textwidth}\centering%
        \includegraphics[width=\textwidth]{example-image-10x16} 
        \caption{The letter B follows the letter A as the next letter in the alphabet}
    \end{minipage}
\end{figure}

\end{document}

enter image description here

The reason this (counterintuitively) works is because \includegraphics anchors the bottom left corner of the image to the baseline of the text, and minipage uses that text baseline for alignment, so as far as minipage 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.

enter image description here