[texhax] Heading question

D. R. Evans doc.evans at gmail.com
Tue Feb 26 19:13:03 CET 2008

In case it wasn't obvious: this question pertained to plain TeX.


D. R. Evans said the following at 02/26/2008 09:31 AM :
> I am trying to do the following, but I can't figure out how to implement it :-(
> 1. I have a book in which the chapters have titles.
> 2. On even-numbered pages, the headline should always be the title of the book.
> 3. On odd-numbered pages, the headline should be the title of the current
> chapter EXCEPT that if a new chapter starts on that page, the headline
> should be empty.
> I can easily do everything except that I haven't been able to find a trick
> that will cause the headline to be empty when a new chapter starts on an
> odd page.
> The closest I have come is to include:
>   \mark{<chapter name>}
> in the macro that is called to start a new chapter,
> and then to have:
> \headline={\ifnum\count0>1 {\ifodd\count0 \hss \it \ifx\topmark\botmark
> \else \topmark \fi \hss \else \hss \it <book name> \hss\fi}\fi}
> but the \ifx always calls the false branch -- probably I am
> misunderstanding something about what gets expanded when \ifx is called
> (basically, I'm trying to compare two strings for equality, but I haven't
> been able to find anywhere in the TeXbook where it describes how to do that
> [which seems odd]).
> I've spent a couple of hours messing with this and am now out of ideas, so
> any suggestions would be very appreciated.
>   Doc

More information about the texhax mailing list