95

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.

dustin
  • 18,617
  • 23
  • 99
  • 204
john84
  • 1,205
  • 1
    Are you using the options for the placement? For example, \begin{figure}[h]. – Sigur Aug 23 '12 at 23:13
  • 3
    See http://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat – David Carlisle Aug 23 '12 at 23:47
  • 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 '12 at 03:03

5 Answers5

92

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.

HTH math.

math
  • 3,135
  • Very nice. This worked in my case. I had two figures which took one page even though there was plenty of space for text. – Beni Bogosel Dec 18 '17 at 19:43
  • 5
    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. – wangguoqin1001 Nov 02 '18 at 15:27
  • 1
    HTH stands for Hope That Helps, btw, hth. – GiuTeX Apr 09 '21 at 08: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? – Steven Thomas Oct 18 '21 at 13:40
  • For adjusting further parameters, I found this page useful. – Berta Dénes Jan 11 '22 at 13:17
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?.

Werner
  • 603,163
11

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

dustin
  • 18,617
  • 23
  • 99
  • 204
Vlad
  • 233
  • 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. – Andrew Swann Jul 18 '13 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.

Florent F
  • 131
  • 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 04 '23 at 00: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

Sjonnie
  • 75