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


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:


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

\firstpageheader{Math 115}{First Exam}{July 4, 1776}
\runningheader{Math 115}
{First Exam, Page \thepage\ of \numpages}
{July 4, 1776}


enter image description here

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

| improve this answer | |
  • 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 '13 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?. – Gonzalo Medina Aug 20 '13 at 16:27

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.