# [Tex/LaTex] LaTeX figure problems

floatsgraphicsjpeg

I want to include a jpg to a LaTeX document, which I have done many times. Normally, I use put it in a figure environment, the code looks like this:

\documentclass[twoside]{article}
\usepackage{graphicx}

\begin{figure}
\includegraphics{myfig.jpg}
\end{figure}


When I try compiling this the document compiles, but no figure shows up. If I do not wrap the \includegraphics in a figure environment then the pdf compiles with the image. I want the figure environment, because I want to add captions/labels.

I can't figure out why this method does not work for this document, when it worked fine for other documents that I have made. The jpg is saved in the same directory as my tex file, so that is not the issue.

Any ideas?

Probably you (or a package) have disabled \clearpage (\let\clearpage\relax). Do not do this, because \clearpage is needed. Apart from starting a new page it also forces LaTeX to output all pending floats. Thus \clearpage is automatically called at the start of \chapter and at the end of the document, for instance.
Thus if the figure is not yet output, \clearpage is disabled, and \end{document} is reached, then the figure "vanishes" and is not set in the document.
Frank Mittelbach has explained \include in this answer. If you do not want page breaks by \include, then use \input.