29

I am using LaTeX to write my dissertation, and I have realised that on the table of contents and on every chapter page, LaTeX leaves a lot of empty space.

What I mean is that lets say in the page where chapter 1 begins, from the top of the page until the chapter title there is much more vertical space than on any other page. The same goes with chapter 2 etc... and for contents page as well.

Can anybody help me to remove that space? Is there any mistake in my code or something like that? Is this a default of LaTeX?

the preamble is

\documentclass[12pt,twoside]{report}
\pagestyle{plain}
\usepackage{a4paper}
\usepackage{setspace}
\doublespacing 
\usepackage{amssymb}
\usepackage{amsmath} 

I've tried the methods below, but none of them work properly.

migrated from stackoverflow.com Jan 4 '12 at 6:26

This question came from our site for professional and enthusiast programmers.

  • Please provide a minimal example. The spacing really depends on the document class and mabye related packages. – Marco Daniel Jan 4 '12 at 6:41
  • I want to add that this default behaviour of scrreprt is really strange. Usually you don't want so much whitespace before a chapter, at least if you have a limit of totally available space. – TomM Dec 26 '13 at 13:33
31

Werner answered the questions for the standard classes. If you use scrbook or scrreprt (KOMA-script) the space before and after the chapter title is given by \chapterheadstartvskip and \chapterheadendvskip. These "lengths" are not defined as lengths, but as commands instead. To change the settings you must use renewcommand:

\renewcommand*{\chapterheadstartvskip}{\vspace*{1cm}}
\renewcommand*{\chapterheadendvskip}{\vspace{2cm}}

With KOMA-script version 3.16, a new interface was introduced to change the appearance of sectioning commands, including chapters. You can now do something like this

\RedeclareSectionCommand[beforeskip=0pt,
afterskip=2cm]{chapter}
  • 2
    Thank you for answering. Incidentally, I also found a reply by Markus Kohm himself which leads to \renewcommand*{\chapterheadstartvskip}{\vspace*{-\topskip}}. – henry Jun 8 '13 at 7:55
  • @henry: Of course this is another possibility. \topskip has a length of 11pt. – Marco Daniel Jun 8 '13 at 10:21
18

The default style for LaTeX's book class is quite generous with the whitespace on the page -- there's probably nothing wrong with your code.

One way to change the behavior of headings is to use the titlesec package, which allows you finegrained control over how all the levels of headings are displayed. For example, the following code in the preamble of the document would remove the whitespace above the chapter heading:

\usepackage{titlesec}

\titleformat{\chapter}[display]
    {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}

In the last line, the four measurements are the left, upper and lower spacing around the heading, respectively. The second one is normally 50pt; it was changed here to 0pt to remove the white space above the chapter heading completely.

  • This does nothing in my tex document. Has anything changed? – Ivan Perez Sep 16 '18 at 18:28
17

This is the default behaviour of for \chapter (and \chapter*) in both book and report document class, so you're doing nothing wrong. This default length is 50pt.

You could use the etoolbox package to remove (or modify) the spacing above the chapter headings. Here's a minimal example that will work with either book or report document class:

enter image description here

\documentclass{book}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
\makeatother
\begin{document}
\chapter{A chapter}
\chapter*{Another chapter}
\end{document}

\patchcmd searches for \vspace*{50\p@} in both \@makechapterhead and \@makeschapterhead and replaces it with nothing, thereby removing the space. If you want to add a little space, you can insert something different as the replacement text. For example

\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{\vspace*{20pt}}{}{}%
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{\vspace*{20pt}}{}{}%

will insert 20pt instead of the default 50pt.

showframe was added to show the frame of the text block and was merely used for illustrative purposes - you can remove this.


An alternative to this would be to use the titlesec package. However, in order to modify the \chapter spacing (via \titlespacing{\chapter}...), you are also required to modify the \chapter format (via \titleformat{\chapter}...). See the titlesec documentation for more information.

  • Thank you! After all these years, your solution keeps being useful for people like me! – mathreader Apr 21 '18 at 16:18
7

With the report class the space before a chapter title is 50pt. The easiest method for changing it is to patch the two relevant commands:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage{amssymb}
\usepackage{amsmath}

\usepackage{setspace}
\doublespacing 

%\pagestyle{plain} % default for report

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{50\p@}{0pt}{}{}
\patchcmd{\@makeschapterhead}{50\p@}{0pt}{}{}
\makeatother

<rest of the preamble>

\begin{document}

<the document>

\end{document}

You can play with the figures: instead of 0pt you can put any dimension you want.

Note that there's no a4paper package; to get page parameters suitable for ISO A4 paper you need to specify a4paper as an option to \documentclass.

  • This somehow does not work for me with the book class. I want the "Chapter 1" line to appear right at the top. What am I doing wrong? – Ivan Perez Sep 16 '18 at 18:35
  • @IvanPerez What document class are you using? – egreg Sep 16 '18 at 19:00
  • The document class book – Ivan Perez Sep 16 '18 at 19:08
  • @IvanPerez Change 0pt to something like -24pt (it depends on the main font size, though). – egreg Sep 16 '18 at 19:12
  • I changed it to -100pt, and it had no effect. It's like it's not using \@makechapterhead at all. I removed every import but this and left only one chapter to obtain a minimal example, and it still won't make a difference. I'm using Ubuntu 18.04, and installing latex from the default repositories. – Ivan Perez Sep 16 '18 at 19:26

Your Answer

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

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