Skip to content

You can influence the location LaTeX chooses to place an image using so-called placement specifiers, which are options provided to the figure environment. The following code fragment uses [h!], which instructs LaTeX to try to place the figure exactly where it appears in the text instead of letting it 'float' to another location in the document.

\begin{figure}[h!]
  \caption{A picture of a gull.}
  \centering
  \includegraphics[width=0.5\textwidth]{Image File Name}
\end{figure}

Despite using [h!] LaTeX might not be able to place the figure exactly where it was encountered. For more information on figure placement, see the Overleaf article Positioning images and tables.

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX