I wanted to put an image between to paragraphs. I used the following codes:
\documentclass[12pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{enumerate}
\begin{document}
\begin{enumerate}
\item text
\begin{figure}
\centering
\includegraphics[width=6cm, height=6cm]{set.png}
\caption {$(S,\le)$}
\label{fig:}
\end{figure}
\item text
\end{enumerate}
\end{document}
I want example (i) to be at first, then the image and then example (ii).
But it is appearing as the image attached here. What am I missing here?


figurewhich is just used to specify that the content is afloatthat may be moved to help with page breaking, So it is working as expected – David Carlisle Apr 05 '21 at 22:34\begin{figure}[htbp]then it will use theh(here) position and not move it of it fits at that position. – David Carlisle Apr 05 '21 at 22:35figureenvironment does is allow the figure to be moved in that way, if you includehand it still move sthen that is because it doesn't fit so moving is most likely the best thing to do. – David Carlisle Apr 05 '21 at 22:40\begin{figure}if you want the previous paragraph to end at that point. – David Carlisle Apr 05 '21 at 22:42figure, – David Carlisle Apr 05 '21 at 22:45figure\includegraphics never moves. the only reason to usefigureis to allow it to move, but see the second of the lonks I gave above, or the answer I just posted. – David Carlisle Apr 05 '21 at 22:49