How to get Chapter Number in TOC

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
ksoltys
Propeller Head
Posts: 73
Joined: Mon Oct 20, 2008 5:38 pm

How to get Chapter Number in TOC

Post by ksoltys »

I am working on getting my PDF output setup to match the current FrameMaker-generated output.

I don't use heading numbering in the PDFs, but I do use a chapter number, set up as a numbered paragraph called ChapterNumber. I have my TOC set up to display it in front of the TOC1 heading, like so.

1. This is Chapter 1 ........... 1
Heading 2 ................... 2
Heading 2 ................... 3

I can't figure out how to get the chapter number to appear in the TOC in Flare. What I have now looks like this:

This is Chapter 1 ............... 1
Heading 2 ................... 2
Heading 2 ................... 3

My chapter number autonumber is defined as C:{chapmum} in the autonumbering format.

In my p.TOC1 style, I have tried various combinations of autonumbering to reference that chapter number sequence but nothing I try works. Can anyone help?

Thanks
Keith
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How to get Chapter Number in TOC

Post by Nita Beck »

Hi Keith,

Are you saying that the chapters number don't appear in the TOC when you're viewing it in the TOC Editor or in the Contents/headings in your generated PDF?

If the former, you don't need to bother getting them to appear in the TOC. The TOC used for a PDF is really just an outline*. It tells Flare how to order and nest the topics in the PDF it generates. Flare doesn't use the language of the headings in the TOC for the headings of the chapters, sections, subsections in the PDF. Instead, the Contents of the PDF will use the topics' headings. So, for a PDF target, its TOC will show entries such as "Getting Started" and "Printing", but those topics will appear as "Chapter 2. Getting Started" and "Chapter 6. Printing" based on their location in the TOC. (I hope I'm being clear... it's late, and I've futzed with Flare all day.)

NOTE: What I just described is not true for a Help system. There, the TOC *is* more than an outline. It truly does show how items will appear on a generated Help system's Contents tab/accordion.

If you're not seeing the numbers in the Contents/headings in the generated PDF, can you drop in a screenshot of what the Contents look like in your PDF? I'm not sure off the top of my head what the problem might be.

Hope this helps (at least somewhat).

-------
* edited by doc-guy from "online" to "outline" for clarity on 2009-Dec-17.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How to get Chapter Number in TOC

Post by Nita Beck »

Hi again,

Having gotten a nice dinner and glass of wine in me, my mind is now clearer. I've got more ideas now!

In your TOC for the PDF target, have you defined the entries for the topics that begin each chapter with a chapter break? Right-click a topic in the TOC that is the first topic in the chapter and select Properties from the shortcut menu. On the Printed Output tab, make sure to check the "Start new chapter document" check box. Then select the page layout, page type, etc. Then go to the Auto Numbers tab and set the Chapter number options. If the topic is supposed to be the first chapter in your document, select the "Reset to" option and set it to "1". For all the subsequent chapters, you'll want to set it to "Continue from previous." That way, Flare will increment the number each time you define a TOC item as a chapter break.

Lastly, about the auto number themselves, here's an example of how I have my style for chapter headings defined. Notice the single quotation marks around the auto number. (I didn't see that in your auto number definition above. And besides, it's not the p.TOC1 style where you want to define the auto-number; its the heading style you want to apply to the heading of the topic that will begin a chapter, as in the h1 style I show below.)

h1.Chapter
{
mc-auto-number-format: 'Chapter {chapnum}. ';
}

This will yield language like "Chapter n. "

Is this getting you closer to a solution?
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
ksoltys
Propeller Head
Posts: 73
Joined: Mon Oct 20, 2008 5:38 pm

Re: How to get Chapter Number in TOC

Post by ksoltys »

To clarify, here's a screen capture from the PDF.
chapter_number.jpg
My chapter number is contained in a paragraph class p.ChapterNumber, which has the auto-number format set to C:Chapter {chapnum}. This seems to work OK. My h1.Heading 1 class does not have any autonumbering.

I thought I could modify the p.TOC1 style to pick up the chapter number from the p.ChapterNumber class but this doesn't seem to work.

If I put the chapter number in the heading tag, it does appear in the TOC. But it also appears in the heading, which is not what I want.

Is there any way of putting it in the heading autonumber so it gets picked up the the TOC, but not shown in the heading? Word has a switch to do this, but I can't see an equivalent in Flare.
You do not have the required permissions to view the files attached to this post.
jacortes
Propeller Head
Posts: 45
Joined: Thu Oct 16, 2008 1:11 pm

Re: How to get Chapter Number in TOC

Post by jacortes »

Keith,
I have the same issue. My pages display the Chapter number and headings the way I want, but the words "Chapter" and the number do not appear in the TOC. I can tell you I tried to alter the TOC1 style in my stylesheet to include an "Chapter {chapnum}" in the mc-auto-number-format property. That did not work.

I ultimately have resigned myself to typing the words "Chapter" and the number in the TOC directly in the PDF after it is generated. This is done using the Adobe Touchup Text tool. Not ideal. But it worked for me.
KGaetz
Propeller Head
Posts: 80
Joined: Thu Jul 26, 2007 8:12 am
Location: Boston, MA

Re: How to get Chapter Number in TOC

Post by KGaetz »

Here is a suggestion:

Create a new H1 style called h1.Chapter and set the numbering properties to be "Chapter {chapnum}. (If you don't want chapter numbers in your online Help, only set the numbering properties for the Print medium).

Use the new h1.Chapter for your chapter headers only and use h1 for your regular topic headings. Then you don't have to modify the TOC1 style at all. It will insert both styles using the TOC1 style.

I'm not sure if this will give you exactly what you want.
dtmenges
Propeller Head
Posts: 97
Joined: Tue Oct 28, 2008 6:38 am
Location: Goshen, IN
Contact:

Re: How to get Chapter Number in TOC

Post by dtmenges »

I have been working the same problem and have tried the previous solution. In the example by ksoltys on Mon Dec 07, the TOC results in something like this

Chapter 1...........................1
Getting Started....................1
Heading2.........................2

I am trying to arrive at the following solution:

Chapter 1: Getting Started...................1
Heading2.....................................2

In Framemaker printed output I just defined the TOC style for what would be H1.Chapter as a run-in. However, Flare doesn't seem to allow much of anything to be done with the TOC styles other than font and leader lines.

I could live with the following but can't figure out how to get rid of page numbers.

Chapter 1
Getting Started..................1
Heading2.........................2

So my question is what can you format in the TOCx styles and what is ignored?
ddiemetric
Propeller Head
Posts: 59
Joined: Mon Nov 24, 2008 12:31 pm
Location: Is it Spring yet?

Re: How to get Chapter Number in TOC

Post by ddiemetric »

I have a kludge that I am still ironing out...

I have three chapter heading styles:
Chapter Heading - a non-numbered format that I use for Contents, Preface, etc.
Chapter Heading Numbered - a numbered format for chapter titles
Appendix Heading Numbered - a numbered format for appendix titles

The numbered styles (Print medium only) have autonumbering set to:
For chapters - {color white}Chapter {chapnum}:{/color}
For appendixes- {color white}Appendix {chapnum}:{/color}

These show up in the TOC as:

Preface
Chapter 1: Chapter title
Appendix A: Appendix title

However (as I said, I'm still working on this), the rub comes in how to arrange the numbered titles on the first page of the chapter or appendix. Although you can't see the white text, the black text is obviously indented. I have a couple of ideas I intend to try. (At least I got half of the problem figured out.) So far, the only way I've been able to address this is to place a soft return between the white text and the black text. Inelegant, but effective.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: How to get Chapter Number in TOC

Post by LTinker68 »

dtmenges wrote:I could live with the following but can't figure out how to get rid of page numbers.

Chapter 1
Getting Started..................1
Heading2.........................2
I figured out a way to get rid of the leader and essentially hide the page numbers, although it's not an elegant solution. Make sure you submit a feature request at http://www.madcapsoftware.com/bugs/submit.aspx asking for a way to turn off page numbering altogether.

Open the stylesheet file in the Internal Text Editor and paste the code below into the file, then save and build the PDF output.

Code: Select all

p.TOC1 {
    mc-leader-format:none;
	}

MadCap|xref.TOCPageNumber {
    color:#FFFFFF;
	}
The first block of code turns off the leader. If you don't want the leader on any of the TOC items, then you'll need to repeat that code, but for p.TOC2, p.TOC3, etc. The second block of code changes the color of the page number to white, assuming that you don't have a background on your table of contents. I couldn't figure out a way to hide it altogether, so it's camouflaging as the background color. If you hover over the right side of the outputted TOC then you'll get a hand cursor to indicate it's clickable, but most users probably wouldn't move the cursor over there if there's nothing visible for them to hover over.

Like I said, not the most elegant solution, but it works.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
DocuWil
Sr. Propeller Head
Posts: 344
Joined: Thu Feb 09, 2006 1:22 am
Location: Netherlands
Contact:

Re: How to get Chapter Number in TOC

Post by DocuWil »

Hi,

I created the following solution (excuse me for the long picture).
The upper part shows the result in the PDF.
The trick lies in the Page Layout. There I inserted the variable {chapnum}.
Then I set the Heading style H1, but only for Medium: print
Finally I reset the numbering in the TOC starting at the point I wanted it.
Of course there is no influence on the result of the WebHelp.

Let the picture speak:
chapters.png
So, give it a try.
I hope I could bring something.
You do not have the required permissions to view the files attached to this post.
Wil Veenstra

Documentation and Training Centre
Infologic Nederland
(Using Flare 11.1.2, Capture 7.0.0 and Mimic 7.0.0 in Windows 10 64-bit)
ddiemetric
Propeller Head
Posts: 59
Joined: Mon Nov 24, 2008 12:31 pm
Location: Is it Spring yet?

Re: How to get Chapter Number in TOC

Post by ddiemetric »

Scrapped my previous workaround. I finally broke down and sent a request to Support. Rob sent me a better way of adding the automatic chapter numbers (Thanks, Rob!):

h1.chapter
{
mc-auto-number-format: 'CH:Chapter {chapnum}: ';
mc-auto-number-class: white;
mc-auto-number-position: outside-head;
mc-auto-number-offset: 50px;
}

span.white
{
color: #ffffff;
}

Works like a charm. :D
kellyhouser
Jr. Propeller Head
Posts: 5
Joined: Wed Mar 31, 2010 1:57 pm

Re: How to get Chapter Number in TOC

Post by kellyhouser »

ddiemetric wrote:Scrapped my previous workaround. I finally broke down and sent a request to Support. Rob sent me a better way of adding the automatic chapter numbers (Thanks, Rob!):

h1.chapter
{
mc-auto-number-format: 'CH:Chapter {chapnum}: ';
mc-auto-number-class: white;
mc-auto-number-position: outside-head;
mc-auto-number-offset: 50px;
}

span.white
{
color: #ffffff;
}

Works like a charm. :D
Where does one place this information? I cannot get chapter numbers to work and I would like to try this.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: How to get Chapter Number in TOC

Post by LTinker68 »

It's a combination of putting the styles in the stylesheet (the mc-auto-number stuff is in the AutoNumber category when in Advanced view) and specifying the chapters in the TOC. You do the latter by setting the "start a new chapter" option in the Properties screen of a TOC entry. I tend to organize topics into books and I set each book to start as a new chapter, but you don't need to use books -- you can apply that setting to topics outside of books.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Post Reply