I've created chapter containing only images with caption. All images shall have fixed width (\textwidth), height is always unknown (image shall be correctly scaled).

From second image everything works fine, but first image has damaged page break, see the screenshot:

enter image description here

Current behaviour: chapter title is broken to next page, image itself is displayed to the same page although it doesn't fit.

Expected behaviour: chapter title stays on the first page, image is displayed to next page if it doesn't fit the previous.

Interesting is that for further images it works - if image doesn't fit, it's rendered correctly to following page.

I've tried to fix it using additional ~\newline before first image, but it still provides wrong result:

enter image description here

Full code:




\def\do#1{\appto\UrlSpecials{\do#1{\mathchar`#1 \mskip 0mu plus 1mu\penalty100\relax}}}







Question is simple: how to display first image in chapter correctly? Solution shall be universal - for tall images which don't fit to page together with chapter title and for wide images which fit to the same page (so forcing page break doesn't help, height of images is unknown).

  • 1
    the whole reason that figures are normally floating environments is to help with page breaking, but you have use [H] so disabled that mechanism and not allowed latex to adjust the figure positions. – David Carlisle Jan 1 at 21:26
  • 1
    all warnings about bad page breaks go if you change every [H] to [htp] – David Carlisle Jan 1 at 21:27
  • @David Carlisle: it looks better with [htp], but new issue has arised: images are vertically centered. How to draw them from the top of page? – Joseph Jan 1 at 21:40
  • 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.