-
Notifications
You must be signed in to change notification settings - Fork 0
/
multibib.sty
180 lines (179 loc) · 6.06 KB
/
multibib.sty
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
%%
%% This is file `multibib.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% multibib.dtx (with options: `package')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from multibib.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file multibib.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Package `multibib' to use with LaTeX2e.
%% Copyright (C) 2003 by Thorsten Hansen. All rights reserved.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{multibib}
[2003/03/24 v1.2 Multiple bibliographies for one document.]
\newif\ifcontinuouslabels
\continuouslabelstrue
\DeclareOption{resetlabels}{\continuouslabelsfalse}
\ProcessOptions
\def\mylop#1\to#2{\expandafter\mylopoff#1\mylopoff#1#2}
\long\def\mylopoff#1,#2\mylopoff#3#4{\def#4{#1}\def#3{#2}}
\AtBeginDocument{%
\@ifpackageloaded{natbib}{%
\NAT@set@cites
\let\std@@citex\@citex
\def\mb@@citex[#1][#2]#3{%
\global\let\@save@auxout\@auxout
\let\@auxout\@newciteauxhandle
\std@@citex[#1][#2]{#3}%
\let\@auxout\@save@auxout
\let\@citex\std@@citex}%
}{% else
\let\std@@citex\@citex
\def\mb@@citex[#1]#2{{%
\let\@auxout\@newciteauxhandle
\std@@citex[#1]{#2}}%
\let\@citex\std@@citex}%
}%
}%
\def\@newusecounter#1{\@nmbrlisttrue\def\@listctr{#1}}
\let\newusecounter\usecounter
\let\std@bibliography\bibliography
\def\bibliography#1{%
\ifcontinuouslabels
\let\usecounter\newusecounter
\fi
\std@bibliography{#1}%
\ifcontinuouslabels
\global\let\newusecounter\@newusecounter
\fi}
\newcount\mb@biblabelwidth
\newcommand\setbiblabelwidth[1]{\mb@biblabelwidth #1}
\AtBeginDocument{%
\@ifpackageloaded{suthesis}%
{\def\thebibliography#1{%
\newpage
\addcontentsline{toc}{chapter}{\bibname}%
\@ldthebibliography{#1}}}%
{}%
\let\std@thebibliography\thebibliography
\def\thebibliography#1{%
\@isnumber{#1}%
{\ifnum\mb@biblabelwidth=0
\@tempcnta\c@enumiv
\ifcontinuouslabels
\advance\@tempcnta#1%
\fi
\std@thebibliography{\@arabic\@tempcnta}%
\else
\std@thebibliography{\@arabic\mb@biblabelwidth}%
\global\mb@biblabelwidth 0
\fi}%
{\std@thebibliography{#1}}%
}%
}
\newcommand{\@isnumber}[3]{%
\def\argi{#1}%
\ifx\argi\empty
#3
\else
\global\@tempswafalse
\setbox\@tempboxa=\hbox{\@scannumber#1\plugh}%
\if@tempswa#2\else#3\fi
\fi}
\let\plugh\relax
\newcommand{\@scannumber}[1]{%
\let\testchar#1%
\ifx \testchar 0\let\next\@scannumber
\else\ifx \testchar 1\let\next\@scannumber
\else\ifx \testchar 2\let\next\@scannumber
\else\ifx \testchar 3\let\next\@scannumber
\else\ifx \testchar 4\let\next\@scannumber
\else\ifx \testchar 5\let\next\@scannumber
\else\ifx \testchar 6\let\next\@scannumber
\else\ifx \testchar 7\let\next\@scannumber
\else\ifx \testchar 8\let\next\@scannumber
\else\ifx \testchar 9\let\next\@scannumber
\else\ifx \testchar \plugh \let\next\relax \global\@tempswatrue
\else \let\next\relax
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\next}
\long\def\mb@addtocontents#1#2{%
\protected@write\temp@auxout
{\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
{\string\@writefile{#1}{#2}}}
\def\newcites#1#2{%
\def\@suffixlist{#1,}%
\@for\@newrefname:=#2\do{%
\mylop\@suffixlist\to\@suffix
\expandafter\protected@edef\csname refname\@suffix\endcsname
{\@newrefname}%
\if@filesw
\expandafter\newwrite\csname @auxout\@suffix\endcsname
\expandafter\edef\csname @auxout\@suffix name\endcsname{\@suffix}%
\begingroup
\makeatletter
\@input@{\csname @auxout\@suffix name\endcsname .aux}%
\endgroup
\immediate\openout\csname @auxout\@suffix\endcsname
\csname @auxout\@suffix name\endcsname .aux
\fi
\expandafter\edef\csname cite\@suffix\endcsname{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\cite}%
\expandafter\edef\csname nocite\@suffix\endcsname##1{{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@auxout\csname @auxout\@suffix\endcsname
\noexpand\nocite{##1}}}%
\expandafter\edef\csname citep\@suffix\endcsname{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\citep}%
\expandafter\edef\csname citet\@suffix\endcsname{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\citet}%
\expandafter\edef\csname citealp\@suffix\endcsname{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\citealp}%
\expandafter\edef\csname citealt\@suffix\endcsname{%
\let\noexpand\@citex\noexpand\mb@@citex
\let\noexpand\@newciteauxhandle\csname @auxout\@suffix\endcsname
\noexpand\citealt}%
\expandafter\edef\csname bibliography\@suffix\endcsname##1{{%
\let\noexpand\temp@auxout\noexpand\@auxout
\let\noexpand\addtocontents\noexpand\mb@addtocontents
\let\noexpand\@auxout\csname @auxout\@suffix\endcsname
\let\noexpand\jobname
\expandafter\noexpand\csname @auxout\@suffix name\endcsname
\let\noexpand\refname
\expandafter\noexpand\csname refname\@suffix\endcsname
\let\noexpand\bibname
\expandafter\noexpand\csname refname\@suffix\endcsname
\noexpand\bibliography{##1}%
}}
\expandafter\edef\csname bibliographystyle\@suffix\endcsname##1{{%
\let\noexpand\@auxout\csname @auxout\@suffix\endcsname
\noexpand\bibliographystyle{##1}}}%
}%
}
\@onlypreamble\newcites
\endinput
%%
%% End of file `multibib.sty'.