# Remove blank space before chapter heading on top of new page

I want chapters in the report class to start 3em below the end of the previous chapter. To do this, I patch the \chapter command using titlesec and etoolbox. However, this adds blank space above the chapter name even if is on the top of a new page, which I don't want. How can I remove the spacing if the chapter starts at the top of a new page? I want the Sixth chapter heading like in the right hand side figure below, not the one at the left.

\documentclass[12pt,a4paper]{report}

\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}%
{\par\vspace{\baselineskip}}{}{}
\makeatother
\titlespacing*{\chapter}{0mm}{3em}{1em}

\begin{document}

\chapter*{First chapter}
\lipsum[1-4]
\chapter*{Second chapter}
\lipsum[1-2]
\chapter*{Third chapter}
\lipsum[2]
\chapter*{Fourth chapter}
\lipsum[1-3]
\chapter*{Fifth chapter}
\lipsum[2]
\chapter*{Sixth chapter}
\lipsum[1-2]

\end{document}

• welcome to tex.sx. the command \@makechapterhead contains the spacing command  \vspace*{50\p@}. to make this space not persist at the top of a page, patch \@makechapterhead to remove the * from the \vspace. – barbara beeton Mar 16 '18 at 17:15
• – Werner Mar 16 '18 at 17:20

titlesec inserts the "traditional" forced vertical space as part of setting the chapter title header. You need to also change this \vspace* to \vspace so the space is gobbled at the start of a page:

\documentclass[a4paper]{report}

\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}%
\titlespacing*{\chapter}{0mm}{3em}{1em}
\patchcmd{\ttl@save@mkschap}{*}{}{}{}
\makeatother

\begin{document}

\chapter*{First chapter}
\lipsum[1-4]
\chapter*{Second chapter}
\lipsum[1-2]
\chapter*{Third chapter}
\lipsum[2]
\chapter*{Fourth chapter}
\lipsum[1-3]
\chapter*{Fifth chapter}
\lipsum[2]
\chapter*{Sixth chapter}
\lipsum[1-2]

\end{document}

• This worked in the MWE, but I encountered new spacing problems once I started messing with titleformat. Bernard's solution works even in that case, though. – Solstrand Mar 17 '18 at 5:06

You don't need to patch whatever. Just change the class of \chapter to straight:

\documentclass[12pt,a4paper]{report}

\usepackage[showframe]{geometry}
\usepackage{lipsum}
\usepackage{titlesec}

\titleclass{\chapter}{straight}
\titleformat{\chapter}{\bfseries\huge}{\thechapter}{0.4em}{}
\titlespacing*{\chapter}{0mm}{3em}{1em}

\begin{document}

\chapter*{First chapter}
\lipsum[1-4]
\chapter*{Second chapter}
\lipsum[1-2]
\chapter*{Third chapter}
\lipsum[2]
\chapter*{Fourth chapter}
\lipsum[1-3]
\chapter*{Fifth chapter}
\lipsum[2]
\chapter*{Sixth chapter}
\lipsum[1-2]

\end{document}


• This worked a treat. So, I assume the straightremoves all the formatting? – Solstrand Mar 17 '18 at 5:07
• @Solstrand: In principle it only changes the fact that \chapter doesn't start a new page: it behaves like \section. However, I had an error message for some reason, which disappears using \titleformat, which I made roughly like the default. Strangely enough, doing the same for \part produces no error message. – Bernard Mar 17 '18 at 9:20