LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsIndexing with Reference to Section and Subsection

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
misterbenn
Posts: 3
Joined: Fri Jul 29, 2011 7:48 am

Indexing with Reference to Section and Subsection

Postby misterbenn » Fri Jul 29, 2011 9:01 am

Hello,

I'm having some probblems with indexing and i hope you can help. I have a list of technical presentations (100s of them) seperated in numbered sections (the conference) and numbered subsections(the presentation name).

To help me navigate this i want to build an index of topics, but with the index refering to the section.subsection number not the page number.

so far i have this:
\newcommand{\sec}[1]{\alpha{section}.\alpha{subsection}}


and to create the index
\section{Conference}
\subsection{Topic}
\index{topic|sec}


However i've discovered that this sets all the section.subsection refrences to the last section.subsection - I think this is because the
\alpha{section}.\alpha{subsection}}
is only evaluated at the command \printindex which is at the end of the document.
can anyone suggest a solution to this? Maybe i could use \label and \ref commands to give dedicated section refrences??

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
misterbenn
Posts: 3
Joined: Fri Jul 29, 2011 7:48 am

Indexing with Reference to Section and Subsection

Postby misterbenn » Fri Jul 29, 2011 5:31 pm

so i've found a solution i'm happy with.

\makeindex
\newcommand{\ind}[2]{\index{#1|inds{\ref{#2}}}}
\newcommand{\inds}[2]{#1}

and i add to my index in the document using
\section{a thing}
\subsection{a thing of the first thing}\label{sub:thing}
\ind{things}{sub:thing}


So i'm create a label for each of my subsections. I then pass to my command (ind) the index entry name and the label refence. to give me
\index{things|\inds{\ref{sub:thing}}}

The inds command is just removing my page number for me.
so the output looks like
things, 1.1

misterbenn
Posts: 3
Joined: Fri Jul 29, 2011 7:48 am

Re: Indexing with Reference to Section and Subsection

Postby misterbenn » Fri Jul 29, 2011 8:28 pm

The above solution has worked fine ...however
Label only stores values upto 9, and i am now on 13 subsections so i need to fine a way to expand the lable functionality or else find a different way of doing this.


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest