3

In the KOMA class scrbook with the help of scrlayer-scrpage, I want to realize the following header: enter image description here i.e. a thick light-blue horizontal band along most of the page, the current chapter title in capitals on top of it, and in front of the chapter title a dark-blue vertical line. This vertical line should always be right in front of the of the chapter title, i.e. flexible for longer or shorter titles.

My problem is: How can I add a vertical line to \rohead* that is printed on top of the horizontal band? Right now, the lower parts are hidden because the horizontal band is printed on top. See my MWE:

\documentclass{scrbook}
\usepackage{xcolor}
\usepackage{lipsum}

\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\KOMAoptions{headsepline=12pt, headwidth=textwithmarginpar}
\rohead*{\raisebox{-12pt}[0pt][0pt]{\color{blue}\rule{1pt}{24pt}}\hspace{0.8em}\rightmark}
\setkomafont{pagehead}{\scshape}
\setkomafont{headsepline}{\color{blue!20!white}}

\begin{document}
\markright{Some Headline}
\lipsum[1]
\end{document}

enter image description here

1 Answer 1

2

If you add

\newcommand*\newlineatlist{}
\noindent\ForEachLayerOfPageStyle{scrheadings}{%
  \newlineatlist#1\def\newlineatlist{\\ }}

you will get the order of the layers:

enter image description here

Now you can remove the layer scrheadings.head.below.line from layer pagestyle scrheadings

\RemoveLayersFromPageStyle{scrheadings}{scrheadings.head.below.line}

and add this layer at the begin:

\AddLayersAtBeginOfPageStyle{scrheadings}{scrheadings.head.below.line}

New order of the layers:

enter image description here

Example:

\documentclass{scrbook}
\usepackage{xcolor}
\usepackage{lipsum}

\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\KOMAoptions{headsepline=12pt, headwidth=textwithmarginpar}
\rohead*{%
  \raisebox{\dimexpr-12pt-\dp\strutbox\relax}[0pt][0pt]
    {\color{blue}\rule{1pt}{\dimexpr24pt+\dp\strutbox\relax}}%
  \hspace{0.8em}%
  \rightmark
}
\setkomafont{pagehead}{\scshape}
\setkomafont{headsepline}{\color{blue!20!white}}

\RemoveLayersFromPageStyle{scrheadings}{scrheadings.head.below.line}
\AddLayersAtBeginOfPageStyle{scrheadings}{scrheadings.head.below.line}

\begin{document}
\markright{Some Headline}
\lipsum[1]

%% List the layer ordner of scrheadings:
%\newcommand*\newlineatlist{}
%\noindent\ForEachLayerOfPageStyle{scrheadings}{%
  %\newlineatlist#1\def\newlineatlist{\\ }}
\end{document}

Result:

enter image description here

Note that I have enlarged the horizontal rule to get the desired result.

You must log in to answer this question.

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