GeneralReducing space above chapter headings

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Reducing space above chapter headings

Post by dmt »

How do I reduce the amount of white space above chapter headings in the report class?

Also, how do I reduce the size of the font in the chapter headings?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Reducing space above chapter headings

Post by localghost »

Both issues can be solved using the titlesec package for standard classes. The classes from KOMA Script have some built-in features. Perhaps the memoir class offers similar solutions. A look at the related documentations will show you how to get along.


Best regards
Thorsten¹
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: Reducing space above chapter headings

Post by dmt »

I looked at the titlesec docs and found them quite confusing. I tried to implement some of the simple examples, but it didn't work. Does the "easy" method not work for chapters and only for sections?

----

I've looked again at the titlesec docs and they are very poorly written. It seems to be a simple thing I want to do, and I am having a lot of trouble figuring it out. There are a lot of options and it is very confusing on how to use them, and there are very few examples given.

Can someone please post an example of simply reducing the font size and the space above a chapter heading using titlesec? I would much appreciate the example.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Reducing space above chapter headings

Post by Juanjo »

If you look into report.cls, you will realize that the chapter titles are really done by the following piece of code:

Code: Select all

\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}

\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
The \@makechapterhead and \@makeschapterhead commands are called, respectively, by \chapter and \chapter*. It may hard to fully understand what those lines do. But, for your needs, you only have to know that vertical space is controlled by the \vpace and \vskip commands, whereas the font size is given by the \huge and \Huge commands. Copy the above code in the preamble, between \makeatletter and \makeatother, and change the corresponding commands at will. The \p@ command is just an internal shorthand of pt. Thus there are 50 pt of vertical space above the chapter title, 20 pt between "Chapter nn" and the real title, and 40 pt after it. That's all.

P.S: Of course, this is not a titlesec example, but a direct approach.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Reducing space above chapter headings

Post by Stefan Kottwitz »

Hi dmt,

you could just follow Juanjo's approach.

Even if the titlesec documentation seems to be complicated, reading 9.2. Standard Classes would really help. If you just include

Code: Select all

\usepackage{titlesec}
and you copy from 9.2. Standard Classes the commands:

Code: Select all

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{50pt}{40pt}
you will get the standard behavior of the report class. But now you can make changes in the parameters of the code above to get what you need. Change that \Huge to \Large perhaps, or change the 50pt to 0pt etc.
The same could be done with \section, \subsection etc. if you want. I believe those examples in 9.2. are an easy start.

Stefan
LaTeX.org admin
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: Reducing space above chapter headings

Post by dmt »

Thanks, that was really helpful
Post Reply