Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to control the placement of figures. The paper that I am currently writing contains a lot of figures, resulting in some figures ending up in the bibliography section. Therefore I want to manually control their placement. I know options like [t] and [h] will help, but I am unable to find a good tutorial.

share|improve this question

marked as duplicate by Xavier, Werner, Jubobs, Kurt, mafp May 27 '13 at 23:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You should read Frank Mittelbach's detailed answer on How to influence the position of float environments. It explains how everything works behind the scene and the influence of options like [t] and [h] and is the poster model of a great answer imho! –  Xavier May 27 '13 at 22:19

3 Answers 3

up vote 32 down vote accepted

The document "Using Imported Graphics in LaTeX and pdfLaTeX" contains a section about float placement and how to use those options, it's 17.2 Figure Placement.

It's available for download on CTAN in English and French.

In short, the placement options means allowing placement at certain locations:

  • h means here: Place the figure in the text where the figure environment is written, if there is enough room left on the page
  • t means top: Place it at the top of a page.
  • b means bottom: Place it at the bottom of a page.
  • p means page: Place it on a page containing only floats, such as figures and tables.
  • ! allows to ignore certain parameters of LaTeX for float placement, for example:

    • \topfraction: maximal portion of a page (or column resp., here and below), which is allowed to be used by floats at its top, default 0.7
    • \bottomfraction: maximal portion of a page, which is allowed to be used by floats at its bottom, default value 0.3
    • \textfraction: minimal portion of a page, which would be used by body text, default value 0.2
    • \floatpagefraction: minimal portion of a float page, which has to be filled by floats, default value 0.2. This avoids too much white space on float pages.
    • topnumber: maximal number of floats allowed at the top of a page, default 2
    • bottomnumber: maximal number of floats allowed at the bottom of a page, default 1
    • totalnumber: maximal number of floats allowed at whole page, default 3

    This means, if you add !, the float will be placed if it fits onto the current page and if there aren't further waiting float objects of the same type, ignoring predefined propotions of text and floats as above. Such floats are also called bang floats.

    Fractions can be changed by \renewcommand, numbers are counters which can be changed by \setcounter, further there are lenghts for spacing before, after, and between floats. This gives an impression how LaTeX automatically takes care of sensible figure placement, which you could adjust yourself - or override by ! if meaningful.

These options can be combined, such as [!htbp]. Their order doesn't matter, LaTeX itself attempts using allowed places in order h, t, b, p, even if [pbth] was used.

You should even consider combining as many options as sensible. If a figure cannot be placed, it blocks subsequent figures. This can be a reason why figures end up very late, as you noticed. Specifically, ensure that the figures are not too big to fit into the margins.

share|improve this answer
6  
Also one can consider the placeins package and the \FloatBarrier command that prevents figures from floating any further. If figures are supposed to remain in the section, one can load \usepackage[section]{placeins} –  Martin H Nov 17 '11 at 9:57
    
Good additional advice by @Martin, further is here: Keeping tables/figures close to where they are mentioned. –  Stefan Kottwitz Nov 17 '11 at 10:04
2  
+1 because I always thought the order did matter, and learnt from your post that the order does not matter. Quoting the document you linked to: The order in which the placement options are specified does not make any difference, as the placement options are always attempted in the order h-t-b-p. Thus [hb] and [bh] are both attempted as h-b. The more float placement options are given to LATEX, the better it handles float placement. In particular, the [htbp], [tbp], [htp], [tp] options usually work well. Single-location options [t], [b], [p] [h] are problematic. –  matth Nov 17 '11 at 11:03
    
Also good to know: If no optional arguments are listed, the placement options default to [tbp]. –  matth Nov 17 '11 at 11:09
    
Could we find a better wording for "! relaxes placement restrictions a bit"? IIuc, it "lowers LaTeX's standards", i.e. enables "worse" or "typographically less desirable" placement. The way it currently is, your sentence could be misunderstood as "relaxes the restrictions you're giving with these options a bit". How about "! relaxes LaTeX's placement restrictions a bit and enforces your placement options more strongly." Furthermore, I suggest adding a reference to tex.stackexchange.com/questions/32472/what-is-a-bang-float –  doncherry Nov 17 '11 at 13:10

I would advise you to read the Wikibook on LaTeX/Floats, Figures and Captions since it contains a very general, yet detailed, overview of floats (including figures) and their placement. Also included are crucial things like the placement of \caption and \label (the latter should follow the former, not the other way around).

Then you should consider reading the float package documentation since it contains some important considerations when wanting to force floats to "float no more." The UK TeX FAQ entry entitled Figure (or table) exactly where I want it also discusses this in detail.

share|improve this answer
1  
the wikibook page has a lot of wrong or "not optimal" statements ... –  Herbert Nov 17 '11 at 8:25

The order of the values is not important and using only a h will be extended to ht by the document class:

  • If ! is specified, then ignore the restrictions of placing floating objects, like maximal number of floats per page, amount of text in relation to floats, and so on.
  • If h is specified, try to place the floating environment at the current position. If this is not possible because of the restrictions, replace h by t; the float will appear at the earliest available position on the following page.
  • If t is specified, try to place the floating environment at the top of the current or the next page.
  • If b is specified, try to place the floating environment at the bottom of the current or the next page.
  • If p is specified, place the floating environment on the following page without any text.

With the setting of [!htb] you'll get the best results

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.