[Tex/LaTex] Minipage Figure Caption Alignment

floatsminipage

The alignment is broken when a long caption is there. How to fix?

\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=1\linewidth]{images/Image_34}
  \caption{{\fontfamily{pcr}\selectfont spy} Plot of 4-bus Test System
  \label{fig:Image_34}}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=1\linewidth]{images/Image_001}
  \caption{{\fontfamily{pcr}\selectfont spy} Plot of 4-bus Test System load buses only \label{fig:Image_001}}
\end{minipage}
\end{figure}

enter image description here

Best Answer

If you want to align the images and captions independently, use a tabular, but you must put the captions in \parboxes or minipages.

\documentclass{article}
\usepackage{graphicx}
\usepackage{showframe}% debugging tool
\begin{document}

\newlength{\halfwidth}
\setlength{\halfwidth}{\dimexpr 0.5\textwidth-\tabcolsep}

\begin{figure}
\begin{tabular}{@{}p{\halfwidth}p{\halfwidth}@{}}
  \raisebox{-\height}{\includegraphics[width=1\linewidth]{example-image-4x3}}&
    \raisebox{-\height}{\includegraphics[width=1\linewidth]{example-image-1x1}}\\
  \caption{{\fontfamily{pcr}\selectfont spy} Plot of 4-bus Test System}\label{fig:Image_34}&
  \caption{{\fontfamily{pcr}\selectfont spy} Plot of 4-bus Test System load buses only}\label{fig:Image_001}
\end{tabular}
\end{figure}

\end{document}

demo

Related Question