3

I use vim-latex. For the sake of SyncTeX, I usually format my paragraphs into separate lines, using a customized gqip.

I used to put \index after the term to be indexed, as suggested here. For example

Bla bla bla bla bla bla bla bla bla bla. A 
\emph{quasipseudometaball}\index{quasipseudometaball} is defined as follows

However, this produces a long string without spaces, which is not practical when I format the paragraph in Vim with gqip, as shown in the example above.

Putting space or line break before \index is not a good idea, neither, because

Let $B$ be a ball \index{ball}.

will put a space before the period. Anyway, putting \index within the text makes the defining paragraphs unreadable in the source code. I don't like it.

I now decide to put them before the relative paragraphs, but sometimes the paragraph is long, and the location is not precise anymore.

It may be a silly question, but I would like to know where do you put \index?

4
  • 2
    I usually hide the \index inside a macro. So instead of doing ball\index{ball} I'll do \term{ball} or something similar and then define \term (or whatever) to use \index. (Although that additionally requires escaping makeindex special characters etc, unless I use \usepackage[index]{glossaries} which does it for me.) – Nicola Talbot Mar 12 '14 at 15:03
  • Related with Nicola Talbot comment, event you can make that the word is showed differently the fisrt time but indexed in the same way, and more ... There are an example of some complexity in tex.stackexchange.com/questions/116436/… for a example – Fran Mar 13 '14 at 19:17
  • It also seems to me that I get different kerning for punctuation if I do cats\index{cat}. or cats.\index{cat} - the second seems to work better. – bombcar Mar 23 '14 at 23:11
  • 1
    What about putting the \index before the paragraph that contains the keywords? I guess most people just start reading a paragraph from the beginning. – Leonardo Castro Feb 9 '16 at 20:25

Your Answer

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

Browse other questions tagged or ask your own question.