3

When trying to add a big image directly below a chapter title, the image together with the title are drawn to the following, an even page. This way, the first page is empty. However, I want to start each chapter on an odd page and prevent the occurrence of an empty page.

How can the title together with the (too) big figure be forced to be drawn on the first page? The question targets figures as the most simple occurrence of floats, but I am in particular interested in other floats directly below the title, e.g. sidewaystables (How to fix issues after rotating a table with sidewaystable directly below the Chapter title?). I opened up a new question, as the problem is more general than I initially expected it to be.

A minimal example is attached:

\documentclass[openright,
    liststotoc,
    ]{scrbook}[2007/12/24]

\usepackage{graphicx}

\begin{document}

\chapter{Big Pic Chapter}

    \includegraphics{big_pic}

\end{document}
1n7er33ANT
  • 71
  • 1
  • 4
  • Do you really want to use a KOMA version from 2007? –  Sep 08 '14 at 10:15
  • You could reduce the spacing after a chapter title, but it's better to scale the image instead ;-) –  Sep 08 '14 at 10:16
  • Well no, it is not specific for an image. And it indeed can be forced to fit together with the title on one page. But I am wondering, why both are shifted to the following page at the same time. – 1n7er33ANT Sep 08 '14 at 10:39
  • No page break is possible between the chapter title and the paragraph (and your picture does make a paragraph). After having seen the picture, TeX decides there's too much text on the page, so it wants to do a page break; the only feasible place it finds is before the chapter title, so it moves everything to the next page and ships out an empty (underfull) page and an overfull one after it. – egreg Sep 08 '14 at 13:34

2 Answers2

3

Page breaking happens in an asynchronous way. TeX typesets entire paragraphs and places them in the “recent contributions list” and computes how much space has been occupied on the page it's on. When typesetting a paragraph overflows the available space, TeX moves the recent contributions to the main vertical list and calls the page builder into action.

Roughly speaking, the page builder examines the main vertical list and finds the best feasible page break point that doesn't overflow the available space on a page; then it uses it for breaking, calls the output routine into action, removes the completed page from the main vertical list and puts what remains back into the recent contributions list, resuming typesetting from the next paragraph.

The process is actually more complex, due to floats and footnotes, but this is the general principle.

In your case, there is no feasible page break between the lines of the chapter title, nor between the title and the text that follows it (similar to what happens with section titles that are never separated from the first two lines of the text that follows). So, when the paragraph made up by the big picture (TeX knows anything else, so the picture does form a paragraph), TeX realizes that it has more text than fills a page, so it calls the page builder.

The only feasible break point it finds is, however, only before the chapter title (a penalty, to be precise). So an underfull empty page is shipped out (the output routine appends the page number) and the material is placed back in the recent contributions list. Now there's no feasible page break (because the penalty before the chapter title has already been used and discarded) until after the big picture, so that one is used and an overfull page is shipped out as there's nothing else to do.

egreg
  • 1,121,712
  • Thank you for the explanation @egreg. However, I still miss a way to force the content on the first page. Unfortunately, a \nopagebreak placed above the chapter title did not help. – 1n7er33ANT Sep 08 '14 at 15:55
  • @1n7er33ANT \enlargethispage{<dimen>} between the \chapter{...} and \noindent\includegraphics{...}. But the best is, of course, scaling the picture so that it fits. Here <dimen> should be changed into some length, say 2cm – egreg Sep 08 '14 at 15:56
  • Thx @egreg, that was helpful! – 1n7er33ANT Sep 08 '14 at 19:28
0

Answer has already appeared. Slightly modified Code;

\documentclass[openright,
    liststotoc,
    ]{scrbook}[2007/12/24]

\usepackage{graphicx}
\usepackage[no-math]{fontspec}
\usepackage{xunicode,xcolor} 
\usepackage{hyperref,titlesec,scalefnt}

\titleformat{\chapter}[display]%
    {\relax\huge\color{blue}}%
    {\Huge\raggedleft{\textcolor{blue!25}{\scalefont{5}\includegraphics[width=0.30\textwidth]{albt}\thechapter}}}{-50pt}{}
\titlespacing{\chapter}{0pt}{\baselineskip}{\baselineskip}

\begin{document}

\chapter{Big Pic Chapter}

\appendix
\chapter{Big Pic Chapter}   

\end{document}

chappic1

chappic2

egreg
  • 1,121,712
murugan
  • 1,669