views:

121

answers:

3

Hi

LaTeX seems to have a preference for placing figures together on a page, and placing surrounding text on a separate page. Can I somehow change that balance a bit, as I prefer figures to break up the text to avoid too black text-heavy pages.

Example:

\section{Some section}

[Half a page of text]

\begin{figure}
    [...]
    \caption{Figure text 1}
\end{figure}

[Half a page of text]

\begin{figure}
    [...]
    \caption{Figure text 2}
\end{figure}

[More text]

So what LaTeX usually does is to stack the two half pages of text on a single page, and the figures on the following page. I believe this really gives a bad balance, and bores the reader. So can I change that somehow?

I know about postfixing the \begin{figure} with [ht!], but often it does not really matter. I would like to configure the balancing algorithms in LaTeX to naturally prefer pages with combined figures and text.

+7  A: 

Try putting the following in your preamble.

\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.85}
\renewcommand{\textfraction}{0.15}
\renewcommand{\floatpagefraction}{0.7}

You might play with those numbers a little to suit your own preferences. Some explanations of the different parameters are given here.

Rob Hyndman
+1 Exactly. Your explanation of the *fraction commands is maybe unintuitive: these say up to how much of the vertical height of a page may be made of floats: if you set this high, then it will allow a little text to appear above/below the float. I'd also set the *number counters lower, say 1/1/2.
Charles Stewart
Exactly what I was looking for, great article you've written. Thanks.
bjarkef
A: 

Try

\makeatletter
\@colnum 1 % Or 2. It is the max of the float insertions at the top of the page.
\makeatother
Alexey Malistov
+1  A: 

Try to tune floats positioning with:

  • \begin{figure}[tb] for figures that fit well in a page with text (say, half of the text height for the figure and the other half for the text)
  • \begin{figure}[p] for floats large enough to require a dedicated page.

Also, you can place some "barriers" for floats positioning with the packages placeins or afterpage.

Alessandro C.