# sectsty interferes with documentclass scrreprt Chapter Titles!

I've created a minimal example that visualizes the problem:

\documentclass[chapterprefix = true]{scrreprt}

\usepackage{sectsty}

\begin{document}
\chapter{Hello world!}
\end{document}


As you'll see, the chapter title is displayed something like this:

Chapter 1Hello world!

Only when the sectsty package is commented out, the chapter title is displayed correctly:

Chapter 1

Hello world!

Is there an easy fix to this?

Updated minimal example, to test a possible solution without using sectsty:

\documentclass[chapterprefix = true]{scrreprt}
\usepackage{xcolor}

\begin{document}
\tableofcontents

\chapter{Hello world!}
\end{document}

• sectsty is for standard document classes. It is incompatible with the advanced KOMA-script interface. – Johannes_B Jun 18 '18 at 6:33
• Would it be an option not to use sectsty when you use a KOMA class? sectsty is from 1999 and the documentation notes that for simple tasks KOMA has its own interfaces that are probably easier to use it goes on to say that there might be uses for secsty with KOMA classes. But that was almost twenty years ago and KOMA development has progressed a lot over since then, so it is not impossible that something broke sectsty. Especially since KOMA has many customisation features on its own. What do you use sectsty for? – moewe Jun 18 '18 at 6:36
• Oh, that's good to know. I'm only using sectsty to change the color of the chapter and section titles, through: \chapterfont{\color{chaptercolor}}, so I think there should be a way to do this without sectsty. 🤔 – Michael Jun 18 '18 at 6:51
• \addtokomafont{disposition}{\color{red!20}} – Johannes_B Jun 18 '18 at 6:55
• \addtokomafont{chapter}{\color{red!20}}? – moewe Jun 18 '18 at 7:16

If it all possible I would avoid using sectsty together with KOMA classes. sectsty was written in 1999 and the KOMA classes have received multiple updates over the last twenty years or so. It is not surprising that some features of sectsty would interfere with KOMA given that it was mainly written for the standard classes. The KOMA classes have extensive options to change the output of sectioning commands so that sectsty should not be needed in most cases.

In this case it turns out that

\addtokomafont{disposition}{\color{red!20}}


before the beginning of the body text/main matter gives the desired result.

As mentioned by @esdd in the comments it might be slightly nicer to say

\addtokomafont{disposition}{\color{red!20}}

in the preamble to colour all sectioning elements but exempt the TOC and other "list of ..."s controlled by KOMA's tocbasic.
• This can also be done in the preamble if \BeforeTOCHead{\addtokomafont{disposition}{\normalcolor}} is added. Then disposition uses \normalcolor in TOC, LOF, LOT and other lists under the control of package tocbasic. – esdd Jun 18 '18 at 8:03