🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #95

Re: LaTeX citations

#95
From: Olivier PLAUT
Date: Thu, 29 Oct 1992 15:05
128 lines
5961 bytes
In article <1992Oct28.211450.13258@ucc.su.OZ.AU>, king@langmuir.physics.su.OZ.AU (Peter King) writes:
> 
> 	How do you get LaTeX to generate the references like [ref1 --- ref10]? 
> If I want to cite ref1 to ref10 inclusive?  The closest I've managed to get is
> [ref1, ref10 ---] which isn't quite what I'm after.  Does anyone know how to do
> this?  Or a relevant .sty file?
> 	Please post or email.  Thanks in advance.
> 
> 
> -- 
> ********************************************************************************
> Peter King                               *         The home of TORTUS.
> Plasma Physics Department                *   T
> University of Sydney, NSW 2006           *   O
> AUSTRALIA                                *   Roid of
>     voice: 61 2 692 3371                 *   The 
>       FAX: 61 2 660 2903                 *   University of
>     email: king@physics.su.OZ.AU         *   Sydney
> ********************************************************************************

Use CITE.STY that you can borrow from your favorite ftp site.

I put there my old version which works very well.

%--------------------------- cut here -----------------------
%     CITE.STY -- compress numerical citations.
%     See also OVERCITE.STY.
%
%     Copyright (C) 1989,1990 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.
%  ------------------------------------
%
%  Pull out the code that writes the aux file citation and formats 
%  the number.  \citen can be used by itself to give citation numbers 
%  without the other formatting; e.g., "See also ref.~\citen{junk}."
%
\def\citen#1{%
\if@filesw \immediate \write \@auxout {\string \citation {#1}}\fi 
\@tempcntb\m@ne \let\@h@ld\relax \def\@citea{}%
\@for \@citeb:=#1\do {%
  \@ifundefined {b@\@citeb}%
    {\@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\csname b@\@citeb \endcsname \relax
       \egroup \@tempcntb\number\csname b@\@citeb \endcsname \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\csname b@\@citeb\endcsname}% 
       \else % compressible list of successives
%         % use \hbox to avoid easy \exhyphenpenalty breaks 
          \edef\@h@ld{\hbox{--}\penalty\@highpenalty
            \csname b@\@citeb\endcsname}%
       \fi
    \else   %  non-successor--dump what's held and do this one
       \@h@ld\@citea\csname b@\@citeb \endcsname 
       \let\@h@ld\relax
    \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}% 
%%
}\@h@ld}
% 
%     Replacement for \@citex:
% 
\def\@citex[#1]#2{\@cite{\citen{#2}}{#1}}%
%
%  Replacement for \@cite 
%
\def\@cite#1#2{\leavevmode\unskip
  \ifnum\lastpenalty=\z@\penalty\@highpenalty\fi% highpenalty before
  \ [{\multiply\@highpenalty 3 #1%             % triple-highpenalties within
      \if@tempswa,\penalty\@highpenalty\ #2\fi % and before note.
    }]\spacefactor\@m}
%
\endinput
%
%     
%                          CITE.STY
%
%     Modify LaTeX's normal citation mechanism to:
%
%     o Allow, but strongly discourage, line breaks within a series of
%       citations.  Each number is separated by a comma and a small space.
%       A break at the beginning of an optional note is discouraged also.
%
%     o Compress lists of three or more consecutive numbers to one number 
%       range which can be split, with difficulty, after the dash.  No sorting
%       to optimize compression is done.  All numbers should be greater than
%       zero. E.g., if you used to get [5,6,7,9,8,Einstein,6], then this style 
%       will give you [5--7,9,8,Einstein,6]. 
%
%     o Always puts an interword space before the citation and allow a 
%       highpenalty break there (unless you specifically forbid it with ~).
%       E.g.,   Something really stupid \cite{Larry,Curly,Moe}.
%                                      ^-- This space doesn't matter.
%
%     To get just the numbers (and write to the aux file) without the
%     extra formatting, use \citen just like \cite.
%
%     Linebreaks are allowed with triple-highpenalties after dashes
%     and commas; these may have to be taken if TeX sees no other 
%     viable breakpoints.  If you think citations are being split 
%     unnecessarily, try using \sloppy or a sloppypar environment.
%
%     FRAGILE!
%
% Send problem reports to asnd@triumfcl.bitnet or Arseneau@mtsg.ubc.ca

-- 

-------------------------------------------------------------------
 Olivier Plaut                   |  
 Institute of Forensic Medicine  |   Phone:    +41 (22) 702.56.12  
 Toxicology Unit                 |   Fax:      +41 (22) 789.24.17  
 University of Geneva            |
 Av. de Champel 9                |   E-mail:  plaut@sc2a.unige.ch  
 CH-1211 Geneve 4                |            plaut@cgeuge52.bitnet
 Switzerland                     |   
-------------------------------------------------------------------
Technical Details
Message-ID: <1992Oct29.170544.1@sc2a.unige.ch>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!news.unige.ch!ugsc2a!plaut
References: <1992Oct28.211450.13258@ucc.su.OZ.AU>

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!news.unige.ch!ugsc2a!plaut
From: plaut@sc2a.unige.ch (Olivier PLAUT)
Subject: Re:  LaTeX citations
Message-ID: <1992Oct29.170544.1@sc2a.unige.ch>
Lines: 128
Sender: usenet@news.unige.ch
Organization: University of Geneva, Switzerland
References: <1992Oct28.211450.13258@ucc.su.OZ.AU>
Date: Thu, 29 Oct 1992 15:05:44 GMT