Why is it that, when I insert my figure with \begin{figure}
, it is placed at the beginning of the paper ?
2 Answers
You need to specify [H]
like the code below
\begin{figure}[H]
\centering
\includegraphics[width=0.95\textwidth]{image.png}
\caption{Caption.}
\label{fig:image1}
\end{figure}
Add \usepackage{float}
-
2You should mention that by default
[H]
will give an error! LaTeX Error: Unknown float option `H'.
May 10, 2020 at 16:33 -
1Your answer is misleading. In the case, that ina document preamble you load package
float
(which defineH
), figure can still appear at the top of page (for example, if on the page is not enough space for figure, it is pushed to the next page and left empty space on the previous).– ZarkoOct 9, 2020 at 5:41
So, the way i fixed this was by using center
instead of figure
:
\begin{center}
\centering
\includegraphics[width=0.95\textwidth]{image.png}
\caption{Caption.}
\label{fig:image1}
\end{center}
-
Using
center
and\centering
is redundant– user263192May 11, 2022 at 14:26 -
What happens with the
\caption
? Does it still print correctly as a figure caption?– Werner ♦May 11, 2022 at 15:59 -
figure
environment is to allow the figure to be moved to help with page breaking.\includegraphics
includes the image. You haven't shown any code but presumably you wrapped it in\begin{figure}..\end{figure}
that environment doesn't do anything to do with including images, it just marks the region as a float that can be moved and re-inserted at another place to help with page breaking.