%%
%% This is file `combcite.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% combine.dtx  (with options: `citepack')
%% 
%%   Author: Peter Wilson, Herries Press
%%   Maintainer: Will Robertson (will dot robertson at latex-project dot org)
%%   Copyright 2000, 2001, 2002, 2003 Peter R. Wilson
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3c of this license or (at your option) any
%%   later version: <http://www.latex-project.org/lppl.txt>
%% 
%%   This work has the LPPL maintenance status "maintained".
%%   The Current Maintainer of this work is Will Robertson.
%% 
%%   This work consists of the files listed in the README file.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{combcite}[2003/11/09 v1.0 combine version of cite package]
\@ifclassloaded{combine}{}{%
  \PackageError{combcite}{The `combine' class is expected}{\@ehc}}

\newif\ifc@lbsuperopt
  \c@lbsuperoptfalse
\DeclareOption{super}{\ExecuteOptions{superscript}}
\DeclareOption{superscript}{\c@lbsuperopttrue
                            \PassOptionsToClass{superscript}{cite}}
\ProcessOptions
\RequirePackageWithOptions{cite}[2003/11/04]

\DeclareRobustCommand\c@lbciten[1]{%
 \begingroup
  \let\@safe@activesfalse\@empty
%%  \c@lb@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
  \@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
  \@tempcntb\m@ne    % \@tempcntb tracks highest number
  \let\@h@ld\@empty  % nothing held from list yet
  \let\@citea\@empty % no punctuation preceding first
  \let\@celt\delimiter % an unexpandable, but identifiable, token
  \def\@cite@list{}% % empty list to start
  \@for \@citeb:=\@no@sparg\do{\c@lb@make@cite@list}% make a sorted list of numbers
  % After sorted citelist is made, execute it to compress citation ranges.
  \@tempcnta\m@ne    % no previous number
  \let\@celt\@compress@cite \@cite@list % output number list with compression
  \@h@ld % output anything held over
 \endgroup
 \@restore@auxhandle
 }

\def\c@lb@make@cite@list{%
 \expandafter\let \expandafter\@B@citeB
          \csname B?\jobname?@\@citeb\@extra@b@citeb \endcsname
 \ifx\@B@citeB\relax % undefined: output ? and warning
    \@citea {\bfseries ?}\let\@citea\citepunct \G@refundefinedtrue
    \@warning {Citation `\@citeb' on page \thepage\space undefined}%
    \oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}%
 \else %  defined               % remove previous line to repeat warnings
    \ifcat _\ifnum\z@<0\@B@citeB _\else A\fi % a positive number, put in list
       \@addto@cite@list
    \else % citation is not a number, output immediately
       \@citea \citeform{\@B@citeB}\let\@citea\citepunct
 \fi\fi}

\ifc@lbsuperopt
  \DeclareRobustCommand{\c@lbcite}{%
    \@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citew}}
\else
  \DeclareRobustCommand{\c@lbcite}{%
    \@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citex[]}}
\fi

\def\c@lb@citex[#1]#2{\@cite{\c@lbciten{#2}}{#1}}

\def\c@lb@citew#1{\begingroup \leavevmode
  \@if@fillglue \lastskip \relax \unskip
  \def\@tempa{\@tempcnta\spacefactor
     \/% this allows the last word to be hyphenated, and it looks better.
     \@citess{\c@lbciten{#1}}\spacefactor\@tempcnta
     \endgroup \@restore@auxhandle}%
  \oc@movep\relax}% check for following punctuation (depending on options)

\DeclareRobustCommand\c@lbnocite[1]{%
 \@bsphack \@nocite{#1}%
 \@for \@citeb:=\@no@sparg\do{\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}%
    {\G@refundefinedtrue\@warning{Citation `\@citeb' undefined}%
    \oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}}{}}%
 \@esphack}

\def\@nocite#1{\begingroup\let\protect\string% normalize active chars
 \xdef\@no@sparg{\expandafter\@ignsp#1 \: }\endgroup% and remove ALL spaces
 \if@filesw \immediate\write\@newciteauxhandle % = \@auxout, except with multibib
    {\string\citation {\@no@sparg}}\fi
 }

\g@addto@macro{\setuppapers}{\let\cite\c@lbcite}
\g@addto@macro{\setuppapers}{\let\citenum\c@lbciten}
\g@addto@macro{\setuppapers}{\let\citeonline\c@lbciten}

\endinput
%%
%% End of file `combcite.sty'.
