is now part of CreativePro.com!

Create a Cross Reference Quickly with this Free Script

13

As much as I like the built-in cross-references feature in InDesign CS4, I still find it onerous on occasion, and I have often wished there were a “better way” to make x-refs. There is, of course, also the Cross References Pro plug-in from DTP Tools, which offers many more features for people who really need a lot of power over their x-refs. But for many of us, we just need basic cross-references, but we want to make them more quickly and easily!

Fortunately, Harbs, over at In-Tools.com (makers of some great plug-ins and scripts for long document publishers), came up with a super-nifty script that creates cross-references for you based on text you have selected on the page rather than having to maneuver through a dialog box based on paragraph styles. Here, let me show you an example. In this image, I have manually typed the words “Figure 12-5” and then selected the text with the Type tool:

I want to make a real cross-reference of this (not just static text), so that if the figure number caption changes later, I can update the x-ref quickly, too. To do this, I choose Type > Hyperlinks & Cross-References > Create Quick Reference:

That feature in the menu was put there by Harb’s script — it’s not normally there. This is interesting because it means you don’t run the script the way most scripts get run (from the Scripts panel). It looks like a normal InDesign feature. In the screen shot above you’ll see that it has a keyboard shortcut. I added that myself, by choosing Edit > Keyboard Shortcuts, choosing the Product Area called Scripts, and then choosing the Quick Reference script. After all, if I’m making a lot of x-refs, I don’t want to be tied to choosing from the menus each time. Ick.

Now, the script searches my current document for the text that is selected… in other words, it looks for a match and then gives me a list of all the places in the document that match shows up:

If the document is part of a book, and the book panel is currently open as well, then the script will actually look through all those documents, too!

In this case, it only shows me the page number in the Target list because of an oddity of the “match.” There actually was no instance of “Figure 12-5” in my document, because I use automatic numbering to number illustrations. But the script is smart enough to know that if it can’t find any real text, then it should go looking for these “numbers.” Sweet.

Anyway, I select the instance I want to use, choose a Format (all the formats normally found in the Cross References dialog box are there), and click Create. The result: The script puts a text anchor in the “target” text and then creates a cross-reference to that anchor!

Okay, in this particular example, the figure was on the same page, so I probably should have chosen a different format (one that didn’t include the page number), but whatever. You get the point. I made a real cross-reference based on text right on the document page.

Why This Is Easier

If I had to type the words “Figure 12-5” anyway, then why even bother with this script? Well, I want to make a cross-reference (instead of just relying on the static, manually-typed text) because the figure number or the page the figure is ont might change, and I want a way to quickly update it. That’s the argument for making a real x-ref to start with. However, why is this faster than using the cross-references dialog box?

Well, let’s say I have a heading somewhere in my document called “Easy Techniques for Making Paper Airplanes” and I want to create a cross-reference to it. To make an x-ref the normal way, I need to go find the heading, click on it, find out what paragraph style it is, go back to where I want the x-ref, create the new cross-ref, choose the paragraph style, then find the heading in a list of paragraphs in that style. It’s not a bad workflow, but I’d rather do it with the script:

I type “paper airplanes”, select it, and run the script. It gives me a list of all the places that phrase appears… I quickly realize that it’s too many targets, so I cancel. I change it to “making paper airplanes” and run the script again. Now just the heading appears. I select it and click OK. Done.

The script does all the extra work for me, and I’m a happy camper.

I freely admit that it’s not going to be the perfect solution for every cross-reference, but it’s a wonderful additional tool in my toolbox! And the next time a file comes to me where the author has already created basic x-refs by typing them manually in the Word file, I’ll be prepared to swap them out for InDesign cross-references with this script.

(Note that, completely synchronistically, DTP Tools has also just this week released a script that does something similar, but it works only with their Cross References plug-in, so you get all the additional abilities there.)

Where To Get Harbs’ Script

You can download the script and find complete installation instructions by visiting this page at In-Tools.com.

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • F vd Geest says:

    Is it me or isn’t there a link on Harbs website to download – I can not find it…

  • Harbs says:

    It’s there…

    I just responded to your comment over there. :)

  • F vd Geest says:

    Ah! There they were, the whole time ;-) Thanks!

  • F vd Geest says:

    And… error on my Dutch version of InDesign Cs4 6.04…
    Won’t load… :-(

    (Object error)

    (I have Cross refs Pro however myself, but would be nice to show this)

  • Jennie says:

    I think I love Harbs!

  • Harbs says:

    Okay, F vd Geest was very helpful in tracking down a localization issue with the script which prevented it from being loaded on some systems. Thanks!

    I fixed another loading issue as well. We’re up to version 1.0.3 now…

  • You guys are awesome! I love how everyone pitches in. Thanks!

  • I am developing a new script that creates cross-references from tags inserted into a text file.
    If anybody is interested, check out this page.

  • Mai Ali says:

    Thanks a lot (Y)

  • Tom Carlson says:

    Is there any way to make this script work in a Swedish version CC2014.2. Just get errormessages.

  • Riccardo Riguzzi says:

    It works really well, BUT if I export a PDF only the first reference works as a link…

    • Riccardo Riguzzi says:

      If I open the pdf on acrobat reader, it works perfectly… It seems the problem is with acrobat PRO

  • Art Hoffman says:

    This is a great time saver! But is there a way to set the default X Ref. Format to Page Number since that is what we mostly use?

  • >