Repeating chapter titles at the top of each page

Post here questions and problems related to editing and publishing DITA content.
tech_writer
Posts: 2
Joined: Thu Feb 08, 2024 12:19 pm

Repeating chapter titles at the top of each page

Post by tech_writer »

Please have a look at the following (simplified) extract from my DITA bookmap:

Code: Select all

<chapter keyref="using_the_product">      
     <topicref keyref="topic1" outputclass="page-break-after"/>
     <topicref keyref="topic2"/>        
     <topicref keyref="topic3"/>        
</chapter>
(The keyrefs point to key definitions with filepaths, in a separate DITA map.)

Output is for PDF, with customisation via CSS.

I want the chapter titled "Using the product" to be split into 2 pages - topic1 on one page, with topic2 and topic3 on the next page.
But I would also like the title from the chapter (i.e. "Using the product") to appear at the top of the page that contains topic2 and topic3. Right now, it only appears at the top of the page containing topic1. (So I need it to be be sort of like having the header of the table repeated when the table entries extend into the following page.)

I would like this to be done as part of the main body text, instead of altering the header of the page which is already formatted to what I need.

Is there a way to achieve what I have in mind? I've done quite a lot of searching but can't find a suitable solution.

Thanks in advance for any advice.
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Repeating chapter titles at the top of each page

Post by julien_lacour »

Hello,

The only solution that came to me in mind is to duplicate the chapter in order to add the title again in the document:

Code: Select all

<chapter keyref="using_the_product">      
     <topicref keyref="topic1" outputclass="page-break-after"/>
</chapter>
<chapter keyref="using_the_product">
     <topicref keyref="topic2"/>        
     <topicref keyref="topic3"/>        
</chapter>
In this case the outputclass is not needed anymore, but the whole "using_the_product" topic will be duplicated, not only its title.

On the other side, for each chapter a string-set is used to store the chapter title and is displayed in the following chapter pages.

I hope I understood your requirement, if this is not the case you could send us a sample for analysis at support@oxygenxml.com.

Regards,
Julien
tech_writer
Posts: 2
Joined: Thu Feb 08, 2024 12:19 pm

Re: Repeating chapter titles at the top of each page

Post by tech_writer »

Hi Julien,
Thank you for your reply, you understood my question perfectly. Actually I've already tried what you suggested (but creating a shell topic instead with just "Using the product" as the title, so the rest of the text in "using_the_product" is not replicated), and then using that shell topic at the chapter level and placing topic2 and topic3 under it. Very similar to the code you posted.

But the issue with that approach is that the PDF output will show it as 2 separate chapters: one chapter with topic1, and another chapter after that with topic2 and topic3. This is reflected in the bookmarks section of the PDF too. Which in my opinion is not an ideal and clean solution since it's really one chapter :)... I though about using some CSS code (and an outputclass attribute on the shell topic) to hide the shell topic from showing up as a bookmark in the PDF, but that just didn't feel right so I didn't pursue that :).

Anyway, I think I'll just stick to the original code for now. Appreciate your help!
Post Reply