[Tex/LaTex] Header and Footer offset in Exam Document Class

examfancyhdrheader-footermargins

I am using the exam document class and I want to implement a layout where the headers and footers span over both the text body and the margins.

I tried using the \fancyhfoffset command from the fancyhdr package, but commands like \cfoot, \lfoot are overruled by the document class.

Is there a way to disable the native header and footers from the exam document class or some other way of implementing this?

My MWE:

\documentclass[11pt,a4paper,fleqn]{exam}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage[includemp, a4paper, textwidth=0.6\paperwidth, marginparwidth=0.2\paperwidth]{geometry}

\pagestyle{headandfoot}
\firstpagefooter{MyName}{MyTitle}{ThePage}
\runningfooter{MyName}{MyTitle}{ThePage}

\title{MyTitle}
\author{MyName}

\begin{document}

\maketitle
\thispagestyle{headandfoot}
...

\end{document}

Best Answer

I'm not sure to understand exactly what you want to achieve.

Anyway the commands to move headers and footers up and and down in your document when using the exam class are, respectively, \extraheadheight and \extrafootheight.

They have to be used in the preamble and their sintax is

\extraheadheight[<1st page spacing>]{<spacing>}

and

\extrafootheight[<1st page spacing>]{<spacing>}

If the optional argument is omitted, then all pages including the first are affected by these commands.

Give positive values if you want headers/footers closer to the text, negative values if you want headers/footers closer to the margins of the page.

The following is an example that shows you how they act when you give different values for the first and the running pages:

\documentclass[11pt,a4paper,fleqn]{exam}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage[includemp, a4paper, textwidth=0.6\paperwidth, marginparwidth=0.2\paperwidth]{geometry}
\usepackage{lipsum} % only for the example

\pagestyle{headandfoot}
\firstpagefooter{MyName}{MyTitle}{ThePage}
\runningfooter{MyName}{MyTitle}{ThePage}
\firstpageheader{MyName}{MyTitle}{ThePage}
\runningheader{MyName}{MyTitle}{ThePage}

\extraheadheight[.25in]{.5in}
\extrafootheight[.25in]{.5in}

\title{MyTitle}
\author{MyName}

\begin{document}

\maketitle
\thispagestyle{headandfoot}
\lipsum[1-7]

\end{document} 

Result:

enter image description here

Related Question