On Saturday 02 October 2010 11:54:46 Paul A. Rubin wrote:
> On 10/2/2010 11:16 AM, Steve Litt wrote:
> > On Saturday 02 October 2010 08:42:55 Richard Heck wrote:
> >> On 10/02/2010 12:49 AM, Steve Litt wrote:
> >>> Hi all,
> >>>
> >>> I'm using a document class derived from the Book class, and that can't
> >>> change.
> >>>
> >>> I created a character style that in LyX shows the text, but in the PDF
> >>> doesn't show the text and simply sets a variable, which I then put in
> >>> the header. So far so good.
> >>>
> >>> But there's trouble in paradise. These variables are dates, and I want
> >>> the variable value in the header to be the value on entry to the page.
> >>> Instead, it's the value on exit from the page. Is there any way to make
> >>> it the value on entry to the page? Maybe some sort of LaTeX break
> >>> logic?
> >>
> >> I've read about this problem elsewhere, and I don't think there is any
> >> solution to it without a massive rewrite of the heading code. Think
> >> about the section headings: You get in the header the section with which
> >> the page ENDS, not the one with which it STARTS.
> >
> > Thanks Richard,
> >
> > I've been giving this a lot of thought the past 18 hours. I have a
> > feeling it's possible, although I'd have to use, what's it called, the
> > ifthenelse package? Here's the logic:
> >
> > 1) On any chapter start page, the header shows the char style text at the
> > beginning of the chapter. I'll make sure every chapter start page has
> > such char style text at its beginning.
> > 2) On any other page, the header shows the latest char style text from
> > previous pages.
> >
> > OK, now it sounds to me like I'll need two different char styles. The
> > chapter start char style directly manipulates the variable that displays
> > on the header. The other char style manipulates a variable that, on page
> > changes, gets copied to the variable that displays on the header. I might
> > have to have some flags or something like that.
> 
> Steve,
> 
> I gather from this (perhaps incorrectly) that you use a LaTeX macro
> repeatedly at various points in the text to set the variable value for a
> page. 

That's right.

> What happens if you load the afterpage package and put the macro
> inside \afterpage{}?  Hopefully that would say the new value goes into
> effect after the current page is emitted, which (hopefully) would cause
> the value at entry to print on the current page.

Hi Paul,

\afterpage, if it's what it looks like, is the key to simplifying this 
daunting task, but it's not as simple as just putting my one macro in an 
\afterpage{} for one specific reason: I need the ability upon the start of a 
chapter to specify the start date for that chapter. I DO NOT want to specify 
it at the end of the preceding chapter -- chapters can always get moved 
around.

So the way I envision this thing, I have a 2 variable queue. Varh is what's in 
the header, and vart holds the latest value from the text. My chapter begin 
macro sets Varh directly and overwrites whatever was in it. My midchapter 
macro sets vart, overwriting whatever was in it. Now comes the magic of of 
\afterpage:

\afterpage{\let\varh\vart}

So if the brand new page is not a chapter beginning, the header value is the 
final value of the previous page. Same is true if it IS a chapter beginning, 
but that value of varh promptly gets overwritten by the chapter begin macro.

You're a genius. No ifandelse required. Minimal break logic. All because of 
\afterpage{}. I'll let you know if it works.

SteveT

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

Reply via email to