96

I have a couple of floats in my document, which contain large Images (it consumes the half of the page). In this case, the figure get's its own page and no text goes on this page.

How can I configure this? I'd like to have text before and after the floats until the float doesn't use more then 75% of the page height.

3
  • 1
    Are you using the options for the placement? For example, \begin{figure}[h].
    – Sigur
    Aug 23, 2012 at 23:13
  • 3
  • 2
    May be ignoring LaTeX rules with ! option ([!tbph], for example) could be also useful in addition to @Werner comment (uhm...answer).
    – Fran
    Aug 28, 2012 at 3:03

5 Answers 5

95

I didn't have had success with the \topfraction, but there is another important setting which gave me less float-only pages. With \renewcommand{\floatpagefraction}{.8}% I was able to specify that only pages with more than 80% of floats, will become pure float-only pages. The default is 0.6 so if a figure consumes 60% of the page it will get its own float-page.

In order to avoid Latex Errors, due to postponing figure processing, we should always use both commands: \topfraction and \floatpagefraction. Thanks to @wangguoqin1001 and @Maurits Houck.

Solution:

\renewcommand{\topfraction}{.8}
\renewcommand{\floatpagefraction}{.8}
6
  • 6
    For anyone who gets here after me, this method alone will postpone the processing of figures, move figures to the end of the document, and generate a lot of "LaTeX Error: Too many unprocessed floats." Using this method with "\renewcommand{\topfraction}{.75}" of the next answer solves the problem for me. Nov 2, 2018 at 15:27
  • 1
    HTH stands for Hope That Helps, btw, hth.
    – GiuTeX
    Apr 9, 2021 at 8:21
  • 1
    I'm late to this, but this answer appears to have worked for me, and I don't have the error that @wangguoqin1001 reports. As a side note, does anyone know what the default value for \floatpagefraction is, or if there is a way to return/print what fraction of a page a specfiic float is using? Oct 18, 2021 at 13:40
  • 1
    For adjusting further parameters, I found this page useful. Jan 11, 2022 at 13:17
  • 1
    Only setting "\renewcommand{\floatpagefraction}{.8}%" could indeed create the issues @wangguoqin1001 mentions. This is because \topfraction is still only by default 0.7. Figures that are 0.75 can thus not be placed: too small to get their own page and too big to go in the topfraction. We should thus always pair this setting with "\renewcommand{\topfraction}{.8}%" May 4 at 3:35
31

Default for LaTeX is to allow up to 70% of the top of a page to be float (set by \topfraction as .7); up to 30% of the bottom of the page (set by \bottomfraction as .3) and at least 20% text (set by \textfraction as .2). Perhaps increase \topfraction using \renewcommand{\topfraction}{.75} as a start.

For more on TeX's float algorithm, read How to influence the position of float environments like figure and table in LaTeX?.

11

I had the exact same problem and I fixed it by setting the [ht] options for the figure environment.

1
  • 2
    Providing correct placement options is a good start. However, as Werner says in his answer, you also have to adjust the parameters that LaTeX uses to get the proportions the questioner is asking for. Jul 18, 2013 at 13:47
3

I had exactly the same problem, but in a two-column environment. Concretely, I wanted to have two figures in the rightmost column of the last page of an article, but the second figure went on a new page even if there was clearly enough space left in the column.

None of the proposed solutions (htbp options, float fraction, \vspace, etc.) worked for me, but the solution that did work was using the H option of the float package:

\usepackage{float}
...
\begin{figure}[H]
   ...
\end{figure}

This had the last figure move back to the previous page.

1
  • Do you know why this H ("Here, definitely") would be better than h!? I tried using H, but the figure was totally removed from my document.
    – Karlo
    May 4, 2023 at 0:43
0

I had a similar issue, but the solutions with renewing the commands for the spacing around floats did not work for me. Perhaps because I used it in a double column environment, but redefining the \dbltopfraction and \floatpagefraction also did not work.

Instead I found the following make-shift solution that worked for me:

\vspace{-50mm}
\begin{figure*}[!ht]
\centering
\includegraphics[scale=1.0]{figure.eps}
\vspace{-50mm}
\caption{}
\label{fig:label}
\end{figure*}
\vspace{50mm}

In this solution solution I reduced the vertical space with \vspace{} right before the figure environment, inside it the environment (after the include), and right after the environment I added the same vertical space again.

Hope this helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .