7

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?

11

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.

| improve this answer | |
7

You can make an index. See for a description of making an index (see comment of Zooba) and for an example for an index for wiki LaTeX.

| improve this answer | |
  • 2
    The link is actually: en.wikibooks.org/wiki/LaTeX/Indexing (I can't edit the answer because I only want to add 3 characters. Also lack of rep here, but without padding I can't even suggest an edit.) – Zooba Feb 20 '12 at 20:42
2

To create index, you need to include makeidx package, call \makeindex command in the preamble, put indexes in \index{}, and finally \printindex at the place where index needs to be printed. Once the document is set up as above, build the document in the following three steps:

  1. pdflatex <<filename.tex>>, then this command produces filename.idx that will be an argument for the command in step 2
  2. makeindex <<filename.idx>>, and then run
  3. pdflatex <<filename.tex>>

The following is a minimum working example.

 \documentclass[12pt,oneside]{book} 
\usepackage{makeidx} 

\makeindex 

\begin{document} 

\chapter{Chapter One}
Content of chapter one with two indexes indexone\index{indexone} and indextwo\index{indextwo}. 

\chapter{Chapter Two}
Content of chapter two with three indexes indexone\index{indexone}, indexthree\index{indexthree} and indextwo\index{indextwo}.  

\printindex 

\end{document}

Output of the above code

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.