[OS X TeX] First Page Header & Subsequent Pages Header

Piet van Oostrum piet at cs.uu.nl
Mon Sep 21 04:59:19 EDT 2009


>>>>> "Scott, Randy" <Scott_Randy at sccollege.edu> (SR) wrote:

>SR> Good Morning!
>SR> I've been trying to create a header that appears on the first page of a document, and then a different header that appears on all of the subsequent pages. I've been doing this manually, but would really like to automate the process.

>SR> I use the fancyhdr header package along with \pagestyle{fancy} to generate my headers.

>SR> I've been trying to use the ifthen package to get this going. Here is my attempt:

>SR> \ifthenelse{\value{page}=1}
>SR>     {\lhead{\textbf{Math 280, Intermediate Calculus\\Change of Variables in Multiple Integrals}} \chead{} \rhead{}\lfoot{} \cfoot{} \rfoot{}}
>SR>     {\lhead{\textbf{Math 280, Change of Variables in Multiple Integrals}} \chead{} \rhead{\textbf{\thepage}}\lfoot{} \cfoot{} \rfoot{}
>SR> }

>SR> I've spread out the code to make it easier to read; in my document, there are no spaces or line breaks between the arguments of \ifthenelse

>SR> When I run this, the first page shows the appropriate header, but then that header repeats on all of the following pages. Bummer.

>SR> Could any of you please suggest a tweak for this?

You would have to put the \ifthenelse *inside* the \lhead and \rhead. 
But the neater solution is to define a separate pagestyle for the first
page and then use \thispagestyle.

Something like (untested)

\pagestyle{fancy}
\lhead{\textbf{Math 280, Change of Variables in Multiple Integrals}} 
\chead{} \rhead{\textbf{\thepage}}\lfoot{} \cfoot{} \rfoot{}
\fancypagestyle{firstpage}
{
  \lhead{\textbf{Math 280, Intermediate Calculus\\Change of Variables in Multiple Integrals}}
  \rhead{}
}
% the things that don't change don't have to be specified

and where the first page starts:

\thispagestyle{firstpage}

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the MacOSX-TeX mailing list