1

I have created an index list and want to ensure that all pages corresponding to the entries appear in the index are shown (i.e., if the term "urbanization" appears on p.34, 120, 150, then these three pages are shown in the index.) Instead of doing it manually (searching the urbanization for the whole text and add the command \index every time it appears), is there a faster way of doing it? Thank you.

Paullam
  • 11
  • How did you create your index? Please include a small example in how you created the index in your document. If you used the makeidx package including page numbers in the index yould be the default behaviour: `\documentclass{article} \usepackage{makeidx}

    \makeindex

    \begin{document} This is an example\index{example}.

    \newpage

    Example\index{example} is used on page 1 and 2.

    \printindex

    \end{document}`

    – leandriis Jun 18 '20 at 06:16
  • @leandriis I think the OP perhaps has a list of words which they want in the index, and then wants their locations to be automatically found. – oliversm Jun 18 '20 at 08:49
  • This has been discussed before at latex.org, and I think it's a no go. One solution could be a global find and replace, or create a small script to do it. – oliversm Jun 18 '20 at 08:59

1 Answers1

1

This is a recurrent topic. It has been commented several times that a good index need many human decisions to include/exclude/modify/link terms, so an automatic index generally ist not regarded as a good idea.

Said that, with xelatex and xesearch, changing a bit this answer to format acronyms, seems to work at some extent:

mwe

\documentclass{article}
%\usepackage[margin=3mm,bmargin=5mm,footskip=1mm,paperheight=8cm]{geometry}
\usepackage[colorlinks]{hyperref}
\usepackage{makeidx}  \makeindex 
\usepackage{xesearch}
\UndoBoundary{-} % allow hyphens!!
\SearchList{index}{#1\index{{#1}}}{antibod?,covid?,infection,rna,DNA,*ELISA,*WHO,?pcr,%
RT-pcr,Multiplex-PCR,usa,UK,SARS?,virus,sensit?,test?}

\begin{document} Mr. So and So, from the WHO, % organization, must be indexed
\newpage who % common word, must be not indexed has announced yesterday in the UK and the USA that the ELISA % method acronym, must be indexed
\newpage test to detect antibodies against SARS-CoV-2 \newpage\newpage\newpage
in COVID-19 patients with with first signs of the disease is useless,
said now that even PCR methods, \newpage\newpage
like RT-PCR \newpage nested PCR,\newpage quantitative PCR,\newpage\newpage\newpage\newpage
and Multiplex-PCR test, \newpage\newpage\newpage
used too early in the course of infection are not enough sensitives.\newpage On the other hand, the researcher
Elisa % Woman name, must be not indexed Whoknow proposed a WHO meetings to discuss the disgnostic protocols of SARS and RNA virus and the sensitivity of a new indirect antibody test.

\StopList {index} \newpage \printindex

\end{document}

Fran
  • 80,769