Code: Select all
\documentclass[b5paper]{book}
\usepackage{multicol}
\makeatletter
\newcommand{\makesongs}{%
\makeindex
\bgroup
\def\indexsection\numberline##1##2\endindexsection{%
\protected@write\@indexfile{}{\string\indexentry{##2}{##1}}}%
\def\contentsline##1##2##3{\indexsection##2\endindexsection}%
\@input@{\jobname.toc}%
\egroup
}
\newcommand{\listofsongs}{%
\begingroup
\@input@{\jobname.ind}%
\if@filesw
\expandafter\newwrite\csname tf@toc\endcsname
\immediate\openout\csname tf@toc\endcsname\jobname.toc\relax
\fi
\@nobreakfalse
\endgroup}
\newcommand*{\songsection}[2][]{%
\newpage
\def\thesongtitle{#1}%
\ifx\thesongtitle\@empty
\section{#2}%
\else
\section[#1@#2]{#2}%
\fi
}
\makeatother
\makesongs
\begin{document}
% Document is here
\newpage
\begin{multicols}{2}
\listofsongs
\end{multicols}
\end{document}
Code: Select all
song . . . . . . . . 22
Code: Select all
22 song
My songs.ist is:
Code: Select all
preamble "\\section*{List of Songs}"
postamble ""
group_skip ""
item_0 "\n\\contentsline\{section\}\{"
delim_0 "\}\{"
delim_t "\}"
headings_flag 0
level '>'