Page 1 of 1

How to avoid page breaks between some chapters?

Posted: Fri Dec 13, 2019 10:30 am
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?

Re: How to avoid page breaks between some chapters?

Posted: Fri Dec 13, 2019 3:55 pm
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

Re: How to avoid page breaks between some chapters?

Posted: Fri Dec 13, 2019 4:06 pm
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

Re: How to avoid page breaks between some chapters?

Posted: Fri Dec 13, 2019 5:17 pm
by DmitryS
Dan, Costin, thanks a lot!
It hepls and works.

Sincerely,
Dmitry