2

I want to create a fancy header/footer rule in Exam document class. I have tried what is at https://tex.stackexchange.com/questions/89569/custom-header-footer-rules-fancyhdr and Custom header/footer rules (fancyhdr?) but they seem not to work in Exam document class. Any help please

0

1 Answer 1

3

exam.cls uses its own mechanism for headers/footers. To modify the default rules in headers, you can patch \@fullhead (for the first page) and \run@fullhead (for other pages) to use whatever you choose, instead of the default \hrule. A little example using a double rule:

\documentclass{exam}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@fullhead}{\hrule}{\hrule\vskip2pt\hrule height 2pt}{}{}
\patchcmd{\run@fullhead}{\hrule}{\hrule\vskip2pt\hrule height 2pt}{}{}
\makeatother

\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
\runningheader{Math 115}
{First Exam, Page \thepage\ of \numpages}
{July 4, 1776}
\firstpagefooter{}{}{}
\runningfooter{}{}{}

\begin{document}
test\clearpage
test
\end{document}

enter image description here

In the case of footers, one has to patch \@fullfoot and \run@fullfoot and invoke \runningfootrule, \firstpagefootrule.

2
  • Thanks @Gonzalo. It is exactly what I want and I have done it for the footers as well. Thanks a lot.
    – Nana Yaw
    Aug 19, 2013 at 11:32
  • @NanaYaw You're welcome! Please, if you consider my answer solved your problem, don't forget to mark it as accepted by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. Aug 20, 2013 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .