MakeIndex, Nomenclature, Glossaries and AcronymsSectionnames in index

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
Boersma
Posts: 21
Joined: Mon Nov 22, 2010 9:29 pm

Sectionnames in index

Post by Boersma »

Hi all,

I'm busy with a songbook, containing approx 150 songs (each in a section) and I want to put them all in alphabetical order in the index.

One option is to put after each section an \index-command with a unique entry, see code.

Code: Select all

\documentclass{article}
\usepackage{makeidx}
\makeindex

\begin{document}
\section*{First song} \index{First song}
la la la la

\section*{Second song} \index{Second song}
la li la lo

\printindex
\end{document}
But is there a faster way? (something like \index{\thissectionname}) Or an option at makeindex?

Thanks in advance
Boersma
Last edited by Boersma on Tue Nov 23, 2010 3:54 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Sectionnames in index

Post by nlct »

I think the easiest way would be to create a new command that does the section and indexing. For example:

Code: Select all

\newcommand*{\song}[1]{\section*{#1}\index{#1}}
Then just do

Code: Select all

\song{First Song}
etc

Regards
Nicola Talbot
Boersma
Posts: 21
Joined: Mon Nov 22, 2010 9:29 pm

Re: Sectionnames in index

Post by Boersma »

Thanks: a simlpe, elegant solution for the problem.
Now it is fixed in a split second.
Post Reply