I am trying to set an image to a particular subsection by
\begin{figure}[h!]
\centering
\includegraphics[width=4.0in]{sample.pdf}
\caption{My sample}
\label{fig:mysample}
\end{figure}
also tried:
\begin{figure}[h]
\centering
\includegraphics[width=4.0in]{sample.pdf}
\caption{My sample}
\label{fig:mysample}
\end{figure}
However, it keeps appearing within the immediate section. How could I fix an image to a subsection?
[h]and[!h]are very restrictive an usually generate a warning, in particular they prevent the figure being placed at the top or bottom of the current page, or on a page on its own, so make it more likely that it goes to the end of the docuemnt. try[htp]or failing that see http://tex.stackexchange.com/q/2275/1090 – David Carlisle Oct 07 '16 at 12:54[htp]seems to work butminipageis even better for what I was after – Manolete Oct 07 '16 at 13:10