[Tex/LaTex] Looking for three images on top of each other with text underneath each

floatsgraphics

I need to place three images on a page with text under each, and then one 'overall' caption for the figure. This code puts the images on top of each other but the text is to the left of the images, I need the text under each image. E.g. n = 10 steps should be the text directly under the first image.

\begin{figure}[ht]
    \centering
    \subfigure[$n = 10$ steps]{
        {\includegraphics[width=0.45\textwidth]{Raster/cw_10.png}
        \label{cw_10}
    }\\
    \subfigure[$n = 25$ steps]{
        {\includegraphics[width=0.45\textwidth]{Raster/cw_25.png}
        \label{cw_25}
    }\\
    \subfigure[$n = 50$ steps]{
        {\includegraphics[width=0.45\textwidth]{Raster/cw_50.png}
        \label{cw_50}
    }
    \caption{Classical Random Walk with various step sizes.}
    \label{TS}
\end{figure}

Best Answer

subfigure is an obsolete package which shouldn't be used anymore. You can use subfig or subcaption instead. Below, an example using \subcaptionbox from subcaption:

\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\centering
\subcaptionbox{$n = 10$ steps\label{cw_10}}{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_10.png}%
  }\par\medskip
\subcaptionbox{$n = 25$ steps\label{cw_25}}{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_25.png}%
  }\par\medskip        
\subcaptionbox{$n = 50$ steps\label{cw_50}}{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_50.png}%
  }
\caption{Classical Random Walk with various step sizes.}
\label{TS}
\end{figure}

\end{document} 

enter image description here

And with subfig:

\documentclass{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\centering
\subfloat[$n = 10$ steps\label{cw_10}]{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_10.png}%
  }\par
\subfloat[$n = 25$ steps\label{cw_25}]{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_25.png}%
  }\par        
\subfloat[$n = 50$ steps\label{cw_50}]{%
  \includegraphics[width=0.45\textwidth]{Raster/cw_50.png}%
  }
\caption{Classical Random Walk with various step sizes.}
\label{TS}
\end{figure}

\end{document} 

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

Related Question