%%
%% This is file `splitbib.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% splitbib.dtx  (with options: `package')
%% 
%% 
%% This is a generated file.
%% 
%% 
%% IMPORTANT COPYRIGHT NOTICE:
%% 
%% Permission is granted to copy this file to another file with a clearly
%% different name and to customize the declarations in that copy to serve
%% the needs of your installation.
%% 
%% However, NO PERMISSION is granted to generate or to distribute a
%% modified version of this file under its original name.
%% 
%% You are NOT ALLOWED to change this file.
%% 
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{splitbib}
     [2005/12/22 v1.17 Splits bibliography into categories]
\newif\ifNMSB@strict\NMSB@strictfalse
\DeclareOption{strict}{\NMSB@stricttrue}
\DeclareOption{nonstrict}{\NMSB@strictfalse}
\newif\ifNMSB@ownorder\NMSB@ownorderfalse
\DeclareOption{reorder}{\NMSB@ownordertrue}
\DeclareOption{keeporder}{\NMSB@ownorderfalse}
\newif\ifNMSB@export\NMSB@exportfalse
\DeclareOption{export}{\NMSB@exporttrue}
\DeclareOption{noexport}{\NMSB@exportfalse}
\newif\ifNMSB@newchap\NMSB@newchaptrue
\DeclareOption{newchap}{\NMSB@newchaptrue}
\DeclareOption{newsec}{\NMSB@newchaptrue}
\DeclareOption{nonewchap}{\NMSB@newchapfalse}
\DeclareOption{nonewsec}{\NMSB@newchapfalse}
\ProcessOptions*
\newcounter{NMSB@catlevelone}
\newcounter{NMSB@catleveltwo}
\setcounter{NMSB@catlevelone}{10}
\setcounter{NMSB@catleveltwo}{10}
\newcounter{NMSB@catlevel}
\setcounter{NMSB@catlevel}{0}
\newcounter{SBresetdepth}
\setcounter{SBresetdepth}{0}
\newcounter{NMSB@ent}
\newcounter{NMSB@maxent}
\def\NMSB@initent{100}
\newtoks\NMSB@tok
\setcounter{NMSB@maxent}{\NMSB@initent0}
\addtocounter{NMSB@maxent}{-1}
\setcounter{NMSB@ent}{\NMSB@initent}
\newdimen\NMSB@longest
\newdimen\NMSB@reallylongest
\setlength{\NMSB@longest}{0pt}
\setlength{\NMSB@reallylongest}{0pt}
\def\NMSB@reallylongestlabel{}
\expandafter\def\csname NMSBtitle@99\endcsname{\SBmisctitle}
\expandafter\def\csname NMSBprefix@9999\endcsname{\SBmiscprefix}
\def\SBmisctitle{Miscellaneous}
\def\SBmiscprefix{}
\newtoks\NMSB@currprefixtok
\newtoks\NMSB@currprefixlevelonetok
\def\NMSB@prevcat{0}
\def\NMSB@prevcatlevelone{0}
\def\NMSB@missingcat{}
\def\NMSB@doublecat{}
\let\NMSB@valuelist\relax
\newdimen\SBabovesepwidth
\newdimen\SBbelowsepwidth
\setlength{\SBabovesepwidth}{.4pt}
\setlength{\SBbelowsepwidth}{.4pt}
\def\NMSB@penalty{5000}
\def\NMSB@halfpenalty{500}
\def\NMSB@warnnocateg#1,\end{%
  \message{---- Splitbib warning ----^^J%
    -- The following bib entries have no category: #1^^J}}
\def\NMSB@warndblcateg#1,\end{%
  \message{---- Splitbib warning ----^^J%
    -- The following bib entries have several categories: #1^^J%
    -- The first one will be used.^^J}}
\def\NMSB@warnwronglongest{%
  \expandafter\NMSB@tok\expandafter{\NMSB@reallylongestlabel}
  \message{---- Splitbib warning ----^^J%
    -- The longest label appears to be [\the\NMSB@tok]
    instead of}
  \@ifundefined{SBlongestlabel}{}{\message{(forced)}}
  \expandafter\NMSB@tok\expandafter{\NMSB@longestlabel}
  \message{[\the\NMSB@tok]^^J}}
\def\NMSB@errtoomanycat#1{%
  \message{---- Splitbib error ----^^J%
    -- You defined too many level-#1 categories (max = 89).^^J}}
\def\NMSB@errtoomanyent{%
  \setcounter{NMSB@maxent}{\NMSB@initent0}
  \addtocounter{NMSB@maxent}{-\NMSB@initent}
  \message{---- Splitbib error ----^^J%
    -- You defined too many entries in one category %
    (max = \theNMSB@maxent)^^J}}
\def\NMSB@errcattoodeep{%
  \message{---- Splitbib error ----^^J
    -- Only two category depth allowed.^^J}}
\def\NMSB@errentriesoutsidecat{%
  \message{---- Splitbib error ----^^J
    -- \string\SBentries outside category environment.^^J}}
\def\NMSB@errentrieswithoptinsidecat{%
  \message{----Splitbib error ----^^J
    -- \string\SBentries with optional argument inside category env.^^J}}
\def\NMSB@erraliasoutsidecat{%
  \message{----Splitbib error ----^^J
    -- \string\SBalias used outside category environment.^^J}}
\def\NMSB@erraliasalreadydef#1{%
  \message{----Splitbib error ----^^J
    -- Alias #1 multiply defined.^^J}}
\def\NMSB@erraliasundefined#1{%
  \message{----Splitbib error ----^^J
    -- Alias #1 undefined.^^J}}
\def\NMSB@errcommentoutsidecat{%
  \message{----Splitbib error ----^^J
    -- \string\SBcomment used outside category environment.^^J}}
\def\SBtitlestyle#1{\gdef\NMSB@titlestyle{#1}}
\def\SBsubtitlestyle#1{\gdef\NMSB@subtitlestyle{#1}}
\def\NMSB@titlestyle{bar}
\def\NMSB@subtitlestyle{dash}
\def\SBtitle#1{\def\NMSB@level{title}%
  \csname NMSB@style\NMSB@titlestyle\endcsname{}{#1}}
\def\SBsubtitle#1#2{\def\NMSB@level{subtitle}%
  \csname NMSB@style\NMSB@subtitlestyle\endcsname{}{#2}}
\def\SBtitlefont#1{{\bfseries\Large #1}}
\def\SBsubtitlefont#1{{\bfseries #1}}
\def\NMSB@stylebox#1#2{\hskip-\leftmargin%
  \vbox{%
    \medskip\par
    {\null\hfill
      \setlength\fboxsep{\baselineskip}%
      \framebox[\textwidth]{%
        \csname SB\NMSB@level font\endcsname{#1#2}}%
      \hfill\null}}%
  \bigskip}
\def\NMSB@stylebar#1#2{\hskip-\leftmargin%
  \vbox{%
    \medskip\par
    \vrule height \SBabovesepwidth depth 0pt width \textwidth
    \vskip.3\baselineskip\par\noindent
    {\null\hfill
      \csname SB\NMSB@level font\endcsname{#1#2}%
      \hfill\null}%
    \vskip-.4\baselineskip\par\noindent
    \vrule height \SBbelowsepwidth depth 0pt width \textwidth}}
\def\NMSB@styledash#1#2{\unskip\hskip-\leftmargin%
  \vbox{%
    \smallskip\noindent
    {\null\hfill
      \csname SB\NMSB@level font\endcsname{---~#1#2~---}}
    \hfill\null}
  \par}
\def\NMSB@stylenone#1#2{%
  \vspace{-2\itemsep}\vspace{-\baselineskip}}
\def\NMSB@stylesimple#1#2{\hskip-\leftmargin%
  \csname SB\NMSB@level font\endcsname{#1#2}
}
\def\category{\@ifnextchar[{\@lNMSBcategory}{\@lNMSBcategory[]}}
\def\@lNMSBcategory[#1]#2{%
  \stepcounter{NMSB@catlevel}%
  \ifnum\theNMSB@catlevel>2\relax
    \NMSB@errcattoodeep
    \addtocounter{NMSB@catlevel}{-1}%
  \fi
  \ifnum\theNMSB@catlevel=1\relax
    \ifnum\theNMSB@catlevelone=98\relax
      \NMSB@errtoomanycat{one}%
    \else
      \stepcounter{NMSB@catlevelone}%
    \fi
    \setcounter{NMSB@catleveltwo}{10}%
    \expandafter\gdef\csname NMSBprefix@\theNMSB@catlevelone
     \endcsname{#1}%
    \expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone
     \endcsname{#2}%
  \else
    \ifnum\theNMSB@catleveltwo=98\relax
      \NMSB@errtoomanycat{two}%
    \else
      \stepcounter{NMSB@catleveltwo}%
    \fi
    \expandafter\let\expandafter\NMSB@tempentry\csname
      NMSBprefix@\theNMSB@catlevelone\endcsname
    \expandafter\NMSB@tok\expandafter{\NMSB@tempentry}
    \expandafter\xdef\csname NMSBprefix@\theNMSB@catlevelone
      \theNMSB@catleveltwo\endcsname{\the\NMSB@tok #1}%
    \expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone
      \theNMSB@catleveltwo\endcsname{#2}%
  \fi
}
\def\@NMSBcategory#1{%
  \stepcounter{NMSB@catlevel}
  \ifnum\theNMSB@catlevel>2\relax
    \NMSB@errcattoodeep
    \addtocounter{NMSB@catlevel}{-1}%
  \fi
  \ifnum\theNMSB@catlevel=1\relax
    \ifnum\theNMSB@catlevelone=98\relax
      \NMSB@errtoomanycat{one}%
    \else
      \stepcounter{NMSB@catlevelone}%
    \fi
    \setcounter{NMSB@catleveltwo}{10}
    \expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone
     \endcsname{#1}%
  \else
    \ifnum\theNMSB@catleveltwo=98\relax
      \NMSB@errtoomanycat{two}%
    \else
      \stepcounter{NMSB@catleveltwo}%
    \fi
    \expandafter\ifx\csname NMSBprefix@\theNMSB@catlevelone\endcsname
      \relax
    \else
      \expandafter\let\expandafter\NMSB@tempentry\csname
        NMSBprefix@\theNMSB@catlevelone\endcsname
      \expandafter\NMSB@tok\expandafter{\NMSB@tempentry}%
      \expandafter\xdef\csname NMSBprefix@\theNMSB@catlevelone
       \theNMSB@catleveltwo\endcsname{\the\NMSB@tok}%
    \fi
    \expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone
     \theNMSB@catleveltwo\endcsname{#1}%
  \fi
}
\def\endcategory{\addtocounter{NMSB@catlevel}{-1}}
\def\SBalias#1{%
  \ifnum\theNMSB@catlevel<1\relax
    \NMSB@erraliasoutsidecat
  \else
    \expandafter\ifx\csname NMSBalias@#1\endcsname\relax
      \ifnum\theNMSB@catlevel=1\relax
        \expandafter\xdef\csname NMSBalias@#1\endcsname{%
          \theNMSB@catlevelone 10}%
      \else
        \expandafter\xdef\csname NMSBalias@#1\endcsname{%
          \theNMSB@catlevelone\theNMSB@catleveltwo}%
      \fi
    \else
      \NMSB@erraliasalreadydef{#1}%
    \fi
  \fi
}
\long\def\SBcomment#1{%
  \ifnum\theNMSB@catlevel<1\relax
    \NMSB@errcommentoutsidecat
  \else
    \ifnum\theNMSB@catlevel=1\relax
      \expandafter\gdef\csname NMSBcomment@\theNMSB@catlevelone
       \endcsname{#1}%
    \else
      \expandafter\gdef\csname NMSBcomment@\theNMSB@catlevelone
       \theNMSB@catleveltwo\endcsname{#1}%
    \fi
  \fi
}
\def\SBentries{\@ifnextchar[
  {\NMSB@entries@withoptarg}%
  {\NMSB@entries@incatenv}}
\def\NMSB@entries@withoptarg[#1]#2{%
  \ifnum\theNMSB@catlevel>0\relax
    \NMSB@errentrieswithoptinsidecat
  \else
    \@for\@citeb:=#2\do{%
      \expandafter\ifx\csname NMSBcateg@\@citeb\endcsname\relax
        \expandafter\ifx\csname NMSBalias@#1\endcsname\relax
          \NMSB@erraliasundefined{#1}%
        \else
          \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
            \csname NMSBalias@#1\endcsname}%
          \ifNMSB@ownorder
            \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
              \csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}%
    \stepcounter{NMSB@ent}%
            \ifnum\theNMSB@ent=\theNMSB@maxent\relax
      \NMSB@errtoomanyent
            \fi
          \fi
        \fi
      \else
        \ifNMSB@strict
          \xdef\NMSB@doublecat{\NMSB@doublecat \@citeb,}%
        \else
          \expandafter\ifx\csname NMSBalias@#1\endcsname\relax
            \NMSB@erraliasundefined{#1}%
          \else
            \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
              \csname NMSBcateg@\@citeb\endcsname,%
              \csname NMSBalias@#1\endcsname}%
            \ifNMSB@ownorder
              \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
                \csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}%
              \stepcounter{NMSB@ent}%
              \ifnum\theNMSB@ent=\theNMSB@maxent\relax
                \NMSB@errtoomanyent
              \fi
            \fi
          \fi
        \fi
      \fi}%
  \fi
}
\def\NMSB@entries@incatenv#1{%
  \ifnum\theNMSB@catlevel<1\relax
    \NMSB@errentriesoutsidecat
  \else
    \@for\@citeb:=#1\do{%
      \expandafter\ifx\csname NMSBcateg@\@citeb\endcsname\relax
        \ifnum\theNMSB@catlevel=2\relax
          \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
            \theNMSB@catlevelone\theNMSB@catleveltwo}%
        \else
          \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
             \theNMSB@catlevelone10}%
        \fi%
        \ifNMSB@ownorder
          \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
            \csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}%
          \stepcounter{NMSB@ent}%
          \ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi
        \fi
      \else
        \ifNMSB@strict
          \xdef\NMSB@doublecat{\NMSB@doublecat \@citeb,}%
        \else
          \ifnum\theNMSB@catlevel=2\relax
            \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
              \csname NMSBcateg@\@citeb\endcsname,%
              \theNMSB@catlevelone\theNMSB@catleveltwo}%
          \else
            \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
              \csname NMSBcateg@\@citeb\endcsname,%
              \theNMSB@catlevelone10}%
          \fi
        \fi
        \ifNMSB@ownorder
          \expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{%
            \csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}%
          \stepcounter{NMSB@ent}%
          \ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi
        \fi
      \fi}%
  \fi
}
\let\@NMSBrealorig@@bibitem\@bibitem
\let\@NMSBorig@@lbibitem\@lbibitem
\def\@NMSBorig@@bibitem#1{\item\if@filesw \immediate\write\@auxout
  {\string\bibcite{#1}{\the\NMSB@currprefixtok\the\value{\@listctr}}}%
  \fi\ignorespaces}
\def\NMSB@getcateg#1#2#3#4#5-{#1#2#3#4}
\def\NMSB@getent#1#2#3#4#5-{#5}
\def\@lbibitem[#1]#2#3\par{%
  \expandafter\ifx\csname NMSBcateg@#2\endcsname\relax
    \expandafter\gdef\csname NMSBcateg@#2\endcsname{9999}%
    \edef\NMSB@missingcat{\NMSB@missingcat #2,}%
  \fi
  \let\@tempa\relax
  \ifNMSB@ownorder
    \edef\NMSB@temp{\csname NMSBcateg@#2\endcsname}%
    \@for\NMSB@local:=\NMSB@temp\do{%
      \ifx\relax\@tempa\relax
        \edef\@tempa{\expandafter\NMSB@getcateg\NMSB@local-}%
      \else
        \edef\@tempa{\@tempa,\expandafter\NMSB@getcateg\NMSB@local-}%
      \fi
    }%
  \else
    \edef\@tempa{\csname NMSBcateg@#2\endcsname}%
  \fi
  \expandafter\ifx\csname NMSBprefix@\@tempa\endcsname\relax
    \def\@tempb{#1}%
  \else
    \expandafter\let\expandafter\NMSB@tempentry\csname
      NMSBprefix@\@tempa\endcsname
    \expandafter\NMSB@tok\expandafter{\NMSB@tempentry #1}%
    \edef\@tempb{\the\NMSB@tok}%
  \fi
  \@ifundefined{SBlongestlabel}{%
    \setbox\@tempboxa=\hbox{\@tempb}%
    \ifdim\NMSB@longest<\wd\@tempboxa
      \setlength\NMSB@longest{\wd\@tempboxa}%
      \global\let\NMSB@longestlabel\@tempb
    \fi}{}%
  \ifNMSB@ownorder
    \edef\NMSB@temp{\csname NMSBcateg@#2\endcsname}%
    \@for\NMSB@local:=\NMSB@temp\do{%
      \edef\NMSB@tempb{\expandafter\NMSB@getent\NMSB@local-}
      \expandafter\xdef\csname NMSBkey@\NMSB@tempb\endcsname{#2}%
      \global\expandafter\let\csname NMSBlabel@\NMSB@tempb\endcsname
        \@tempb
      \expandafter\gdef\csname NMSBentry@\NMSB@tempb\endcsname{#3}%
      \ifx\relax\NMSB@valuelist\relax
        \xdef\NMSB@valuelist{\NMSB@local}%
      \else
        \xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@local}%
      \fi}%
  \else
    \expandafter\xdef\csname NMSBkey@\theNMSB@ent\endcsname{#2}%
    \global\expandafter\let\csname NMSBlabel@\theNMSB@ent\endcsname
      \@tempb
    \expandafter\gdef\csname NMSBentry@\theNMSB@ent\endcsname{#3}%
    \@for\NMSB@item:=\@tempa\do{%
      \ifx\relax\NMSB@valuelist\relax
        \xdef\NMSB@valuelist{\NMSB@item\theNMSB@ent}%
      \else
        \xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@item\theNMSB@ent}%
      \fi}%
    \stepcounter{NMSB@ent}%
    \ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi
  \fi
}
\def\@bibitem#1#2\par{%
  \expandafter\ifx\csname NMSBcateg@#1\endcsname\relax
    \expandafter\gdef\csname NMSBcateg@#1\endcsname{9999}%
    \edef\NMSB@missingcat{\NMSB@missingcat #1,}%
  \fi
  \def\@tempa{}%
  \ifNMSB@ownorder
    \edef\NMSB@temp{\csname NMSBcateg@#1\endcsname}%
    \@for\NMSB@local:=\NMSB@temp\do{%
      \ifx\relax\@tempa\relax
        \edef\@tempa{\expandafter\NMSB@getcateg\NMSB@local-}%
      \else
        \edef\@tempa{\@tempa,\expandafter\NMSB@getcateg\NMSB@local-}%
      \fi}%
  \else
    \edef\@tempa{\csname NMSBcateg@#1\endcsname}%
  \fi
  \@ifundefined{SBlongestlabel}{%
    \expandafter\ifx\csname NMSBprefix@\@tempa\endcsname\relax
      \let\@tempb\NMSB@initiallongestlabel
    \else
      \expandafter\let\expandafter\NMSB@tempentry\csname
        NMSBprefix@\@tempa\endcsname
      \expandafter\expandafter\expandafter\NMSB@tok
      \expandafter\expandafter\expandafter{%
        \expandafter\NMSB@tempentry
        \NMSB@initiallongestlabel}%
      \edef\@tempb{\the\NMSB@tok}%
    \fi
    \setbox\@tempboxa=\hbox{\@tempb}%
    \ifdim\NMSB@longest<\wd\@tempboxa
      \setlength\NMSB@longest{\wd\@tempboxa}%
      \global\let\NMSB@longestlabel\@tempb
    \fi}{}%
  \ifNMSB@ownorder
    \edef\NMSB@temp{\csname NMSBcateg@#1\endcsname}%
    \@for\NMSB@local:=\NMSB@temp\do{%
      \edef\NMSB@tempb{\expandafter\NMSB@getent\NMSB@local-}
      \expandafter\xdef\csname NMSBkey@\NMSB@tempb\endcsname{#1}%
      \expandafter\gdef\csname NMSBentry@\NMSB@tempb\endcsname{#2}%
      \ifx\relax\NMSB@valuelist\relax
        \xdef\NMSB@valuelist{\NMSB@local}%
      \else
        \xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@local}%
      \fi}%
  \else
    \expandafter\xdef\csname NMSBkey@\theNMSB@ent\endcsname{#1}%
    \expandafter\gdef\csname NMSBentry@\theNMSB@ent\endcsname{#2}%
    \@for\NMSB@item:=\@tempa\do{%
      \ifx\relax\NMSB@valuelist\relax
        \xdef\NMSB@valuelist{\NMSB@item\theNMSB@ent}%
      \else
        \xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@item\theNMSB@ent}%
      \fi}%
    \stepcounter{NMSB@ent}%
    \ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi
  \fi
}
\def\NMSB@afterfi#1\fi{\fi#1}
\def\NMSB@afterelse#1\else#2\fi{\fi#1}
\def\NMSB@empty{}
\def\NMSB@pivot#1#2#3#4#5,{%
  \ifx\relax#5\NMSB@empty%
    \ifx\relax#3\relax\else\NMSB@resort{#1}{#3}, \fi%
    #2%
    \ifx\relax#4\relax\else,\NMSB@resort{#1}{#4}\fi%
  \else%
    \ifnum#5#1#2 \NMSB@afterelse{\NMSB@afterfi{%
        \NMSB@pivot{#1}{#2}{#3#5,}{#4}}}%
    \else%
      \NMSB@afterfi{\NMSB@afterfi{%
          \NMSB@pivot{#1}{#2}{#3}{#4#5,}}}%
    \fi
  \fi
}%
\def\NMSB@qsort#1#2,{%
  \ifx\relax#2\relax\else
    \NMSB@afterfi{\NMSB@pivot{#1}{#2}{}{}}\fi}
\def\NMSB@resort#1#2{\NMSB@qsort{#1}#2\relax,}
\def\NMSBsort#1#2{\NMSB@qsort{#1}#2,\relax,}
\def\NMSBsortlt#1{\NMSBsort{<}{#1}}
\long\def\NMSB@writecatbib#1{%
  \NMSB@tok{#1}%
  \immediate\write\NMSB@catbib{\the\NMSB@tok}}
\def\NMSB@writeentry#1#2#3#4#5,{\ifx\relax #5\relax
  \else
    \def\NMSB@currcat{#1#2#3#4}%
    \def\NMSB@currcatlevelone{#1#2}%
    \ifx\NMSB@currcatlevelone\NMSB@prevcatlevelone\else
      \expandafter\ifx\csname NMSBtitle@\NMSB@currcatlevelone
       \endcsname\relax
      \else
        \ifNMSB@export
          \if@filesw
            \immediate\write\NMSB@catbib{%
              \string\par\string\addpenalty{-\NMSB@penalty}%
              \string\relax^^J%
              \string\item[]%
              \string\SBtitle}%
            \expandafter\let\expandafter\NMSB@tempentry
              \csname NMSBtitle@\NMSB@currcatlevelone\endcsname
            \expandafter\NMSB@writecatbib\expandafter{%
              \expandafter{\NMSB@tempentry}}%
            \immediate\write\NMSB@catbib{\string\relax^^J%
              \string\par\string\addpenalty{\NMSB@penalty}%
              \string\relax}%
            \expandafter\ifx\csname
             NMSBcomment@\NMSB@currcatlevelone\endcsname\relax
            \else
              \immediate\write\NMSB@catbib{\string\vskip2ex^^J%
                \string\hspace{-\leftmargin}\string\relax^^J%
                \string\begin{minipage}{\textwidth}^^J%
                \string\addtolength\string\parindent{20pt}^^J%
                \string\noindent}
              \expandafter\let\expandafter\NMSB@tempentry
                \csname NMSBcomment@\NMSB@currcatlevelone\endcsname
              \expandafter\NMSB@writecatbib\expandafter{%
                \NMSB@tempentry^^J}%
              \immediate\write\NMSB@catbib{\string\end{minipage}^^J%
                \string\par\string\addpenalty{\NMSB@penalty}
                \string\vskip2ex}
            \fi
          \fi
        \else
          \par\addpenalty{-\NMSB@penalty}%
          \item[]%
            \SBtitle{\csname NMSBtitle@\NMSB@currcatlevelone\endcsname}
          \par\addpenalty{\NMSB@penalty}%
          \expandafter\ifx\csname
           NMSBcomment@\NMSB@currcatlevelone\endcsname\relax
          \else
            \vskip2ex\hspace{-\leftmargin}\begin{minipage}{\textwidth}%
            \addtolength\parindent{20pt}\noindent%
            \csname NMSBcomment@\NMSB@currcatlevelone\endcsname
            \end{minipage}%
            \par\addpenalty{\NMSB@penalty}\vskip2ex
          \fi
        \fi
      \fi
      \xdef\NMSB@prevcatlevelone{#1#2}%
      \ifnum\theSBresetdepth>0\relax
        \setcounter{\@listctr}{0}%
      \fi
      \expandafter\ifx\csname NMSBprefix@\NMSB@prevcatlevelone
       \endcsname\relax
        \NMSB@currprefixlevelonetok{\relax}%
      \else
        \expandafter\expandafter\expandafter\NMSB@currprefixlevelonetok
        \expandafter\expandafter\expandafter{%
           \csname NMSBprefix@\NMSB@prevcatlevelone\endcsname}%
      \fi
    \fi
    \ifx\NMSB@currcat\NMSB@prevcat\else
      \ifnum\NMSB@currcat=9999\else
        \expandafter\ifx\csname NMSBtitle@\NMSB@currcat\endcsname
         \relax
        \else
          \ifNMSB@export
            \if@filesw
              \immediate\write\NMSB@catbib{%
                \string\par\string\addpenalty{-\NMSB@halfpenalty}%
                \string\relax^^J%
                \string\item[]%
                \string\SBsubtitle}%
              \expandafter\let\expandafter\NMSB@tempentrya
                \csname NMSBtitle@\NMSB@currcatlevelone\endcsname
              \expandafter\let\expandafter\NMSB@tempentryb
                \csname NMSBtitle@\NMSB@currcat\endcsname
              \expandafter\NMSB@writecatbib\expandafter{%
                \expandafter{\NMSB@tempentrya}}
              \expandafter\NMSB@writecatbib\expandafter{%
                \expandafter{\NMSB@tempentryb}}
              \immediate\write\NMSB@catbib{\string\relax^^J%
                \string\par\string\addpenalty{\NMSB@penalty}%
                \string\relax}%
              \expandafter\ifx\csname
               NMSBcomment@\NMSB@currcat\endcsname\relax
              \else
                \immediate\write\NMSB@catbib{\string\vskip2ex^^J%
                  \string\hspace{-\leftmargin}\string\relax^^J%
                  \string\begin{minipage}{\textwidth}^^J%
                  \string\addtolength\string\parindent{20pt}^^J%
                  \string\noindent}
                \expandafter\let\expandafter\NMSB@tempentry
                  \csname NMSBcomment@\NMSB@currcat\endcsname
                \expandafter\NMSB@writecatbib\expandafter{%
                  \NMSB@tempentry^^J}%
                \immediate\write\NMSB@catbib{\string\end{minipage}^^J%
                  \string\par\string\addpenalty{\NMSB@penalty}%
                  \string\vskip2ex}
              \fi
            \fi
          \else
            \par\addpenalty{-\NMSB@halfpenalty}%
            \item[]
            \SBsubtitle{\csname NMSBtitle@\NMSB@currcatlevelone\endcsname}%
                       {\csname NMSBtitle@\NMSB@currcat\endcsname}%
            \par\addpenalty{\NMSB@penalty}%
            \expandafter\ifx\csname
             NMSBcomment@\NMSB@currcat\endcsname\relax
            \else
              \vskip2ex\hspace{-\leftmargin}\begin{minipage}{\textwidth}%
              \addtolength\parindent{20pt}\noindent%
              \csname NMSBcomment@\NMSB@currcat\endcsname
              \end{minipage}%
              \par\addpenalty{\NMSB@penalty}\vskip2ex
            \fi
          \fi
        \fi
      \fi
      \xdef\NMSB@prevcat{#1#2#3#4}%
      \ifnum\theSBresetdepth>1\relax
        \setcounter{\@listctr}{0}%
      \fi
      \expandafter\ifx\csname NMSBprefix@\NMSB@currcat\endcsname\relax
        \expandafter\NMSB@currprefixtok\expandafter{%
           \the\NMSB@currprefixlevelonetok}%
      \else
        \expandafter\expandafter\expandafter\NMSB@currprefixtok
        \expandafter\expandafter\expandafter{%
          \csname NMSBprefix@\NMSB@currcat\endcsname}
      \fi
    \fi
    \expandafter\ifx\csname NMSBlabel@#5\endcsname\relax
      \ifNMSB@export
        \if@filesw
          \stepcounter\@listctr
          \immediate\write\NMSB@catbib{%
            \string\bibitem}%
  \expandafter\ifx\expandafter\relax\the\NMSB@currprefixtok
          \else
    \expandafter\expandafter\expandafter\def
    \expandafter\expandafter\expandafter\NMSB@tempentry
    \expandafter\expandafter\expandafter{%
      \expandafter\the\expandafter\NMSB@currprefixtok
              \the\value{\@listctr}}%
            \expandafter\NMSB@writecatbib\expandafter{%
              \expandafter[\NMSB@tempentry]}%
  \fi
          \immediate\write\NMSB@catbib{%
            {\csname NMSBkey@#5\endcsname}}
          \expandafter\let\expandafter\NMSB@tempentry
          \csname NMSBentry@#5\endcsname%
          \expandafter\NMSB@writecatbib\expandafter{%
            \NMSB@tempentry^^J^^J}
        \fi
      \else
        \@NMSBorig@@bibitem{\csname NMSBkey@#5\endcsname}%
        \csname NMSBentry@#5\endcsname
      \fi
      \setbox\@tempboxa=\hbox{\the\NMSB@currprefixtok\the\value{\@listctr}}%
      \ifdim\NMSB@reallylongest<\wd\@tempboxa
        \setlength{\NMSB@reallylongest}{\wd\@tempboxa}%
        \xdef\NMSB@reallylongestlabel{%
          \expandafter\ifx\expandafter\relax\the\NMSB@currprefixtok
  \else\the\NMSB@currprefixtok\fi\the\value{\@listctr}}%
      \fi
    \else
      \ifNMSB@export
        \if@filesw
          \immediate\write\NMSB@catbib{%
            \string\bibitem}
          \expandafter\let\expandafter\NMSB@tempentry
            \csname NMSBlabel@#5\endcsname
          \expandafter\NMSB@writecatbib\expandafter{%
            \expandafter[\NMSB@tempentry]}%
          \immediate\write\NMSB@catbib{%
            {\csname NMSBkey@#5\endcsname}}%
          \expandafter\let\expandafter\NMSB@tempentry
            \csname NMSBentry@#5\endcsname%
          \expandafter\NMSB@writecatbib\expandafter{%
            \NMSB@tempentry^^J^^J}
        \fi
      \else
        \@NMSBorig@@lbibitem[\csname NMSBlabel@#5\endcsname]%
                            {\csname NMSBkey@#5\endcsname}%
                            \csname NMSBentry@#5\endcsname
      \fi
      \setbox\@tempboxa=\hbox{\csname NMSBlabel@#5\endcsname}%
      \ifdim\NMSB@reallylongest<\wd\@tempboxa
        \setlength{\NMSB@reallylongest}{\wd\@tempboxa}%
        \expandafter\let\expandafter\NMSB@reallylongestlabel\csname
  NMSBlabel@#5\endcsname
      \fi
    \fi
  \fi
}
\def\NMSB@writelist#1{%
  \@for\NMSB@curritem:=#1\do{%
    \edef\NMSB@curritem{\expandafter
      \@firstofone\NMSB@curritem\@empty}%
    \expandafter\NMSB@writeentry\NMSB@curritem ,}}
\let\@NMSBorig@thebibliography\thebibliography
\let\@NMSBorig@endthebibliography\endthebibliography
\def\thebibliography#1{%
  \setcounter{NMSB@ent}{\NMSB@initent}%
  \@ifundefined{SBlongestlabel}{%
    \gdef\NMSB@initiallongestlabel{#1}}{%
    \global\let\NMSB@longestlabel\SBlongestlabel
    \setbox\@tempboxa=\hbox{\SBlongestlabel}%
    \setlength{\NMSB@longest}{\wd\@tempboxa}}%
  \ifNMSB@export
    \if@filesw
      \newwrite\NMSB@catbib
      \immediate\openout\NMSB@catbib \jobname.sbb\relax
      \expandafter\NMSB@tok\expandafter{\SBlongestlabel}
      \immediate\write\NMSB@catbib{%
        \string\begin{thebibliography}{%
        \@ifundefined{SBlongestlabel}{#1}{\the\NMSB@tok}}}
    \fi
  \fi
}
\def\endthebibliography{%
  \ifNMSB@export
    \usecounter{enumiv}%
  \else
    \ifNMSB@newchap
      \@ifundefined{chapter}{\section*{\refname}}{\chapter*{\bibname}}%
    \fi
    \list{\@biblabel{\the\NMSB@currprefixtok\@arabic\c@enumiv}\hfill}{%
      \settowidth\labelwidth{\@biblabel{\NMSB@longestlabel}}%
      \leftmargin\labelwidth
      \advance\leftmargin\labelsep
      \@openbib@code
      \usecounter{enumiv}%
      \let\p@enumiv\@empty
      \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  \fi
  \edef\NMSB@sortedvaluelist{%
    \expandafter\NMSBsortlt\expandafter{\NMSB@valuelist}}%
  \expandafter\NMSB@writelist\expandafter{\NMSB@sortedvaluelist}%
  \ifNMSB@export
    \if@filesw
      \immediate\write\NMSB@catbib{%
        \string\end{thebibliography}}
      \immediate\closeout\NMSB@catbib
    \fi
    \begingroup
    \ifNMSB@newchap\else
      \@ifundefined{chapter}{\def\section##1##2{}}{\def\chapter##1##2{}}%
    \fi
    \let\thebibliography\@NMSBorig@thebibliography
    \let\endthebibliography\@NMSBorig@endthebibliography
    \let\@lbibitem\@NMSBorig@@lbibitem
    \let\@bibitem\@NMSBrealorig@@bibitem
    \@input@{\jobname.sbb}
    \endgroup
  \else
    \endlist
  \fi
  \ifx\NMSB@missingcat\NMSB@empty\else
    \expandafter\NMSB@warnnocateg\NMSB@missingcat\end
  \fi
  \ifNMSB@strict
    \ifx\NMSB@doublecat\NMSB@empty\else
      \expandafter\NMSB@warndblcateg\NMSB@doublecat\end
    \fi
  \fi
  \ifdim\NMSB@reallylongest=\NMSB@longest\relax\else
    \NMSB@warnwronglongest
  \fi
}
\endinput
%%
%% End of file `splitbib.sty'.
