another solution to indexing, via comments feature

I know this has been discussed a few times, and I’ve seen solutions where terms are highlighted and added to an index. I needed something a bit more flexible, and wanted to share what I came up with.

I wasn’t using the ‘comments’ feature (comments & footnotes item on the inspector), so used that for indexing. I add a comment at the point in the text I want the index entry to point to, and the text of the comment is the index entry. By doing it this way, I’m not restricted to having the term in the index exactly match what’s in the text body.

In my case, the output is markdown, turned into LaTeX via pandoc. To add the comment to the compiled output, I go into ‘compile’, then ‘edit format’, and then on the ‘annotations’ panel, put “<$lnk>\index{<$cmt>}” as the format to use for comments. So this will generate something akin to “main text \index{entry for index}”.

The index processing for LaTeX has its own little language, so I don’t have to just have a simple word as an index entry, but can also do things like:

  • “index” (simple entry for “index”)
  • “index!creating” (entry for “index” with a sub-entry for “creating”)
  • “feedback|see {commenting}” (generate nicely formatted ‘see’ line)
  • “feedback|seealso {commenting}” (ditto but ‘see also’)

Altogether, this lets me manually index my document with the flexibility I need.

Presumably, this approach could be incorporated into Scrivener proper by adding another annotation type that behaves like comments, but probably with a nicer UI to add different types of index entries like the above.