Unlike subtopics, which InDesign sorts, cross-references are printed in the order in which they were added to the document. If you create a cross-reference to the topic UXP, and later, at the same topic, create a cross-reference to the topic JavaScript, then another one to AppleScript, the Index panel shows them in the order you created them:
After generating the index you'll see that the cross-references weren't sorted:
In addition, cross-references of the same type (See, See also) aren’t grouped. What we're after is See also AppleScript; Javascript; UXP. In addition, subtopics are often placed after the page references:
This script fixes all these problems. Run it against a generated index.
It has no interface, but you need to set two parameters: the text (language) of the cross-reference label and whether the cross-references should be moved. The script defaults to See also and placing cross-references after page references. To change these settings, open the script in a plain-text editor and change these two lines, which are at the top of the script:
var xrefString = 'See also'; var moveCrossRefs = true;
Change 'See also' to e.g. 'Zie ook' and true to false. Save the script (as a plain-text file)
With See cross-references moving them isn't relevant, so make sure that moveCrossRefs is false.
Installing and running scripts
Questions, comments? Get in touch