General ⇒ Page of floats
-
- Posts: 4
- Joined: Wed May 16, 2007 3:28 pm
Page of floats
I am trying to work out how to do something in Latex for my technical report. I have an appendix at th back which contains code fragements which I reference in the main text. These code fragments are wrapped inside a float I defined called `code'. Currently I have all the code segments one after another in the Latex code, but when compiled it makes a first page of code segments and then subsequent ones appear at the end of the document on their own pages each. I currently have [h] set for each code float. I have tried it with [!h] for all of them but that doesn't fully work either.
Is there any way I can specify to Latex to keep placing floats on a page until full, then start a new page, etc, etc and stop it from pushing them all to the back?
Many thanks in advance!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Page of floats
Code: Select all
\begin{figure}[!ht]
\centering
…
\caption{A figure}\label{fig:figure}
\end{figure}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 4
- Joined: Wed May 16, 2007 3:28 pm
Re: Page of floats
Thanks for your help. I think I found a work around which is working well for me - I'm just forcing a new page myself. It's quite good because in between two floats on a page I have \vfill so that it looks better on the page.
I didn't know that you're meant to put 2 things always for the float placement - thanks for that tip!