[texhax] Heading question

D. R. Evans doc.evans at gmail.com
Wed Feb 27 16:00:12 CET 2008

Donald Arseneau said the following at 02/27/2008 04:21 AM :
> "D. R. Evans" <doc.evans at gmail.com> writes:
>> \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
> Yes. \ifx expands nothing (besides itself:-) but compares the
> meaning of the next two tokens. \topmark does not have the same
> meaning as \botmark; they are different tokens.  You are 
> thinking of them as macros, but they are built-in tokens.

OK; I think I understand that.

> Verify by \show.
> An analogous mistake would be:
> \parskip=15pt
> \baselineskip=15pt
> \ifx\parskip\baselineskip
> Anyway, I don't think even the intent makes much sense.

I don't understand why you say that.

The intent is:
  if the value of \topmark is the same as the value \botmark:
     then this must be a new chapter, so don't print anything;
     this is not a new chapter, so print something

That intent seems exactly right to me (even though the implementation is
wrong). So can you please explain why the intent is wrong?

> Rather, I'd suggest
> \newif\ifspecialpage
> Then in your \chapter macro(s)
> \vfill\supereject
> \global\specialpagetrue
> \ifodd\pageno\else
>  \null \vfill \eject \global\specialpagetrue
> \fi
> and your headline tests \ifspecialpage, and also performs
> \global\specialpagefalse.

OK; to me, when I first started trying to implement a solution to my
problem, it seemed like an inelegant approach to tag just the pages where
chapters began, and then check to see whether a tag was present whenever a
page was output; it seemed much more elegant to process every page the same
and compare marks. But you are right that your approach has the great merit
that it actually works.

I do wonder about how one is supposed to compare the values of \topmark,
\firstmark and \botmark, though. There has to be an easy way to do it, but
I haven't been able to find any way that works.


More information about the texhax mailing list