1

I use fancyhdr for customized headers/footers. I have the following code :

\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\fancyhead{} 
\fancyfoot{}
\fancyheadoffset[L]{\dimexpr\marginparsep+\marginparwidth}
\fancyhead[LE]{\leftmark}
\fancyhead[RO]{\rightmark}
\fancyfoot[LE,RO]{|\quad\thepage\quad |}

Before I added this :

\fancyheadoffset[L]{\dimexpr\marginparsep+\marginparwidth}

Each the headers/footers dont align with my text.I have a twosided scrreprt. What i want to achieve is that on odd page numbers the header should align left and even page numbers on the right.And the same for the footer.Like this : enter image description here

When

 \fancyheadoffset[L]{\dimexpr\marginparsep+\marginparwidth}

is added, the footers seems to be ok (WHY ?) and on even page numbers also, but on odd page numbers it is not aligned. Like this : enter image description here

  • 2
    Are you loading geometry perhaps? If so, you need to load geometry before fancyhdr. However, you're using KOMA-script, which has its own header-setting options... – Werner Dec 29 '15 at 22:04
  • Welcome to TeX.SX! Since you're using scrreprt: KOMA classes and fancyhdr may work together, but often they are conflicting! – user31729 Dec 29 '15 at 22:05
  • @Werner yes i load geometry before fancyhdr – greedsin Dec 29 '15 at 22:06
  • @ChristianHupfer Ok good to know,i will try another class – greedsin Dec 29 '15 at 22:07
  • @lolio: Alright. If that does not work as desired come back please and provide a compilable document that shows the issues. – user31729 Dec 29 '15 at 22:31
2

I solved my problem by adding this :

 \fancyheadoffset[L]{0pt}
  • Given that this is the default value, you could equally well not set an offset at all. – cfr Dec 31 '15 at 1:11
  • Well then it is not aligned...strange – greedsin Dec 31 '15 at 9:06
  • 1
    Without a minimal example we can use to reproduce the issue, it is hard to say why, but zero is the default so something is misaligning things and then you are using this to get back to the default aligned configuration. – cfr Dec 31 '15 at 17:21

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.