I have been using the exam class by Philip Hirschhorn in LaTeX to write out homework and tests for my class, The Epidemiology of Everyday Life. It allows me to write out problems with the ease of mathematical notation in LaTeX, provide solutions that can be turned on and off with a single line of code, and to easily tally points on various pages. If you haven't used it and teach a stats-based course, I would definitely recommend checking it out.
I ran into a problem, however, because I am a procrastinating perfectionist. I have had a desired to have all of my teaching handouts to have a similar look. I created a custom syllabus class to do that, and I really liked it. I wanted the homework to have the same look. And what better way to procrastinate than to try to figure out the arcane rules of LaTeX!?1
In order to do this, I wanted to use the fancyhdr package from LaTeX as I had done when I created my syllabus class. Well, I ran into a problem:
fancyhdr wouldn't load because the macro
\lhead had already been defined in the
exam class. After spending way too much time trying to re-write the header commands by combining what was written in the
exam class and
fancyhdr style, I stumbled upon a more parsimonious solution: what if I just "erased" the
\lhead (and its companion commands) and let
fancyhdr write them?
I just needed to figure out how to do that, and it turned out it was pretty easy: tell LaTex to undefine the command (
\let\<commandname>\@undefined). Now I can use the fancyhdr command by including the following lines in my custom exam class above where I load the
\let\lhead\@undefined \let\chead\@undefined \let\rhead\@undefined \let\lfoot\@undefined \let\cfoot\@undefined \let\rfoot\@undefined
And it works (with no bad boxes, to boot)!
I would say that this isn't entirely a terrible excuse to procrastinate: having a common look lets me find teaching material relatively quickly when I need it because it looks different than other material, but that's probably not a great reason to spend a lot of time on it. ↩