0

so i want to make an index that shows where certain words appear in which pages in the output pdf

let's say I have a document that contains a certain amount of the word "avocado" and at the end of the file, i want texstudio to show which page contains that word something like

avocado- 10, 15, 420, 500,

is anything like that possible and if not, what's the closest I can do? i did try using makeindex, printindex and all that and maybe that was it, but i can't seem to figure out how those work either

2
  • makeindex is the solution. You could provide an example showing what you've tried and got by far. Commented May 8, 2022 at 8:00
  • unfortunately i can't present an exact example of what i did after someone other than me tried to figure out how it worked, but i believe it was something along the lines of \begin{theindex} \index{avocado} \index{potato} \end{theindex} and then also put a printindex call at the end of the main document
    – Reddimus
    Commented May 8, 2022 at 12:45

1 Answer 1

0

Along the lines of:

% index2prob.tex SE 643379

\documentclass{article}
\setlength{\textheight}{0.5\textheight}
\usepackage{lipsum}
\usepackage{makeidx}
\makeindex

\begin{document}

Stuff about avocados.\index{avocardo}

\newpage

Different stuff about potatoes\index{potato} and avocardos.\index{avocardo}

Remember that the sequence of events should be:
\begin{itemize}
\item \verb!pdflatex index2prob! % compile the document
\item \verb!makeindex index2prob! % generate the index
\item \verb!pdflatex index2prob! % compile the document with its index
  \end{itemize}
\printindex
\end{document}

enter image description here

1
  • that worked like a charm, thanks
    – Reddimus
    Commented May 8, 2022 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .