How to display chapter number in an x-ref

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
bill b
Propeller Head
Posts: 56
Joined: Mon Feb 04, 2013 12:47 pm

How to display chapter number in an x-ref

Post by bill b »

Hi,
Newbie here. I've managed to get autonumbering right for my chapter numbers (in PDF). What I need to be able to do is refer to the chapter number. {chapnum} refers to the current (source) chapter as opposed to the destination. Flare has {pagenum} (analogous to {chapnum} but no "[chap} analogous to {page}.

What I need is this

"Chapter 1, Chapter_Title_here"

How do I grab the chapter number from the destination topic? I searched the board and couldn't find a thread on this subject.

TIA,
Bill
Msquared
Propellus Maximus
Posts: 848
Joined: Mon Aug 06, 2012 10:19 am
Location: Southampton, UK

Re: How to display chapter number in an x-ref

Post by Msquared »

Well done for getting your head round auto-numbering. I've just had a look at my stylesheet, and I've got this for my chapter xrefs:

Code: Select all

MadCap|xref.Chapter
{
  text-decoration: none;
  mc-format: 'Chapter {paranum}"{paratext}"';
}
This will show as, for example,

Chapter 6 "Generating Reports"

Note that my section reference is almost identical at

Code: Select all

MadCap|xref.Section
{
  text-decoration: none;
  mc-format: 'section {paranum} "{paratext}"';
}
The only difference is "section" instead of "Chapter".

The relevant bits of my heading style for the chapter are:

Code: Select all

h1
{
   . . . 
	page-break-before: always;
	mc-heading-level: 1;
	mc-next-tag: h2;
	mc-auto-number-format: '{chapnum} ';
}
The text-decoration: none is needed because by default, xrefs are displayed as hyperlinks, and in the print document, I didn't want them underlined.

When you want to insert an xref to a destination, do Insert > Cross reference, make sure that "Link to" is Topic in Project, select the topic (and, if for some odd reason, the level 1 heading isn't at the very start of the topic, click on the bookmark symbol to view the locations in the topic that you can select).
Don't forget to select an Xref class of MadCap:xref.Chapter. I'm always forgetting to set the class, and if you do, the xref is inserted with the default xref style. You can change the style (technically actually a class in XML-speak!) after you have inserted it, but in the Flare XML editor, the display of the Xref won't actually be updated unless you do Tools >Update Cross-References.
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
bill b
Propeller Head
Posts: 56
Joined: Mon Feb 04, 2013 12:47 pm

Re: How to display chapter number in an x-ref

Post by bill b »

Thanks. This looks nice and logical. I'll give it a try!

Maybe you'll be promoted to Senior Propeller Head now :D

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

Re: How to display chapter number in an x-ref

Post by Msquared »

Thanks for the nice comments. No chance of a "promotion" for me though. You have no idea how little I know. :-)

Although I think you get promotions by making lots of posts. In my case, they are more questions than answers.
Marjorie

My goal in life is to be as good a person as my dogs already think I am.
Post Reply