Forum How do I...?

Complex Headers: Numbered Corners

lsimon
I have a document with numbered headings, and I can (mostly) get the number of the last heading on a page into the top right margin. Is there any way to get the number of the first heading on a page into the top left? Can the Javascript see into where it is at any given time and find the previous page break?

Thanks in advance.
mikeday
If you are using string-set or counter, you can specify which instance of the string or counter you want to use in the page margin box. For example, counter(section, decimal, first), where "first" can be replaced with "last" or "start". In this case, first is the default, and refers to the first use on the current page, while start refers to the value as it appears at the start of the current page, which is probably what you want.
jim_albright
I found that I needed to add
nextVerse

after each Verse number for a Bible

That way when I could use nextVerse at the top to handle the problem of the page starting with a section head and then a new Chapter, Verse

Let me know if you want complete details.

Jim Albright
Wycliffe Bible Translators

lsimon
The good news: I'm pretty sure "start" is what I'm trying to accomplish. Did I miss that somewhere in the documentation?

The bad news: The results are a little confused, especially when the section I'm pulling a number from crosses a page.

For example, I'm setting "sect-num" every <section>.
Page 3 runs from the middle of sect 3 to the end of sect 4. I get:
string(sect-num,start) = 2
string(sect-num,last) = 5
jim_albright
What you are getting is absolutely right.
The top line of the page is from section 2.
Section 3 happens after you turn the page.
That is why you need to have the nextSection tag so it will work out correctly. Place it at the end of the last section.
Then the content of nextSection start will be correct when you turn the page.

Jim Albright
Wycliffe Bible Translators

mikeday
Perhaps you could email me (mikeday@yeslogic.com) a small example document demonstrating the issue?
mikeday
The issue seems to be caused by block elements nested inside inline elements, causing the inline elements to be split and resulting in unexpected behaviour for the string-set. Changing the outer element to "display: block" should fix the problem.