6

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?

3
  • You are thinking too complicated i think and use the wrong interface (the one for experienced users). Use \cehead[useful text]{center even} and \cohead[useless text]{center odd}. Avoid the generation f a new page style/
    – Johannes_B
    Sep 6, 2016 at 8:47
  • 1
    You can use \KOMAoption{headsepline}{false} instead of the current line, that sets the width to zero and generates the warning.
    – Johannes_B
    Sep 6, 2016 at 8:48
  • Thank you for your answer. I generate new pagestyles because in my actual document I want different styles for the toc, chapters and "normal" pages. Thus I have three styles and the interface you suggested seems to only support two.
    – Benjamin
    Sep 6, 2016 at 9:03

2 Answers 2

6

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?

2
  • Thanks! I'm also not sure if paired pagestyles is the way to go. :D I had another look at the manual. Seems like I didn't understand their potential yet. I will look more closely into this in the future.
    – Benjamin
    Sep 6, 2016 at 9:25
  • 1
    Could you please indicate how to redefine plain style? I am straggling with KOMA-Script documentation since yesterday to reimplement what i had implemented with fancyhdr. KOMA-Script documentation is amazing: it does not contain a single usage example of \newpagestyle, neither of \newpairofpagestyles.
    – Alexey
    Mar 6, 2020 at 17:44
3

If you need different styles for TOC, chapter pages and normal pages, you can also use the plain style for your chapter pages with

\lehead{left even}
\cehead[useless text]{center even}
\rehead*{right even}

\lohead*{left odd}
\cohead[usefull text]{center odd}
\rohead{right odd}

and change the header and footer in TOC by

\BeforeTOCHead[toc]{%
    \clearpage
    \KOMAoptions{plainfootsepline=false}%
    \lehead[]{left even in toc}%
    \cehead[]{center even in toc}%
    \rehead[]{right even in toc}%
%
    \lohead[]{left odd in toc}%
    \cohead[]{center odd in toc}%
    \rohead[right on odd toc start page]{right odd in toc}%
}
\AfterStartingTOC[toc]{\clearpage}

Example:

\documentclass[a4paper,11pt,twoside]{scrbook}
\usepackage[
    manualmark,
    headsepline,
    footsepline,
    plainfootsepline% added to get a footline on plain pages
]{scrlayer-scrpage}
\usepackage{blindtext}
\usepackage{microtype}

\lehead{left even}
\cehead[useless text]{center even}
\rehead*{right even}

\lohead*{left odd}
\cohead[usefull text]{center odd}
\rohead{right odd}

\BeforeTOCHead[toc]{%
    \clearpage
    \KOMAoptions{plainfootsepline=false}%
    \lehead[]{left even in toc}%
    \cehead[]{center even in toc}%
    \rehead[]{right even in toc}%
%
    \lohead[]{left odd in toc}%
    \cohead[]{center odd in toc}%
    \rohead[right on odd toc start page]{right odd in toc}%
}
\AfterStartingTOC[toc]{\clearpage}

\begin{document}
\addchap{Introduction}
\Blindtext
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument
\end{document}

You could also use something like

\BeforeTOCHead{%
    \clearpage
    \KOMAoptions{automark}%
    \clearpairofpagestyles
    \chead[plain page in toc]{}%
    \ohead{\headmark}%
    \ofoot*{\pagemark}%
}
\AfterStartingTOC{\clearpage}

to use automark in TOC, LOT and LOF.

You must log in to answer this question.

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