0

I have a latex document using the acmart documentclass (2 columns layout). For the figures I have used [ht!]. Unfortunately, now I have at the top of one page two figures directly placed one below the other. What I want is to place the upper figure at the top of the previous page (there is no other figure at that page).

How can I achieve this?

I have tried \afterpage{\FloatBarrier} for the upper figure but with this the figure is placed on a separate page.

  • Just move up the first figure before of any other float in that page and use the option [t]. Suggestion: a priori options: [tbp], but not [h]. – Fran Dec 7 '18 at 19:11
  • If two figures at top is a problem for you, you can also consider set \topnumber instead of ignore the LaTeX rules with ! – Fran Dec 7 '18 at 19:21
2

The easiest/most convenient solution is to move the code for the first figure earlier in the document so it falls on the appropriate page. This should not influence numbering as the figures still appear sequentially, just on different pages.


It is possible to also insert the figure using a forced non-float together with \afterpage, but that can be avoided if code-shifting suffices.

As an example, assume you have the following code arrangement:

<A lost of document content>
<B some more document content>
<first figure code>
<C some document content>
<second figure code>
<D more document content>

You could use

<A lost of document content>
% First figure code; moved earlier in the document
\afterpage{%
  \begin{figure}[H]
    <first figure content>
  \end{figure}%
}
<B some more document content>
<C some document content>
<second figure code>
<D more document content>

The above required the use of afterpage and float and some adjustment of the placement of \afterpage to ensure the figure ends up in the correct location.

Both approaches are similar. The first relies on TeX to find the most suitable location, assuming it will be earlier in the document since you moved the code earlier (and there are no other floats waiting to be placed). The second places the figure as a non-float (thanks to [H]) and therefore relies more on where the end user places the code.

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.