How to Create an Index from a Style
July 10, 2023 | IndexMatic³ | en | fr
Creating an index (or any statistical report) from InDesign style(s) is really the easiest operation you can imagine with IndexMatic³. I swear! But for some reason that I still haven't been able to figure out, this question keeps coming up from users. So let's explain once and for all the procedure to follow…
Target the Style(s)
First, you have in your hands an InDesign document, or multiple style-consistent documents, or an entire book. Your goal is to extract data of interest based on one or several style(s). Are these paragraph styles or character styles? It doesn't matter. Only these portions of the text are of interest to you. You want IndexMatic to focus exclusively on the regions where the desired styles apply.
In the example above, I'm interested in the style Book Authors that tags authors names. In fact, this particular catalog has been divided into logical sections (A, B, C…) each of which bears a characteristic paragraph style for the names: “A Title - Book Authors”, “B Title - Book Authors”, and so on.
Therefore, when launching IndexMatic³, I select all the styles that matter to me in the Filters panel:
If your project involves character styles instead, do the same using the Character Styles subpanel. Note that you can combine the two filters, as discussed in the manual.
Run the “Universal” Query
Now all you have to do is enter a single query, which I informally call the Universal Query because it captures all available characters: /.+/
Note. — Although deadly easy to type in, this query should normally belong to your list of favorites under the label “ALL”. If not, proceed as instructed in the manual.
And… that's it! The Quick Matches feature will allow you to instantly precheck the matches, and producing the final index will be no more than a formality.
Refining?
Now suppose the Universal Query is too greedy. For example, in my test document the ISBN is identified by a generic style—named “Common Biblio Info”—which also applies to other elements. What if I want to extract and index ISBN numbers only, based on that filter?
Well, let's just refine the pattern! In this particular case I just had to select the desired style (Filters › Characters Styles) and change my query into /978.+/
, since all ISBNs referenced in my document happen to start with “978”. Here is the resulting report:
The filter guarantees that among all items of the form “978…”, only those which have the style “Common Biblio Info” will appear. Often the combination of a style and a regular expression works wonders.