1

I am using the oneside layout of MastersDoctoralThesis. I want to give a different header for even and odd pages. The process should be simple with fancyhdr, however it not supported in this template, unfortunately. This is so far I've come across:

\clearpairofpagestyles
\cehead{even header}
\cohead{odd header}

However, it prints "odd header" on ALL the pages and ignores my cehead command.

Ingmar
  • 6,690
  • 5
  • 26
  • 47
foobar
  • 153
  • 2
    There are, by definition, no odd and even pages when using a one-sided layout ... Use a two-sided one. – Ingmar Mar 12 '21 at 04:20
  • You can create your own headers using everypage and tikzpagenodes. See https://tex.stackexchange.com/questions/276358/text-on-background-image-footer-and-header/276453?r=SearchResults&s=10|18.7871#276453 – John Kormylo Mar 12 '21 at 04:31

1 Answers1

4

As already mentioned in a comment, there are only recto (odd) pages in onesided documents. But you could use

\clearpairofpagestyles
\chead{%
  \ifodd\number\value{page}
    odd header%
  \else
    even header%
  \fi
}

to get different headers for even and odd pages in your document.

Example:

\documentclass[oneside]{MastersDoctoralThesis}% loads package scrlayer-scrpage
\usepackage{lipsum}% only for dummy text

\clearpairofpagestyles \chead{% \ifodd\number\value{page} odd header% \else even header% \fi } \cfoot*{\pagemark}

\begin{document} \lipsum[1-20] \end{document}

enter image description here

esdd
  • 85,675