    %From:	BITNET%"FILESERV@SHSU" 12-NOV-1991 18:08:16.23
%% Save file as: OVERCITE.STY           Source: FILESERV@SHSU.BITNET
%     O V E R C I T E . S T Y
%     compressed lists of superscript numerical citations.
%     See also CITE.STY and DRFTCITE.STY.
%
%     Copyright (C) 1989,1990,1991 by Donald Arseneau
%     These macros may be freely transmitted, reproduced, or modified for
%     non-commercial purposes provided that this notice is left intact.
%
%     Instructions follow \endinput.
%  ------------------------------------
%
%
%  \@citen contains the code that parses the list of names, ignoring
%  spaces after commas, writes the aux file \citation, and formats the
%  number list.  \citen can be used by itself to give citation numbers
%  without the other formatting; e.g., "See also ref.~\citen{junk}."
%
\def\citen#1{%
\edef\@tempa{\@ignspaftercomma,#1, \@end, }% ignore spaces in parameter list
\edef\@tempa{\expandafter\@ignendcommas\@tempa\@end}%
\if@filesw \immediate \write \@auxout {\string \citation {\@tempa}}\fi
\@tempcntb\m@ne \let\@h@ld\relax \def\@citea{}%
\@for \@citeb:=\@tempa\do {\@cmpresscites}%
\@h@ld}
%
% for ignoring spaces in the input:
\def\@ignspaftercomma#1, {\ifx\@end#1\@empty\else
   #1,\expandafter\@ignspaftercomma\fi}
\def\@ignendcommas,#1,\@end{#1}
%
% For each citation, check if it is defined, if it is a number, and
% if it is a consecutive number that can be represented like 3-7.
%
\def\@cmpresscites{%
 \expandafter\let \expandafter\@B@citeB \csname b@\@citeb \endcsname
 \ifx\@B@citeB\relax % undefined
    \@h@ld\@citea\@tempcntb\m@ne{\bf ?}%
    \@warning {Citation `\@citeb ' on page \thepage \space undefined}%
 \else%  defined
    \@tempcnta\@tempcntb \advance\@tempcnta\@ne
    \setbox\z@\hbox\bgroup % check if citation is a number:
    \ifnum0<0\@B@citeB \relax
       \egroup \@tempcntb\@B@citeB \relax
       \else \egroup \@tempcntb\m@ne \fi
    \ifnum\@tempcnta=\@tempcntb % Number follows previous--hold on to it
       \ifx\@h@ld\relax % first pair of successives
          \edef \@h@ld{\@citea\@B@citeB }%
       \else % compressible list of successives
%         % use \hbox to avoid easy \exhyphenpenalty breaks
          \edef\@h@ld{\hbox{--}\penalty\@highpenalty
            \@B@citeB }%
       \fi
    \else   %  non-successor--dump what's held and do this one
       \@h@ld\@citea\@B@citeB
       \let\@h@ld\relax
 \fi\fi%
%%    To put space after the comma, use:
 \def\@citea{,\penalty\@highpenalty\hskip.13em plus.1em minus.1em}%
%%    For no space after comma, use:
%% \def\@citea{,\penalty\@highpenalty}%
%%
}
%
%  Replacement for \cite (gets rid of space and chooses superscript or normal)
%
\def\cite{\leavevmode\unskip\@ifnextchar[{\@tempswatrue\@citew}%
            {\@tempswafalse\@citex}}
%
%  With note, so do on line...highpenalty before
%
\def\@citew[#1]#2{\ifnum\lastpenalty=\z@ \penalty\@highpenalty \fi
   \ [{\multiply\@highpenalty 3 % ...triple-highpenalties within
   \citen{#2}},\penalty\@highpenalty\ #1]\spacefactor\@m}
%
%  No note, so superscript, but check for punctuation first.
%
\def\@citex#1{\begingroup \leavevmode \@tempcnta\@m \unskip
  \def\@tempa{\@cite{\citen{#1}}\spacefactor\@tempcnta\endgroup}%
  \futurelet\@tempb\@citey}%
%% to not move punctuation, replace previous line with:
%%  \@cite{\citen{#1}}\endgroup}
%
%  Move trailing punctuation before the citation:
%
\def\@citey{\let\@tempc\@tempa
   % Watch for double periods and suppress them
   \ifx\@tempb.\ifnum\spacefactor>2999 \let\@tempb\relax\fi\let\@tempc\@citez
   % Move other punctuation
   \else\ifx\@tempb,\let\@tempc\@citez
   \else\ifx\@tempb:\let\@tempc\@citez % add other punctuation as necessary,
   \else\ifx\@tempb;\let\@tempc\@citez % with balancing \fi s
   \fi\fi\fi\fi
   \@tempc}%
%
% Place punctuation (except periods) before citation, and remember spacefactor
% of that punctuation
\def\@citez#1{\@tempcnta\sfcode`#1\@tempb\futurelet\@tempb\@citey}%
%
\def\@cite#1{$\m@th\the\scriptfont\z@\edef\bf{\the\scriptfont\bffam}%
      ^{\hbox{#1}}$}
%
\let\nocitecount\relax % so no error when switch from drftcite
%
\endinput
%
%
%                      OVERCITE.STY
%
%   Modify LaTeX's normal citation mechanism to:
%
%   o Display citations as superscript numbers, a comma and a small space
%     between each number.
%
%   o Compress lists of three or more consecutive numbers to one
%     number range.  No sorting to optimize compression is done.
%     All numbers should be greater than zero.
%
%   o If an optional note is given, typeset the whole list of citations
%     as if cite.sty was in effect.  (See cite.sty).
%
%   o Use THE SAME INPUT FORMAT as for ordinary citations; this style
%     will move trailing punctuation to before the citation.  For example,
%     "...information \cite{source};" ignores the space before the
%     citation and puts the simicolon before the number, just as if
%     you typed  "...information;$^{12}$"
%
%     The punctuation that will migrate before the superscript is .,;:.
%     Perhaps ! and ? should too, but they weren't listed in the APS style
%     manual I looked at.  Quotes were, but they should never have to
%     migrate because both on-line and superscript versions put quotes
%     before the citation.  This gives one difficulty: the trailing
%     punctuation won't migrate inside the quotation:
%                   ``Transition State Theory''\cite{Eyring}.
%     gives         ``Transition State Theory''.$^8$
%     when you want ``Transition State Theory.''$^8$
%
%   o Doubling of periods (.., ?., !.) is checked for and suppressed.
%     The spacing after the citation is set according to the final
%     punctuation mark moved.  There is problem with double periods
%     after a capitalized abbreviation or directly after \@ : Both
%     "N.A.S.A. \cite{space}." and "et al.\@ \cite{many}." will give
%     doubled periods.  These can be fixed as follows:
%     "N.A.S.A\@. \cite{space}." and "et al.\ \cite{many}.".
%     These work properly for both cite.sty and overcite.sty, but the NASA
%     example gives the wrong spacing when there is no citation.  Sorry.
%     Use \  after abbreviations like et al. to get the right spacing
%     within a sentence whether or not a citation follows.
%
%   o Ignore spaces after the commas in the parameter list.
%
%   o define \citen to get just the numbers (and write to the aux file)
%     without the brackets and extra formatting.
%
%   Bibliography entries like \bibitem[1st]{first measurement}
%   will confuse the counting and give st1st.
%
%   See also cite.sty for enhanced [5-9] type citations, and drftcite.sty
%   for draft (draught) mode citations.
%
%   FRAGILE!
%
% Version 1991: Ignore spaces after commas in the parameter list. Move most of
% \citen into \@cmpresscites for speed. Give the proper \spacefactor afterwards.
%
% Send problem reports to asnd@triumfcl.bitnet or asnd@Jack.TRIUMF.CA
%
% test integrity:
% brackets: round, square, curly, angle:   () [] {} <>
% backslash, slash, vertical, hat, tilde:   \ / | ^ ~
