TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a chapter with pictures only, but keep running into troubles. The chapter is an appendix, where only some graphics should be displayed, placed in different sections. I don't need text in the secitons, just the pictures.

After trying many things, I can't figure out, how to do it right. No matter whether I use bare \includegraphics or floats, Latex seems to randomly put the pictures on the pages, sometimes more, sometimes fewer. In most cases it breaks the pages before a new section, but sometimes it squeezes the next sections title onto the last page.

It seems that using floats with the [H] options does almost what i want, except that the first page of each section is left blank and the pictures start on the next one. Also it breaks before each section.

Any advice is highly appreciated!

share|improve this question
if there's no text, and you care about the order of the pictures, don't try to use floats. try using \raggedbottom for your first pass. you may have to resort to manual page breaks to avoid breaks after section headings. – barbara beeton Jun 17 '12 at 14:43
Do you need captions to the graphics? – egreg Jun 17 '12 at 14:45
Thanks for the comments. @barbarabeeton I now use \raggedbottom, \nopagebreaks and \linebreaks without floats, but it still is a little weird that it would rather leave almost an entire page blank after the first section instead of shifting the next section onto it (\nopagebreak didn't work there). @egreg No, I don't need captions, just the images. – ritschwumm Jun 17 '12 at 17:01
consider the possibility that the section heading plus graphic won't fit. to check this, after the graphic that leaves the page very short, insert an \hrule and then \newpage. insert another \hrule after tee next section heading plus graphic. you can then measure from the top of the sectino heading to the rule, and add whatever is the default space above a section heading. this is how much space latex thinks it needs. place the first page on top of a "full" page (a page processed without \raggedbottom) and see how much space is available. it should be less than what's needed. – barbara beeton Jun 17 '12 at 18:35
@ritschwumm Something more is needed about your images; should they be one after another or placed in rows? – egreg Jun 17 '12 at 20:32

From the description, your first float/graphic after the section must be simply too large to fit together with the section onto the page. That explains why with [H] you end up with a page containing only the section title. The [H] means do the float 100% "here and if it doesn't fit then move it to the next page (and everything following it with it). So it doesn't behave like a float but sticks to the sequencial order of the text.

The reason that with real floats you get fairly empty pages, is that LaTeX will (most likely) generate a number of float pages and those are allowed to be fairly empty by default. See the discussion of the float algorithm here.

Now to really see what TeX does under its bonnet, try a little tracing:


\tracingonline1  % show tracing on the terminal
\tracingpages1   % show what the page breaker does



\pagebreak[1] % allow a break here for testing
\parbox{6cm}{Picture too high\rule{1pt}{.98\textheight}}

\parbox{6cm}{Picture ok\rule{1pt}{.5\textheight}}


If you run the above then you will get the following tracing output:

%% goal height=550.0, max depth=5.0
% t=0.0 g=550.0 b=10000 p=0 c=100000#
% t=19.90276 plus 0.86108 g=550.0 b=10000 p=-51 c=100000#
% t=556.84485 plus 1.86108 g=550.0 b=* p=0 c=*
%% goal height=550.0, max depth=5.0
% t=535.9421 g=550.0 b=10000 p=0 c=100000#
% t=811.9421 plus 1.0 g=550.0 b=* p=0 c=*
%% goal height=550.0, max depth=5.0
% t=270.0 g=550.0 b=10000 p=0 c=100000#
% t=275.0 plus 1.0fil g=550.0 b=0 p=-10000 c=-10000#
%% goal height=550.0, max depth=5.0
% t=0.0 g=550.0 b=10000 p=0 c=100000#
% t=10.0 g=550.0 b=10000 p=-10001 c=-10001#
%% goal height=550.0, max depth=5.0
% t=0.0 g=550.0 b=10000 p=0 c=100000#
% t=10.0 g=550.0 b=10000 p=0 c=100000#
% t=10.0 plus 1.0fill g=550.0 b=0 p=-1073741824 c=-1073741824#

It is not really difficult to read once you understand the basics:

%% goal height=550.0, max depth=5.0
% t=0.0 g=550.0 b=10000 p=0 c=100000#

LaTeX is trying to make a page with a goal height of 550pt. The second line means that so fare the target size (t=...) is 0pt (we are at the top of the page) the goal (g=...) is still 550 (surprise :-) and it has found a breakpoint with penalty (p=..) and if it would break there the badness (b=...) would be 10000 in other words awful. The cost (c=...) to use this breakpoint is also given (how it is calculated we can ignore here) and a # at the end means that so far this is the best break point seen and will be used if nothing better comes along.

Now we will get for each breakpoint on the page such a line with a single % in front.

% t=19.90276 plus 0.86108 g=550.0 b=10000 p=-51 c=100000#

So this line was due to the \pagebreak[1] command which is using a penalty of -51. The target point is now 19.9pts down the page, ie we are after our heading. You can also see that t= now includes a "plus" component, depending on the material on the page you might also see "minus" showing up, in that case TeX would be able to squeeze things a bit. The result is still awful, but TeX also marked the line with # i.e., it will use this breakpoint if nothing better comes along.

% t=556.84485 plus 1.86108 g=550.0 b=* p=0 c=*

This line now shows a huge increase in t= which is our first \parbox. And now you see that t exeeds g and since there is no minus component the page is overfull. As a result TeX marked the badness and the cost with * meaning "impossible" and now goes backwards to find the best breakpoint seen and that is our break in the trace line before. Thus the box moves to the next page.

%% goal height=550.0, max depth=5.0
% t=535.9421 g=550.0 b=10000 p=0 c=100000#
% t=811.9421 plus 1.0 g=550.0 b=* p=0 c=*

Here we see it again: the first % t= line shows the breakpoint after the first "picture" and as you can see, TeX thinks this is ugly still (15 points of free room) so it tries to add the second parbox and the break after the second one is what we see as the second line. But this is now way to much so ...


If you add those tracing commands to your document you can see what TeX was trying to do and how it decided on one point or the other. And that should give you and idea if your graphics isn't too large after all (and 1pt too large is too large)

Using \enlargethispage as suggested could help you to avoid problems in certain situations and squeeze things onto a page even if thy do not quite fit.

share|improve this answer
Thank you for this comprehensive breakdown of \tracingpages, @FrankMittelbach - exactly what I was looking for :) Just one question: code uses a \pagebreak[1] - while explanation refers to \linebreak[1]; is it possibly a typo? Thanks again - cheers! – sdaau Jun 24 '12 at 19:49
yes, that was a typo in the text. corrected. If the answered helped you to understand your issue, perhaps you can checkmark it. – Frank Mittelbach Jun 24 '12 at 22:10
Thanks for the correction @FrankMittelbach - already upvoted; but it's not my question, so I don't think I can accept it - although if I could,b I would: I too wish it was accepted, it's a great answer :) Thanks again - cheers! – sdaau Jun 25 '12 at 1:05

Your Answer


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.