I'm having troubles setting the header of a two-sided document. I need only the chapter number (not necessarily) and name in the header at left for even pages and at right for odd pages; I don't want a section title not the word "Chapter" in each page.
So far I've try this with fancyhdr
:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
which gives the correct output of chapter but in left for odds and viceversa, plus it doesn't remove the section header. Also, I try with
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead[]{\thechapter}
\chead{}[\thechapater]
But this only puts the chapter number and adds a horrible 0 in the pages before contents (declaration, acknowledgements, dedication, etc.). I am using documentclass scrreprt
.
Thanks!
Best Answer
It would be better not to use the package
fancyhdr
with KOMA classes likescrreprt
.One of the dedicated packages
scrpage2
orscrpage-scrlayer
should be used instead.In your case, it suffices to load the latter and use the page style
scrheadings
with the following modifications: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
MWE:
Output:
If you want the header line load
scrlayer-scrpage
with the optionheadsepline
:Instead, if you want to swap the sides where headers are printed, you have to define an own style, like this:
and use
\pagestyle{mystyle}
instead of\pagestyle{scrheadings}
.MWE
Output: