%%
%% This is file `labelcas.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% labelcas.dtx  (with options: `labelcas')
%%
%% This is a generated file.
%%
%% Copyright (C) 2006 by Ulrich Diez <ulrich.diez@alumni.uni-tuebingen.de>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of LaTeX version
%% 2003/12/01 or later.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{labelcas}
   [2006/08/14 v1.12 check label-existence and fork accordingly]
\begingroup
\DeclareOption{DefineLabelcase}%
              {\global\let\DefineLabelcase\DefineLabelcase}%
\newcommand\DefineLabelcase[4]{%
  \expandafter\@ifdefinable\csname#3lc@remtrailspace\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@remtrailspace\endcsname##1#1#2##2#2#1{%
      \begingroup
      \toks@{##2}%
      \edef\@tempa{\the\toks@}%
      \expandafter\endgroup
      \ifx\@tempa\@empty
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
      {%
        {\toks@{##1}\edef\@tempa{\the\toks@}%
         \toks@{#2}\edef\@tempb{\the\toks@}%
         \expandafter}%
        \ifx\@tempa\@tempb
          \expandafter\@gobble
        \else
          \expandafter\@firstofone
        \fi
        {\csname#3lc@remleadspace\endcsname#2##1#1#2#2}%
      }%
      {\csname#3lc@remtrailspace\endcsname##1#2#1#2#2#1}%
    }%
  }%
  \expandafter\@ifdefinable\csname#3lc@remleadspace\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@remleadspace\endcsname##1#2#1##2#2#2{%
      \begingroup
      \toks@{##1}%
      \edef\@tempa{\the\toks@}%
      \expandafter\endgroup
      \ifx\@tempa\@empty
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
      {\csname#3lc@remleadspace\endcsname#2##2#2#2}%
      {\@tempa##1#2}%
    }%
  }%
  \expandafter\@ifdefinable\csname#3lc@iterate\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@iterate\endcsname##1#2{%
      \begingroup
      \toks@{##1}%
      \edef\@tempa{\the\toks@}%
      \toks@{#1\@nil}%
      \edef\@tempb{\the\toks@}%
      \expandafter\endgroup\ifx\@tempa\@tempb
        \expandafter\@gobble
      \else
        \expandafter\@firstofone
      \fi
      {%
        \csname#3lc@remtrailspace\endcsname##1#2#1#2#2#1%
        \csname#3lc@iterate\endcsname#1%
      }%
    }%
  }%
  \expandafter\@ifdefinable\csname#3eachlabelcase\endcsname{%
    \expandafter\DeclareRobustCommand
    \csname#3eachlabelcase\endcsname[2][]{%
      {%
        \long\def\@tempa#2####1#2{%
          \@tempb####1#2#1#2#2%
        }%
        \long\def\@tempb####1{%
          \begingroup
          \long\def\@tempb########1########2########3{%
            \expandafter\expandafter
            \expandafter\endgroup
            \expandafter\ifx
            \csname r@########1\endcsname\relax
              \expandafter\@firstoftwo
            \else
              \expandafter\@secondoftwo
            \fi
            {\@temptokena\expandafter{\the\@temptokena########3}}%
            {\@temptokena\expandafter{\the\@temptokena########2}}%
          }%
          \begingroup
          \toks@{}%
          \long\def\@tempb########1{%
            \long\def\@tempa#2################1#2{%
              \toks@\expandafter{\the\toks@{################1}}%
              \expandafter\endgroup\expandafter\@tempb\the\toks@
            }%
            \toks@\expandafter{\the\toks@{########1}}%
            \csname#3lc@remleadspace\endcsname#2%
          }%
          \toks@{{####1}}\csname#3lc@remleadspace\endcsname#2%
        }%
        \@temptokena{}%
        \csname#3lc@iterate\endcsname#1##2#2\@nil#2%
        \lc@macrodefiner{##1}%
      \expandafter}\the\@temptokena
    }%
  }%
  \expandafter\@ifdefinable\csname#3lotlabelcase\endcsname{%
    \expandafter\DeclareRobustCommand
    \csname#3lotlabelcase\endcsname[6][]{%
      {%
        \long\def\@tempa#2####1#2{%
          {\expandafter\expandafter\expandafter}\expandafter
          \ifx\csname r@####1\endcsname\relax
            \let\@tempb\relax
          \else
            \let\@tempc\relax
          \fi
        }%
        \def\@tempb{}%
        \def\@tempc{}%
        \csname#3lc@iterate\endcsname#1##2#2\@nil#2%
        \ifx\@tempb\@empty
          \ifx\@tempc\@empty
            \@temptokena{##6}%
          \else
            \@temptokena{##3}%
          \fi
        \else
          \ifx\@tempc\@empty
            \@temptokena{##4}%
          \else
            \@temptokena{##5}%
          \fi
        \fi
        \lc@macrodefiner{##1}%
      \expandafter}\the\@temptokena
    }%
  }%
  {\toks@{#4}\edef\@tempa{\the\toks@}\def\@tempb{\global}\expandafter}%
  \ifx\@tempa\@tempb
    \expandafter\global\expandafter\let
      \csname#3lc@remtrailspace\expandafter\endcsname
      \csname#3lc@remtrailspace\endcsname
    \expandafter\global\expandafter\let
      \csname#3lc@remleadspace\expandafter\endcsname
      \csname#3lc@remleadspace\endcsname
    \expandafter\global\expandafter\let
      \csname#3lc@iterate\expandafter\endcsname
      \csname#3lc@iterate\endcsname
    \expandafter\global\expandafter\let
      \csname#3eachlabelcase\expandafter\endcsname
      \csname#3eachlabelcase\endcsname
    \expandafter\global\expandafter\let
      \csname#3lotlabelase\expandafter\endcsname
      \csname#3lotlabelcase\endcsname
  \fi
}%
\ProcessOptions\relax
\expandafter\endgroup\DefineLabelcase{ }{,}{}{\global}%
\newcommand\lc@macrodefiner[1]{%
  {\def\@tempa{#1}\expandafter}%
  \ifx\@tempa\@empty
  \else
    \@temptokena\expandafter{%
                \expandafter\begingroup
                \expandafter\toks@
                \expandafter\expandafter
                \expandafter            {%
                \expandafter\expandafter
                \expandafter            \@temptokena
                \expandafter\expandafter
                \expandafter            {%
                \expandafter\the
                \expandafter\@temptokena
                \expandafter}%
                \expandafter}%
                \expandafter\@temptokena
                \expandafter{%
                \expandafter\@temptokena
                \expandafter{%
                \the\@temptokena}%
                \@ifdefinable#1{\edef#1{\the\@temptokena}}}%
                \expandafter\endgroup
                \the\expandafter\@temptokena
                \the\toks@
    }%
  \fi
}%
\endinput
%%
%% End of file `labelcas.sty'.