# Where do I place floats in the source?

I realize that this is an embarrassing simple question. Shall I put the floats, e.g.

\begin{figure}
.
.
\end{figure}


in the source immediately after first reference? or wait until the end of the paragraph, or section with the main/first reference.

(My plan is to keep the memoir standard placements [htbp] unless they give me problems in the final document)

-
I removed the {memoir} tag because float placement is not a specific question about memoir. Instead, I added {positioning} and (perhaps subjective) {typography}. –  lockstep Jan 4 '12 at 22:53

There's no single correct answer to your question, in part because you haven't told us much (actually, anything...) about the appearance, average size, or contents of the floats you're creating. Much of what I'm writing below therefore touches only on general issues.

• It's usually considered good practice to place a float close to its first call-out that's generated with a \ref (or similar) command. Of course, this is only a guideline and not an absolute requirement. House styles of journals and other publishing outfits must be followed scrupulously; they will always trump personal preferences, including those expressed below!
• If the floats are mostly small (i.e., if their height is less than about 20% to 25% of \textheight) and if they are meant to illustrate specific points being made in the text, then it's almost a must to place them immediately after (or before) the paragraphs in which they are first mentioned.
• Addendum: As Barbara Beeton has pointed out in her excellent comment, once you're close to finishing the paper, it's important to go through the output pages with an eye towards fine-tuning the placement of the floats. Suppose, say, that you've been placing all short floats after the paragraphs in which they're first mentioned. By inspecting the output, you may detect cases in which LaTeX has moved the float to the following page simply because the paragraph in which the float is mentioned is too long to let the float fit on that page as well. In such instances, you may want to place the input code of the short float above rather than below the respective paragraph in order to keep the float and the call-out on the same (output) page. This is especially important if the paragraphs of your text tend to be fairly long -- say, longer than about 6 to 8 lines.
• For floats that are a bit larger, say from 1/3 to 3/5 of \textheight, it's generally a good idea to direct LaTeX to place all of them either at the top or at the bottom of the respective output pages (while still placing them "reasonably close" to their first call-outs, of course). If you place some of these medium-sized floats at the top, others at the bottom, and others still somewhere in the middle of the (output) pages, you run a serious risk of having the appearance of the entire document fall apart.
• For floats whose height is more than about 60% to 70% of \textheight, give serious consideration to directing LaTeX to place these floats on pages by themselves (by using the [p] placement specifier). If you simply must place such floats on a page that also contains text, be sure to never place them in the middle of the page. Otherwise, you'll have just a few lines of text above the float, then the tall float, and finally a few more lines at the bottom of the page.

• The only time such a disjointed layout might work is if the text below the float starts off with a new sectioning header. Even then, there's probably no harm done by forcing the float to be located at the top of the respective (output) page.
• In addition to deciding on the placement of floats, there are many other considerations that should be made in order to generate satisfactory-looking floats.

• If you use graphics, use consistent color schemes, line styles, and other ways of grouping/organizing information. If you have labels and legends embedded in the graph, try to use, at least roughly, the same font and font size for the text as LaTeX uses for the figure's caption, etc. If that's not possible, consider minimizing the use of such information generated by the graphics program in question and, instead, you LaTeX to provide a decent legend.
• Are some of the floats closely related to each other(logically and/or thematically)? If so, consider creating a main float and various subfloats to help the reader recognize these connections.
• Consider using a different font size and/or font from what's used in the main text. This will help the reader "distinguish" the floating material from the text.
• If you have several tables of varying widths, consider standardizing their widths -- usually by setting the widths to \textwidth -- by employing tabular* and tabularx environments rather than the tabular environment.
• Consider loading the hyperref package to generate hyperlinks from the call-outs to figures and tables to the associated floats. This is especially important for those floats that are collected at the back of the document.

Happy TeXing!

-
all good suggestions for the first pass. when the document nears completion, it's a good idea to review the layout, and consider adjustments in the positioning of the floats in the input to improve the appearance. for example, if a float is referred to at the beginning of a paragraph, and there would be room at the top of the page to keep it on the same page, but the lengths of the paragraph and the float together push it to the next page, moving the float before that paragraph in the input could give a better result. –  barbara beeton Jan 4 '12 at 21:52
I'm out of votes, but will upvote your answer tomorrow. –  lockstep Jan 4 '12 at 22:47
Thanks, @lockstep! :-) –  Mico Jan 5 '12 at 0:19
@Mico: Thanks for the many good suggestions. Will this be good practice?: Place floats in the source(input) immediately after the paragraphs in which the main/first reference is, with standard placements settings([htbp]). - and then when the final version of the document is to be made then check output against your advice, and adjust placements settings, or source placement if needed. –  Hans-Peter E. Kristiansen Jan 5 '12 at 13:00
@barbarabeeton Would you turn your comment into an answer? Mico's answer is excellent for deciding output placement, while your most valuable advices are more oriented to input placement. –  egreg Jan 5 '12 at 13:31

The point at which the float is placed in the source determines the placement of the float in the formatted document in the following way:

• The page on which this point in the source eventually appears in the formatted document will be the earliest page in the formatted document on which the float can appear. If the float is placed inside a paragraph, then this reference point is defined to be the next linebreak (compared to the actual placement in the source). If the float is placed between paragraphs then the reference point for the float is the end of the previous paragraph.
• It is possible (and in fact happens quite often) for the float to appear physically before this reference point but only through its placement in the top area of the same page.
• The moment LaTeX reaches the reference point in the source it will try hard to place the float as fast as possible, i.e., preferably on the same page.

The take-away from this that one normally should (at least initially) place a float close to its first main call-out, i.e., the place in the source where the float is referenced and one expects the reader to be interested in consulting the float material with ease. This is in most cases (but not always) the first reference to the float.

It is fairly easy to do this even within a paragraph, e.g.,

... some text. See figure~\ref{foo} ...
%
\begin{figure}
... \caption{..}\label{foo}
\end{figure}
%
... some more text in the same paragraph


However, even with the additional lines containing just a % this is somewhat difficult to read (and to maintain) and in most cases with minimal gain. So my advice is to initially place such floats always between paragraphs following the paragraph that contained the main call-out. When the document is in its final stage (with respect to its content). The float placement could then be adjusted if necessary.

-

mico's suggestions are all good for the first pass, but may still not result in optimum placement.

when the document nears completion, it's a good idea to review the layout, and consider adjustments in the positioning of the floats in the input to improve the appearance. for example, if a float is referred to at the beginning of a paragraph, and there would be room at the top of the page to keep it on the same page, but the lengths of the paragraph and the float together push it to the next page, moving the float before that paragraph in the input could give a better result.

it's also worthwhile to consider whether the "float" really needs to float. small figures or tables that don't need captions or cross-references can simply be placed in line if there's sufficient space at that point on the page to incorporate them; \begin{center} ... \end{center} should usually provide enough "air" around them to look reasonable. adjustments in text input may be desirable in such a case, including explicit breaking of a line in the middle of a sentence to allow this material to appear in the middle of a paragraph; use \newline, not \\, to maintain an even right margin, and \noindent to continue the interrupted text.

-

Place float code in order, immediately after the paragraph where the main reference is(e.g via \ref or similar).

When the final version of the document is made, adjustments to the placements specifiers can be made, to make the floats appear according to special wishes or layout rules given by the publisher or other authorities. -see Mico's answer and many other excellent guides elsewhere.

In the final version, float placement in the source can also be changed e.g. moving the floats to the beginning of the paragraph can sometimes produce better results.

-
I intend to accept my own answer - please comment. - and up-vote lots of Mico's and barbara beeton's stuff. –  Hans-Peter E. Kristiansen Jan 5 '12 at 21:14
Hans-Peter, maybe I'm missing something, but why don't you accept Mico's excellent and elaborate answer, but rephrase it (as far as I see) to accept your own one? –  Martin Jan 5 '12 at 21:57
@Martin: Because either there is something I do not understand, or Mico's answer is mainly about the placements in the output, and not the input. –  Hans-Peter E. Kristiansen Jan 6 '12 at 13:26
well, I think you can not ignore the output, because that's, what its finally all about, isn't it? So as I understood Mico's post (and as I would handle it) firstly place all floats in the source directly after the paragraph where they are first mentioned. Once you have a final version of the document, as Barbara Beeton correctly noted, if you want an excellent output, you'll have to check the position of each float in the output file according to its reference in the text and in case it is too far away from the reference, move its source code up or modify placement options htbp –  Martin Jan 6 '12 at 14:04
The difference is that in Mico's answer, the first try placement is 'close to its first call-out' and in my answer it is 'immediately after the paragraph'. So Mico is not answering the original question - but I will accept the answer with most votes(Mico's). –  Hans-Peter E. Kristiansen Jan 6 '12 at 14:37