# [texhax] Marks

Philip Taylor P.Taylor at Rhul.Ac.Uk
Tue Oct 21 15:51:43 CEST 2014

TeX defines three marks :  \firstmark, \topmark and \botmark.
\firstmark contains the value (if any) of the first \mark on the current
page; \botmark similarly contains the value (if any) of the last \mark
on the current page; and \topmark contains the value (if any) of the
last mark encountered before the start of the current page.

Now, consider a document which consists of a large number of headed
sections; usually one or more sections will fit neatly onto a single
page, but occasionally a section will start on one page and continue on
the next.  In those circumstances, it would be very helpful to the
reader if the header of the section that started on an earlier page
could be reflected in the running head, because otherwise if he/she
lands on that page by chance, he/she will not know the context of the
text at the top of the page since its header will have appeared on a
previous page and thus not be visible.  How, then, might I construct
\headline such that it contains \topmark if the page does /not/ start
with a header, and \firstmark if it does (it is the headers themselves
that contribute the \marks to the page).

Philip Taylor