Members Only

How to Preserve Italics in an InDesign Index

How to use GREP Find/Change to apply formatting to text in an InDesign index

This article appears in Issue 25 of CreativePro Magazine.

If you work on long documents with indexes in InDesign, you may have encountered a common problem where you can’t preserve italics and other character-level formatting in the index. You can only specify paragraph styles to format the index content. So, the italics applied to book titles, film titles, etc., is lost and must be manually re-applied each time you generate the index. However, as is the case with many of InDesign’s shortcomings, clever folks have figured out a workaround, using one feature’s strength to compensate for another’s weakness. In this case, you can use the power of GREP Find/Change to fix your index. It won’t really preserve the italics, but it will allow you to reapply any formatting in one quick step after you’ve set things up. Here’s how to do it. Start by opening the Index panel and locating one of the references where you want to have character-level formatting. Double-click the page number to open the Page Reference Options dialog box. screenshot of Adobe InDesign document containing an index, with the Index panel and Page Reference Options dialogs open The content in the Topic Levels field is what InDesign will put into the index. We need to put some tags here that we can use as a “hook” to write a GREP Find/Change expression that will apply the right formatting to all such references. You can wrap the reference in whatever tags you like. For italics, I like to use square brackets and a lowercase i. So, I put [i] before the title and [/i] after it, like so: Page Reference Options dialog box in Adobe InDesign showing custom tags applied to Topic Levels for the purpose of Find/Change to apply italics to a
<!--more-- srcset=
book title” width=”600″ height=”246″ /> But I don’t want the tags to affect the sorting of content in the index. If I left things as they are now, this reference would go into the symbols section of my index instead of the letter A where it belongs. To prevent that from happening, just copy the words for the reference and paste them into the Sort By field. Topic Options dialog box in Adobe InDesign showing how to control the sorting order of index entries Click OK to close the dialog box and then click the Generate Index button at the bottom of the panel. The reference is now wrapped in tags. Book index in Adobe InDesign with a reference wrapped int custom tags to be replaced with italics using Find/Change Repeat that process for all references that you need to make italic. Open Find/Change and click on the GREP tab. In the Find What field we need a GREP expression that will find all the tagged index references. It needs to be composed of three parts: starting with one to match the opening tag, followed by one to match any text, followed by one to match the closing tag. Each part gets wrapped in parentheses. So the whole expression is: (\[i\])(.+)(\[i\]) Note: square brackets have special meaning in GREP so you must put the backslash before them to tell InDesign you mean a literal bracket. Same goes for the forward slash. (\[i\]) matches the opening tag: opening bracket \[, lowercase i, closing bracket \] (.+) matches the enclosed text: any character . repeated one or more times + (\[i\]) matches the closing tag: opening bracket \[, forward slash , closing bracket\] In the Change To field, enter $2 for Found 2, or the stuff in the second set of parentheses. This is the actual text you want to appear in the index. Click in the Change Format area and choose or create a character style that applies italics (or whatever formatting you need). Find/Change dialog in Adobe InDesign showing the GREP expression for replacing a custom tag with italics in an index Run the Find/Change to replace the tagging with italics. The results of Find/Change to replace custom tagging with italics in an InDesign index. Note: If you generate your index again it’ll overwrite the formatted text with the tagged text. So you’ll have to run the query again to get your formatting back. Tip: Click the button in Find/Change to save the query so you don’t have to rewrite it (or remember it) each time you need to use it. You can simply choose it from the list of saved queries. Saving a Find/Change query in Adobe InDesign

Bookmark
Please login to bookmark Close

Not a member yet?

Get unlimited access to articles and member-only resources with a CreativePro membership.

Become a Member

Comments (4)

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Steve Davis

    I await the day when extended text attributes will be made available in indexing!

  2. Katherine Burgener

    Hmmm, would it be possible to use the GREP Style options in the Paragraph Style for the index entries to accomplish this without running a find/change?

    1. Heather Christian

      If there are a limited number of index entries that need to be italicized, I do build the italics right into my index entry styles rather than having to run a find/change every time I need to regenerate the index. It has worked great for some of the biology textbook work I do where the same latin names of things occur frequently that need to be italicized.

      But Mike’s option is great if you have a lot of entries that will need to be italicized and don’t want to make that part of the Paragraph Style GREP style options.

    2. Mike Rankin

      Hmmm. I don’t think so, Katherine. You could use the same GREP expression to automatically apply the italics to anything in the tags. But to remove those tags, you need Find/Change.