%%
%%  Ein Beispiel der DANTE-Edition
%%
%%  1. Auflage
%%
%%  Beispiel 05-02-13 auf Seite 134.
%%
%%  Copyright (C) 2012 Herbert Voss
%%
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%
%%  See http://www.latex-project.org/lppl.txt for details.
%%
%%
%% ====
% Show page(s) 1,2,3
%%
%%
\documentclass[parskip=half,pagesize]{screxabook}
\pagestyle{empty}
\setlength\parindent{0pt}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{geometry,blindtext,xcolor}
\geometry{paperheight=239mm,paperwidth=169mm,tmargin=5mm,textwidth=124mm,textheight=195mm,
 rmargin=22mm,heightrounded,includeheadfoot,headheight=5mm,headsep=8mm,foot=18mm,
 marginparsep=2mm,marginparwidth=18mm}
\makeatletter
\newcommand\s@pt{\hspace{6pt}}
\newcommand\chaptertext{K\s@pt a\s@pt p\s@pt i\s@pt t\s@pt e\s@pt l}
\DeclareRobustCommand\headingfont{\sffamily\bfseries}
\renewcommand\@makechapterhead[1]{\begingroup
     \flushright
     {\topskip\z@\null}
     \headingfont\mdseries
     \fontsize{14.4}{5.5pc minus .5pc}\selectfont
     \textbf{\chaptertext}
     \fontsize{36}{\f@baselineskip}\selectfont\ \thechapter\kern-2pt
                                                 \par
     \fontsize{28}{24pt}\selectfont
     \begin{minipage}{\linewidth}\flushright
     \rule{0pt}{5pc}\normalfont\headingfont #1
     \end{minipage}%
     \null
     \par\endgroup
     \rule{0pt}{7.5pc}\par}
\setcounter{chapter}{4}
\newlength\fullwidth
\setlength\fullwidth{\paperwidth}\addtolength\fullwidth{-1in}
\addtolength\fullwidth{-\oddsidemargin}% für die Kopflinie
\StartShownPreambleCommands
\documentclass[parskip=half,pagesize]{scrbook}
\usepackage[ilines]{scrpage2}  \pagestyle{scrheadings} \clearscrheadfoot{}
\setheadwidth[\marginparsep]{textwithmarginpar}
\lehead[\clearscrheadfoot]{\mbox{\headingfont\smash{%
 \setlength\fboxsep{0pt}\raisebox{-2pt}{\colorbox{black!80}{\makebox[22mm]{\hfill%
  \ifnum\value{chapter}>0
     \textcolor{white}{\fontsize{18}{19}\selectfont\thechapter}~\fi%
  \rule[-2.85pt]{2mm}{12mm}}}}}\quad\small\leftmark}}
\rohead[\clearscrheadfoot]{\small\headingfont\rightmark\quad\makebox[22mm]{}}
\lefoot[\clearscrheadfoot]{\small\headingfont\llap{\thepage~\rule[-13mm]{.6pt}{18mm}
 \hspace{1mm}}} \rofoot[\clearscrheadfoot]{\small\headingfont~
 \hfill \rlap{\hspace{1mm}\rule[-13mm]{.6pt}{18mm}\ \thepage}}
\setheadsepline[\fullwidth]{0.8pt}  \renewcommand\chaptermark[1]{\markboth{#1}{}}
\renewcommand\sectionmark[1]{%
  \markright{\ifnum\c@secnumdepth>\@ne \thesection\quad #1\fi}}
\makeatother
\StopShownPreambleCommands
\begin{document}
\chapter{Textformatierungen}\section{Seitenstil}\blindtext\par\blindtext\newpage
\section{baz}   \blindtext[2]\par\blindtext\newpage
\section{foobar}\blindtext[2]\par\blindtext\newpage  \blindtext[2]
\end{document}