# Creating a Word Index for a Book

I'm writing a book using memoir with a lot of technical words. I want to have an index at the end, which, for each word or term I choose, will refer the reader to the relevant pages. Is there any efficient way to build this index as I write?

-

I would suggest using the memoir documentation source as a start to see how a LaTeX document, which uses the memoir document class, creates an index. Although this may not always be done "efficiently", since it depends on the writer's choice of technique, it's a start none the less.

In many cases, automated index entry generation through a macro is preferred. For example, creating

\newcommand{\addtoindex}[1]{#1\index{#1}}


and then using

\addtoindex{word}


rather than constantly typing

... and then there was a word\index{word} at ...


However, this limits one to using a one-dimensional index. Multi-dimensional index usage (for example, using \index{word!sentence!paragraph}, say) requires more work to define an appropriate macro. For example, using optional parameters based on the depth.

The main motivation should be consistency, and ease of adaptation, if things require some future modification.

-