Avoid page break after headings

This forum is for all Flare issues related to styles, stylesheets and XML.

Avoid page break after headings

Postby andy_smith on Wed May 11, 2022 6:04 am

I’m looking for the stylesheet code to set a heading to keep with next so that the heading doesn’t appear at the bottom of a page and instead stays with the following paragraph on the next page.

I’ve found this but it doesn’t seem to work: page- page-break-after: avoid;

I also found a note that it’s now been replaced by: break-after: avoid;
but that didn’t seem to work either.

Does anyone have any ideas? I’ve put it both in the normal headings and in the @media print headings (my targets are all PDFs) but nothing seems to work.
andy_smith
Propeller Head
 
Posts: 14
Joined: Wed Jun 16, 2021 5:41 am

Re: Avoid page break after headings

Postby sarrantsvt on Wed May 11, 2022 11:23 am

As far as I know, you can say avoid, but you can't say never. There's no "keep-with-next" like there is in Word. You could wrap the hed and the following para in a DIV -- maybe something like:
Code: Select all
div.keeptogether
{
   page-break-after: avoid;
   page-break-inside: avoid;
}


Sometimes you just have to look at it after generating the target and then go back and put an explicit page break (Insert > Text > Page Break) before the element to keep it with the following.
sarrantsvt
Propeller Head
 
Posts: 20
Joined: Mon Jun 28, 2021 8:02 am

Re: Avoid page break after headings

Postby andy_smith on Thu May 12, 2022 1:18 am

Hi, thanks for the reply.

Hard page breaks are what I've been using but because I'm single sourcing the with a lot of conditional text the page breaks appear at different points for different targets. I had considered wrapping it in a div before I did my intermediate Flare training, which is where I heard there was a page break avoid option. I might have to try that after all.

One thing that I did wonder is that the instance that is being really stubborn is where an image is immediately after a heading so I was wonderring if the code only works with text. I was going to experiment further but I'd already sunk too much time into it.

Thanks for your thoughts, I'll keep trying and report back if I discover anything.
andy_smith
Propeller Head
 
Posts: 14
Joined: Wed Jun 16, 2021 5:41 am

Re: Avoid page break after headings

Postby sarrantsvt on Thu May 12, 2022 6:05 am

andy_smith wrote:One thing that I did wonder is that the instance that is being really stubborn is where an image is immediately after a heading so I was wonderring if the code only works with text. I was going to experiment further but I'd already sunk too much time into it.


You can include the img in a div as well as text content, if that is what you are asking.
sarrantsvt
Propeller Head
 
Posts: 20
Joined: Mon Jun 28, 2021 8:02 am

Re: Avoid page break after headings

Postby ChoccieMuffin on Fri May 13, 2022 2:16 am

If you can share the code for that section (the heading followed by the image) we might be able to help.

A few questions for you:

1. Is the image just too big (long) to fit on the page with the heading as well? If you temporarily make the image smaller, does the topic work as you want it to?
2. Do you have page-break-after: avoid; applied to the paragraph that contains the image? If so, Flare has to try to work out for itself where to put a break, and sometimes it doesn't come to the same conclusion as a human would.

Let us see the code and we can try to help.
Started as a newbie with Flare 6.1, now using Flare 2019r1 and 2021 latest.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2540
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK


Return to Styles, Stylesheets and XML

Who is online

Users browsing this forum: No registered users and 11 guests