2 %% This is file `bibunits.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% bibunits.dtx (with options: `package')
11 %% For the copyright see the source file.
13 %% Any modified versions of this file must be renamed
14 %% with new filenames distinct from bibunits.sty.
16 %% For distribution of the original source see the terms
17 %% for copying and modification in the file bibunits.dtx.
19 %% This generated file may be distributed as long as the
20 %% original source files, as listed above, are part of the
21 %% same distribution. (The sources need not necessarily be
22 %% in the same archive or directory.)
23 %% Package `bibunits' to use with LaTeX2e.
24 %% Copyright (C) 1999, 2000 by Thorsten Hansen. All rights reserved.
26 \NeedsTeXFormat{LaTeX2e}
27 \ProvidesPackage{bibunits}
28 [2000/10/10 v2.2 Multiple bibliographies in one document.]
29 \newif\iflabelstoglobalaux \labelstoglobalauxfalse
30 \DeclareOption{labelstoglobalaux}{\labelstoglobalauxtrue}
31 \newif\ifglobalcitecopy
33 \DeclareOption{globalcitecopy}{\globalcitecopytrue}
36 \newcount\@bibunitauxcnt \@bibunitauxcnt=0
37 \def\@bibunitname{bu\the\@bibunitauxcnt}
38 \newif\if@starredversion
40 \DeclareRobustCommand\bu@cite{%
42 {\@starredversiontrue\std@cite}%
43 {\@starredversionfalse\std@cite}%
46 \@ifpackageloaded{natbib}%
48 \NAT@set@cites \let\std@@citex\@citex
49 \def\bu@@citex[#1][#2]#3{%
52 \begingroup\let\@auxout\@bibunitaux\std@@citex[#1][#2]{#3}\endgroup
59 \@ifpackageloaded{overcite}%
61 \let\std@@citew\@citew
65 {\let\@auxout\@bibunitaux \std@@citew{#1}}%
74 \let\std@@citex\@citex
75 \def\bu@@citex[#1]#2{%
78 {\let\@auxout\@bibunitaux \std@@citex[#1]{#2}}%
89 \@ifpackageloaded{jurabib}%
91 \let\std@@citex\@citex
92 \def\bu@@citex[#1][#2]#3{%
95 {\let\@auxout\@bibunitaux \std@@citex[#1][#2]{#3}}%
106 \let\std@@citex\@citex
107 \def\bu@@citex[#1]#2{%
108 \@startbibunitorrelax
110 {\let\@auxout\@bibunitaux \std@@citex[#1]{#2}}%
123 \let\std@nocite\nocite
126 {\@starredversiontrue\@bu@nocite}%
127 {\@starredversionfalse\@bu@nocite}%
130 \@startbibunitorrelax
131 {\let\@auxout\@bibunitaux \std@nocite{#1}}%
144 \let\orig@bibliography\bibliography
145 \def\bibliography#1{%
147 \immediate\openout\@bibunitaux bu.aux
148 \immediate\write\@mainaux{\string\@input{bu.aux}}%
150 \orig@bibliography{#1}%
152 \immediate\closeout\@bibunitaux
156 \let\std@bibliography\bibliography
158 \def\bu@bibliography{%
160 {\@starredversiontrue\@bu@bibliography}%
161 {\@starredversionfalse\@bu@bibliography}%
163 \def\@bu@bibliography#1{%
165 \immediate\write\@auxout{\string\gdef\string\bu@bibdata{#1}}%
167 \gdef\bu@bibdata{#1}%
170 \std@bibliography{#1}%
174 \let\std@bibliographystyle\bibliographystyle
175 \def\bu@bibliographystyle{%
177 {\@starredversiontrue\@bu@bibliographystyle}%
178 {\@starredversionfalse\@bu@bibliographystyle}%
180 \def\@bu@bibliographystyle#1{%
182 \immediate\write\@auxout{\string\gdef\string\bu@bibstyle{#1}}%
184 \gdef\bu@bibstyle{#1}%
187 \std@bibliographystyle{#1}%
191 \global\let\cite\bu@cite
192 \global\let\@citex\bu@@citex
193 \global\let\@citew\bu@@citew
194 \global\let\nocite\bu@nocite
195 \global\let\@startbibunitorrelax\@startbibunit
196 \global\let\@finishbibunit\relax
197 \@ifnextchar[{\@bibunitx}{\@bibunitx[\bu@bibstyle]}%
199 \def\@bibunitx[#1]{\gdef\@localbibstyle{#1}}
201 \global\let\cite\std@cite
202 \global\let\@citex\std@@citex
203 \global\let\@citew\std@@citew
204 \global\let\nocite\std@nocite
209 \global\let\@startbibunitorrelax\relax
210 \global\let\@finishbibunit\@finishstartedbibunit
211 \global\advance\@bibunitauxcnt 1
214 \@input{\@bibunitname.aux}}%
215 \immediate\openout\@bibunitaux\@bibunitname.aux
216 \immediate\write\@bibunitaux{\string\bibstyle{\@localbibstyle}}%
219 \let\@finishbibunit\relax
220 \def\@finishstartedbibunit{%
222 \immediate\closeout\@bibunitaux
225 \let\old@bibunit\@gobble
226 \def\@bibunit{\endbibunit\bibunit\old@bibunit}
228 \def\bibliographyunit{%
230 \@ifnextchar[{\@bibliographyunit}{%
231 \global\let\old@bibunit\@gobble
232 \global\let\bibliography\std@bibliography
233 \global\let\bibliographystyle\std@bibliographystyle
235 \gdef\@endbibunit{}}%
237 \def\@bibliographyunit[#1]{%
238 \global\let\bibliography\bu@bibliography
239 \global\let\bibliographystyle\bu@bibliographystyle
240 \global\let\old@bibunit#1
241 \global\let#1\@bibunit
242 \gdef\@endbibunit{\global\let#1\old@bibunit}%
244 \def\putbib{\@ifnextchar[{\@putbib}{\@putbib[\bu@bibdata]}}
246 \@startbibunitorrelax
248 \immediate\write\@bibunitaux{\string\bibdata{#1}}%
250 \@input@{\@bibunitname.bbl}%
255 \let\std@bibitem\@bibitem
256 \let\std@lbibitem\@lbibitem
258 \let\temp@auxout\@auxout
259 \let\@auxout\@bibunitaux
261 \let\@auxout\temp@auxout
263 \def\@lbibitem[#1]#2{%
264 \let\temp@auxout\@auxout
265 \let\@auxout\@bibunitaux
266 \std@lbibitem[#1]{#2}%
267 \let\@auxout\temp@auxout
271 \def\remequivalent#1\from#2{%
275 \edef#2{\expandafter\plugh#2\plugh}%
281 \noexpand\do\noexpand#1%
286 \def\hgulp\fi\plugh\plugh{\fi}
287 \remequivalent\bibcite\from\@preamblecmds
289 \@ifpackageloaded{natbib}%
290 {\renewcommand\bibcite[2]{\global\@namedef{b@#1\@extra@binfo}{#2}}}%
291 {\renewcommand\bibcite[2]{\global\@namedef{b@#1}{#2}}}%
294 \@ifundefined{bbl@redefine}%
297 \bbl@redefine\@input#1{%
298 \@safe@activestrue\org@@input{#1}\@safe@activesfalse}%
299 \@ifpackageloaded{natbib}%
301 \bbl@redefine\std@@citex[#1][#2]#3{%
302 \@safe@activestrue\org@std@@citex[#1][#2]{#3}\@safe@activesfalse}%
303 \bbl@redefine\bu@@citex[#1][#2]#3{%
304 \@safe@activestrue\org@bu@@citex[#1][#2]{#3}\@safe@activesfalse}%
307 \bbl@redefine\std@@citex[#1]#2{%
308 \@safe@activestrue\org@std@@citex[#1]{#2}\@safe@activesfalse}%
314 %% End of file `bibunits.sty'.