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'm having some issues dealing with figures. It happens that when I have a page with some text and then it comes a figure, with H property, who doesn't fits into the same page as the text, the text itself gets spreaded in that page. here.

Is there a way I can remove theses spaces? What I'd like is that the end of the page would be left blank (even though some people may not think it is the best thing to do). Here is the image with what I would love to have as the output.

Is there any way I can do this?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The \raggedbottom declaration makes all pages the height of the text on that page; No extra vertical space is added. Add that to your document preamble and I believe you'll get the behavior you're looking for.

share|improve this answer
    
It worked! Thanks for the help! –  Francisco Sokol May 16 '12 at 15:33
    
The problem is that this produces the ragged behavior on all pages which is often not desired. –  Frank Mittelbach May 19 '12 at 12:17
add comment

I assume you are using a book type of document class because they normally set \flushbottom as the default, which gives you the behavior you are experiencing. So a trivial solution is, of course, to change that setting to \raggedbottom in the preamble of your document (or the class if this is a private class). However, the downside of this approach is that then all pages will show a ragged behavior which, for a book or manual is normally not desired.

As an alternative you can just make the offending pages come out short by using a command like \maybeflushthispage in front of all the places where you may have to break a page short (i.,e., in your case the in front of all figures of type [H]).

\documentclass{book}

\usepackage{lipsum,float}

\setlength\textheight{26\baselineskip}

\newcommand\maybeflushthispage{\vfil\penalty1000\vfilneg}

\begin{document}

\lipsum[1-2]

\maybeflushthispage
\begin{figure}[H] \rule{5pt}{4cm} \end{figure}

One line here \ldots

\maybeflushthispage
\begin{figure}[H] \rule{5pt}{4cm} \end{figure}

\lipsum[1]

\end{document}

If you run this then \maybeflushthispage will flush the page if a break is taken (first page) but will do nothing otherwise (second page):

enter image description here

share|improve this answer
    
Loved \maybeflushthispage. i^4 –  Brent.Longborough May 16 '12 at 16:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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