[Tex/LaTex] Align three images horizontally

aligngraphics

I have three images that don't have the same size. I want to arrange them horizontally in a way that they are centered. I tried this code, it works for the positionning. But I don't know how I can add a subcaption to each image and a caption for the whole figure package like in the figure below.

   \begin{figure}[!h]
\centering
  $\vcenter{\hbox{\includegraphics[height=3.5cm]{image_a}}}$
  \qquad
  $\vcenter{\hbox{\includegraphics[height=7cm]{image_b}}}$
  \qquad
  $\vcenter{\hbox{\includegraphics[height=7cm]{image_c}}}$
\caption{image}
\end{figure}

enter image description here

Best Answer

You can use the subfigure environment from the subcaption package:

\documentclass{article}  
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=3.5cm]{example-image-a}
\caption{this is the first subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=7cm]{example-image-b}
\caption{this is the second subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=7cm]{example-image-c}
\caption{this is the third subfigure}
\end{subfigure}
\caption{image}
\end{figure}

\end{document}

The result:

enter image description here

Related Question