I would like to format only the first chapter heading in my document differently using KOMA script. I want to change both the font and the presence of the chapter prefix. As apparently KOMA does not offer any options to restore fonts or options, this answer suggests enclosing the corresponding \chapter command into a group for that purpose. That approach works fine, if I want to change the second chapter heading.
\documentclass{scrreprt}
\usepackage{blindtext}
\KOMAoption{parskip}{false}
\begin{document}
\chapter{This}
\blindtext
\section{Foo}
\blindtext
\section{Bar}
\blindtext
\begingroup
\KOMAoption{chapterprefix}{true}
\setkomafont{chapter}{\centering\large\rmfamily}
\chapter{That}
\endgroup
\blindtext
\section{Foo}
\blindtext
\section{Bar}
\blindtext
\end{document}
However, if I actually change the formatting of the first chapter heading, then things go wrong.
\documentclass{scrreprt}
\usepackage{blindtext}
\KOMAoption{parskip}{false}
\begin{document}
\begingroup
\KOMAoption{chapterprefix}{true}
\setkomafont{chapter}{\centering\large\rmfamily}
\chapter{This}
\endgroup
\blindtext
\section{Foo}
\blindtext
\section{Bar}
\blindtext
\chapter{That}
\blindtext
\section{Foo}
\blindtext
\section{Bar}
\blindtext
\end{document}
When I compile the latter document, then the spacing in the first paragraph is broken in two ways. Firstly, the first line is indentet, which it should not. Secondly, the vertical spacing to the first section is much smaller than it should.
It appears that \chapter is setting up some stuff the first time it appears in the document, but these things get lost at \endgroup. Unfortunately, I have no clue what it might set up. I would be happy for suggestions on how to proceed.


\KOMAoptioncommand. Your\defaultchapteralways setschapterprefixtofalse. So, if I ever decide to havechapterprefix=trueas document default, the first call of\defaultchapterwill break that setup for the rest of the document. My actual commands for the special chapter are much more complex and it's easy to lose track of what has been changed, so it would be great to also keep theKOMAoptionsetting local. Any idea, how to achieve that? – ranguwud Oct 23 '19 at 05:27\KOMAoptionin\defaultchapter. But maybe you should show what you really want to do for the first chapter title (in a new question). It could be better to declare an own sectioning command for this chapter. – esdd Oct 23 '19 at 07:37