[Tex/LaTex] aligning the captions for the side-by-side subfigures

subcaptionsubfloats

I am trying to put two figures side-by-side in beamer environment. Figures are placed properly using the following lines:

\usepackage{subcaption}
 ....

\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}\centering
  \includegraphics[width=\columnwidth]{a.pdf}
  \caption{Figure a}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}\centering
  \includegraphics[width=\columnwidth]{b.pdf}
  \caption{Figure b}
\end{subfigure}
\end{figure}

but the captions are not aligned. The caption for the left figure is nicely placed, but the caption for the right figure shows up a few cm below the figure:

|------------------|           |------------------|
|------------------|           |------------------|
|------------------|           |------------------|
    (a) Figure a                   


                                  (b) Figure b

Best Answer

Just use the optional [t] argument from subcaption:

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

\begin{document}
\begin{figure}
%\centering -> This is irrelevant because of the '.5\textwidth' as Mico advised below.
\begin{subfigure}[t]{.5\textwidth}\centering
  \includegraphics[width=.8\columnwidth]{example-image-a.pdf}
  \caption{Figure a}
\end{subfigure}%
\begin{subfigure}[t]{.5\textwidth}\centering
  \includegraphics[width=\columnwidth]{example-image-b.pdf}
  \caption{Figure b}
\end{subfigure}
\end{figure}
\end{document}

enter image description here