Coding Index Entries
This section describes the coding of index entries in the document file. We use the .XX macro for placing index entries in a file. The simplest case is:
.XX "entry"
If the entry consists of primary and secondary sort keys, then we can code it as:
.XX "primary, secondary"
A comma delimits the two keys. We also have a .XN macro for generating “See” references without a page number. It is specified as:
.XN "entry (See anotherEntry)"
While these coding forms continue to work as they have, masterindex provides greater flexibility by allowing three levels of keys: primary, secondary, and tertiary. You’d specify the entry like so:
.XX "primary: secondary; tertiary"
Note that the comma is not used as a delimiter. A colon delimits the primary and secondary entry; the semicolon delimits the secondary and tertiary entry. This means that commas can be a part of a key using this syntax. Don’t worry, though, you can continue to use a comma to delimit the primary and secondary keys. (Be aware that the first comma in a line is converted to a colon, if no colon delimiter is found.) I’d recommend that new books be coded using the above syntax, even if you are only specifying a primary and secondary key.
Another feature is automatic rotation of primary and secondary keys if a tilde (~) is used as the delimiter. So the following entry:
.XX "cat~command"
is equivalent to the following two entries:
.XX "cat command" .XX "command: cat"
You can think of the secondary key as a classification (command, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access