# [texhax] Heading question

D. R. Evans doc.evans at gmail.com
Tue Feb 26 17:31:10 CET 2008

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