[Tex/LaTex] How to switch of headsepline in KOMA Script for selfdefined pagestyle

header-footerkoma-script

I have a document where I want to have the headsepline on in general but switch it off for chapters. The following MWE works but the used option \setheadsepline{0ex} is deprecated.

\documentclass[a4paper,11pt,twoside]{scrbook}
\usepackage[manualmark,headsepline,footsepline]{scrlayer-scrpage}
\usepackage{blindtext}

\lehead{left even}
\cehead{center even}
\rehead{right even}

\lohead{left odd}
\cohead{center odd}
\rohead{right odd}

\newpairofpagestyles[scrheadings]{chapter}{%
\lehead*{}%
\cehead*{useless text}%
\cohead*{usefull text}%
\rohead*{}%
\setheadsepline{0ex}}

\renewcommand*\chapterpagestyle{chapter}

\begin{document}
\blinddocument
\end{document}

The log says:

Package scrlayer-scrpage Warning: Command deprecated!
(scrlayer-scrpage)                Usage of `\setheadtopline', `\setheadsepline',

(scrlayer-scrpage)                `\setfootsepline', and `\setfootbotline'
(scrlayer-scrpage)                became deprecated with scrlayer-scrpage.
(scrlayer-scrpage)                You should use KOMA-Script options
(scrlayer-scrpage)                `headsepline', `headtopline', `footsepline',
(scrlayer-scrpage)                or `footbotline' with values
(scrlayer-scrpage)                `<line thickness>:<line length>' to setup
(scrlayer-scrpage)                the line length and thickness, and
(scrlayer-scrpage)                `\setkomafont' or `\addtokomafont' to
(scrlayer-scrpage)                setup the colour on input line 23.

I also found hints in the documentation that I can use the option headsepline=false to switch it off for a pagestyle. But where do I pass that option?

Best Answer

You can use \KOMAoptions in the definition

\documentclass[a4paper,11pt,twoside]{scrbook}
\usepackage[manualmark,headsepline,footsepline]{scrlayer-scrpage}
\usepackage{blindtext}

\lehead{left even}
\cehead{center even}
\rehead{right even}

\lohead{left odd}
\cohead{center odd}
\rohead{right odd}

\newpairofpagestyles[scrheadings]{chapter}{%
\KOMAoptions{headsepline=false}%
\lehead*{}%
\cehead*{useless text}%
\cohead*{usefull text}%
\rohead*{}%
}

\renewcommand*\chapterpagestyle{chapter}

\begin{document}
\blinddocument
\end{document}

But I'm not sure if declaring a new paired pagestyle is the way to go. Why don't you redefine the plain style?