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.
Post Reply
misterbenn
Posts: 3
Joined: Fri Jul 29, 2011 7:48 am

Indexing with Reference to Section and Subsection

Post by misterbenn »

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:

Code: Select all

\newcommand{\sec}[1]{\alpha{section}.\alpha{subsection}}
and to create the index

Code: Select all

\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

Code: Select all

\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 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
misterbenn
Posts: 3
Joined: Fri Jul 29, 2011 7:48 am

Indexing with Reference to Section and Subsection

Post by misterbenn »

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

Code: Select all

\makeindex
\newcommand{\ind}[2]{\index{#1|inds{\ref{#2}}}}
\newcommand{\inds}[2]{#1}
and i add to my index in the document using

Code: Select all

\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

Code: Select all

\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

Post by misterbenn »

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.
Post Reply