# Komascript - Section after pagebreak has the wrong color

The following MWE shows that the second section is black instead of red. Even if this happens only if there is no text between these two sections: Is this a bug?

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}

\begin{document}
...
\\[0.84\textheight]
\section{Test}
\section{Test}
\end{document}


• Just found out that the page break between sections will never happen if I use \textcolor instead of \color. Looks like \textcolor is more stable: tex.stackexchange.com/questions/86039/… Jun 11 '16 at 13:55
• \RedeclareSectionCommand[font=\large\bfseries\sffamily\color{red}]{section} Jun 11 '16 at 14:00
• I am saying that the above abviously works but has some downsides. You should report the behaviour to komascript.de Jun 11 '16 at 14:05
• @StefanBraun \color{red} is allowed in \addtokomafont, \setkomafont and as value for the font option in \RedeclareSectionCommand. AFAIK the problem will be solved in the next KOMA-Script version (3.21).
– esdd
Jun 12 '16 at 18:59
• @Johannes_B In your suggestion \large is used. Change it to \Large (default for sections in scrartcl) and you get the page break and the black color.
– esdd
Jun 12 '16 at 20:05

The bug is fixed in KOMA-Script Version 3.21 which is the current version on CTAN, in TeX Live 2016 and in MiKTeX.

\documentclass{scrartcl}[2016/06/14]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}

\begin{document}
...
\\[0.84\textheight]
\section{Test}
\section{Test}
\KOMAScriptVersion
\end{document}


results in

You should use \leavevmode before the color command. This will avoid that a page break can occur between the color and the title of the section.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{scrlayer-scrpage}