%% 
%%  Ein Beispiel der DANTE-Edition
%%  
%%  1. Auflage
%% 
%%  Beispiel 05-02-8 auf Seite 131.
%% 
%%  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[]{screxabook}
\pagestyle{empty}
\setlength\parindent{0pt}
\setlength\parskip{0.5\normalbaselineskip}
\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}
\StartShownPreambleCommands
\usepackage{fancyhdr} \pagestyle{fancy}
\fancypagestyle{plain}{\fancyhf{}\def\headrulewidth{0pt}}
\fancyhf{} \fancyheadoffset[RO,LE]{30mm}
\fancyhead[LE]{\mbox{\headingfont\smash{%
 \setlength\fboxsep{0pt}\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}}
\fancyhead[RO]{\small\headingfont\rightmark\quad\makebox[22mm]{}}
\fancyfoot[LE]{\small\headingfont\llap{\thepage\ \rule[-13mm]{.6pt}{18mm}\hspace{1mm}}}
\fancyfoot[RO]{\small\headingfont~
  \hfill \rlap{\hspace{1mm}\rule[-13mm]{.6pt}{18mm}\ \thepage}}
\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{Das Paket \texttt{scrpage2}}   \blindtext[2]\par\blindtext\newpage
\section{foobar}\blindtext[2]\par\blindtext\newpage
\blindtext[2]
\end{document}
