Auto-number margin problems for short vs long numbers, PDFs

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
bwofficer
Propeller Head
Posts: 57
Joined: Tue May 12, 2020 2:16 am

Auto-number margin problems for short vs long numbers, PDFs

Post by bwofficer »

My print output style for product notes applies auto-numbering to h2 and h3 headings. h2 is numbered 1, 2, 3... etc. and h3 is numbered n.1, n.2, n.3... etc. (where n is the h2 number).

I've written the CSS and the output looks just fine until the h2 or h3 numbers reach 10. Then the extra digit causes the heading number to bump into the heading text or in extreme cases even to write over the top of it.

I've attached an annotated screenshot of the built PDF target to show what I mean.

Is there a way that I can force the heading text to move right - ideally by a controlled amount - when the number part of the heading gets too long for the space allocated for it?

I DON'T want to simply add more left margin to ALL h2 and h2 instances, as that means the white space would be too large to be visually pleasing for single digit h2 numbers and two-digit h3 numbers. I only want the extra white space to come into play when it's needed.

Here's the current CSS from my stylesheet.

h2 {
font-size: 14pt;
font-weight: bold;
text-transform: uppercase;
color: var(SenconBlue);
margin: 24pt 0 0 0.5cm;
/* Autonumbering: plain old 1, 2, 3, etc. NOT 1.1 as it would be if h1 was chapter h */
mc-auto-number-format: 'GH:{n+}';
mc-auto-number-position: outside-head;
mc-auto-number-offset: 0.5cm;
}
h3 {
font-size: 12pt;
font-weight: bold;
text-transform: uppercase;
color: var(SenconBlue);
/* Autonumbering: 1.1, 1.2, 1.3, etc. */
mc-auto-number-format: 'GH:{n}.{n+}';
mc-auto-number-position: outside-head;
mc-auto-number-offset: 0.75cm;
margin: 18pt 0 0 0.75cm;
}
You do not have the required permissions to view the files attached to this post.
Matt Harris
Jr. Propeller Head
Posts: 3
Joined: Sun Apr 03, 2022 6:12 pm

Re: Auto-number margin problems for short vs long numbers, P

Post by Matt Harris »

I had the same problem. The solution was to use 'float-left' for the mc-auto-number-position attribute:

Code: Select all

mc-auto-number-position: float-left;
bwofficer
Propeller Head
Posts: 57
Joined: Tue May 12, 2020 2:16 am

Re: Auto-number margin problems for short vs long numbers, P

Post by bwofficer »

Matt Harris wrote:I had the same problem. The solution was to use 'float-left' for the mc-auto-number-position attribute:

Code: Select all

mc-auto-number-position: float-left;
Yes, that's what I ended up doing.

In full, my solution ended up as:

Code: Select all

h2 {
	font-size: 14pt;
	font-weight: bold;
	text-transform: uppercase;
	margin: 24pt 0 0 0.2cm;
	mc-auto-number-format: 'GH:{n+}';	/* autonumber as 1, 2, 3... (h1 being unnumbered) */
	mc-auto-number-position: float-left;
	mc-auto-number-class: h2Num;
}
span.h2Num {
	font-weight: normal;
	text-align: right;
	width: 1.0cm;
	margin-left: -0.7cm;
	padding-right: 0.2cm;
}
Post Reply