On Sunday 03 October 2010 04:33:43 Steve Litt wrote:
> On Saturday 02 October 2010 18:24:01 Julien Rioux wrote:
> > On 02/10/2010 4:25 PM, Steve Litt wrote:
[clip]
> > > The \renewcommand inside the afterpage doesn't work. \afterpage is
> > > firing because I get the row of z's on the next page. The \renewcommand
> > > within the \afterpage either isn't working, or is somehow getting
> > > overwritten, because I keep getting the same value in the header. Note
> > > however that when I uncomment the \renewcommand outside of the
> > > \afterpage, the header changes according to calls to \plotdatebodyL, in
> > > which case it's just like the original -- e.g. the header lists the
> > > last value on the page, not the first.
> > >
> > > So why isn't the \renewcommand inside the \afterpage working or why is
> > > it getting overwritten? By the way, \let\plotdatehdr\plotdateondeck did
> > > exactly the same thing.
> > >
> > > This thing is so close I can taste it, but there's something I'm not
> > > seeing.
> > >
> > > Thanks
> > >
> > > SteveT

> > Does this work?
> >
> > \def\currentdate{}
> > \newcommand{\setdate}[1]{%
> > The date is now: #1%
> > \afterpage{\gdef\currentdate{#1}}
> > }
> >
> > \rhead{\currentdate}
> 
> Fascinating. Thanks for telling me about \gdef, which from what I read is a
> global definition. I'll try something like that tomorrow. I also read about
> \xdef, and will have to find out more about that.

U D Man Julien!!!

\gdef didn't work, but \xdef sure did. I replaced this:

\afterpage{\renewcommand{\plotdatehdr}[0]{\plotdateondeck}}

With this:

\afterpage{\xdef\plotdatehdr{\plotdateondeck}}

And bang! It does what it's supposed to. I set \plotdatehdr with the chapter 
date charstyle, and that determines the header date of the first page of the 
chapter. After that, the header date is the last value input with the body 
date charstyle before the current page. That's exactly what I wanted.

I'm still not quite sure it works right so I won't yet put <SOLVED> in the 
subject. I need to investigate this more thoroughly tomorrow. I also need to 
find out exactly what \xdef does that \gdef and \def and \renewcommand don't 
do, but there's time for that tomorrow.

Thanks to everyone for all your help.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt

Reply via email to