Forum How do I...?

Can a new page reset or increment a counter

BorisKa
Hello

My document is structured in nested sections (three or four levels of nesting).
A section can span several pages.
In order to help the reader to locate himself in the document, I intend to remind on each page the title of the current section.
But I want to increment the callback on each new page.

Example :
page 35: start of the section
page 36: continuation of the section
page 37: continuation of the section
page 38: end of the section and start of the next one

What I want to get:
page 35: Title of the section (1)
page 36: Title of the section (2)
page 37: Title of the section (3)
page 38: Title of the section (4)
Title of the new section (1)

How to obtain this structure?
In other words, can a new page reset or increment a counter?

Thank you in advance for your help.
Boris

PS : I'm a beginner with Prince.
howcome
Hello BorisKa,

Here's a guide to Running headers and footers:

https://css4.pub/2022/running-headers/#using-named-strings

The link points to an example where the title of the section is automatically updated when a new seaction starts. This is what you are asking for, no?

Edited by howcome

BorisKa
Hello Howcome,

Thank you for having answered me.

The document you indicated is very interesting and will be very useful for me when I'll manage the headers and the footers.

But what I want to obtain is a bit different.
The attached pdf file shows what I need.
(In order to simplify the model, I represented only the first level of nesting. The principle remains the same for subsections, ie sections within sections.)
  1. Numbering of reminder titles.pdf99.0 kB
howcome
Ah, I see. Illustrations help. Here's an example where a counter is reset on a page:

https://css4.pub/2023/running-headers/#several-page-numbers
BorisKa
Thanks a lot, howcome!

I hadn't paid attention enough to the last section of the document — or rather, I hadn't understood it enough.

So a page can actually increment a counter! I now have a first line of work.

But my callbacks will not a priori be in page marging boxes.
I am thinking of parallel vertical reminders reflecting the interweaving of sections, as I did on my manuscripts, of which I am attaching an extract here. (I am French and I am writing a series of mathematics books aimed at high school students with an approach that is fundamentally opposite to what is practiced in education.)
  1. Extract of my manuscripts_Page_1.png473.7 kB

Edited by BorisKa

howcome
Here's a small experiment using borders as vertical markers with rotated text:

https://www.princexml.com/howcome/2023/tests/brackets.html
https://www.princexml.com/howcome/2023/tests/brackets.pdf

Your next question is most likely how to show the rotated text on all/more pages. For this, you will probably have to use "multipass" to check if an element has been split over several pages:

https://www.princexml.com/doc/cookbook/#the-multi-pass-solution

Edited by howcome

BorisKa
Thank you very much, howcome, for this help which corresponds so well to what I wish to obtain!

Now I understand better how to do it.
I can now start making the first study models.

PS: Excuse me for not having replied immediately to your message but I was not available during these two days.

Edited by BorisKa