开发者

In LaTeX prefer figures on text-heavy pages

开发者 https://www.devze.com 2022-12-30 08:36 出处:网络
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 t

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.


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.


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.


Try

\makeatletter
\@colnum 1 % Or 2. It is the max of the float insertions at the top of the page.
\makeatother
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号