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.
1 Answers
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:
\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}
- 80,769

makeidxpackage 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