1

I have the following problem. I need a header in my master thesis. I have a template for that. The fancyhdr package has problems with scrbook. Now I have found the following solution:

\usepackage[automark,headsepline,plainheadsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\leftmark}
\ohead*{\pagemark}
\addtokomafont{pagehead}{\normalfont}
%\renewcommand\chaptermarkformat{\ifnumbered{chapter}{\chapapp\ \thechapter. \ }{}}


\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
%\fancyhead[EL,OR]{\sffamily\thepage}
%\fancyhead[ER,OL]{\sffamily\leftmark}
\fancyhead[EL,OR]{\sffamily\bfseries\thepage}
\fancyhead[ER,OL]{\sffamily\bfseries\leftmark}

\fancypagestyle{headings}{}
\fancypagestyle{plain}{

}

%\fancypagestyle{empty}{
%  \fancyhf{}
%  \renewcommand{\headrulewidth}{0pt}
%}

However, I only get a numbering, when a chapter begins. Can someone help a newbie?

1

Do not use both packages scrlayer-scrpage and fancyhdr in the same document. With a KOMA-Script class scrlayer-scrpage is recommended.

I do not know how the desired layout looks like, but may be the following helps:

\documentclass{scrbook}
\usepackage{blindtext}% only for dummy text

\usepackage[automark,headsepline,plainheadsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead*{\leftmark}%<- changed
\ohead*{\pagemark}
\addtokomafont{pagehead}{\normalfont\sffamily\bfseries}%<- changed
\renewcommand\chaptermarkformat{\chapapp\ \thechapter. \ }% <- changed

\begin{document}
\tableofcontents
\blinddocument
\end{document}

But if you decide to use fancyhdr, then remove all scrlayer-scrpage code from your document.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.