You can use the \oddeven
command. That command takes two arguments; the first is used on odd numbered pages and the second is used on even numbered pages. Thus, you'd use something like
\newcommand{\myleft}{\makebox[.5\textwidth][l]{Name:\enspace\hrulefill}}
\newcommand{\myright}{\makebox[.25\textwidth][r]{Date:\enspace\hrulefill}}
\header{\oddeven{\myleft}{\hfill}}
{\hfill}
{\oddeven{\myright}{\hfill}}
Edit: Actually, all those \hfill
's are unnecessary; you can just use
\newcommand{\myleft}{\makebox[.5\textwidth]{Name:\enspace\hrulefill}}
\newcommand{\myright}{\makebox[.25\textwidth]{Date:\enspace\hrulefill}}
\header{\oddeven{\myleft}{}}
{}
{\oddeven{\myright}{}}
Edit: Here are two complete LaTeX files, both of which work when I test them. The first uses \lhead
, \rhead
, etc., and the second uses \header
.
\documentclass{exam}
\newcommand{\myleft}{\makebox[.5\textwidth]{Name:\enspace\hrulefill}}
\newcommand{\myright}{\makebox[.25\textwidth]{Date:\enspace\hrulefill}}
\lhead{\oddeven{\myleft}{}}
\rhead{\oddeven{\myright}{}}
\footrule
\lfoot{Test 1: Ch 1.5 through 3.4}
\cfoot{}
\rfoot{Page \thepage\ of \numpages}
\begin{document}
Here's the first page.
\newpage
Here's the second page.
\newpage
Here's the third page.
\newpage
Here's the fourth page.
\newpage
\end{document}
Here's the second LaTeX file:
\documentclass{exam}
\newcommand{\myleft}{\makebox[.5\textwidth]{Name:\enspace\hrulefill}}
\newcommand{\myright}{\makebox[.25\textwidth]{Date:\enspace\hrulefill}}
\header{\oddeven{\myleft}{}}
{}
{\oddeven{\myright}{}}
\footrule
\footer{Test 1: Ch 1.5 through 3.4}
{}
{Page \thepage\ of \numpages}
\begin{document}
Here's the first page.
\newpage
Here's the second page.
\newpage
Here's the third page.
\newpage
Here's the fourth page.
\newpage
\end{document}
