%  poem.sty
%  Gedichte mit Verzeichniseintrag
\RequirePackage{ifthen}

%  Der Zaehler.
\newcounter{poemcnt}
\renewcommand{\thepoemcnt}{\Roman{poemcnt}}

%  Formatiert die Eintraege im Verzeichnis.
\newcommand{\l@poem}[2]
{{\renewcommand{\numberline}[1]
    {\makebox[1cm][l]{##1}}
  \itshape #1\dotfill#2}\\}

%  Erzeugt die Eintraege im Verzeichnis und druckt
%  den Gedichtkopf in einem bestimmen Format.
\newenvironment{poem}[1]
{\refstepcounter{poemcnt}
 \addcontentsline{lop}{poem}
   {\protect\numberline{\thepoemcnt} #1}
 \begin{verse}
 \flushleft{\itshape\thepoemcnt{} #1}
 }
{\end{verse}}

%  Erzeugt das Verzeichnis.
\newcommand{\lopname}{Die Gedichte}
\newcommand{\tableofpoems}
{\setboolean{@restonecol}{false}
 \ifthenelse{\boolean{@twocolumn}}
   {\setboolean{@restonecol}{true}\onecolumn}
   {}
 \chapter*{\lopname\@mkboth{\lopname}{\lopname}}
 {\setlength{\parindent}{0pt}
  \@starttoc{lop}}
 \ifthenelse{\boolean{@restonecol}}
   {\twocolumn}
   {}
}