GeneralFigures keep shoving down to next page

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Dooley
Posts: 3
Joined: Fri Apr 11, 2008 8:06 pm

Figures keep shoving down to next page

Post by Dooley »

Hi all I'm having a problem display images in latex, it's been a problem for me for quite a while so I hope someone can help. Say I write something like this in latex.

Code: Select all

Some text.
\begin{figure}[!h]
  \centering
    %\underline{Edit-Survey Screen}\\
    \includegraphics[width=1\textwidth]{images/myimage.png}
    \caption{A caption}
  \label{editing}
\end{figure}\\
Some more text
\pagebreak
If the image is too big to fit on the current page it pushes itself to the next page, below all of my text so it turns out like so.

Page 1:
Some text
Some more text.
Page 2:
displays myimage.png

Can someone tell me how to fix this? thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Figures keep shoving down to next page

Post by Stefan Kottwitz »

Hi Dooley,

welcome to the board!

What do you intend exactly? If you want to prevent the floating of the image completely, you can remove the figure environment. You still may give a caption to the picture by using \captionof of the caption (or capt-of) package.

You can force the output of the current floating objects by inserting \clearpage or \cleardoublepage.

Another approach is using \FloatBarrier of the placeins package before the following text.

Stefan
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figures keep shoving down to next page

Post by localghost »

Dooley wrote:[...] If the image is too big to fit on the current page it pushes itself to the next page, below all of my text so it turns out like so. [...]
This is a quite normal behaviour. Where else should the float be placed when there is not enough space left on the current page? Use at least [!ht] as parameters for placing the float. If that doesn't help, insert a \clearpage (or \cleardoublepage) command right after the float environment. Using the \FloatBarrier command will only mess up the layout.


Best regards
Thorsten¹
Last edited by localghost on Fri Apr 11, 2008 8:47 pm, edited 2 times in total.
Dooley
Posts: 3
Joined: Fri Apr 11, 2008 8:06 pm

Re: Figures keep shoving down to next page

Post by Dooley »

Thank you both for your replies, I used ht! and it seems to work perfectly. I could have sworn I had tried that before.

Cheers again.
User avatar
tripwire45
Posts: 129
Joined: Thu Apr 10, 2008 4:35 am

Figures keep shoving down to next page

Post by tripwire45 »

Actually, I've been having the same issue with tables (I haven't added the figures yet to my project...that's next). I need them to be placed under subsection heads and figures. To solve an issue of placing a logo in a "non-float" position on the title page, I used this:

Code: Select all

\includegraphics[width=0.8\textwidth]{./logo}\\[1cm]
Worked quite well. After I try placing the graphics in my project, I'll probably revisit this thread to either tap into the solution, or ask more questions.
Post Reply