0

I am hoping to write a long(ish) article and was going to use \include thus enabling me to work on each section separately. When it comes to indexing I wondered if there was any way to globally search for and find terms to be included in the index or would I need to go through each section in turn. I have tried to do it through the generated PDF - search the PDF and then CMD click the word, it locates it but there seems no way to move to the next occurrence.

Sorry if the question is too basic, I just wanted to make sure before I start.

After more research I suspect the answer is here: https://tex.stackexchange.com/a/339409/87808. I am only a beginner so I will need to figure out how I can adapt this to work for me. Here is a MWE, but I had to enter all the indexed words by hand I was hoping to be able to find a way to do a global Find (and then replace) to make the index.

\documentclass[11pt{article}
\usepackage{makeidx}
\makeindex
\begin{document}
\include{intro}
\include{two}
\include{three}
\printindex
\end{document}

The three files are, intro:

\section{Intro}
This chapter will include \index{worms}worms gardens and fleas.

two:

 \section{Two}
This bit has \index{worms} worms only

three:

    \section{Three}
Loads more \index{worms} worms here.
  • 1
    If you're asking about a search function in your text editor, you need to say which one you're using. – Nicola Talbot Sep 2 '17 at 19:19
  • Sorry, I use TeXShop. – Robert Sep 2 '17 at 19:28
  • (off-topic) in the second section, your use of \index with spaces on both sides will result in a too-wide space in that location in the output. – barbara beeton Sep 2 '17 at 23:55

Browse other questions tagged or ask your own question.