It would be better not to use the package fancyhdr
with KOMA classes like scrreprt
.
One of the dedicated packages scrpage2
or scrpage-scrlayer
should be used instead.
In your case, it suffices to load the latter and use the page style scrheadings
with the following modifications:
\renewcommand*\chaptermarkformat{\thechapter\autodot\enskip}
\automark[chapter]{chapter}
The first line is to eliminate the word "Chapter" from the header and the latter is to place the chapter mark both in even and odd pages.
If you don't want chapter numbers replace the first line with
\renewcommand*\chaptermarkformat{}
MWE:
\documentclass[twoside,openright,chapterprefix=true]{scrreprt}
\usepackage{lipsum} % only for the example
\usepackage{scrlayer-scrpage}
\renewcommand*\chaptermarkformat{\thechapter\autodot\enskip}
\automark[chapter]{chapter}
\pagestyle{scrheadings}
\begin{document}
\chapter{Test}
\lipsum[1-5]
\section{A section}
\lipsum[1-5]
\end{document}
Output:
If you want the header line load scrlayer-scrpage
with the option headsepline
:
\usepackage[headsepline]{scrlayer-scrpage}
Instead, if you want to swap the sides where headers are printed, you have to define an own style, like this:
\defpagestyle{mystyle}{%
{\hfill\headmark}{\headmark\hfill}{\hfill}
}{%
{\hfill}{\hfill}{\hfill}
}
and use \pagestyle{mystyle}
instead of \pagestyle{scrheadings}
.
MWE
\documentclass[twoside,openright,chapterprefix=true]{scrreprt}
\usepackage{lipsum} % only for the example
\usepackage{scrlayer-scrpage}
\renewcommand*\chaptermarkformat{\thechapter\autodot\enskip}
\automark[chapter]{chapter}
\defpagestyle{mystyle}{%
{\hfill\headmark}{\headmark\hfill}{\hfill}
}{%
{\hfill}{\hfill}{\hfill}
}
\pagestyle{mystyle}
\begin{document}
\chapter{Test}
\lipsum[1-5]
\section{A section}
\lipsum[1-5]
\end{document}
Output:
\documentclass{...}
and ending with\end{document}
.