# How to change styling of the header?

How can I make a horizontal rule below the top header (where the current chapter page or section is written)? And last but not least on the even pages in the header it is written

1. Chapter title

but I would like it to have

Chapter 1. Chapter title

Is this possible?

My code is the following:

\documentclass[a4paper,twoside,12pt,chapterprefix=false,listof=totoc,bibliography=totoc]{scrbook}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{longtable}
\usepackage[font={small,sl},hang,labelfont=bf]{caption}
\usepackage{booktabs}

\ifpdfoutput{%
\usepackage{graphicx}
\usepackage[]{pdfpages}
}{%
\usepackage{graphicx}
}
\usepackage{rotating}

\usepackage{scrlayer-scrpage}

% **** Defining chapter style start ****

\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{charter}

\definecolor{mybluei}{RGB}{28,138,207}
\definecolor{myblueii}{RGB}{131,197,231}

\newkomafont{chapternumber}{\fontsize{50}{120}\selectfont\color{white}}
\newkomafont{chaptername}{\itshape\rmfamily\small\color{white}}
\addtokomafont{chapterentry}{\normalcolor}% entrys in tableofcontents not blue

\newkomafont{sectionnumber}{\fontsize{18pt}{18pt}\selectfont\rmfamily\color{white}}

\newkomafont{subsectionnumber}{\fontsize{16pt}{16pt}\selectfont\rmfamily\color{white}}

\setcounter{secnumdepth}{\subsectionnumdepth}% subsubsection and lower unnumbered

\renewcommand\chapterformat{%
\raisebox{-6pt}{\colorbox{mybluei}{%
\parbox[b][60pt]{45pt}{\centering%
{\usekomafont{chaptername}{\chaptername}}%
\vfill{\usekomafont{chapternumber}{\thechapter\autodot}}%
\vspace{6pt}%
}}}\enskip}

\renewcommand\sectionformat{%
\setlength\fboxsep{5pt}%
\colorbox{mybluei}{%
\parbox{40pt}{\centering\usekomafont{sectionnumber}{\thesection\autodot}}}%
}

\renewcommand\subsectionformat{%
\setlength\fboxsep{5pt}%
\colorbox{mybluei}{%
\parbox{60pt}{\centering\usekomafont{subsectionnumber}{\thesubsection\autodot}}}%
}

\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hspace*{#2}#3}{#4}%
\ifstr{#1}{section}{%
\par\nobreak\vspace*{-\parskip}% <- changed
\ifstr{#3}{}{%
\rule[\dp\strutbox]{\textwidth}{1pt}}{%
\hspace*{50pt}\rule[\dp\strutbox]{\dimexpr\textwidth-50pt}{1pt}}%
}{}%
\ifstr{#1}{subsection}{%
\par\nobreak\vspace*{-\parskip}% <- changed
\ifstr{#3}{}{%
\rule[\dp\strutbox]{\textwidth}{1pt}}{%
\hspace*{70pt}\rule[\dp\strutbox]{\dimexpr\textwidth-70pt}{1pt}}%
}{}%
}
\makeatother

% **** Defining chapter style end ****

\usepackage{times}
\usepackage{helvet}
\usepackage[T1]{fontenc}

\ifpdfoutput{%
\usepackage[pdftex,
bookmarks,
bookmarksopen=true,
bookmarksnumbered=true,
pdfauthor={Rafael Wampfler},
pdftitle={Engagement Detector: Modelling engagement dynamics in virtual environments},
pdfsubject={The report of the master thesis about the modelling engagement dynamics in virtual environments.},
pdfkeywords={machine learning, engagement dynamics, classification, virtual environments, calcularis, learning, minecraft},
citecolor=black,
filecolor=black,
urlcolor=black,
anchorcolor=black,
pageanchor=true,
plainpages=false,
citebordercolor=red,
urlbordercolor=red,
pdfpagelabels=true]{hyperref}
}{}

\ifpdfoutput{%
\pdfcompresslevel=9
\DeclareGraphicsExtensions{.pdf,.png}
}{}

\bibliographystyle{alpha}

\topmargin -0.5in
\textheight 9.3in
\textwidth 6.3in
\oddsidemargin 0.18in
\evensidemargin -0.22in
\parskip 0.1in
\parindent 0in

\renewcommand{\arraystretch}{1.5}
\renewcommand{\baselinestretch}{1}

\begin{document}

\hypersetup{pageanchor=false}

\hypersetup{pageanchor=true}
\pagenumbering{roman}
\setcounter{page}{1}

%\include{abstract}

%\include{acknowledgment}

\tableofcontents

\listoffigures

\listoftables

\pagenumbering{arabic}

% ---- MAIN PART ----

\chapter{Chapter Title}
\section{Section Title}
\blindtext
\blindtext
\subsection{Subsection Title}
\blindtext
\subsubsection{Subsubsection Title}
\blindtext
\blinddocument

% ---- END MAIN PART ----

\appendix
\clearpage

%\include{appendix}

\clearpage
\renewcommand*{\chapterpagestyle}{empty}

\bibliography{references}

\end{document}

• Much of your code doesn't seem to be relevant to the question you're asking here. Could you lessen your example to only the code required to show the header? You can have a look at this guide for how to prune your code for this purpose. Jan 27 '16 at 23:17
• Isn't that the effect of chapterprefix=false? Check the documentation - I don't remember, but it sounds suspicious.
– cfr
Jan 28 '16 at 0:01
• @cfr With chapterprefix or chapterprefix=true there is also a prefix line fo the chapter title in the document. AFAIK the OP does not want a two line chapter title..
– esdd
Jan 28 '16 at 0:25
• @esdd Oh, I see. You may be right. I guess it seems odd to me to want it in the header and not in the title of the chapter, but that would make sense of the question.
– cfr
Jan 28 '16 at 0:53
• @cfr It is following up tex.stackexchange.com/q/288737/43317
– esdd
Jan 28 '16 at 0:58

To get a sepline below the header on pages using page style scrheadings use option headsepline.

\usepackage[headsepline]{scrlayer-scrpage}


If the chapter prefix should be in the page header and there should be a prefix line before the chapter title you could use the option chapterprefix or one of the aliases twolinechapter, chapterwithprefix, chapterwithprefixline.

AFAIK you do not want a two line chapter title with the prefix in the first line. Then you have to change the apperance of the chapter number in the page header redefining \chaptermarkformat:

\renewcommand*\chaptermarkformat{\chapapp\ \thechapter\autodot\enskip}


\documentclass[12pt]{scrbook}

\usepackage[english]{babel}
\usepackage{blindtext}% dummy text