How to control float element to achieve compact output?

You may say the second question is duplicated. There are so many discussions about how to control the position of float. But they don't meet my needs. I want to reduce the blank area whilst float element should be surrounded with text. That is said, it can't place on the top or the bottom. I want to place it on the center of body. But I don't care it floats before or after text.

-

So, just to make sure that I understood your request correctly: you want to place floats in the middle of a page, but not on top, not on the bottom, and not on a separate page?

In that case, you may have bad luck (but perhaps someone proves me wrong). I believe that TeX only supports "top of page", "bottom of page", and "separate page containing only floats". And, of, course "here" where "here" refers to the line of code where you entered the float (which, however, is NOT the center of the page in general).

I would say that the closest answer to your request is to use

\usepackage{float}
...
\begin{figure}[H]


which will place the figure at EXACTLY the position where you entered it in your source code. It may also work without the float package and the \begin{figure}[h] modifier (but that might have its own sense of right and wrong).

In addition, you may want to adjust the space between text and figure.

The following variables control the vertical spacing with figures

\floatsep separation between floats on a page with text \intextsep separation between floats and the text

plus the hidden parameters for float pages:

\@fptop space at top of float page \@fpbot space at bottom of float page \@fpsep space between floats on a float page

The vertical space between a graphic and the caption below it is \abovecaptionskip (10pt default) and the vertical space below a caption is \belowcaptionskip (0pt).

[END OF QUOTE].

That page also contains more details on how to configure the number of floats on top/bottom of a page or how much text should be present on a separate float page.

You may also want to consider http://people.cs.uu.nl/piet/floats/node1.html for details.

-
yes, That is what I need – pythonee Oct 12 '11 at 18:15
I'm glad the answer is useful. If you believe that it answers your question, you can mark it as "answered" to close the thread. – Christian Feuersänger Oct 15 '11 at 8:11

To reduce the vertical spacing above and below a float that's somewhere in the middle of a page, i.e., that has text both above and below it, you could change the value of the \intextsep macro to, say,

\setlength\intextsep{1.25\baselineskip plus 2pt minus 4pt}


The \intextsep macro is what's known in TeX jargon as a "rubber length", i.e., it has some stretchabilty and some squeezability. (Making sure that this length isn't rigid is very helfpul for LaTeX when it comes time to build the page as a whole.)

A separate matter: In your in-text floats, do you maybe use \begin{center} ... \end{center} to center the contents? If so, try replacing these instructions with a single \centering command (where the \begin{center} command was before), and you'll be amazed by how much vertical space you'll recover.

-