I have strange, old book chapter to rewrite in LaTeX. The most iritating thing is the header. On odd pages the header should consist of the section name etc. But the problem is that if the page starts new section this sections name should appear in header (standard) and if the does not (the page is continuation of previous started section) and somewhere lower on this page the next section starts then header should show the name of this continuation section (the name of the section that first line of text on current page belongs to).
I've googled a lot and stil have nothing. So simply - how to insert in the header the section name that the first line of text on current page belongs to instead of standard - the section name that starts somewhere lower on current page?