0
\subsection{First} \index{First}

Some text of first subsection.

\begin{figure}[!htb] %[hbtp]
    \centering
        \noindent\makebox[\textwidth]{\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{images/a.pdf}}
    \caption{Some description}


    \label{a}
\end{figure}

\subsection{Second} \index{Second}

Some text

For some reason, the figure / image I want to implement appears in the second subsection, even though it's been declared at the end of the first subsection.

Other posts suggested using [!htb] which didn't help.

Thanks!

  • 1
    [!htb] makes it more likely that the figure floats further away as it prevents the figure being placed on a float page (no p) but you can use the placeins package to stop floats going past a \section – David Carlisle May 09 '18 at 15:54
  • Oh I forgot to mention that I tried adding \usepackage[section]{placeins} to my main file, but that didn't have any affects on the figure. – user3367856 May 09 '18 at 15:56
  • that declaration will prevent the figure floating past a \section but if you have an error in your code you need to provide a complete document from documentclass to \end{document} so people can debug, (you can use example-image as the image as that is available for testing – David Carlisle May 09 '18 at 15:58
  • 1
    note [section] stops floats going past \section but you show \subsection so you would need \FloatBarrier (or simply \clearpage) before the \subsection – David Carlisle May 09 '18 at 16:02

0 Answers0