Potential style class confusion with "Use TOC depth..."

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Potential style class confusion with "Use TOC depth..."

Post by FrankyT »

Not a question, but a tip...

If you select "Use TOC depth for heading levels" in the PDF target, remember that any element-specific style classes that you reference in each heading must be specified for the next heading level down if you want them to be implemented in PDF output.

I had defined a class h1.pageBreakBefore, with page-break-before set to "always". I couldn't work out why the page breaks weren't appearing in PDF output. What I needed to do was to make a copy of h1.pageBreakBefore as h2.pageBreakBefore. You'll gather that the h1.pageBreakBefore class was in fact redundant.

So although the source looks like this -

<h1 class="pageBreakBefore">A Nice Heading for Ya</h1>

- the class that it's referencing is actually h2.pageBreakBefore. If there is no such class, you will get no styles. Confusing for the uninitiated.

Just to reiterate: This is only an issue if you select "Use TOC depth for heading levels" in the PDF target.
Last edited by FrankyT on Thu Aug 16, 2012 2:15 am, edited 1 time in total.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Potential style class confusion with "Use TOC depth..."

Post by LTinker68 »

FrankyT wrote:I had defined a class h1.pageBreakBefore, with page-break-before set to "always". I couldn't work out why the page breaks weren't appearing in PDF output. What I needed to do was to make a copy of h1.pageBreakBefore as h2.pageBreakBefore. You'll gather that the h1.pageBreakBefore class was in fact redundant.
Alternatively, you could create a generic class. That will work with most any tag, so if you have the "Use TOC depth..." option enabled, then it won't matter if it changes from h1 to h2, because you're using a generic class which will work with both h1 and h2. Unfortunately, there's (still) no easy way to create a generic class via the Stylesheet Editor. To make the class generic, open the stylesheet file in the Internal Text Editor, and in this case, delete the h1 or h2 and leave the period followed by the class name. So instead of h1.pageBreakBefore, it would be .pageBreakBefore. (Note: Once the generic class is created manually, you can thereafter edit it in the Stylesheet Editor.)

You'll see this generic class appear in your Styles pane pretty much all the time, so you can apply it to paragraphs, list items, DIVs, etc.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Re: Potential style class confusion with "Use TOC depth..."

Post by FrankyT »

Lisa - thanks, and yes, I was aware that one can create generic classes. For neatness's sake, I wanted to restrict this class to the element for which I created it - although in this case neatness was arguably a lost cause.

I just wanted to highlight the issue really. I was confused for a couple of hours and figured other people might be.
Post Reply