Theses, Books, Title pagesHow can you remove whitespace between header and toc?

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

How can you remove whitespace between header and toc?

Post by templateuser »

I am using the following packages to set up my chapter headings but there is still a major space below the chapter heading the the content in the table of contents.
Any way of removing it.

Code: Select all

\usepackage[Sonny]{fncychap}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
\makeatother

Recommended reading 2024:

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

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How can you remove whitespace between header and toc?

Post by Johannes_B »

Package fncychap redefines the appearance of chapter titles by redefining the internals, so much more stuff has to be dealt with when changing the appearance.

Code: Select all

\documentclass{report}
\usepackage[Sonny]{fncychap}
\usepackage{blindtext}
\usepackage{showframe}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter head
\patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{}{}{}% Removes space above \chapter* head
  \renewcommand{\DOCH}{%
    \raggedleft
    \CNV\FmN{\@chapapp}\space \CNoV\thechapter
    \par\nobreak
    \vskip 10\p@}
  \renewcommand{\DOTI}[1]{%
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
    \vskip 5\p@
    \CTV\FmTi{#1}\par\nobreak
    \mghrulefill{\RW}\par\nobreak
    \vskip 10\p@}
  \renewcommand{\DOTIS}[1]{%
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
    \vskip 5\p@
    \CTV\FmTi{#1}\par\nobreak
    \mghrulefill{\RW}\par\nobreak
    \vskip 10\p@}
\makeatother
\begin{document}
\chapter{Wallaby}
\blindtext
\chapter*{Wombat}
\blindtext
\end{document}
Changing this low level code should be done by experienced users only.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply