Auto numbering for Chapters and Appendix

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
WebHelpppp
Propeller Head
Posts: 78
Joined: Thu Jul 17, 2014 8:08 am

Auto numbering for Chapters and Appendix

Post by WebHelpppp »

In the project I inherited it has auto numbering for chapters that displays like this:

Chapter 1: XXXXXXX

Code:
<h1 style="mc-auto-number-format: 'CH:Chapter {chapnum}: ';" MadCap:autonum="Chapter 1: "> Chapter Topic Template</h1>

I need to also do this for the Appendix so it looks like this:

A: XXXX
B: XXXX
etc.

I tried the following and it displayed as zero not alphabetical:
<h1 style="mc-auto-number-format: 'GH:Appendix {A}: ';" MadCap:autonum="Appendix A: ">Test 1</h1>
Any idea what's wrong?
Last edited by WebHelpppp on Tue Jan 13, 2015 9:58 am, edited 1 time in total.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Auto numbering for Chapters and Appendix

Post by kwag_myers »

Probably the easiest way is to open the CSS in Text Editor (from the context menu), copy the h1 style and name it h1.a. Delete the mc-auto-number-format line and add this:

Code: Select all

h1.a:before
{
	content: 'Appendix 'counter(item, upper-alpha)': ';
	counter-increment: item;
}
The h1.a style will show in the Styles menu (Home tab), so you can apply it to the Appendix headers.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
WebHelpppp
Propeller Head
Posts: 78
Joined: Thu Jul 17, 2014 8:08 am

Re: Auto numbering for Chapters and Appendix

Post by WebHelpppp »

I copied the block of code and pasted it into the stylesheet and it doesn't display in the available styles list. When I deleted the code ":before" from "h1.a:before", it displays in the style list.
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Auto numbering for Chapters and Appendix

Post by Nita Beck »

Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
WebHelpppp
Propeller Head
Posts: 78
Joined: Thu Jul 17, 2014 8:08 am

Re: Auto numbering for Chapters and Appendix

Post by WebHelpppp »

Thanks, I found a post that pointed me to the solution:

To display: Appendix A: Title

Inline code: <h1 style="mc-auto-number-format: 'GH:Appendix {A+}: '" MadCap:autonum="Appendix A: ">Title</h1>

So, I've been able to create a class and apply the style so I now have 2 ways to make it work, but I still have not been able to get the page numbering to work. I am trying to get it to display as follows:
A - 1, A-2, etc.

?????
Last edited by WebHelpppp on Tue Jan 13, 2015 12:51 pm, edited 1 time in total.
kwag_myers
Propellus Maximus
Posts: 810
Joined: Wed Jul 25, 2012 11:36 am
Location: Ann Arbor, MI

Re: Auto numbering for Chapters and Appendix

Post by kwag_myers »

On the PageLayout for your Appendix, add the A - before the PageNumber Variable:
AppendixPgNo.png
You do not have the required permissions to view the files attached to this post.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
jasonsmith
Sr. Propeller Head
Posts: 205
Joined: Wed Apr 28, 2010 2:51 am

Re: Auto numbering for Chapters and Appendix

Post by jasonsmith »

Adding a hard-coded A- to your page layout won't help you if you have more than one Appendix! To add the chapter number to page numbers enter Reset to: {chapnum}‑{n} and select Format > text in the Page Number section of the TOC Properties Printed Output page.
Rene Severens
Sr. Propeller Head
Posts: 210
Joined: Mon Sep 19, 2011 2:06 am
Location: Netherlands - Zoetermeer
Contact:

Re: Auto numbering for Chapters and Appendix

Post by Rene Severens »

Hi,

I use the next styles in the used style sheet:

h1.appendix
{
margin-bottom: 17mm;
margin-top: 17mm;
font-family: Roboto;
font-size: 30pt;
color: #e37222;
mc-auto-number-offset: 40mm;
mc-auto-number-format: 'GM:Appendix {A+}
';
}

h1
{
font-family: Roboto;
font-size: 30pt;
font-weight: bold;
color: #e37222;
margin-left: 0mm;
margin-top: 17mm;
margin-bottom: 17mm;
mc-auto-number-offset: 40mm;
mc-auto-number-position: outside-head;
mc-auto-number-format: 'GH:{n+}. ';
}

h2
{
font-family: Roboto;
font-size: 18pt;
font-weight: bold;
margin-left: 0mm;
margin-top: 6mm;
mc-auto-number-offset: 40mm;
mc-auto-number-position: outside-head;
mc-auto-number-format: 'GH:{n}.{n+} ';
page-break-after: avoid;
margin-bottom: 1mm;
}

h2.appendix
{
margin-top: 7mm;
margin-bottom: 1mm;
page-break-after: avoid;
font-size: 18pt;
font-weight: bold;
font-family: Roboto;
mc-auto-number-offset: 40mm;
mc-auto-number-position: outside-head;
mc-auto-number-format: 'GM:{A}.{n+} ';
}

h3
{
font-family: Roboto;
font-size: 15pt;
font-weight: bold;
margin-top: 6mm;
margin-left: 0mm;
margin-bottom: 1mm;
mc-auto-number-offset: 40mm;
mc-auto-number-position: outside-head;
mc-auto-number-format: 'GH:{n}.{n}.{n+} ';
page-break-after: avoid;
}

h3.appendix
{
font-size: 15pt;
font-weight: bold;
margin-top: 6mm;
page-break-after: avoid;
font-family: Roboto;
mc-auto-number-offset: 40mm;
mc-auto-number-position: outside-head;
mc-auto-number-format: 'GM:{A}.{n}.{n+} ';
mc-heading-level: 0;
}

Which results in

chapters

1 Title
1.1 Title
1.1.1 Title
1.1.2 Title
2 Title
2.1 Title
2.2 Title
2.2.1 Title
2.2.2 Title

Appendix A
Title

A.1 Title
A.1.1 Title
A.1.2 Title

Appendix B
Title

B.1 Title
B.1.1 Title

Apendix C
Title

C.1 Title
C.1.1 Title
C.1.2 Title
C.2 Title

Etc.

and have all topics starting with <h1> only (appendices start with <h1> also but with styleclass h1.appendix) and then in the Target - tab Advanced, checked "Use TOC depth for heading levels" and I use the positioning in the TOC editor and put the topics at the correct level so the headings are applied accordingly.

Note for the h1 style

mc-auto-number-format: 'GM:Appendix {A+}
';

These two lines must be edited by opening the stylesheet for example in Notepad, because I found no option to do this inside the stylesheet editor of Flare.

Hope this helps.

Greetings,
Rene severens
"The numbers are strange today; they somehow do not seem to add up."
WebHelpppp
Propeller Head
Posts: 78
Joined: Thu Jul 17, 2014 8:08 am

Re: Auto numbering for Chapters and Appendix

Post by WebHelpppp »

Thank you to everyone for your comments! I ended up with the book properties for Appendix:

Printed Output tab > Page Number Reset to: {chapnum}-{n} or some projects use: Appendix {chapnum} - {n}

and then the piece I was missing :) :

Auto-numbers tab > Chapter Number > Reset to: A Format: Alpha

CSS:
h1.Appendix
{
mc-auto-number-format: 'O:Appendix {A+}:{ =0} ';
}
Post Reply