You can grab the floatrow
documentation code:
\floatsetup[widefloat]{margins=hangleft}
\begin{figure*}%
\begin{floatrow}[4]
\ffigbox
{\caption{Figure~I in the row (\texttt{floatrow}), ``column'' width}%
\label{fig:row:Dog}}
{\input{TheDog.picture}}
\ffigbox[\FBwidth]
{\caption{Figure~II in the row (\texttt{floatrow}), graphics width}%
\label{fig:row:WcatI}}
{\unitlength1.08\unitlength\input{TheCat.picture}}
\ffigbox[\Xhsize/2]
{\caption{Figure~III in the row, float's width box has the
half of the rest space of row}%
\label{fig:row:mouse}}
{{\setlength\unitlength{\hsize/58}%
{\input{Mouse.picture}}}}
\ffigbox[\Xhsize]
{\caption{Figure~IV in the row,
occupies the rest space of row}%
\label{fig:row:cheese}}
{\input{Cheese.picture}}
\end{floatrow}
\end{figure*}%
where the pictures are contained within pictures.tex
.
Either way, a package-less approach would be to set each inside a tabular
:

\documentclass{article}
\usepackage{lipsum,graphicx}
\begin{document}
\sloppy% Just for this example
\lipsum[1]
\begin{figure}[ht]
\centering
\begin{tabular}{ p{2.3cm} p{1.5cm} p{2.7cm} p{2.3cm} }
\includegraphics[width=\linewidth]{example-image} &
\includegraphics[width=\linewidth]{example-image-a} &
\includegraphics[width=\linewidth]{example-image-b} &
\includegraphics[width=\linewidth]{example-image-c}
\\[\dimexpr-\normalbaselineskip+\abovecaptionskip]
\caption{First figure in this row of figures} &
\caption{Second figure in this row of figures} &
\caption{Third figure} &
\caption{Last figure that has a very long caption, stretching multiple rows}
\end{tabular}
\end{figure}
\lipsum[2]
\end{document}
Each image + caption falls within a fixed-width p
-column, with each image set to the width of that column. It's similar to setting the image in the key-value settings for \includegraphics
.
This works because images are naturally set on the baseline and take up exactly one line. Moreover, each cell within the tabular
is set using a p
-column, which has its alignment anchor set to be the baseline of the top line. As a result, the images are bottom-aligned, while the captions are top-aligned.
You can adjust the spacing between the figures and the captions as needed. The same goes for the gap between the images, which default to \tabcolsep
in the above example. One could also use tabularx
for spreading content out and/or making it stretch-and-fit within the text block.