# Songs Package Index Generation

First of all I have to say I’m Spanish, so I’m sorry for any mistakes in my English. Also, I’m very new at LaTeX.

I'm using the songs package to create a songs book. I've been able to typeset songs with chords but I cant find the way to generate a “Title Index” or an “Author Index” at the beginning of the book.

I have these lines at the beginning:

\newindex{titleidx}{titleidx}
\newauthorindex{authidx}{authidx}


I use these lines to show my indexes:

\showindex[2]{Índex de títols}{titleidx}


and

\showindex[2]{Índex de d'autors}{authidx}


And my songs are written between:

\begin{songs}{titleidx,authidx}


... songs ...

\end{songs}


I checked the Songs package documentation and it seems that I need to use a program named “songsidx”. Where do I find it and how exactly do I use it to generate my indexes?

Thank you!

The songidx program was written in order to sort scripture references.

# Windows

If you use Windows, there's a self-installing executable named songs-<version.number>-setup.exe available for download which contains a binary songidx.exe ready for you to use. The current version of songs is 2.15, so you can download songs-2.15-setup.exe available in the project homepage (link is provided).

# Unix

For Unix, we have some work to do beforehand. Let's build the program from source, so we need to obtain a file named songs-<version.number>.tar.gz and unpack it. The current version of songs is 2.15, so you can download songs-2.15.tar.gz available in the project homepage (link is provided).

In terminal, go to the same directory you have downloaded songs-2.15.tar.gz and run:

$tar xvzf songs-2.15.tar.gz  A directory named songs-2.15 will be created in the current directory. Let's enter in this directory with the command $ cd songs-2.15


Now, we have to configure our build process. Run

$./configure  and wait a couple of seconds. After it ends, it's actually time to build everything! Go with $ make


and go have some ice cream while everything is built. :) When finished, our songidx program is now build inside src/songidx/.

Copy songidx to your current project directory (if you want to specify which version of the bible you wish to use as a basis for sorting your scripture index, copy the corresponding .can file as well). Now let's take a look at the usage.

# Usage

Now let's see a real example. I wrote this humble .tex file based on your initial setup:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{songs}

\newindex{titleidx}{titleidx}
\newauthorindex{authidx}{authidx}

\begin{document}

\showindex[2]{Índex de títols}{titleidx}
\showindex[2]{Índex de d'autors}{authidx}

\begin{songs}{titleidx,authidx}

\beginsong{Mi alma glorifica al Señor, mi Dios}[by={Tradicional}]

\begin{chorus}
Mi \[E]alma glorifica al Señor, mi \[B7]Dios,
\[C#m]gózase mi espíritu en mi Salva\[G#m]dor.
\[A]El es mi ale\[B7]gría, \[E]es mi pleni\[C#m]tud,
\[A6]El es todo \[B7]para \[E]mí.
\end{chorus}

\begin{verse}
\[G#] Ha mi\[C#m]rado la ba\[G#]jeza de su es\[C#m]clava,
muy di\[B7]chosa me dirán todos los \[E]pueblos
porque en \[C#7]mí ha hecho grandes mara\[F#m]villas
El que \[C#m]todo puede, \[G#]cuyo Nombre es \[C#m]Santo. \[B7]
\end{verse}

\endsong

\end{songs}

\end{document}


Let's call this file cancionero.tex. First of all, let's run our favourite engine on this file:

$pdflatex cancionero.tex  Based on our setup, two files will be generated, titleidx.sxd and authidx.sxd. Now it's time to use songidx on them: $ ./songidx titleidx.sxd titleidx.sbx


and

$./songidx authidx.sxd authidx.sbx  Then, let's run our engine again to organize everything: $ pdflatex cancionero.tex


The output follows. First of all, we have \showindex[2]{Índex de títols}{titleidx}, our index of titles:

Then, our index of authors, thanks to \showindex[2]{Índex de d'autors}{authidx}:

And at last but not least, our song:

Hope it helps. :)

• Hello @Paul Cereda, do you have any idea how this works in a mac? – Mercy King Aug 22 '13 at 18:52
• @Mercy: Hi! :) The build instructions for Unix should work in a Mac as well, provided that you have gcc installed (via Xcode or homebrew). Then the usage of songidx is the same. The author only provides Windows binaries; for Mac or Linux, we need to compile the tool from source. – Paulo Cereda Aug 28 '13 at 14:02
• A couple of notes. on OS X as of this writing in the preamble we need to add \newcommand{\songlink}[2]{\hyperlink{#1}{#2}} . Also when using xelatex, the authidx.sbx file doesn't get generated, but running ./songidx with just the authidx.sxd seems to work. – MikeiLL Oct 30 '16 at 3:47