[Tex/LaTex] Subcaption vertical alignment

subcaptionvertical alignment

I'm displaying some figures with different bounding box. The figures seems to be bottom aligned, but I would like to have them vertically aligned. I though subcaption automatically take care of that, but it seems that does not.

Here's a piece of my code:

\documentclass[final,5p,times]{elsarticle}
\usepackage{subcaption}

\begin{document}

\begin{figure*}[htpb]
\subcaptionbox{Curl-free potential singularities}{\includegraphics[width=.3\textwidth]{figs/Case1/Singularities/rotational_pot_sing}} \hfill
\subcaptionbox{Divergence-free potential singularities}{\includegraphics[width=.3\textwidth]{figs/Case1/Singularities/divergence_pot_sing}} \hfill
\subcaptionbox{Vector field potentials singularities}{\includegraphics[width=.3\textwidth]{figs/Case1/Singularities/vector_field_sing}}
\label{fig:case1_sing}
\end{figure*}

\end{document}

And that is the result:

enter image description here

How could I get the desired result?

Thank you.

Best Answer

You can capture the tallest image in a box, which you can then use to measure the height by which you want/have to raise the other not-so-tall images:

enter image description here

\documentclass[final,5p,times]{elsarticle}
\usepackage{subcaption}

\begin{document}

\begin{figure*}[htpb]
  \setbox9=\hbox{\includegraphics[width=.3\linewidth]{example-image-1x1}}% Capture tallest image in box 9
  \subcaptionbox{Curl-free potential singularities}
    {\raisebox{\dimexpr\ht9-\height}{\includegraphics[width=.3\linewidth]{example-image-a}}} \hfill
  \subcaptionbox{Divergence-free potential singularities}
    {\raisebox{\dimexpr\ht9-\height}{\includegraphics[width=.3\linewidth]{example-image-b}}} \hfill
  \subcaptionbox{Vector field potentials singularities}{\includegraphics[width=.3\linewidth]
    {example-image-1x1}}
\end{figure*}

\end{document}

\ht9 represents the height of box 9, while \height is the height of <stuff> in \raisebox{<height>}{<stuff>}.

As reference see References for \dimexpr and \numexpr.

Related Question