summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/combine/combcite.sty
blob: bc97fa0b60e12226deed2e6060d41de4c47949f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
%%
%% 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
%%   Copyright 2010 Will Robertson
%% 
%%   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.
%% 
\ProvidesPackage{combcite}
  [2010/07/10 v0.7a
         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'.