I have a Miktex 2.9 installation on my computer, I am writing my PhD thesis and I am struggling with the fancyhdr package. Up to now, whenever I need a new package, the software just ask me whether I want to download and install it, I agree with him and I keep going with my thesis.

Problems come with the fancyhdr package. If I add the line of code


on my thesis preamble than what I get is

! Class MastersDoctoralThesis Error: Package `fancyhdr' is incompatible
(MastersDoctoralThesis)              with this class.

See the MastersDoctoralThesis class documentation for explanation.
Type  H <return>  for immediate help.

l.58 \usepackage{fancyhdr}


I had a look around, other people struggle with this packages and I also tried to provide a kind of manual download from the Miktex Package Manager, which also "believe" the fancyhdr is already installed. But I can't use it at all.

Would you be able to help me sorting out this problem, please?

  • 4
    Welcome to TeX.SX! The message says all: you cannot use fancyhdr with that class. Can you point to the source of the class and specify what changes to the headers or footers you wish? – egreg Sep 11 '17 at 17:11
  • What also helps is the documentation for your class. texdoc MastersDoctoralThesis would in most cases pop up the documentation. – Oleg Lobachev Sep 11 '17 at 17:40
  • @OlegLobachev Actually not in this case as you'll find the "documentation" (template) online only... – TeXnician Sep 11 '17 at 18:39
  • If you would have typed h, there would have been a more meaningful explanation. The template you are using uses package scrlayer-scrpage from the KOMA-script bundle. – Johannes_B Sep 17 '17 at 10:42

From what I can tell this is hardcoded in the MastersDoctoralThesis.cls

\PreventPackageFromLoading[\ClassError{\classname}{Package `fancyhdr' is
incompatible\MessageBreak with this class}{The pagesyles are defined 
using package `scrlayer-scrpage', please consult the\MessageBreak 
KOMA-script documentation for details.}]{fancyhdr}

So why not go ahead and checkout the suggested package scrlayer-scrpage. Maybe it has the options you need? Checkout chapter 5, especially pg. 236.

E.g. this puts your page pagenumber in the bottom center:

\cfoot*{- \pagemark{} -}
  • It looks like scrlayer-scrpage works on my thesis. What I personally need is just to move the page number from the top left to the bottom centre. I am googling around but still I didn't find anything valid and/or easy to apply. Could you suggest me anything? – Stefano Fedele Sep 11 '17 at 18:46
  • 1
    \clearpairofpagestyles \cfoot*{- \pagemark{} -} should do the trick :-) read up on the fancy options of the package! – nhck Sep 11 '17 at 19:20

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.