2

What I want to achieve is not so simple but I'll try my best to make myself clear. I have the following document:

\documentclass{article}

\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{makeidx}
\makeindex

\begin{document}
\section*{List}
The index \texttt{testindex} appears in these locations: \printindex

\section{First}
\textcolor{red}{The index does not appear here.}
\clearpage

\subsection{First.First}
\textcolor{green}{The index appears here.\index{testindex}}
\clearpage

\section{Second}
\textcolor{red}{The index does not appear here.}
\clearpage

\subsection{Second.First}
\textcolor{red}{The index does not appear here.}
\clearpage

\subsubsection{Second.First.First}
\textcolor{green}{The index appears here.\index{testindex}}
\clearpage

\section{Third}
\textcolor{green}{The index appears here.\index{testindex}}
\clearpage

\end{document}

The \printindex command produces this output:

Index

What I want is a comma-separated list of the sections/subsections/subsubsections (whatever is more specific) of all occurrences and I want all of these values to be links to the specified locations, i.e. when I click on 1.1 that the document will jump to First.First. I generated the desired output (without the link behaviour) for a better understanding: Desired output

Can anyone help me?

2
  • this may be helpful: Index by section.subsection Jan 21 '18 at 12:44
  • Sketch of an idea: create your own custom <list of> and patch the index command to write the current section number to this list.
    – cmhughes
    Jan 21 '18 at 13:08

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.