Im having trouble displaying an image. It tends to float where ever it wants in the doc. The code I used it displayed here
\begin{figure}[h!]
\begin{center}
\includegraphics[width=8cm]{Hyperfine_splitting.png}
\end{center}
\caption{\label{fig1} Hyperfine splitting of hydrogen states. The first three states equivalent to $F=1$ and the single state corresponding to $F=0$}
\end{figure}
figureenvironment float? Incidentally, how tall is the entirefigure? Incidentally, if you want a simple way of economizing on vertical space, replace\begin{center}with\centeringand delete\end{center}. – Mico Feb 08 '22 at 06:48\documentclass{}is added and {Hyperfine_splitting.png} is exchanged with {example-image-a} since nobody has you image. Also without knowing your packages laoded (or documentclass) it is a big guessing game. Read the link I provided earlier. It basically handles your problem. – Roland Feb 08 '22 at 08:15\begin{figure}is to allow it to move, but using[h]makes it moving to the end of the document quite likely as it removes the possibilitiest b pso does not allow the float at the top of a page, the bottom of a page or on a page of just floats, which does not give many places it is allowed. latex will warn about this and change it tohtto give itself a chance but preventingpfloats is still very restrictive and force larger images to the end of the document – David Carlisle Feb 08 '22 at 08:44\centeringnot\begin{center}and use[htbp]not[!h]– David Carlisle Feb 08 '22 at 08:45[h!]float is because cannot be fitted in the actual page, and the alternative to fix only here ([H]of float package) is much worse: jump anyway to the next page but now leaving a huge bottom space on the previous page. Bad solution: use [H] and bear with the ragged bottoms. Good solutions: move the float or resize the image so it can be fitted without floating, or better allow floating (see above comment) and use\refand\pageref, that exist just to locate something that is "lost" in another page. – Fran Feb 08 '22 at 08:47