1

I am writing a book that mentions many people. Say that I mention Donald Knuth on a page. I would have:

... Donald Knuth\index{Knuth, Donald}

In many other places I have mentioned Donald Knuth. Right now it seems that I need to manually add the \index everywhere I mention Dr. Knuth. Is there a way that I can just declare Knuth as an indexed term and have this done automatically?

This is different than the question discussed in Auto generate an Index.

And, alas, the 29-line program https://github.com/themoodymann/IndexTex is over-aggressive about indexing. It also does not remove \index{} entries that have been inserted when the text changes.

I would like to do the following:

  1. Define all of the names that I care about.
  2. Have LaTeX automatically index the names when they are encountered.
  3. Have the option of automatically italicizing the name on first reference.
  4. Have the option of automatically adding birth and possibly death dates on first reference.
3
  • This question looks incomplete. Did you intend to add more? Sep 27, 2020 at 13:47
  • Thanks! I did. Fixed.
    – vy32
    Sep 27, 2020 at 13:49
  • I think the whole point of good index is that it is done manually, by a human (you might have a page that includes a quote that refers simply to "Don", or a page of source code that includes a reference to him but does not merit indexing). Rather use tags as suggested by Peter Wilson. Otherwise it is just an inferior search. Sep 28, 2020 at 9:15

1 Answer 1

1

Define a macro for each name of interest, for example

\newcommand{\dknuth}{Donald Knuth\index{Knuth, Donald}}
\newcommand{llamport}{Leslie Lamport\index{Lamport, Leslie}}

and use it wherever you want to print the name.

1
  • That's one approach...
    – vy32
    Sep 27, 2020 at 18:00

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.