# Minipage aligning bottom of pictures with multiple-line caption

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.

• WELCOME to TeX.SE. I have edited your text in a correct form. What \documentclassand prologue are you using? – Sebastiano Dec 22 '16 at 19:55
• Welcome to TeX.SE! In the future, please post a complete minimal working example (meta.tex.stackexchange.com/questions/228/…); that will make it much easier for us to help you. – dgoodmaniii Dec 22 '16 at 19:58
• Also, you can post code by indenting each line by four spaces, or by highlighting all of it and hitting the {} button; that formats code nicely and makes it much easier to read. – dgoodmaniii Dec 22 '16 at 19:59
• Could you update this with a minimal working example? – Ryan Dec 22 '16 at 20:00

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}


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.

• If the 2 images have different heights, them you can align the minipages with [b], and extend the first caption by some white space so that it will occupy two lines, like \caption{The letter A \newline \hspace*{\textwidth}} – Pieter van Oostrum Dec 22 '16 at 20:15
• Actually, my solution still works, I'll edit my answer above to explain – Ryan Dec 22 '16 at 20:17
• @HarrySchmidlap If my answer works for you, I'd appreciate you giving it the check mark! – Ryan Dec 22 '16 at 20:21
• @Ryan: Similarly, people provide a question with sufficient detail would enjoy your up-vote. You're currently voting, on average, 5 times a month. – Werner Dec 22 '16 at 20:40
• @Werner I haven't used LaTeX for any complex work or school projects in over a year, so I don't come here any more very often or spend too much time—I just try to chip in a few minutes here and there because I like the community. I think you'll find I've handled all my own questions properly (though I haven't asked any in almost three years), even though I haven't had enough time lately for the general moderation side of things. – Ryan Dec 22 '16 at 20:51