5

At https://gist.github.com/8210807 I've gisted the TeXShop Console messages for three runs of the same .tex file along with that file. Now when I typeset that .tex, a strange blank page is created just before \chapter{\lez{13/12/2013}}. How do I get rid of that? And why on Earth does that happen?

\documentclass[a4paper]{report}
\usepackage{graphicx}
\newcommand{\hsp}{\hspace}

\begin{document}
\chapter{mapu}
mumau

\chapter{gungu}
\includegraphics[width=11.5cm]{Felli_1.jpg}
\end{document}  

shows this behaviour and the picture is:

enter image description here

Sean Allred
  • 27,421
MickG
  • 5,426
  • It would be more helpful if you created a minimal working example (MWE) demonstrating the behaviour, it is a lot easier than scanning through thousands of lines of log file. – Torbjørn T. Jan 01 '14 at 14:30
  • Unrelated comment: Don't use $$ ... $$, see Why is \[ … \] preferable to $$? – Torbjørn T. Jan 01 '14 at 14:31
  • 3
    Your TeX code is terrible. Really. Why one would define \6 instead of using ' is beyond my understanding. You have tens of commands and you'll remember none of them after a few days without using them. In any case, it's impossible to say something sensible examining a 10000 line file. – egreg Jan 01 '14 at 15:13
  • 1
    Thx for the compliment! The reason \6 is that it was formerly '\hsp{0.0001cm}, thus defined to avoid interpretation of things as shorthands when they were not. Only that gave problems with line breaks. I kept it for a long time, up till I had problems with ' in theorem names and I finally decided to drop the shorthands, which indeed I didn't remember. As for the "tens of commands", this is the old preamble which I need to use as it is to avoid problems with a file that was written with it and may use those commands. Many indeed I did not use, and I will remove as soon as I change file. – MickG Jan 01 '14 at 16:15

2 Answers2

7

I can reproduce your problem if the figure is too high to fit in the remaining part of the page after the chapter title. There's nothing you can do about it other than reducing the figure height or letting it float.

Here's an explanation.

After a chapter title, LaTeX disallows a page break. Then it builds the following paragraph, which happens to consist only of a very big object, the picture, which, together with the chapter title, fills the page. Therefore it looks for a feasible page break points and finds the vertical space before the chapter title, so it ejects an empty page and pushes the material to the following page. Now it finds the same items as before, but with no vertical space before the chapter title, that has disappeared at the page break. Hence its only possibility is ejecting an overfull page.

egreg
  • 1,121,712
1

It is a normal behavior, since you are using report class. report and book, unlike article, give you the ability to print your file two sided. A feature is implemented and in enabled in default, so that every chapter begins on the same side.

You can change this behavior by passing openany class option to report:

\documentclass[openany,onesided]{report}

This way, no blank page is inserted before chapters start.

Hasan Zakeri
  • 1,942
  • If you look at the end of the gist he linked to (line 5819) he has \documentclass[a4paper]{report}. report has oneside,openany as default, so one shouldn't have to specify those. – Torbjørn T. Jan 01 '14 at 14:34
  • With what criterion does he decide where to put those blank pages? It doesn't depend on the page counter because if I extend the last non-blank page before it to get to the following page, the blank stays there. It's not a default because none of the other chapters have it. I think it might be the pictures' fault because removing those three \includegraphics right at the start of the following chapter solves the problem. Btw the first picture's bottom overlaps with the page number. And no, [openany,onesided] doesn't solve the problem. And if I make the picture smaller, the blank vanishes. – MickG Jan 01 '14 at 15:48
  • e.g. with [width=1cm] it goes away. It shows up ad 10.354cm but not at 10.353cm. – MickG Jan 01 '14 at 15:51
  • @TorbjørnT. I formerly had no idea what could cause the behaviour so I couldn't make an MWE. Now I'll add it. And one of the 4 pictures. As for \[…\], the problem is I've redefined those commands. Once I change my preamble for the next semester, I'll keep that in mind. Though I've made $$ very automatic in taking notes, so it might be troublesome to change that habit. – MickG Jan 01 '14 at 15:53
  • It seems that any picture with a width such that the bottom goes too close to the page number does this trick. – MickG Jan 01 '14 at 15:58
  • @MickG That's part of the point of making an MWE -- figuring out where the problem lies. As I said in my comment, report has oneside as default, so adding it doesn't make a difference. On the other hand, if you had twoside,openright then all chapters starts on an odd page, which can cause blank pages just before the chapter. – Torbjørn T. Jan 01 '14 at 16:05
  • OK got that. Now the MWE is there. – MickG Jan 01 '14 at 16:16
  • What do you mean by "letting it float"? – MickG Jan 01 '14 at 19:34
  • @MickG \begin{figure}\includegraphics{imagefilename}\end{figure} – Torbjørn T. Jan 01 '14 at 19:40