Re: LaTeX running head problem - head to be title of first/last line on page



On Mon, 24 Oct 2005 10:07:38 -0500, Jonathan Fine <J.Fine@xxxxxxxxxx> wrote:

Hello

I have a running head problem.

I'm using LaTeX.  My document is divided into sections.

For recto (right) pages I want the running head to be
the title of the section of the last line on the page.

For verso (left) pages I want the running head to be
the title of the section of the first line on the page.

Something similar is described in The TeXbook, pp259--60.
But that is plain TeX, and I am using LateX.

The plain TeX solution uses \topmark.  The LaTeX
Companion, ed 2, p221 writes:
===
A third type of primitive, \topmark, is also present
in the mark model of TeX, which is not normally
made available in LaTeX. [..]  The reason that it is
not available is that it conflicts with LaTeX's
float and \marginpar mechanism.  In other words,
each such object internally triggers the output
routine, with the result that the \topmark value
for the current page is clobbered.
===

Does anyone have any hints about how to solve my
problem in LaTeX?  (I have looked at fancyhdr.sty
but in view of the above quote, it seems unlikely
that it will work.)

The titlesec package has something for this:

One of the cooler features added to page styles is the possibility of selecting which marks are used in
subsequent macros. These commands set from which mark the values of \thesection,
\sectiontitle, etc. will be taken. You can use freely in your headers; 23 just for fun, the following
header shows the section label from three of these marks:


\newpagestyle{funny}{
\sethead{Top is \toptitlemarks\thesection}
{First is \firsttitlemarks\thesection}
{Bot is \bottitlemarks\thesection}}

More in the titlesec manual.
--
Morten
.