【LaTeX技巧30】Control float placement

2015-03-16 20:22 阅读 132 次 评论关闭

If you’ve ever written a report with a lot of (big) pictures in it, you’ve probably also noticed that LaTeX sometimes places floats (e.g. figures, tables) on other pages than intended. Adding options like [h] (i.e. “here”), [t] (i.e. “top”) or [htp] to the float environment will mostly give you enough control. but not always. This is because of the fact that by default, LaTeX’s algorithms require that at least 20% of page is filled with text. If you want to place a rather big picture along with a table and some descriptive text, LaTeX will place the information on two pages even if it would fit on one page. If the 

 options is called in a float environment, floats will be allowed to appear on pages without any text. However, that’s mostly not wanted either. To gain more control over float placement, a few commands have to be redefined.

To change the percentage of text to, for instance, 5%:


When trying to place multiple floats directly underneath each other, LaTeX might also send the floats to different pages. To change this behavior, we have the following commands:

\renewcommand{\topfraction}{0.8} \renewcommand{\bottomfraction}{0.8}

Sometimes LaTeX puts a float on an empty page, even if it would nicely fit on another page. This is the case when you call the float on a page where it doesn’t fit. Half empty pages with just a picture or a table on it aren’t exactly eye candy. So, in order to tell LaTeX that a float must at least take 75% of a page in order to be placed on an empty one, we redefine:


You should take into account that the floatpagefraction must always be less than the topfraction. Otherwise, LaTeX will postpone the placement of a float until a \clearpage command is given.


转载请注明:【LaTeX技巧30】Control float placement | 猎微网
分类:LaTeX 标签:, , , ,