0

I have several floats arranged over several pages which LaTeX isn't quite ordering correctly, and I'd like to know how I can adjust this. My code is essentially of the form:

paragraph of text referencing table1, table2, figure1, in that order.
table1 float environment [p]
table2 float environment [p]
figure1 float environment [t]

(Here p,t, etc are just the standard positioning options for floats, and have the usual meaning - page of floats, top of page, etc.)

This produces pages of the form:

--------------page-1--------------

paragraph of text referencing table1, table2 in that order.

--------------page-2--------------

figure1 float

continuation of paragraph, mentioning figure1.

--------------page-3--------------

table1 float

table2 float

---------------etc----------------

This results in the tables appearing quite a while after being mentioned in the text, and it would make more sense for the page of floats to appear as page 2, rather than 3. How can I achieve this?

  • 1
    \afterpage{\clearpage} immediately after creating all three should work, but if you want the figure first, you need to create it first. – John Kormylo Nov 13 '15 at 13:45
  • @John Kormylo I am creating the floats in the order table1, table2, image1, and I wish for them to appear in this order. Instead they appear as described above. Essentially I want what is currently page 3 (the page of tables) to appear as page 2, and what is currently page 2 (the figure and body text) to occur as page 3. – Ulysses Nov 16 '15 at 1:48
  • I tried \afterpage{\clearpage} at a few different positions in the document, without success. Thank you for your suggestion though. I will keep trying. – Ulysses Nov 16 '15 at 2:20
2

Using [p] on the tables restricts the position the tables can go so latex is forced to hold them back hoping to fill a float page subject to the constraints on float pages. As you have posted no example we have to guess but I would guess that the two figures are too small to fill a float page on their own but too large to both fit, so they will be held back until the next \clearpage.

See Frank's answer for how to customise the float parameters.

How to influence the position of float environments like figure and table in LaTeX?

Also note that the float placement does not use the position where they are referenced with \ref in the source, only the point in the source where the \begin{figure} or \begin{table} appears.

  • The two tables fill a float page together with room to spare, and the figure comfortably fits on a page with the text. The layout of the pages produced is just fine, it's the order that is a problem. I want everything currently on page 3 to instead be placed on page 2, and everything currently on page 2 to be placed on page 3. I have produced the floats in the order they should appear (table1, table2, figure1), but they instead appear in the order figure1, table1, table2. The thing you linked to did not address the issue I am having. – Ulysses Nov 16 '15 at 2:09
  • @Ulysses "room to spare" suggests that you are looking at white space, by eye, which is not what tex does, it compares the numerical values of the parameters described in the "The thing you linked to [that] did not address the issue". If you had posted an example, someone could have shown how to adjust the settings, as you did not, then a self-answer is the only possibility. – David Carlisle Nov 16 '15 at 7:59
  • The layout LaTeX produces is actually fine, including the white space. It is the order that is the issue. – Ulysses Nov 16 '15 at 8:14
0

I have now fixed this and thought I'd share my solution since it is not similar to any of the suggestions by others. Essentially I managed to force the order of my floats by defining the tables before the paragraph rather than after it. Compare the following to my original post. The code I am now using is of the form:

table1 float environment [p]
table2 float environment [p]
paragraph of text referencing table1, table2, figure1, in that order.
figure1 float environment [t]

This now gives the desired output, in the form:

--------------page-1--------------

paragraph of text referencing table1, table2 in that order.

--------------page-2--------------

table1 float

table2 float

--------------page-3--------------

figure1 float

continuation of paragraph, mentioning figure1.

---------------etc----------------

Frankly, this is an ad hoc work-around, rather than a nicely coded general solution, but it does the job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.