4

I am trying to place two figures of identical dimensions side-by-side and align then vertically. However, one of the figures has a long caption which spans several more lines than the other.

As a result, the two figures are aligned but the two graphics are not.

How can I align the graphics rather than the entire figure?

\begin{figure}[b]
\centering
\begin{minipage}{0.45\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{figure1} % 
\caption{Short caption}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{figure2} % 
\caption{Long caption}
\end{minipage}
\end{figure}

image

1

2 Answers 2

3

Add the option [t] to the minipages, then they will be aligned with their first lines, which happen to be the images.

enter image description here

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[b]
\centering
\begin{minipage}[t]{0.45\textwidth}
\centering
\includegraphics[width=0.6\textwidth]{example-image-a}
\caption{Short caption}
\end{minipage}\hfill
\begin{minipage}[t]{0.45\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{example-image-b}
\caption{Long caption long caption long caption long caption long caption}
\end{minipage}
\end{figure}
\end{document}
1

I would put them in a table where the cells are aligned on the first row (and centered).

\documentclass{article}
\usepackage{array}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htb]
  \def\arraystretch{0}
  \centering
  \begin{tabular}{>{\centering\arraybackslash}p{0.45\linewidth}>{\centering\arraybackslash}p{0.45\linewidth}}
    \includegraphics[width=0.7\linewidth,height=3cm]{example-image}
    & \includegraphics[width=0.7\linewidth,height=5cm]{example-image}\\
    \caption{Short caption}\label{fig:short}
    & \caption{Long caption that needs sevreral rows in the caption.}\label{fig:long}
  \end{tabular}
\end{figure}
In Figure~\ref{fig:short} and Figure~\ref{fig:long} the captions are aligned but different.
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .