TransWikia.com

Image not uploading just after text

TeX - LaTeX Asked on August 18, 2021

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).enter image description here

enter image description here
But it is appearing as the image attached here. What am I missing here?

One Answer

As posted, the document produces

enter image description here

documentclass[12pt,a4paper]{article}  
usepackage{graphicx}  
begin{document}
 text  
begin{figure}  
centering  
includegraphics[width=6cm, height=6cm]{example-image.png}  
caption {$(S,le)$}  
label{fig:}  
end{figure}  
text  
end{document}

As the float has been inserted mid-paragraph so the pargraph line breaking happens as normal (producing text text ) an and then the float is inserted at the top of the page (as the default position option is [tbp]

If you place the float between paragraphs and allow h then it appears in that place as it fits:

enter image description here

documentclass[12pt,a4paper]{article}  
usepackage{graphicx}  
begin{document}
 text  

begin{figure}[htbp]  
centering  
includegraphics[width=6cm, height=6cm]{example-image.png}  
caption {$(S,le)$}  
label{fig:}  
end{figure}  

text  
end{document}

Answered by David Carlisle on August 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP