I was thinking the other day how Scrivener’s developers might attack the problem of including an “index generation” algorithm (and workflow) into Scrivener, such that it could generate an index as part of “back matter” for a book in the same manner that it can currently generate a TOC for a book using “Copy as TOC” in the Edit Menu. Here’s what I came up with:
-
The user sets out with the intention of creating a book that has an index. They have to start out with this intention, as it will affect the way they approach creating their Project.
-
They set up their Project Keyword list with the intention of creating a list of Index keywords. Each keyword will be an entry into the eventual index, with child-keywords being sub-entries, etc. Each Keyword must match exactly the text to be indexed within the finished Draft.
-
Once that is done, the user selects “Create Draft Index Document” from, say, the “Project” or “Documents” menu and places it in, say, a “Back Matter” folder in the Binder. The program creates the file and auto-populates it with all the Project Keywords with placeholder tags to indicate where the page-numbers will be filled in. The user applies formatting to the Keyword list and page-number tags as they see fit.
-
In the Compile dialogue, assuming there is an added section to select Back Matter as well as Front Matter, the user selects their appropriate Back Matter folder, and selects “Use This File To Create An Index” next to the file they’ve placed in the Back Matter folder.
-
The User clicks Compile.
-
The program then compiles the Draft, but with a twist: As it compiles the Draft, it scans the Draft for the Keywords in the Index file. It notes and stores each page number that each Keyword appears occur on, each time for each occurrence of each keyword, and then appropriately outputs these page numbers into the index file, thus generating the index. Then, it throws away the compiled Draft, and then it compiles a second time: This time, it compiles the Draft, including the newly generated index file placed accordingly where it belongs in the Draft.
-
The user gets an output file with a nicely generated Index.
Thoughts on this?
—Andy H.