15

I am using the KOMA script document class scrbook. Is there any way to make the chapter headings appear exactly at the top of the page body just by using KOMA (without using titlesec, fancyhdr, fncychap, ... for they would mess up other things in my documents)? Is there any way to change the space between section heading and the following text?

1
  • I'm not quite sure what you mean. Are we talking about the chapter titles in the document and that KOMA, like the standard class, adds a vertical space before the chapter or do you refer to the header where KOMa can print the current section/chapter one reads in. In case you mean the position of chapters, search for \chapterheadstartvskip
    – Martin H
    Feb 1, 2012 at 16:38

3 Answers 3

14

Update

Since KOMA-Script version 3.26 you can option afterindent=false to avoid the paragraph indentation of the first text line after the chapter title.

\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{showframe}
\RedeclareSectionCommand[
  beforeskip=0pt,
  afterindent=false% <- added
  ]{chapter}
\begin{document}
\chapter{foo}
\blindtext
\end{document}​

The result is the same as in the original answer below.

With afterindent=false or afterindent=true a negative value of beforeskip results in a negative skip above the chapter title (needs version 3.26 or newer).

Note: With KOMA-Script versions 3.22 - 3.25 you have to set beforeskip to a negative value to avoid the paragraph indentation in the first text line following the chapter title: beforeskip=-1sp. For more information see the documentation or Adjusting spacing around section/subsection titles with koma-script


Original answer

With KOMA-Script Version 3.15 or newer you can use \RedeclareSectionCommand or \RedeclareSectionCommands to change the space above or below the chapter title.

\RedeclareSectionCommand[beforeskip=0pt]{chapter}

enter image description here

Code:

\documentclass{scrbook}
\usepackage{blindtext}% dummy text
\usepackage{showframe}% to show the page layout
\RedeclareSectionCommand[beforeskip=0pt]{chapter}
\begin{document}
\chapter{foo}
\blindtext
\end{document}​
1
  • This was the easiest way ever.
    – user9424
    Sep 29, 2015 at 20:37
11

The following is probably what you're after:

enter image description here

\documentclass{scrreprt}
\usepackage{blindtext,showframe}
\renewcommand{\chapterheadstartvskip}{}
\begin{document}
\chapter{foo} \blindtext \blindtext
\end{document}​

Setting \chapterheadstartvskip to a no-op removes any vertical skip to set the chapter title on the first line.

showframe was loaded just to highlight the text block, while blindtext provided dummy text.

3
  • 2
    There was a change in KOMA-Script version 3.15: now you have to use \renewcommand{\chapterheadstartvskip}{}.
    – esdd
    Mar 8, 2015 at 0:30
  • 1
    @Werner, why is there still a little bit of space above the chapter heading, and how would you eliminate it completely?
    – AML
    Jun 7, 2018 at 18:54
  • 1
    @AML: It's most likely as a result of the baseline skip, which leaves room at the top of text so they don't protrude into the descenders of a row of text above it. The easiest would be to try using a small but negative value for the vertical skip; something like \renewcommand{\chapterheadstartvskip}{\vspace{-.2\baselineskip}}.
    – Werner
    Jun 7, 2018 at 19:39
1

I am facing exactly the same problem and I think that this is in fact a problem in KOMA chapter handling. Have a look at the following MWE:

\documentclass[
paper=a4,
twoside,
scrbook,
fontsize=11pt,
DIV=12,
headings=small,
usegeometry=true]{scrbook}
\usepackage[showframe=true]{geometry}

% I would expect that now chapter has no top vskip, just like section
\RedeclareSectionCommand[beforeskip=0pt]{chapter}
\renewcommand{\chapterheadstartvskip}{}%

\begin{document}
\cleardoubleevenpage
\section*{\usekomafont{chapter}The Section is Correct}
Baz bar.

\clearpage
\chapter*{The Chapter Still Has a Gap Above}
You can see some additional handling in the KOMA scrbook class:\\ 
\textbackslash{}renewcommand*\{\textbackslash{}scr@chapter@beforeskip\}{-2.8\textbackslash{}baselineskip-\textbackslash{}parskip\}\\%
However, I have no idea how to get rid of it and why it is there.
\end{document}

I would expect that the chapter* and section* now both have zero top vspace. If you have a look into scrbook.cls you will see that there is special handling using scr@chapter@beforeskip that is not present for the section commands.

Maybe Markus Kohm could clarify the purpose of this difference and give a hint how to overcome this issue. Here is a post that is somewhat related: Abstand zwischen Kapitelüberschrift und Kopfzeile

MWE that shows Difference between chapter* and section* with zero beforeskip

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .