Index Topics from Text Tags

This script is part of the Indexes and Concordances collection. See the full collection here

The script creates topics and page references from text marked with certain tags. You enter the tags in the script’s dialog, including, optionally, tags for subtopic separators and sort-order separators. Choose to replace an existing index or to add new topics and page references to an existing index.

Use

The script shows this dialog:

[image: index from tags]

Enter the start and end tags and the tags used for subtopics and sort order (you must enter tags for subtopics and sort order; if there aren’t any subtopics and/or sort orders, just use any tags that aren’t meaningful in the index, such as @ and #). For instance, an entry like this:

\index{Mathematicians#B. Russell@Russell, B.}

creates a topic Mathematicians with a subtopic B. Russell. And that subtopic’s sort-order field will be set to Russell, B.

Sort orders can be specified for all (sub)topic levels. Schematically as follows:

\index{topic@sort#sub1@sort1#sub2@sort2#sub3@sort3}

which will end up in InDesign’s page references options window as follows:

[image: InDesign's page references window]

Hiding/keeping tags

To keep your tags in the document, tick Keep (and hide) tags. The script creates a character style and applies it to the tags so that they become invisible (by setting the type size to 0.1 points and the horizontal scaling to 1%). The tags can be seen in the story editor.


Version history

26 February 2016: The script needed a fix to improve the handling of sort orders.

18 March 2011: Fixed a problem with consecutive index tags.

3 February 2011: Fixed an odd bug that caused page references to be deleted if the tag was followed by certain punctuation marks. The script now also remembers which tags you used the previous time the script was used.

May 2009: First posted.


Peter Kahrel Script Repository
Hosted as a community service, and with deep appreciation, by CreativePro.com


Scripts by Topic | Script Index
Basic Script Installation and Use
How to Modify or Configure These Scripts
Resources for Scripting and Publishing Automation
About This Repository


Repository Home Page


Contact Peter Kahrel


Note to users: You run scripts at your own risk: CreativePro and the author accept no liability for anything that may be caused by any of these scripts. Always take the necessary precautions. We encourage you to save backups and test scripts on copies of your documents.

Bookmark
Please login to bookmark Close

This article was last modified on August 22, 2026

Comments (0)

Leave a Reply

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

Loading comments...