[comp.text.tex] citation style

muzic@ds2.uh.cwru.edu (Ray Muzic) (06/18/91)

I am using the unsrt bibliography style for a manuscript.  In several
places, I cite a group of references and get, for example, `[1,2,3,4,5,8]'.
Does anyone have a style file that would abbreviate this to something
like `[1-5,8]'.

Please e-mail the response.

Thanks in advance,
Ray

* Ray Muzic, Jr.        | "I try not to think, it slows the progress." - rfm2 *
* muzic@ds2.uh.cwru.edu | Biomedical Engr, CWRU & Image Analysis Ctr, UH  __o *
* Voice: (216)-844-3543 | Div Nuclear Medicine, Univ Hosp of Cleveland   -\<, *
* Fax: (216)-844-3106   | 2074 Abington Rd, Cleveland, OH, 44106, USA....O/ O *






























-- 
* Ray Muzic, Jr.        | "I try not to think, it slows the progress." - rfm2 *
* muzic@ds2.uh.cwru.edu | Biomedical Engr, CWRU & Image Analysis Ctr, UH  __o *
* Voice: (216)-844-3543 | Div Nuclear Medicine, Univ Hosp of Cleveland   -\<, *
* Fax: (216)-844-3106   | 2074 Abington Rd, Cleveland, OH, 44106, USA....O/ O *

spit@fys.ruu.nl (Werenfried Spit) (06/18/91)

In <muzic.677244536@ds2.uh.cwru.edu> muzic@ds2.uh.cwru.edu (Ray Muzic) writes:

>I am using the unsrt bibliography style for a manuscript.  In several
>places, I cite a group of references and get, for example, `[1,2,3,4,5,8]'.
>Does anyone have a style file that would abbreviate this to something
>like `[1-5,8]'.

% Collapse citation numbers to ranges.  Non-numeric and undefined labels
% are handled.  No sorting is done.  E.g., 1,3,2,3,4,5,foo,1,2,3,?,4,5
% gives 1,3,2-5,foo,1-3,?,4,5
\newcount\@tempcntc
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \@tempcnta\z@\@tempcntb\m@ne\def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@ifundefined
       {b@\@citeb}{\@citeo\@tempcntb\m@ne\@citea\def\@citea{,}{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
    {\setbox\z@\hbox{\global\@tempcntc0\csname b@\@citeb\endcsname\relax}%
     \ifnum\@tempcntc=\z@ \@citeo\@tempcntb\m@ne
       \@citea\def\@citea{,}\hbox{\csname b@\@citeb\endcsname}%
     \else
      \advance\@tempcntb\@ne
      \ifnum\@tempcntb=\@tempcntc
      \else\advance\@tempcntb\m@ne\@citeo
      \@tempcnta\@tempcntc\@tempcntb\@tempcntc\fi\fi}}\@citeo}{#1}}
\def\@citeo{\ifnum\@tempcnta>\@tempcntb\else\@citea\def\@citea{,}%
  \ifnum\@tempcnta=\@tempcntb\the\@tempcnta\else
   {\advance\@tempcnta\@ne\ifnum\@tempcnta=\@tempcntb \else \def\@citea{--}\fi
    \advance\@tempcnta\m@ne\the\@tempcnta\@citea\the\@tempcntb}\fi\fi}