I want to create a TeX document with sections and a running header containing the name of the current section. I know I can use \mark{}
to mark the section headings and then use \topmark
or \firstmark
to show the section name in my header. The problem is that neither \topmark
nor \firstmark
do what I want (they're actually more suitable for typesetting dictionaries).
I would like the header to reflect the section the contents of which appear at the very top of the current page. In other words, I want to use mostly \topmark
, but when a new section begins on the current page before any other text before it, I want to use \firstmark
(or, alternatively, leave the header blank), because then \topmark
refers to the previous section and thus is irrelevant. Any ideas on how I could do that?
\mark
twice, before and after the section title, if I remember correctly.\topmark
is still empty. Can I tell TeX to use\firstmark
instead?\ifnum\pageno=1 \firstmark\else\topmark\fi
can solve the issue.