Page 1 of 1

PDF: H4s being rendered the same as H1

Posted: Wed Apr 11, 2018 4:22 am
by oceanclub
We have a stylesheet with headings 1 to 6 set up as normal. But we're seeing a problem where H4 is "reset" to H1 - that is, in the resulting PDF, it appears with the same font size and at the same level as the H1 heading, even though it's defined differently in the stylesheet.

Here's a screenshot from the PDF bookmarks:

Image

And here's a short of an example topic rendering in PDF. Not that Heading 1 and Heading 4 have the same numbering and font size:

Image

I'm using "TOC Depth for Heading Levels" which is why H1 above is starting at what looks a H4. Note it's _ONLY_ in this situation that this problem occurs. If I create a dummy guide with a topic at the root of the folder using these styles, for example, they appear as expected. It's only when "TOC Depth for Heading Levels" and the topic containing H1 to H6 is at a level where, say, a H1 is rendered as a H4, etc.

Here's the stylesheet itself, or at least the parts defining the headings. Any help is appreciated!

Paul

Code: Select all

h1,
h2,
h3,
h4,
h5,
h6,
h7
h8
{
	margin-left: 0pt;
	color: #FC4C02;
	font-weight: bold;
	word-wrap: none;
	page-break-inside: avoid;
	page-break-after: avoid;
	mc-auto-number-offset: 50pt;
	mc-auto-number-position: outside-head;
	mc-hyphenate: never;
}

h1
{
	margin-top: 60pt;
	font-size: 26pt;
	page-break-before: always;
	mc-heading-level: 1;
	mc-auto-number-format: 'CH:{n+}   ';
}

h1.indexheading
{
	margin-top: 60pt;
	font-size: 26pt;
	page-break-before: always;
	mc-heading-level: 1;
	mc-auto-number-format: '';
}

h2
{
	margin-top: 15pt;
	font-size: 18pt;
	mc-heading-level: 2;
	mc-auto-number-format: 'CH:{n}.{n+}   ';
}

h3
{
	margin-top: 10pt;
	font-size: 16pt;
	mc-heading-level: 3;
	mc-auto-number-format: 'CH:{n}.{n}.{n+}   ';
}

h4
{
	margin-top: 7pt;
	font-size: 14pt;
	mc-heading-level: 4;
	mc-auto-number-format: 'CH:{n}.{n}.{n}.{n+}   ';

}

h5
{
	mc-heading-level: 5;
	mc-auto-number-format: 'CH:{n}.{n}.{n}.{n}.{n+}   ';
	font-size: 12pt;
	margin-top: 7pt;
	letter-spacing: -1px;
}
h6
{
	mc-heading-level: 6;
	mc-auto-number-format: 'CH:{n}.{n}.{n}.{n}.{n}.{n+}   ';
	font-size: 11pt;
	margin-top: 7pt;
	letter-spacing: -1px;
}

h7
{
	mc-heading-level: 7;
	mc-auto-number-format: 'CH:{n}.{n}.{n}.{n}.{n}.{n}.{n+}   ';
	font-size: 11pt;
	margin-top: 7pt;
	letter-spacing: -1px;

}
h8
{
	mc-heading-level: 8;
	mc-auto-number-format: 'CH:{n}.{n}.{n}.{n}.{n}.{n}.{n}.{n+}   ';
	font-size: 11pt;
	margin-top: 7pt;
	letter-spacing: -1px;
}

Re: PDF: H4s being rendered the same as H1

Posted: Wed Apr 18, 2018 5:18 am
by devjoe
This is what "TOC Depth for Heading Levels" means. The levels of the headings at the start of each topic are adjusted to match the indentation levels of their TOC entries. These headings adopt the styling of the heading styles they become.

Re: PDF: H4s being rendered the same as H1

Posted: Wed Apr 18, 2018 5:27 am
by NorthEast
Your CSS isn't valid, so I'd suggest fixing that.

(1) First h7 and h8 don't exist in HTML, only h1 to h6. So you need to remove (or change) the CSS for h7 and h8. You could create classes on the heading levels, if you really need 8 heading levels.

(2) In this CSS, you missed a comma after h7. (Not that h7 and h8 exist, but it means the CSS won't be parsed properly.)

Code: Select all

h1,
h2,
h3,
h4,
h5,
h6,
h7
h8
{
   margin-left: 0pt;
   ...

Re: PDF: H4s being rendered the same as H1

Posted: Wed Apr 18, 2018 5:30 am
by oceanclub
Hi - yes indeed what was happening was that if one uses "TOC Depth for Heading Levels" and then this causes a heading to get promoted to a heading style that doesn't exist (for example, a H4 is "promoted" to a H7), then the heading is rendered as a H1.

There's no real solution to this other than restructuring one's documentation to avoid this.

P.