I recently completed a project where I needed to build in auto-numbering for figures and then cross-references to those figures in preceding paragraphs. I’ve built many an auto-numbered figures, and had inserted many cross-references but never both in the same project. This was just my kind of challenge.
The parts to this task are:
- Creating the auto-numbering style class
- Assigning that style class to your figures
- Creating book-marks
- Editing cross-reference style
- Creating cross-references
It sounds like a lot but it isn’t.
Before I go any further with instructions, please be sure that you are working in your Print medium. I cannot stress this enough.
Creating an Auto-Numbering Style
Let’s create a new style class in the <p> tag called caption. We will be applying the auto-numbering to that class.
Open your stylesheet and go to the <p> tag and create a new class called ‘caption’ and set the properties as shown:
This is standard format for numbering figures. In this document, I didn’t need to add chapter numbers or anything else to the caption – just the figure number. I added the H to separate this style from all other auto-numbering that I had established in the project. If you don’t do this, then Flare won’t know to separate numbering chapters from numbering figures and you’ll have a big mess:
Chapter 1
Figure 2
Figure 3
Chapter 4
etc.
That would be bad.
Applying That Style to P Tags
Apply that new p.caption style class to all captions that need a figure number. Where ever you’ve applied the style, this is what you’ll see in your XML Editor:
Note that in each topic, the figures will start at number 1, regardless of that topic’s location in the document. The auto-numbering will not be sorted out until you build the output.
Creating Bookmarks
While you’re applying the style to the <p> tags that are captions, go ahead and create bookmarks. This step will allow you to create cross-references in a few more steps.
To create a bookmark, click at the beginning of the caption name (note that you won’t be able to click in front of ‘Figure.’) and go to Insert > Bookmark and, when the bookmark window opens, name the bookmark. For this project, I just used the first word of the caption.
Here’s an example of one of the bookmarks.
Now that you’ve applied the caption style to all the <p> tags that need it and you’ve created bookmarks as well, you are ready to work with the cross-references.
Editing Cross-References Style
Now to tell Flare how to refer to those figures in the preceding paragraph. For this project, I only want to show the figure number, not the caption too. I’ll save you the trouble and tell you that there isn’t a pre-made style for this. SO, we get to make a new xref style.
Go to your stylesheet and look for MadCap|Xref and create a new style. I called mine fig_ref.
In the Unclassified section of Properties, find mc-format and edit it to look like this:
You’ll see in the preview that only the caption number will appear.
Adding Cr0ss-References to Your Document
We’re almost done!
Now go to where ever you want to add a cross-reference to your figure. Click Insert > Cross-Reference.
(Here’s where your bookmarks come in!)
When the window opens, select:
- Link to: Place in this Document
- The correct bookmark
- The new xref class
You’ll see a preview of what you’ll get in the lower right hand corner of this window. If it looks good, click OK.
Here’s what I see in my XML Editor:
Using this method, when you build your PDF output, your figures will be numbered correctly and your figure references in preceding paragraphs will be correct as well.
In my next post, I’ll show you how to create and format a List of Figures based on what you’ve done above.
I write a lot of online help for web apps and software and I’ve found that sometimes I need to add examples in the middle of the list. There are a number of ways to do this: one was my original workaround prior to v6 and the other is the method provided by Flare v6. I’ll discuss my way here.
My Workaround (which works great for me!)
Before you implement this, you need to create a style class called p.list_example or whatever works for you. I set the text indent to match the indent amount of the <li> tags, set a background color so the example stands out somewhat among the list items, and then I set the auto-number so the tag always starts with Example: .
The resulting css for this style class is:
p.list_example
{
padding-top: 5px;
padding-bottom: 5px;
margin-left: 0px;
text-indent: 5px;
background-color: #eff7fc;
mc-auto-number-format: ‘{b}Example{/b}: ‘;
}
- Create your list, ordered or unordered, doesn’t matter.
- When you get to the item for which you need to put in an example, hit the Enter key.
- When either the bullet or the number appears, click the outdent icon
on the tool bar. This will result in the <li> tag becoming a <p>. - Set the <p> to <p.example> and then add the example text.
- When you’re done, hit Enter and then click the bulleted list icon
. Be sure to select either ordered (numbered list) or unordered (bulleted list). - Click the list options icon
and select
if you want the numbering to continue from the previous <li>.
Here’s what you get when you’re done:




