Want to prevent page break before H3, but can't

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Want to prevent page break before H3, but can't

Post by Cecily »

Long time since I last posted here. Now getting back to Flare, with PDF and HTML5 outputs, using Flare 2018 v2 on Windows 10 PC.

The first PDF is a QSG. I don't want page breaks before the heading 3s, but I can't switch them off.

I've edited the style in the css, so page-break-before is "avoid".

When that didn't work, I tried applying it to the individual headings. There are only five in this doc, so that's OK in this instance, though it wouldn't be viable in longer docs. But it didn't work anyway - except for one of the five.

The paragraphs before and after (ordinary p or ol styles) have their breaks set to "default", so I don't think they should be affecting it.

What else should I try? Where should I look?
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Want to prevent page break before H3, but can't

Post by ChoccieMuffin »

Can you post the CSS for headings in the medium you use for your QSG? Also, if you're doing other PDFs that you DO want to have a page break before, you might find you need to have another medium in your stylesheet to take account of any minor differences between the main UG settings and the QSG settings.

The setting I'm interested in is "page-break-before". I have a few generic styles that I apply when I need to (rather than using inline styles). Here they are, in case these are of any use:

Code: Select all

	.KeepWithNext
	{
		page-break-after: avoid;
		page-break-before: auto;
		page-break-inside: auto;
		column-break-after: auto;
	}

	.KeepWithPrevious
	{
		page-break-inside: auto;
		column-break-after: auto;
		page-break-after: auto;
		page-break-before: avoid;
	}

	.KeepTogether
	{
		page-break-inside: avoid;
		page-break-before: auto;
		page-break-after: auto;
		column-break-after: avoid;
	}

	.PageBreakBefore
	{
		page-break-before: always;
		column-break-after: auto;
		page-break-after: auto;
		page-break-inside: auto;
	}
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Re: Want to prevent page break before H3, but can't

Post by Cecily »

There's no "KeepWithNext" or similar anywhere in the css. The definitions for h3 are below. (And although this is my first PDF in this project, I won't ever want a forced page break before h3s in future.)

h3
{
color: #fa0a54;
page-break-before: avoid;
page-break-after: avoid;
page-break-inside: avoid;
}

h3.Heading3
{
page-break-after: avoid;
page-break-before: avoid;
page-break-inside: avoid;
margin-top: 17pt;
margin-bottom: 9pt;
mc-heading-level: 3;
font-weight: bold;
color: #fa0a54;
border-left-width: 0pt;
border-top-width: 0pt;
font-size: 14pt;
}
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Want to prevent page break before H3, but can't

Post by ChoccieMuffin »

How very strange that your h3s don't just follow on, they certainly should...

A couple of things that have occurred to me. What comes AFTER the h3s that don't behave? If you have a long paragraph or a table immediately following and the paragraph or table css includes "page-break-inside: avoid;" then THAT could be what's forcing the heading onto a new page.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Re: Want to prevent page break before H3, but can't

Post by Cecily »

Good idea, but no. In each case, the paragraph immediately after the h3 is short, and when I double-checked the Breaks settings for the paragraphs, they're all (default), which is what I would expect. It's the same for each of the paragraphs immediately preceding the h3s. I imported from Word, but it all looks pretty clean when I look at it in Flare's text editor.
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
Nita Beck
Senior Propellus Maximus
Posts: 3669
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Want to prevent page break before H3, but can't

Post by Nita Beck »

I could be wrong, but I think that generally one should not define page-break-before: avoid and page-break-after: avoid on the same class. They seem to conflict to me.

What happens if, temporarily, you get rid of (or comment out) the page-break-before, page-break-inside, and page-break-after attributes in your h3 classes and build your PDF? Any difference? Worse, better?
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
devjoe
Sr. Propeller Head
Posts: 337
Joined: Thu Jan 23, 2014 1:43 pm

Re: Want to prevent page break before H3, but can't

Post by devjoe »

page-break-(somewhere): avoid IS effectively keep-with-next. It says "don't allow a page break to occur here if it's avoidable by moving something to another page."

When you put page-break-before, page-break-after, and page-break-inside on the same object, it means "keep this object all on one page, and don't let it be the first or last thing on that page."

This can lead to odd pagination if there is too much together to avoid the page breaks, and may lead to what you are seeing.
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Re: Want to prevent page break before H3, but can't

Post by Cecily »

Ah, that makes some sense, Nita and devjoe. Thanks. I'm less sure what I should change things to, but I'll experiment.

Edit:
I removed all the page-break elements from all the styles (except page-break-inside: avoid for notes which are in boxes).
I checked all the individual h3s are set to default. They were.
The result is I'm now getting all H3s starting on a new page (previously, one followed on), even when there's only a couple of lines on the previous page.
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Re: Want to prevent page break before H3, but can't

Post by Cecily »

Problem solved, but answer may be of use to others: this is a very short document and for lazy reasons, all the headings are h3, but in the TOC, they're top level. In the target's Advanced tab, I had "Use TOC depth for heading levels" selected, so Flare was effectively treating the h3s as h1s.

Solutions include:
* Deselect that option.
* Create an h1 class and an h3 class of the same name, and in the print medium format the new h1 class with the page-break-before:avoid property. In the content, apply the new h3 class to the h3s which you do not want breaking onto a new page.

I opted for the former - in this instance. In future, I'll use sensible headings and levels.
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
Post Reply