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.

Leave a Reply?

Recent Posts