Graphics, Figures & TablesPut Float on Page where referenced or earlier

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Put Float on Page where referenced or earlier

Post by Singularity »

Apparently I am extremely picky about figure placement, even when under severe time pressure.

In the epslatex document (p. 58, #3) I see that a float is always placed on the page where it is referenced, or a following page. I hate that. When I'm reading something, I like pictures to appear on the same page or on an earlier page, so I don't have to go searching for them.

Is there any (easy, non-time consuming) way to get floats to appear on the page where it's referenced or earlier?

Thanks.

Recommended reading 2024:

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

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

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

Put Float on Page where referenced or earlier

Post by localghost »

The output routine is not bounded to the reference to a float. So you have to take care that your reference is not to far away from the declaration in the source. From my point of view you can't completely rule out that a float appears after a reference. You can only make provision against it by carefully organizing your source code. Packages like varioref support enhanced referencing. Appropriate placement parameters allow better control of float placement (see below). Perhaps you will find your way with this tools.

Regarding float placement some additional remarks. Due to the fact the typesetting with LaTeX is a linear process, floating environment can never appear before they are declared in the source. To minimize the "distance" between declaration in the source and appearance in the output you should start with appropriate placement parameters for floats.

Code: Select all

\begin{figure}[!ht]
% figure content
\end{figure}
This makes LaTeX to neglect internal restrictions and place the float as early as possible. The float will appear where declared in the source (h) or at the latest on top of the next page (t). It depends on whether there is enough space on the current page.


Thorsten
Post Reply