# Completely remove chapter text and vertical space

I have this strange requirement that chapter titles shall only appear in the \tableofcontents and page headings, but not in the document body.

I have been successful in removing the number by using:

\renewcommand*{\chapterformat}{}%


And the text doesn't appear if I use:

\chapter[Test]{}


But I can't get rid of the vertical space. I played around with the things suggested here, but none of those remove all of the space.

If I do \renewcommand{\chapterheadstartvskip}{\vspace*{-25pt}}, that actually does remove all space, but only as long as I don't modify the 10pt option passed to scrbook. (It also seems to be font-dependant, because I need to use a truetype font I can't post here that I import using fontspec, and for that font, -29.3pt is the measure to use at 10pt size).

So, is there any 'portable' way to make page 2 of the document look like page 1? Would it possibly be easier to redefine \chapter, or to use {book} and {titlesec} (as I believe titlesec and the koma-classes don't get along very well)? The project is still at a very early stage, so I could still make any of these changes without breaking anything.

MWE:

\documentclass[10pt,a4paper,oneside]{scrbook}
\usepackage[showframe]{geometry}
\usepackage{lmodern}
% remove chapter number
\renewcommand*{\chapterformat}{}%
% removes some vertical space, but not all:
\RedeclareSectionCommand[beforeskip=0pt,afterskip=0pt]{chapter}
% works for 10pt only
\parindent0pt
\begin{document}
Test
\newpage
\chapter[Test]{}
Test
\end{document}


Output:

Instead of trying to remove features of \chapter that you don't want, I would go for defining a new macro (say \mychapter) that includes only the features you want. Let's define it including

• a pagebreak,
• an increase of the chapter counter,
• an entry for the headline,

but you can of course extend this the way you need it. Assuming that you want the title of the table of contents to behave the same way, we can borrow from this answer and get:

\documentclass[10pt,a4paper,oneside]{scrbook}
\usepackage[showframe]{geometry}
\usepackage{lmodern}
\parindent0pt

\newcommand{\mychapter}[1]{%
\clearpage%
\refstepcounter{chapter}%
\chaptermark{#1}%
}

\makeatletter
\renewcommand\tableofcontents{%
\@mkboth{\contentsname}{\contentsname}%
\@starttoc{toc}%
}
\makeatother

\begin{document}

\tableofcontents

\mychapter{Test}
Test
\mychapter{Another test}
More text

\end{document}


• But the table of contents is a chapter as well? – Johannes_B Aug 27 '17 at 11:46
• That's right. Give me a minute to update my answer. – Tiuri Aug 27 '17 at 11:48
• Thanks a lot, this is almost exactly it. Seems so easy now ... – takrl Aug 27 '17 at 12:52

Here is another suggestion redefining the KOMA-Script command \chapterlinesformat:

\documentclass[10pt,a4paper,oneside]{scrbook}
\usepackage[showframe]{geometry}
\usepackage{lmodern}
\setlength\parindent{0pt}% really no parindent and no parskip?

\renewcommand\chapterlinesformat[3]{}

\cleardoublepage
%\addchaptertocentry{}{\contentsname}% if there should be a TOC entry for TOC
}

\begin{document}
\tableofcontents
\chapter{Test}
Test
\chapter{Another Test}
More text
Text
\end{document}


For a twosided document you have to ensure that \rightmark is used for the page header:

\documentclass[10pt,a4paper,twoside]{scrbook}
\usepackage[showframe]{geometry}
\usepackage{lmodern}
\setlength\parindent{0pt}% really no parindent and no parskip?

\renewcommand\chapterlinesformat[3]{}

\cleardoublepage
%\addchaptertocentry{}{\contentsname}% if there should be a TOC entry for TOC
}

\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\cfoot*{\pagemark}

\begin{document}
\tableofcontents
\chapter{Test}
Test
\chapter{Another Test}
More text
Text
\end{document}


And if it should work with option chapterprefix too then you have to add the line

\renewcommand\chapterlineswithprefixformat[3]{}

• Thanks, that is pretty much what I tried to do. I hadn't come across \chapterlinesformat when searching the koma docs though. – takrl Aug 28 '17 at 15:36