PDF TOC nth level appearing as top-level in output

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

I have an HTML TOC that I'm repurposing to single source PDF output. I have inserted chapter breaks etc and they are all working nicely.

I have "Use TOC depth for heading levels" turned on and all my topics start with H1 with H2s (and lower) within the topics.

My TOC goes quite deep - down to about 8 levels. My CSS has upto H9 defined with everything from H5-H9 having "mc-heading-level: 0;" set. I've also tried setting "toc-depth" but that doesn't make any difference because level 7 TOC H1 is being treated as H1 instead of H7.

However sometimes - for no good reason that I can see an H1 from a topic at level 7 (or 8 or 9) of the TOC gets put into the PDF as H1. I can't figure out why Flare is treating these really deep topics H1 differently from higher up H1s and not using their TOC depth to set the heading style to H7, H8, H9.

The subsequent H2 ends up being under the H1 from deep level 7 TOC item!

Anyone got any ideas? I've had a read around the forums and can't find anything quite like this - similar issues but for me the "Use TOC depth.." is working for upper TOC levels just not deep ones.

help!
Ruth
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: PDF TOC nth level appearing as top-level in output

Post by Msquared »

You haven't set a chapter break on the TOC entry for that topic by any chance? I know that should just increment the numbering, not pull it back up to level 1, but since the reason isn't obvious, it's worth checking everything.
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
dorcutt
Sr. Propeller Head
Posts: 234
Joined: Thu May 15, 2014 12:16 pm

Re: PDF TOC nth level appearing as top-level in output

Post by dorcutt »

I noticed that the headers in the default "Advanced" template only goes up to h6, which is the exact cutoff where your heading styles stop working. I wonder if h7-9 aren't fully supported or are just buggier possible?
-Dan, Propellerhead-in-training
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

Re: PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

Hi guys

Thanks for the fast responses/ideas!

No, no chapter or page breaks anywhere around and I've added h7-h9 to my css so I can't think of a good reason why it _should_ be limited by that...

I've opened a support call cos I got so frustrated, I'll post a reply if I get a solution.

Thanks!
Ruth
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

Re: PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

OK, fresh eyes this morning and I've tried a few work arounds.

Since my level 7 H1 is insisting on displaying as H1 I've created a new CSS class: H1.hide. This is styled to look like H7 and has its mc-heading-level at 0 so its not in the TOC or PDF bookmarks:

Code: Select all

	h1.hide
	{
		mc-heading-level: 0;
	font-size: 100%;
	color: #000000;
	font-style: normal;
	font-family: Calibri, Sans-Serif, Arial;
		border-bottom-width: 0px;
	}
Then I've applied this to any topic heading that was spuriously appearing at the top of the TOC.

This means that the level 7 topic heading is still strictly a H1, I've just disguised it. Not a nice workaround because now I have to got through all my TOCs and manually apply this to every topic deeper than level 6!

I've got a Flare 10 install on a test VM (trying to get an upgrade) so I'll see if I get the same behaviour there....
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: PDF TOC nth level appearing as top-level in output

Post by NorthEast »

Setting anything on h7-h9 won't work because they don't exist in HTML; only h1-h6 are valid HTML tags (http://www.w3schools.com/html/html_headings.asp).

If you don't want sub-headings h2 (-h6) appearing in the target, perhaps try this method that I use:

Code: Select all

	h2, h3, h4, h5, h6
	/* Don't include headings h2-h6 in TOC */
	{
		mc-heading-level: 0;
	}

	h1
	{
		mc-heading-level: 1;
	}

	h1.NotTOC
	/* Don't include heading in TOC */
	{
		mc-heading-level: 0;
	}

	h1.TOC2
	{
		mc-heading-level: 2;
		mc-disabled: true;
	}

	h1.TOC3
	{
		mc-heading-level: 3;
		mc-disabled: true;
	}

	h1.TOC4
	{
		mc-heading-level: 4;
		mc-disabled: true;
	}

If you use this with the 'Use TOC depth..' setting in the target, you will get a print TOC that only includes the main h1 headings from your topics; any sub-headings h2-h6 are not included.

The example just goes to 4 levels, but you would use the same technique to go to 9 levels.

Note that your topics just need a plain h1 heading; don't manually apply the h1.TOCx styles in your topics (which is why I disable them), they're just used for the output.

You can use the h1.NotTOC for any headings you don't want in the print TOC.

Also, you can't use this if you have set a 'master stylesheet' in the target, it must be set to (default) ; there's a bug in Flare interferes with custom mc-heading-level styles when a master stylesheet is used.
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

Re: PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

Hi Dave

Ahh HTML heading levels explains it all! grrrr

This was my starting point - without the custom TOC styles. I've got a topic with H1 that is at the 7th level and this is showing at H1 level in the TOC and bookmarks and with that styling. My original CSS was:

Code: Select all

h4
	{
		mc-heading-level: 4;
	}

	h5
	{
		mc-heading-level: 0;
	}

	h6
	{
		mc-heading-level: 0;
	}
I've changed this to:

Code: Select all

h3.hide
	{
		mc-heading-level: 0;
	font-size: 100%;
	color: #000000;
	font-style: normal;
	font-family: Calibri, Sans-Serif, Arial;
	}
	
	h2.hide
	{
		mc-heading-level: 0;
	font-size: 100%;
	color: #000000;
	font-style: normal;
	font-family: Calibri, Sans-Serif, Arial;
	}
	
	h1.hide
	{
		mc-heading-level: 0;
	font-size: 100%;
	color: #000000;
	font-style: normal;
	font-family: Calibri, Sans-Serif, Arial;
		border-bottom-width: 0px;
	}

	h4
	{
		mc-heading-level: 4;
		toc-depth: 4;
	}

	h5
	{
		mc-heading-level: 5;
		toc-depth: 5;
	}
	
	h6
	{
		mc-heading-level: 0;
		toc-depth: 0;
	}
This way I get my deep TOC H1s to look like H6 and I get everything down to H5 in the TOC and in the bookmarks. I think this is analogous to your suggestion.

What is "mc-disabled" by the way?

I was hoping to avoid having the do extensive manual application of custom print styles but it sounds like that's just going to have to be my reality.
Luckily this help set is mature and so I won't have to manage addition of extra levels of TOC that could mess up my custom styles.

I'm surprise that after H6 is reached any further deeper TOC items' headings aren't handled more elegantly. This is going to be laborious but what the customer wants the customer gets!

thanks
Ruth
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: PDF TOC nth level appearing as top-level in output

Post by NorthEast »

ruthhoward wrote:This way I get my deep TOC H1s to look like H6 and I get everything down to H5 in the TOC and in the bookmarks. I think this is analogous to your suggestion.
Not really, in my CSS example, only the main h1 heading in each topic is included in the print TOC.

I don't like using h2-h6 for mc-heading-level, because it means sub-headings within a topic will also be included in the print TOC, and will be mixed together with the main h1 headings of other topics. My method means the print TOC will only show the main h1 topic headings, so it looks like the TOC you set up in the TOC editor. It also means I never have to manually apply a heading style (apart from the h1.NotTOC).
ruthhoward wrote:What is "mc-disabled" by the way?
It hides the style from the styles list (and stylesheet editor), so it prevents people from accidentally applying these styles in a topic.
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

Re: PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

Hi Dave
My method means the print TOC will only show the main h1 topic headings, so it looks like the TOC you set up in the TOC editor.
but not for TOC items below level 6 - for those you need to apply h1.NotTOC right? what does you h1.NotTOC look like in the PDF content for items deeper than level 6 of the TOC? without setting the style override in my h1.hide style mine just looks like H1 even if it is hidden from the TOC and bookmarks.

Similarly without h2.hide subsections of topics with h2 styling which would end up as lower than h6 are styled as h2 and appear in the PDF TOC and bookmarks at the H2 level. So I think I'll have to keep my h1,h2,h3.hide styles.

I think I've got it now. Will try these changes...

[later]
OK, the deep TOC items are behaving now but I'm only getting 3 levels of bookmarks because my corporate standard CSS has:

Code: Select all

	h4
	{
		mc-heading-level: 0;
	}

h5
	{
		mc-heading-level: 0;
	}

h6
	{
		mc-heading-level: 0;
	}
any idea on how to override that without setting the mc-heading-level to something else? we're not meant to edit the corporate CSS in our projects (I'm the template holder so if all else fails I'll make an exception for myself!)

thanks
Ruth
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: PDF TOC nth level appearing as top-level in output

Post by NorthEast »

ruthhoward wrote:but not for TOC items below level 6 - for those you need to apply h1.NotTOC right?
No, the print TOC will just display the number of levels according to the styles that I set up in my CSS.
My example goes to h1.TOC4, so will produce a print TOC with 4 levels.
If I wanted a print TOC with 9 levels, I would add extra styles up to h1.TOC9 { mc-heading-level: 9; }

I only apply h1.NotToc in special circumstances, e.g. the title of the Contents page.

In the source, all my headings are h1.
In the output, Flare modifies the headings according to mc-heading-level; so they will be h1 (first level), h1.TOC2 (second), h1.TOC3 (third), etc.

What might be different is that I want all the h1s in the PDF to look the same; i.e. I don't want a main topic heading to look like a sub-heading.
I don't see the point in modifying the visual style of the h1s (e.g. to a smaller font size), because the reader isn't going to distinguish between 8 or 9 different heading styles, or recognise when a heading is a sub-heading or a new topic.

Anyway, that's just how I do it - I prefer a zero-effort approach!
ruthhoward wrote:any idea on how to override that without setting the mc-heading-level to something else? we're not meant to edit the corporate CSS in our projects (I'm the template holder so if all else fails I'll make an exception for myself!)
I produce a shared corporate template/CSS, and the CSS file looks like this.

Code: Select all

@import url('main.css');
@import url('custom.css');
Where main.css is a fixed stylesheet (it's imported and can't be edited), and custom.css is individual to that project.

That means if a project needs any additions/modifications to the CSS, they can be included in custom.css.
ruthhoward
Sr. Propeller Head
Posts: 121
Joined: Tue Jul 24, 2012 12:38 am

Re: PDF TOC nth level appearing as top-level in output

Post by ruthhoward »

I produce a shared corporate template/CSS, and I have a line like this at the top of the main CSS file.

Code: Select all
@import url('custom.css');

That means if a project needs any additions/modifications to the CSS, they can be included in a file named custom.css in the same folder.
yes I have one of those too, but I assume that if the parent CSS has

Code: Select all

   h4
   {
      mc-heading-level: 0;
   }
I can't override that in the linked CSS to unset it completely. I would have to add to custom.css something like:

Code: Select all

   h4
   {
      mc-heading-level: 4;
   }
but that doesn't overcome the issue because what I want is to let Flare decide the heading level. Just wondered if you knew some magic there!

back to the TOC

I think the difference between our projects is that I have lower heading levels within topics and I do want to modify the appearance of headings in the body. I agree that there's no real visual indicator between h6 and h7 for example but the PMs requirements are what they are and I can see his point. I'm taking an HTML5 TOC and repurposing it to also be used for PDF generation. The HTML5 has keyword topics which might only be 6 lines long - so in HTML5 each is a separate TOC item and H1 at the top looks fine, but in a PDF that leads to a very cluttered look with 4 H1s on a single page for example.

I think I've achieved the behaviour I want now so thanks for all your advice

Cheers
Ruth
Post Reply