Formatting PDFs (and the index) with the stylesheet

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
bobmoon
Sr. Propeller Head
Posts: 259
Joined: Thu Mar 27, 2008 10:22 am
Location: Atlanta

Formatting PDFs (and the index) with the stylesheet

Post by bobmoon »

There is a very helpful post on customizing Flare-generated PDFs, particularly focusing on the index: Index problems.

If you're like garyjgeoaccess (and me), you may dive into your stylesheet to fix problems with how Flare generates PDFs. It works in a lot of instances, but there are some issues that can trip you up.

To summarize a few points:
  • When generating the index (and TOC), Flare puts them inside a table, which certainly affects what you can and cannot do with the stylesheet.
  • The elements in a stylesheet are indeed "cascading", and the settings for <p> will affect p.Index1 and p.IndexHeading. If you specify "margin-bottom:6pt" for your p tag, that will apply to p.IndexHeading unless you specify some other value for margin-bottom.
  • If you edit your stylesheet manually, you may be tempted to consolidate your attributes (such as "margin: 0in 0in 6pt 1.5in;"). Flare may not recognize this definition when generating, and it may cause erratic results. You may be better off breaking these into separate lines (margin-top, margin-right, and so on).
  • Even if you are a CSS guru, it helps to look at the Flare Stylesheet Editor. The Editor can reveal what default values Flare is applying for the attribute in question. For example, Flare applies a default value of "white-space: nowrap" for p.Index1, which means that index entries don't wrap. This default shows up in the Editor.
Sorry if this seems a bit scattershot. I'm trying to post these for myself so I won't forget them.

Bob
Last edited by bobmoon on Thu May 21, 2009 7:10 am, edited 1 time in total.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Formatting PDFs (and the index) with the stylesheet

Post by LTinker68 »

bobmoon wrote:If you edit your stylesheet manually, you may be tempted to consolidate your attributes (such as "margin: 0in 0in 6pt 1.5in;"). Flare may not recognize this definition when generating, and it may cause erratic results. You may be better off breaking these into separate lines (margin-top, margin-right, and so on).
Technically Flare handles consolidated code fine. So long as you don't then edit any of the individual attributes. For instance, if you have a consolidated margin tag with the settings shown above but then later decide that you want the left margin to be 1.0in, you might be tempted to edit just the left margin attribute. If you do, however, what you've actually done is change your stylesheet file to the following:

Code: Select all

p { 
     margin: 0in 0in 6pt 1.5in;
}

p {
     margin-left: 1.0in;
}
That is an acceptable way to insert code into a stylesheet file, but what may have happened is that the consolidated style set appears near the top of the stylesheet file (when viewed in the Internal Text Editor) but the single margin-left style block appears at the bottom of the stylesheet file (because it was added later), but you didn't see it because you were expecting Flare to change the consolidated style set so you didn't go to the end of the stylesheet file.

The problem is that Flare's Stylesheet Editor doesn't let you edit the margin tag as a consolidated style set -- you can only set all margins to the same amount, you can't type in the consolidated styles the way you should be able to, so once you enter a consolidated style set, you can't edit individual values unless you manually do so via the Internal Text Editor.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
garyjgeoaccess
Sr. Propeller Head
Posts: 148
Joined: Mon Feb 16, 2009 3:23 pm

Re: Formatting PDFs (and the index) with the stylesheet

Post by garyjgeoaccess »

Flare does indeed handle consolidated style attributes correctly in the topic stylesheet.

However ...

Flare does NOT handle consolidated style attributes correctly when compiling MadCapBlaze.css, which is used by the TOC and the index. Flare generates NEW styles on the fly by pulling attributes from inherited styles and it does NOT order these style attributes correctly if you've used consolidated style attributes in the styles that are being inherited, resulting in layout problems that can be VERY difficult to diagnose.

For example, when creating styles for the index, Flare will pull the margin attributes from the default P style (if you set these values in your topic stylesheet). If you consolidate margin attributes in the default P style like this "p {margin: 5pt 0pt 5pt 1.5in}", well, these margin attributes will be thrown into MadCapBlaze.css BELOW the margin-top, margin-right, etc. attributes that Flare is attempting to set for index elements. The result: Your index has major layout problems.
Post Reply