## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Image appears on next page if I use a caption

Information and discussion about graphics, figures & tables in LaTeX documents.
jessie tex
Posts: 2
Joined: Thu Sep 24, 2015 6:07 pm

### Image appears on next page if I use a caption

If I don't include a caption then my image sits under my writing, eg:
\documentclass[11pt]{article}\usepackage{graphicx}\title{Trying}\author{Ksks}\begin{document}\maketitleHello.\begin{figure}[!h]\centering\includegraphics[scale=0.75]{plot.jpg}\end{figure}\end{document}

But when I include a caption then it jumps to the next page. My image is small and doesn't take up much space (it's not like it's near the bottom of the page in the first one).

Any help would be hugely appreciated.

Tags:

Johannes_B
Site Moderator
Posts: 3795
Joined: Thu Nov 01, 2012 4:08 pm
Welcome, do you know why you are using the {figure} environment? That floating is on purpose. If you want to decide where a picture goes, you can use the Hammer method provided by package float, but I advise you not to and let LaTeX do all the positioning.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

jessie tex
Posts: 2
Joined: Thu Sep 24, 2015 6:07 pm
I'm not sure, I followed a YouTube tutorial. Do you know what I should use instead?

Actually, done it. Thank you for your help!

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
It is hard to believe that the small example you posted compiles to two pages.

However, the caption may very well make the contents of the {figure} environment too big for the remaining space. And then the floating property of the {figure} environment shows its effect.

The {figure} environment (like the {table}) is a floating environment. It is used to allow its contents to be moved to a place where it fits best.

By saying [!h] you only allow the float to be placed here. That is – not quite: h means place here if it fits. As this very often isn't the case LaTeX will very likely change this into ht and then place the float in the top area (t) of the next page. In the small example the bang is completely irrelevant (IIRC it only comes into effect if several floats are to be placed).

Frank Mittelbach has written a detailed explanation on how the floating mechanism works and how it can be influenced.

If you don't want your figure to float then there are easier ways than [!h] (which doesn't prevent floating, anyway)
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim