Where do I place floats in the source?
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 employingtabular*
andtabularx
environments rather than thetabular
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!
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.
Update
Perhaps I should explicitly mention that "between paragraphs" doesn't mean at the end of paragraphs, e.g.
...last sentence.
\begin{figure}
...
Instead always leave a blank line between the last sentence and the figure. Otherwise you might see some strange paragraph breaks if you are unlucky! The reason is the following: normally TeX removes white spaces at the end of the paragraph and then appends \parfillskip
. This is done because such a space is normally not intentional at this point. However if the figure directly follows the paragraph text then it is effectively not "between" paragraphs but at the very end of the paragraph (seen in horizontal mode). As a consequence any space after the last word in the paragraph is hidden from TeX's mechanism as there is this figure following it. Thus the space remains and if you are unlucky enough this extra space makes an otherwise perfectly fitting last line become overfull, so that TeX then generates another line for that pragraph.
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.