3

In exam documents where there are index pages and the page numbering restarts, I'm having trouble with getting the lhead and rhead to work correctly. Reference this example:

\documentclass[letterpaper, 12pt, twoside]{exam}
\printanswers

\usepackage{abbrevs}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{hyperref}
\usepackage[letterpaper, headheight=80px, top=.5in, bottom=.5in, left=1in, right=.5in, includeheadfoot]{geometry}
\usepackage{lipsum}

\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
\shadedsolutions
\renewcommand{\solutiontitle}{\noindent}

\rhead[\thepage]{logo goes here}
\chead{Project Name}
\lhead[logo goes here]{\thepage}

\begin{document}

\title{Sample Number Errors}
\maketitle
\thispagestyle{empty}
\newpage

Copyright
\thispagestyle{empty}
\newpage

\setcounter{page}{1}
\pagenumbering{roman} %use lowercase Roman numerals for page numbers

Revision history page goes here.
\newpage

\setcounter{tocdepth}{1}
\tableofcontents
\newpage

%reset the page counter for the regular pages
\setcounter{page}{1}
\pagenumbering{arabic} %use standard numbers for the page number

\lipsum[1-50]

\end{document}

Here, everything looks fine until you get to the third page of content (IE: title page is good, copyright page is good, revision history page is good, table of contents is good, then the first two pages of content are good). On the third page of content, the header stops switching between lhead and rhead. The page numbering is on the inside spine instead of the outside. In fact, for every subsequent page after page 2, the header is always using the rhead definition only, regardless of which page I'm on.

How can I fix this for my document? Note that I left all the \usepackage and preamble in the example, just in case something odd is interfering/conflicting with what I'm trying to do.

3

\rhead[<1>]{<2>} prints <1> on page 1 and <2> on all other pages. The same is true for \lhead.

If you want to achieve what you want you have to substitute the lines

\rhead[\thepage]{logo goes here}
\lhead[logo goes here]{\thepage}

with

\rhead{\oddeven{\thepage}{logo goes here}}
\lhead{\oddeven{logo goes here}{\thepage}}

Complete MWE

\documentclass[letterpaper, 12pt, twoside]{exam}
\printanswers

\usepackage{abbrevs}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{hyperref}
\usepackage[letterpaper, headheight=80px, top=.5in, bottom=.5in, left=1in, right=.5in, includeheadfoot]{geometry}
\usepackage{lipsum}

\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
\shadedsolutions
\renewcommand{\solutiontitle}{\noindent}

\rhead{\oddeven{\thepage}{logo goes here}}
\chead{Project Name}
\lhead{\oddeven{logo goes here}{\thepage}}

\begin{document}

\title{Sample Number Errors}
\maketitle
\thispagestyle{empty}
\newpage

Copyright
\thispagestyle{empty}
\newpage

\setcounter{page}{1}
\pagenumbering{roman} %use lowercase Roman numerals for page numbers

Revision history page goes here.
\newpage

\setcounter{tocdepth}{1}
\tableofcontents
\newpage

%reset the page counter for the regular pages
\setcounter{page}{1}
\pagenumbering{arabic} %use standard numbers for the page number

\lipsum[1-50]

\end{document} 

Output

enter image description here

  • @Jon You're welcome. Glad to help. – karlkoeller Dec 12 '13 at 16:52

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.