Indexes and concordances

The terms 'concordance' and 'index' are not used in the same way by everybody. For the purposes of this web page, I use concordance for a list of occurrences of one word in its context and index for a list of several words, each word accompanied by one or more page references. There are several types of index (word index, language index, subject index, author index, citation index, etc.), but there's just one type of concordance.

In InDesign you can create indexes, not concordances, though concordances can be scripted (see the concordance script, below). Indexes should be done manually by adding topics and page references using the Index panel. InDesign's indexing is limited in that you can create just one index in a document, though with some trickery (to be outlined below) you can create, say, author, language, and subject indexes in one document.

Another approach to indexing in InDesign is to ignore its index feature entirely, using one or more scripts to find words from a word list and find all page references for each word. The first script listed here, under "Independent index from word list", is an example.

Finally, two scripts to display index statistics: one shows the number of topics, subtopics, page references and cross-references; the other script shows how index markers are distributed across the book.

Creating topics and page references

The scripts in this section create topics in a document from a variety of sources: an external word list, text formatted with any character styles, text formatted with certain text tags, or topics imported from another document.

Independent index from word list

The script creates an index from a word list, sidelining InDesign's index altogether. It can be used for author, language, and citation indexes and similar indexes. For subject indexes it's not particularly good, but it can be used to get a start. It runs on all open documents.

The script has some overlap with Marc Autret's IndexMatic script (which was rewritten in June 2011). His script is a versatile and highly configurable tool for compiling indexes, bypassing, like my script, InDesign's index feature.

Topics and page references from character styles

Create topics and page references in InDesign documents using InDesign's index feature. The script looks for the character styles you pick in the dialog and creates topics from and page references to whatever those character styles are applied to. Choose to replace an existing index or to add to it. Optionally use the character style's name and any style groups to create subtopics.

Topics and page references from text tags

The script looks for tagged index entries such as \index{collie} or {ix}collie{#ix}. The format of the tags is is user-definable, it's specified in the script's dialog. From these strings a topic collie is created, a page reference is added to the page on which the text string occurs, and the whole string is deleted. Subtopics and sort orders are handled as well.

Page references from imported topics

When you import topics from another document, any page references aren't imported, naturally. The script adds these.

Editing topics

It's not so easy to edit topics in an InDesign document. Adding and removing subtopics, for instance, is very labour-intensive when the topic has page references associated with it. The method described here makes life a little easier.

(Post-)editing indexes

Indexes often need some editing after they've been created. In InDesign-generated indexes it's generally better to edit the topics and page references, then regenerate the index. In manually produced indexes that's not an option, naturally, and here are some scripts I use to make some of that work a bit easier.

Update index

When you edit an index, for example to combine entries, you can end up with unwellformed page ranges such as 2, 16-34, 4-8, 5-10, x, 12-18, ii-iv. The update script fixes this, either the whole index or just the selected entry.

Sectioning an index

Apply a paragraph style to entries that start a new letter. Optionally insert section headings.

Fix index problems: convert page references to text tags

Problems with indexes can be solved by converting all page references to text.

Build index from textual markers

The script that converts an index to text places text tags in a document such as <ix>cat</ix>. This script (re)builds an InDesign index from such tags. (The script is a simple version of the one listed above, "Topics and page references from text tags" in that it is fixed to the tags produced by the script that converts references to tags.)

Index statistics

The two scripts in this section deal with InDesign's index, reading all the information from the Index panel, not from a genrated index. It's therefore not necessary first to generate the index before collecting the statistics.

Index statistics

The script displays a simple window showing the number of topics used in the active document together with the number of subtopics and the number of unused topics. It also shows the number of page references and cross-references.

Index graph: show marker spread

To show how the index markers (page references) are distributed across the document, the script creates a bar graph where each bar represents a page and the length of each bar the number of references in the index to that page.

Concordance

The concordancer takes one word and creates a list of sentence fragments that show the concordanced word in its context. In the interface you specify which word should be concordanced and how big the context should be (number of words before and after. The list includes the page numbers of the found items.


Back to script index

Questions, comments? Get in touch