[Tex/LaTex] Line up captions on side by side figures

captionsfloatsvertical alignment

I want to place two (or more) figures with side by side. The figures are independent, so need separate captions, with no overall caption for the two. I know how to do this with minipages within a figure environment. But the captions don't line up without trail and error \vspace's before the individual captions. Is there a way to line up the captions automatically?

Best Answer

You could use the optional argument b to the minipage environments to align the images at their bottom, this way the caption would be side by side. At least you did'nt say if you want the images aligned in another way. Though, a common baseline at their bottom would be good, especially as their captions are aligned.

Here's an example using the caption package:

\documentclass{article}
\usepackage[labelfont=bf]{caption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[ht]
\begin{minipage}[b]{.4\linewidth}
\centering%
\includegraphics[width=140pt]{test}
\captionof{figure}{First image}
\end{minipage}%
\hfill%
\begin{minipage}[b]{.5\linewidth}
\centering%
\includegraphics[width=180pt,height=50pt]{test}
\captionof{figure}{Second image with caption}
\end{minipage}
\end{figure}
\begin{figure}[ht]
\centering%
\includegraphics{test}
\caption{Another figure}
\end{figure}
\end{document}

Output:

alt text

Using the tiny capt-of package would be sufficient. The \captionof command is important. As you can see, the numbering of the subfigures matches the numbering of normal figures.