That’s why LaTeX provides simple methods to place a figure in the document correctly. However, many beginners don’t know how to put images correctly. So, if you want to learn how to figure placement in LaTeX, please read this tutorial thoroughly.
How To Do Figure Placement in LaTeX
Let’s start with a simple example to place a figure with the document using the {graphicx, float} \usepackage:
\usepackage{graphicx, float}
\usepackage{caption}
\usepackage{blindtext}
\begin{document}
\blindtext
\blindtext
\begin{figure}[h]
\centering
\includegraphics[scale= 0.2]{Images/3d_image.png}
\caption{3D cube in x, y, z axis}
\label{fig:my_label}
\end{figure}
\blindtext
\blinddocument
\end{document}
Output
The previous example is related to floating objects. A float contains non-collapsible elements across the page. Moreover, you can replace h in \begin{figure}[h] with the following:
Option | Description |
---|---|
h | Permits to place a float here |
t | Positions the figure at the top of a page |
b | Allows a figure to be placed at the bottom of the page |
p | Permits to place the figure on a different page |
! | Allows overriding the float position determined by LATEX’s internal parameters |
H | Allows the float to be placed at the right location in a LaTeX source code |
You can use the \begin{center} to place a figure in the center of the document and text. So here is the following simple source code you can use:
\usepackage{graphicx, caption}
\usepackage{blindtext}
\begin{document}
\blindtext
\blindtext
\begin{center}
\includegraphics[scale= 0.2]{Images/3d_image.png}
\captionof{figure}{3D cube in x, y, z axis}
\label{fig:center}
\end{center}
\blindtext
\blinddocument
\end{document}
Output
Conclusion
In this tutorial, we explained different ways to place a figure correctly in a LaTeX document. If you do not correctly place a figure or table in the document, it may confuse a reader. Moreover, placing a figure and wrapping it around a text is different. Hence, please visit our official website to find out how to wrap a figure around a text in LaTeX.