I am using a scrbook
document with scrlayer-scrpage
for page styling. The document-wide page-style is scrheadings
with some custom modifications, e.g., I moved the page numbers from footer to header and added a separator line. Here is my minimal working example.
\documentclass{scrbook}
\usepackage{scrlayer-scrpage}
% default: scrheadings with ruler and empty footer
\pagestyle{scrheadings}
\clearscrheadfoot
\ihead{\headmark}
\ohead{\pagemark}
\cfoot[\pagemark]{}
\setheadsepline{0.5pt} % document-wide (does not work)
% also apply scrheadings to chapter, but without separator
\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{scrheadings}
\setheadsepline{0.0pt} % only on first chapter page
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
\begin{document}
\chapter{Chapti-po-papti}
This page should \textsl{not} have a head rule separator.
\newpage
This page \textbf{should have} a head rule separator.
\end{document}
However, I want to have different line widths for the separator on the first chapter page (0.0pt / invisible) and on all other pages (0.5pt).
The renewing of the chapter
command somehow does reset all following header separator line widths to 0. How can I avoid this?
Best Answer
You should not redefine
\chapter
to change the page style and line width. Instead of just configure the plain page style:If you really need to change the page style of chapter pages, redefine
\chapterpagestyle
: