[texhax] Index and Glossary?

Reinhard Kotucha reinhard.kotucha at web.de
Fri Dec 9 04:01:54 CET 2005

>>>>> "Magnus" == Magnus Ottosson <it3otma at ituniv.se> writes:

  > Hi!  I want to have an index list and a glossay list in my
  > document. I have found a couple of ways to do this but with all
  > the solutions I have found I have to mark each occurrence of the
  > word at each place I have it in the text. So if I want to have the
  > word "latex" in my index and glossary I have to mark the work
  > latex with a \index{latex} at each place it occurs in the text.

If you want to provide a useful index, I think that you have to do it
manually.  Not every occurence of a particular word should appear in
the index.  It's very annoying if an index entry points to something
completely useless.

You need a very good editor to do this conveniently.  Emacs is a good
choice.  See


Emacs has been ported to all major operating systems.

Put the following lines into the configuration file (~/.emacs on UNIX):

(defun latex-index (event)
    (interactive "e")
    (mouse-set-point event)
    (backward-word 1) (setq beg (point))
    (forward-word 1)  (setq end (point))
    (kill-ring-save beg end)
    (insert "\\index{")(yank 1)(insert "}")
    (backward-word 1)

(define-key global-map [mouse-3] 'latex-index)

Then re-start emacs.  If you then click with the right mouse button on
a word in your file, the word <word> is replaced by <word>\index{<word>}.

There are some limitations (and there is no warrenty that it works at
all).  A word is what emacs regards as a word.  Emacs regards a "-" as
a word boundary, for instance.


Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the texhax mailing list