I want to recreate the header from this book: https://books.google.de/books?id=ybEmCgAAQBAJ&pg=PA36&hl=de&source=gbs_selected_pages&cad=3#v=onepage&q&f=false Example images: Header even pages header odd pages

So on even pages, the chapter number is on the top left corner in a gray box. This is followed by the chapter name. In contrast to the example here, the headsepline should extend over the whole page, i.e. the line should extend into the inner margin.

On odd pages the section should be shown on the top right corner. Again, the headsepline should extend over the whole page.

My current attempt:

\documentclass[a4paper, twoside]{scrbook}







\newcommand{\Graybox}{\noindent\adjustbox{minipage=[c]{\marginparwidth}\centering,height=8pt, bgcolor=gray}}




\usepackage{blindtext}% dummy text

  • page 123 fillllll
    – Johannes_B
    Sep 3, 2017 at 13:23
  • 1
    scrlayer-scrpage is (almost) compatible with scrpage2. So you can use the scrpage2 code of the head from the book (page 134f) and do only the wanted changes like increasing the length of the headsepline. You will get warnings if you use obsolete commands. The warning messages should contain information about the corresponding new solution. Sep 3, 2017 at 13:31
  • Ah, thank you for the hint! I didn't think that the author would publish the layout directly in the book.
    – Merlin1896
    Sep 3, 2017 at 13:37

1 Answer 1


With the following MWE, a version based on the code of the author of the book, Herbert Voss, you can use scrlayer-scrpage instead of scrpage2 to get the layout you want.

There are some things you should look at:


\addtolength\fullwidth{-\oddsidemargin}% für die Kopflinie

\fullwidth the lebgth of the line in the header is calculated (right margin + textwidth), with

%\setheadwidth[\marginparsep]{textwithmarginpar} % <====================
%\KOMAoption{headwidth}{textwithmarginpar} % <==========================

\KOMAoption is the headwidth set. Because we want the line reach the paper end we can not use textwithmarginpar, we have to use

\KOMAoption{headwidth}{\fullwidth:0mm} % <=========================== 

and the headsepline is set with

%\setheadsepline[\fullwidth]{0.8pt}  % <================================
\KOMAoption{headsepline}{0.8pt} % <=====================================

With the following MWE

%%  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
  showframe, % <========================================================
  paperheight=239mm,  % 
  paperwidth=169mm,   % 
  tmargin=5mm,        % top
  textwidth=124mm,    % 
  textheight=195mm,   % 
  rmargin=22mm,       % right (outer)
  headheight=5mm,     % 
  headsep=8mm,        % 
  foot=18mm,          % 
  marginparsep=2mm,   % 
  marginparwidth=18mm % 
\newcommand\chaptertext{K\s@pt a\s@pt p\s@pt i\s@pt t\s@pt e\s@pt l}
      \fontsize{14.4}{5.5pc minus .5pc}\selectfont
      \fontsize{36}{\f@baselineskip}\selectfont\ \thechapter\kern-2pt
      \rule{0pt}{5pc}\normalfont\headingfont #1
\addtolength\fullwidth{-\oddsidemargin}% für die Kopflinie

\usepackage[ilines]{scrlayer-scrpage}  % scrlayer-scrpage scrpage2 <====
%\setheadwidth[\marginparsep]{textwithmarginpar} % <====================
%\KOMAoption{headwidth}{textwithmarginpar} % <==========================
\KOMAoption{headwidth}{\fullwidth:0mm} % <===========================
  \hfill \rlap{\hspace{1mm}\rule[-13mm]{.6pt}{18mm}\ \thepage}}
%\setheadsepline[\fullwidth]{0.8pt}  % <================================
\KOMAoption{headsepline}{0.8pt} % <=====================================
   \markright{\ifnum\c@secnumdepth>\@ne \thesection\quad #1\fi}}

\section{baz}   \blindtext[2]\par\blindtext\newpage
\section{foobar}\blindtext[2]\par\blindtext\newpage  \blindtext[2]

you get the wished result:

enter image description here

  • Please don't use \setlength{\parindent}{0pt}. If you don't like pararagraph indention you should use paragraph separation. With KOMA-Script you should use option parskip to do so. And redefinition if \@makechapterhead is also not needed for the example and is not recommended if you use a newer KOMA-Script release. And if the line should be extended into the inner margin headwidth=paper should be enough. Sep 4, 2017 at 8:41

You must log in to answer this question.

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