I have a figure block with 2 'minipage', each having a figure. When I typeset the document, the figure goes to the top of the page instead of being in the sub-section where I am defining it. The following is the code I am using to do this.
\begin{figure}
\centering
\begin{minipage}[t]{.45\textwidth}
\centering
\includegraphics[height=.4\linewidth]{sample.png}
\caption{Collection Definition}
\end{minipage}
\begin{minipage}[t]{.45\textwidth}
\centering
\includegraphics[height=.4\linewidth]{tree.png}
\caption{Collection Result}
\end{minipage}
\end{figure}

\usepackage{flafter}– David Carlisle Oct 24 '13 at 10:30