How to avoid page breaks between some chapters?

Post here questions and problems related to editing and publishing DITA content.
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

How to avoid page breaks between some chapters?

Post by DmitryS »

Hi!
I need to place some very short chapters on the same page. I see that chapter heading has a different behavior than topic heading, and

Code: Select all

*[class~="topic/topic"] > *[class~="topic/title"] {
    page-break-before:avoid;
}
doesn't work.
I tried to apply something like this:

Code: Select all

*:not([class ~= "map/chapter"])[outputclass ~= "no-page-break-before-chapter"] {
    page-break-before:avoid;    
}
but no result.
I 've found that p-chapters.css contains:

Code: Select all

*[class ~= "topic/topic"][is-chapter] {
	/* Each chapter starts a new page sequence, so the :first selector applies to each of them. */
     -oxy-page-group:start; 
     page: chapter; 
}
Does it affect?
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: How to avoid page breaks between some chapters?

Post by Dan »

Yes, the property to change is -oxy-page-group. You should set the value of "auto" to merge the current element with the opened chapter page sequence.

Code: Select all

*[class ~= "topic/topic"][is-chapter] {
	/* Each chapter starts a new page sequence, so the :first selector applies to each of them. */
     -oxy-page-group:start; 
     page: chapter; 
}
Many regards,
Dan
Costin
Posts: 828
Joined: Mon Dec 05, 2011 6:04 pm

Re: How to avoid page breaks between some chapters?

Post by Costin »

In addition to what Dan already suggested (setting the -oxy-page-group: auto), if you do not need all the topics in your publication to be continuous (if you need to remove the page breaks only for some specific chapters) you should also use the "outputclass" attribute.

More specific, in the DITA Map, you could set the outputclass="no-page-break-before-chapter" attribute on the topicrefs corresponding to the topics that you don't need to start on a new page, then slightly change the rule in your customization CSS to:

Code: Select all

*[class ~= "topic/topic"][is-chapter][class~="no-page-break-before-chapter"] {
     -oxy-page-group:auto;
     page: chapter; 
}
I hope this helps.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

Re: How to avoid page breaks between some chapters?

Post by DmitryS »

Dan, Costin, thanks a lot!
It hepls and works.

Sincerely,
Dmitry
Post Reply