Debian Codegraph @

latex/misc/bibtopic.sty

raw
1 %%
2 %% This is file `bibtopic.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% bibtopic.dtx (with options: `package')
8 %%
9 %% LaTeX package for multiple bibliographies
10 %%
11 %% Copyright (C) 1998-2000 P. Basso, S. Ulrich
12 %% 2001-2004 S. Ulrich
13 %%
14 %% Please send bug reports to: <[email protected]>
15 %%
16 %% This program is free software; you can redistribute it and/or
17 %% modify it under the terms of the GNU General Public License
18 %% as published by the Free Software Foundation; either version 2
19 %% of the License, or (at your option) any later version.
20 %%
21 %% This program is distributed in the hope that it will be useful,
22 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
23 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 %% GNU General Public License for more details.
25 %%
26 %% You should have received a copy of the GNU General Public License
27 %% along with this program; if not, write to the Free Software
28 %% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 %%
30 \NeedsTeXFormat{LaTeX2e}[1996/12/01] \ProvidesPackage{bibtopic}[2002/08/22 v1.0k
31 Sectioned Bibliographies]
32 \RequirePackage{ifthen}
33 \newcommand\bt@tempa{}
34 \newcommand\bt@tempb{}
35 \newcommand\bt@tempc{}
36 \newcommand\bt@args{}
37 \newcommand*\bt@info{\@gobble}
38 \newcommand*\bt@infoNoLine{\@gobble}
39 \newcommand\bt@gobblethree[3]{}
40 \newif\ifbt@natbib
41 \newif\ifbt@koma@class
42 \newif\ifbt@brf
43 \newif\ifbt@after@brf
44 \newif\ifbt@elem
45 \newif\ifbt@inside@sect
46 \newif\ifbt@inside@unit
47 \newif\ifbt@found@item
48 \newif\ifbt@print@cited
49 \newif\ifbt@print@all
50 \newif\if@globalbiblio
51 \newcommand\bt@stepcnt[1]{%
52 \@tempcnta#1
53 \advance\@tempcnta\@ne
54 \protected@xdef#1{\the\@tempcnta}%
55 }
56 \newcounter{btauxfile}
57 \def\thebtauxfile{\jobname\arabic{btauxfile}}
58 \newcommand\bt@unit@cnt{1}
59 \newcommand\bt@internal@sect@cnt{0}
60 \newcommand\bt@helpctr{0}
61 \newcommand\bt@totalctr{0}
62 \newread\bt@infilea
63 \newread\bt@infileb
64 \newwrite\bt@outfile
65
66 \newif\ifbt@btunits
67 \DeclareOption{btunits}{%
68 \PackageWarningNoLine{bibtopic}{ignoring obsolete `btunits' option}
69 }
70 \newif\ifbt@fallback@thb
71 \DeclareOption{defaultbib}{%
72 \global\bt@fallback@thbtrue
73 }
74 \DeclareOption{verbose}{%
75 \def\bt@info#1{%
76 \begingroup
77 \def\MessageBreak{^^J(bibtopic)\@spaces\@spaces\@spaces}%
78 \set@display@protect
79 \immediate\write\@unused{%
80 ^^JPackage bibtopic info: #1\on@line.^^J%
81 }%
82 \endgroup
83 }%
84 \def\bt@infoNoLine#1{%
85 \begingroup
86 \def\MessageBreak{^^J(bibtopic)\@spaces\@spaces\@spaces}%
87 \set@display@protect
88 \immediate\write\@unused{%
89 ^^JPackage bibtopic info: #1.^^J%
90 }%
91 \endgroup
92 }%
93 }
94 \newif\ifbt@breakcites
95 \DeclareOption{breakcites}{%
96 \global\bt@breakcitestrue
97 }
98 \newif\ifbt@normalwarnings
99 \DeclareOption{normalwarnings}{%
100 \global\bt@normalwarningstrue
101 }
102 \newif\ifbt@printheadings
103 \DeclareOption{printheadings}{%
104 \global\bt@printheadingstrue
105 }
106 \newif\ifbt@part@cont@ctr
107 \DeclareOption{unitcntnoreset}{%
108 \global\bt@part@cont@ctrtrue
109 }
110 \newif\ifbt@sectctr@reset
111 \DeclareOption{sectcntreset}{%
112 \global\bt@sectctr@resettrue
113 }
114 \newif\ifbt@fast
115 \bt@fasttrue
116 \DeclareOption{slow}{%
117 \global\bt@fastfalse
118 }
119 \DeclareOption{dot}{%
120 \def\thebtauxfile{\jobname.\arabic{btauxfile}}%
121 }
122 \newif\ifbt@warn@override
123 \bt@warn@overridetrue
124 \newif\ifbt@override@numargs
125 \bt@override@numargstrue
126 \newif\ifbt@overridden@numargs
127 \DeclareOption{overridenumbers}{%
128 \bt@warn@overridefalse
129 \bt@override@numargstrue
130 }
131 \DeclareOption{dontoverridenumbers}{%
132 \bt@warn@overridefalse
133 \bt@override@numargsfalse
134 }
135 \ProcessOptions*
136
137 \newcommand\bt@isnum[1]{%
138 \if!\ifnum9<1#1!\else_\fi
139 \expandafter\@firstoftwo
140 \else
141 \expandafter\@secondoftwo
142 \fi
143 }
144
145 \newcommand*\bt@sect@ref@list{}
146 \newcommand\bt@curr@file{}
147 \newcommand\bt@curr@line{}
148 \newcommand*\bt@kv@req@list{}
149
150 \newcommand*\bt@curr@bib@file{}
151 \newcommand*\bt@cited@list{}
152 \newcommand*\bt@warn@files{}
153 \newcommand*\bt@label{}
154 \newcommand*\bt@globalstyle{}%
155 \newcommand*\bt@defaultstyle{plain}%
156 \newcommand*\@bt@orig@citation{}
157 \let\@bt@orig@citation\citation
158 \ifthenelse{\boolean{bt@fast}}{%
159 \def\citation#1{%
160 \@for\bt@tempa:=#1\do{%
161 \def\@extra@b@citeb{\bt@unit@cnt}%
162 \global\@namedef{\bt@tempa bt@\@extra@binfo}{}%
163 \@bt@orig@citation{\bt@tempa}%
164 }%
165 }%
166 }{%
167 \def\citation#1{%
168 \@for\bt@tempa:=#1\do{%
169 \def\@extra@b@citeb{\bt@unit@cnt}%
170 \bt@add@elem{\bt@tempa}{\bt@cited@list}%
171 \@bt@orig@citation{\bt@tempa}%
172 }%
173 }%
174 }
175 \newcommand*\bt@citesurround{}%
176
177 \def\bt@citesurround#1{%
178 \ifthenelse{\not\boolean{bt@breakcites}}{%
179 \hbox{#1}%
180 }{%
181 #1%
182 }%
183 }
184 \@ifundefined{citeform}{\let\citeform\relax}{}
185 \@ifundefined{citepunct}{\def\citepunct{,\penalty\@m\ }}{}
186 \@ifpackageloaded{backref}{%
187 \bt@after@brftrue
188 }{%
189 \relax
190 }
191 \newcommand\bt@citex{}
192 \def\bt@citex[#1]#2{% Add \@extra@b@citeb to \cite
193 \let\@citea\@empty
194 \@cite{%
195 \@for\@citeb:=#2\do{%
196 \@citea\let\@citea\citepunct
197 \edef\@citeb{\expandafter\@firstofone\@citeb}%
198 \if@filesw\immediate\write\@auxout{%
199 \string\citation{\@citeb}}\fi
200 \@ifundefined{b@\@citeb \@extra@b@citeb}{%
201 \mbox{\reset@font\bfseries ?}%
202 \@warning{Citation `\@citeb' on page \thepage\space
203 undefined}\G@refundefinedtrue
204 }{%
205 \bt@citesurround{\citeform{\csname b@\@citeb
206 \@extra@b@citeb\endcsname}}%
207 }%
208 }%
209 }{#1}%
210 }
211 \newcommand\bt@nocite{}
212 \def\bt@nocite#1{%
213 \@bsphack % Add \@extra@b@citeb to \nocite
214 \@for\@citeb:=#1\do{%
215 \edef\@citeb{\expandafter\@firstofone\@citeb}%
216 \if@filesw
217 \immediate\write\@auxout{%
218 \string\citation{\@citeb}%
219 }%
220 \fi
221 \@ifundefined{b@\@citeb\@extra@b@citeb}{%
222 \G@refundefinedtrue
223 \@warning{Citation `\@citeb' undefined}%
224 }{}%
225 }%
226 \@esphack
227 }
228
229 \newcommand*\bt@setcites{%
230 \let\@citex\bt@citex
231 \let\nocite\bt@nocite
232 }
233
234 \newcommand\change@bibcite{%
235 \let\change@bibcite\relax
236 \def\bibcite##1##2{%
237 \global\@namedef{b@##1\@extra@binfo}{##2}%
238 }%
239 }
240 \gdef\the@ipfilectr{}
241 \def\@extra@b@citeb{\the@ipfilectr}
242 \gdef\@extra@binfo{} % in case .aux files are left from old run.
243
244 \newcommand\bt@saveitem{}
245 \newcommand*\bt@savebib{}
246 \newcommand*\bt@endsavebib{}
247 \newif\ifbt@harvard@errs
248
249 \AtBeginDocument{%
250 \@ifclassloaded{scrbook}{%
251 \global\bt@koma@classtrue
252 }{%
253 \@ifclassloaded{scrartcl}{%
254 \global\bt@koma@classtrue
255 }{%
256 \@ifclassloaded{scrreprt}{%
257 \global\bt@koma@classtrue
258 }{%
259 \relax
260 }%
261 }%
262 }%
263 \global\let\bt@savebib\thebibliography
264 \global\let\bt@endsavebib\endthebibliography
265 \let\bt@saveitem\bibitem
266 \@ifpackageloaded{natbib}{%
267 \global\bt@natbibtrue
268 }{%
269 \def\harvarditem{\global\bt@harvard@errstrue}%
270 \let\harvardand\relax
271 \let\harvardyearleft\relax
272 \let\harvardyearright\relax
273 }%
274 \@ifpackageloaded{backref}{%
275 \ifthenelse{\not\boolean{bt@after@brf}}{%
276 \PackageError{%
277 bibtopic%
278 }{%
279 Load bibtopic after hyperref when using the `backref'
280 option\MessageBreak of hyperref%
281 }{%
282 Please see the section about `Compatibility with other^^J%
283 packages' in bibtopic.dvi for details.
284 }%
285 }{}%
286 \global\bt@brftrue
287 }{%
288 \relax
289 }%
290 }
291
292 \AtEndDocument{%
293 \immediate\write\@auxout{%
294 \string\csname\space bt@set@cnt\string\endcsname{\bt@helpctr}}%
295 \def\citation#1{\@bt@orig@citation{#1}}%
296 \let\bt@kv@add\@gobbletwo
297 \bt@files@warnings
298 \ifnum\bt@helpctr=\bt@totalctr\else
299 \PackageWarningNoLine{%
300 bibtopic%
301 }{%
302 Rerun to get indentation of bibitems right%
303 }%
304 \fi
305 }
306 \newcommand*\bt@savelist{}
307 \newcommand*\bt@append@list[2]{%
308 \let\bt@savelist#2
309 \protected@xdef#2{\bt@savelist\@elt{#1}}%
310 }
311 \newcommand*\bt@add@elem[2]{%
312 \bt@if@elem{#1}{#2}{%
313 \relax
314 }{%
315 \bt@append@list{#1}{#2}%
316 }%
317 }
318 \newcommand\bt@test@cmd{}
319 \newcommand*\bt@if@elem[2]{%
320 \let\bt@test@cmd\@secondoftwo
321 \let\bt@elt\@elt
322 \protected@edef\bt@tempc{#1}%
323 \def\@elt##1{%
324 \protected@edef\bt@tempb{##1}%
325 \ifx\bt@tempc\bt@tempb
326 \let\bt@test@cmd\@firstoftwo
327 \fi
328 }%
329 #2%
330 \let\@elt\bt@elt
331 \bt@test@cmd
332 }
333 \newcommand\bt@elt{}
334 \newcommand*\bt@mk@warning@list[1]{%
335 \@temptokena={}%
336 \let\bt@elt\@elt
337 \def\@elt##1{%
338 \@temptokena=\expandafter{\the\@temptokena ##1\MessageBreak}%
339 }%
340 #1%
341 \let\@elt\bt@elt
342 }
343
344 \newcommand*\@orig@bibliographystyle{}
345 \let\@orig@bibliographystyle\bibliographystyle
346 \def\bibliographystyle#1{%
347 \gdef\bt@globalstyle{#1}%
348 \bt@info{Default bibliographystyle is `#1'}%
349 \@orig@bibliographystyle{#1}%
350 }
351 \def\bibliography{%
352 \PackageWarning{%
353 bibtopic%
354 }{%
355 Ignoring `\string\bibliography' command\MessageBreak
356 (not compatible with bibtopic.sty)%
357 }%
358 \@gobble
359 }
360
361 \newcommand*\@bt@write@auxfile[3]{%
362 \bt@can@overwrite{btaux.aux}%
363 \bt@copy@verbatim{\thebtauxfile.aux}{btaux.aux}%
364 \immediate\closeout\bt@outfile
365 \immediate\openout\bt@outfile\thebtauxfile.aux
366 \ifthenelse{\boolean{bt@natbib}}{%
367 \immediate\write\bt@outfile{%
368 \@percentchar\@percentchar\space
369 Info from `bibtopic.sty': natbib loaded.^^J%
370 \string\bibstyle{#1}^^J%
371 \string\citation{#2}^^J%
372 \string\bibdata{#3}%
373 }%
374 }{%
375 \immediate\write\bt@outfile{%
376 \string\bibstyle{#1}^^J%
377 \string\citation{#2}^^J%
378 \string\bibdata{#3}%
379 }%
380 }%
381 \immediate\closeout\bt@outfile
382 \bt@if@files@differ{\thebtauxfile.aux}{btaux.aux}{%
383 \bt@if@elem{\thebtauxfile}{\bt@warn@files}{%
384 \relax
385 }{%
386 \ifthenelse{\boolean{bt@normalwarnings}}{%
387 \PackageWarningNoLine{%
388 bibtopic%
389 }{%
390 \thebtauxfile.bbl may be outdated%
391 }%
392 }{%
393 \bt@appendtofile{\thebtauxfile.bbl}{%
394 \string\csname\space
395 bt@warn@outdated\string\endcsname{\thebtauxfile}%
396 }%
397 }%
398 }%
399 }{}% they don't differ
400 }
401
402 \newcommand*\bt@appendtofile[2]{%
403 \bt@can@overwrite{btbbl.aux}%
404 \bt@copy@verbatim{#1}{btbbl.aux}%
405 \immediate\closeout\bt@outfile
406 \bt@copy@verbatim{btbbl.aux}{#1}
407 \immediate\write\bt@outfile{\expandafter\string #2}%
408 \immediate\closeout\bt@outfile
409 }
410
411 \newcommand*\bt@save@list[1]{%
412 \expandafter\protected@xdef\csname bt@sect%
413 #1\endcsname{\bt@cited@list}%
414 }
415 \newcommand\btBegThbCmd{}
416 \newcommand*\bt@beg@thb@hook{%
417 \btBegThbCmd
418 \global\bt@found@itemfalse
419 \bt@item{}%
420 }%
421 \newcommand\bt@save@cnt{0}
422 \newcommand*\bt@end@thb@hook{%
423 \endbt@item
424 \ifthenelse{\boolean{bt@natbib}}{%
425 \protected@xdef\bt@save@cnt{\theNAT@ctr}%
426 }{%
427 \protected@xdef\bt@save@cnt{\@arabic\c@enumiv}%
428 }%
429 \bt@bibitemcheck
430 }%
431 \newcommand*\bt@change@bibitem{%
432 \expandafter\ifx\btBegThbCmd\empty\else
433 \bt@info{\string\btBegThbCmd nonempty: \meaning\btBegThbCmd}%
434 \fi
435 \ifthenelse{\boolean{bt@natbib}}{%
436 \def\harvarditem{\endbt@item\bt@harvitem}%
437 }{}%
438 \def\bibitem{\endbt@item\bt@item}%
439 }
440 \newcommand*\bt@adjust@label[1]{%
441 \bt@isnum{#1}{%
442 \def\bt@label{\bt@totalctr}%
443 }{%
444 \def\bt@label{#1}%
445 }%
446 }
447 \newcommand*\bt@change@thb{%
448 \long\def\bt@tempa##1##2\endthebibliography{%
449 \def\bt@tempc{##1}%
450 }%
451 \expandafter\bt@tempa\thebibliography{}\endthebibliography
452 \ifthenelse{\boolean{bt@brf}}{%
453 \@ifundefined{BRorg@thebibliography}{%
454 \PackageInfo{bibtopic}{assuming backref.sty <= v1.16}%
455 \let\bt@brf@bbl@cmd\oldbibl
456 }{%
457 \PackageInfo{bibtopic}{assuming backref.sty >= v1.19}%
458 \let\bt@brf@bbl@cmd\BRorg@thebibliography
459 }%
460 \def\bt@tempb{\@starttoc}%
461 \ifx\bt@tempb\bt@tempc
462 \expandafter\bt@tempa\bt@brf@bbl@cmd{}\endthebibliography
463 \fi
464 }{}%
465 \def\bt@tempa{\bibfont}%
466 \ifx\bt@tempa\bt@tempc %
467 \bt@change@nat@thb
468 \else
469 \def\bt@tempa{\bibsection}%
470 \ifx\bt@tempa\bt@tempc
471 \bt@change@nat@thb
472 \else
473 \def\bt@tempa{\bib@heading}%
474 \ifx\bt@tempa\bt@tempc
475 \bt@change@KOMA@thb
476 \else
477 \def\bt@tempa{\chapter}%
478 \ifx\bt@tempa\bt@tempc
479 \bt@change@standard@thb
480 \else
481 \def\bt@tempa{\section}%
482 \ifx\bt@tempa\bt@tempc
483 \bt@change@standard@thb
484 \else
485 \ifbt@koma@class
486 \bt@change@KOMA@thb
487 \else
488 \ifthenelse{\boolean{bt@fallback@thb}}{%
489 \PackageWarning{%
490 bibtopic%
491 }{%
492 `defaultbib' specified; using
493 built-in\MessageBreak
494 `thebibliography' environment%
495 }%
496 \let\thebibliography\bt@dflt@bthb
497 \let\endthebibliography\bt@dflt@ethb
498 }{%
499 \PackageError{%
500 bibtopic%
501 }{%
502 Found unknown `thebibliography' environment%
503 }{%
504 You should either use a package providing
505 a known bibliography^^J%
506 environment (such as natbib), or use the
507 `defaultbib' package^^J%
508 option as a workaround; please see the
509 section about `Warnings^^J%
510 and error messages' in `bibtopic.dvi' for
511 details.
512 }%
513 }%
514 \fi
515 \fi
516 \fi
517 \fi
518 \fi
519 \fi
520 }
521
522 \providecommand\@openbib@code{}
523 \newcommand\bt@dflt@bthb[1]{%
524 \bt@adjust@label{#1}%
525 \ifthenelse{\boolean{bt@printheadings}}{%
526 \@ifundefined{chapter}{%
527 \@ifundefined{section}{%
528 \@startsection{section}{1}{\z@}%
529 {-3.5ex \@plus -1ex \@minus -.2ex}%
530 {2.3ex \@plus.2ex}%
531 {\normalfont\Large\bfseries}*{\refname}%
532 }{%
533 \section*{\refname\@mkboth{\refname}{\refname}}%
534 }%
535 }{%
536 \chapter*{\bibname\@mkboth{\bibname}{\bibname}}%
537 }%
538 }{}%
539 \list{\@biblabel{\@arabic\c@enumiv}}{%
540 \settowidth\labelwidth{\@biblabel{#1}}%
541 \leftmargin\labelwidth
542 \advance\leftmargin\labelsep
543 \@openbib@code
544 \ifthenelse{\boolean{bt@sectctr@reset}}{%
545 \usecounter{enumiv}%
546 }{%
547 \@nmbrlisttrue
548 \def\@listctr{enumiv}%
549 }%
550 \let\p@enumiv\@empty
551 \renewcommand*\theenumiv{\@arabic\c@enumiv}%
552 }%
553 \sloppy\clubpenalty4000\widowpenalty4000%
554 \sfcode`\.=\@m
555 \bt@beg@thb@hook
556 }%
557
558 \newcommand\bt@dflt@ethb{%
559 \bt@end@thb@hook
560 \def\@noitemerr{%
561 \@latex@warning{Empty `thebibliography' environment}%
562 }%
563 \endlist
564 }%
565
566 \newcommand\bt@change@nat@thb{%
567 \def\thebibliography##1{%
568 \bt@adjust@label{##1}%
569 \ifthenelse{\not\boolean{bt@printheadings}}{%
570 \let\bibsection\relax
571 }{}%
572 \bt@savebib{\bt@label}%
573 \ifthenelse{\not\boolean{bt@sectctr@reset}}{%
574 \setcounter{NAT@ctr}{\bt@save@cnt}%
575 }{}%
576 \bt@beg@thb@hook
577 }%
578 \def\endthebibliography{%
579 \bt@end@thb@hook
580 % \bt@endsavebib %% not; define it explicitly instead:
581 \def\@noitemerr{%
582 \PackageWarning{%
583 bibtopic%
584 }{%
585 Empty `thebibliography' environment%
586 }%
587 }%
588 \endlist % \vskip-\lastskip omitted here
589 }%
590 }
591
592 \newcommand*\bt@change@standard@thb{%
593 \def\thebibliography##1{%
594 \bt@adjust@label{##1}%
595 \ifthenelse{\not\boolean{bt@printheadings}}{%
596 \let\chapter\@gobbletwo
597 \let\section\@gobbletwo
598 }{}%
599 \bt@savebib{\bt@label}%
600 \ifthenelse{\not\boolean{bt@sectctr@reset}}{%
601 \setcounter{enumiv}{\bt@save@cnt}%
602 }{}%
603 \bt@beg@thb@hook
604 }%
605 \def\endthebibliography{%
606 \bt@end@thb@hook
607 \bt@endsavebib
608 }%
609 }
610 \newcommand*\bt@change@KOMA@thb{%
611 \ifthenelse{\not\boolean{bt@printheadings}}{%
612 \let\bib@heading\relax
613 }{}%
614 \bt@change@standard@thb
615 }
616
617 \newcommand\bt@harvitem{%
618 \@ifnextchar[{\bt@@harvitem}{\bt@@harvitem[]}%] brace matching
619 }
620
621 \newcommand*\bt@@harvitem[4][]{%
622 \ifthenelse{\equal{#1}{}}{%
623 \protected@xdef\bt@args{[#2(#3)]}%
624 }{%
625 \bt@warn@brackets{#2}#1[]\end%
626 \protected@xdef\bt@args{[#1(#3)#2]}%
627 }%
628 \bt@call@item{#4}%
629 }
630 \newenvironment{bt@item}{%
631 \@ifnextchar[{\bt@@item}{\bt@@item[]}%] brace matching
632 }{
633 \relax
634 }
635 \newcommand*\bt@@item[2][]{%
636 \ifthenelse{\equal{#2}{}}{%
637 \def\endbt@item{\relax}%
638 }{%
639 \ifthenelse{\equal{#1}{}}{%
640 \gdef\bt@args{}%
641 }{%
642 \bt@isnum{#1}{%
643 \ifthenelse{\boolean{bt@override@numargs}}{%
644 \global\bt@overridden@numargstrue
645 \gdef\bt@args{}%
646 }{%
647 \bt@warn@brackets{#2}#1[]\end%
648 \protected@xdef\bt@args{[#1]}%
649 }%
650 }{%
651 \bt@warn@brackets{#2}#1[]\end%
652 \protected@xdef\bt@args{[#1]}%
653 }%
654 }%
655 \bt@call@item{#2}%
656 }%
657 }
658 \newcommand*\bt@warn@brackets{}
659 \def\bt@warn@brackets#1#2[#3]#4\end{%
660 \ifthenelse{\equal{#3}{}}{%
661 \relax
662 }{%
663 \PackageError{%
664 bibtopic%
665 }{%
666 Can't parse brackets in key `#1' properly%
667 }{%
668 You seem to have used brackets `[]' inside that key in^^J%
669 `\bt@curr@[email protected]', and bibtopic could have confused these^^J%
670 with the optional argument of the `\string\bibitem' command.^^J%
671 To avoid this, please `hide' such brackets in an extra pair^^J%
672 of braces, like this: `{[]}'.^^J^^J%
673 (Don't forget to rerun BibTeX on `\thebtauxfile' afterwards.)^^J%
674 If you proceed now, your bibliograpy may look somewhat garbled.
675 }%
676 }%
677 }
678
679 \newcommand*\bt@boxing@hook{%
680 \global\let\@noitemerr\relax
681 \def\cite{%
682 \@ifstar{}{}% just gobble it
683 \@ifnextchar[{% brace matching ]}{
684 \@citex
685 }{%
686 \@citex[]%
687 }%
688 }
689 \def\@citex[##1]{%
690 \@ifnextchar[{%]}{
691 \bt@gobble@citex[##1]%
692 }{%
693 \bt@gobble@citex[##1][]%
694 }%
695 }%
696 \def\bt@gobble@citex[##1][##2]##3{}%
697 \let\citet\cite
698 \let\Citet\cite
699 \let\citep\cite
700 \let\Citep\cite
701 \let\citealt\cite
702 \let\Citealt\cite
703 \let\citealp\cite
704 \let\Citealp\cite
705 \let\citetext\cite
706 \let\citeauthor\cite
707 \let\Citeauthor\cite
708 \let\citeauthoryear\cite
709 \let\citeyearpar\cite
710 \let\citetalias\cite
711 \let\citepalias\cite
712 \let\jbdoitem\relax
713 \let\jbbibargs\bt@gobblethree
714 }
715
716 \newcommand*\bt@call@item{}
717 \ifthenelse{\boolean{bt@fast}}{%
718 \def\bt@call@item#1{%
719 \@ifundefined{#1bt@\@extra@b@citeb}{%
720 \bt@print@all@or@notcited{#1}%
721 }{%
722 \bt@print@all@or@cited{#1}%
723 }%
724 }
725 }{%
726 \def\bt@call@item#1{%
727 \def\endbt@item{\relax}%
728 \bt@if@elem{#1}{\csname bt@sect\bt@unit@cnt\endcsname}{%
729 \bt@print@all@or@cited{#1}%
730 }{%
731 \bt@print@all@or@notcited{#1}%
732 }%
733 }%
734 }
735
736 \newcommand*\bt@print@all@or@cited[1]{%
737 \ifthenelse{\boolean{bt@print@cited}}{%
738 \bt@do@print@item{#1}%
739 }{%
740 \ifthenelse{\boolean{bt@print@all}}{%
741 \bt@do@print@item{#1}%
742 }{%
743 \bt@dont@print@item
744 }%
745 }%
746 }
747 \newcommand*\bt@print@all@or@notcited[1]{%
748 \ifthenelse{\boolean{bt@print@cited}}{%
749 \bt@dont@print@item
750 }{%
751 \bt@do@print@item{#1}%
752 }%
753 }
754 \newcommand*\bt@do@print@item[1]{%
755 \global\bt@found@itemtrue
756 \bt@stepcnt\bt@helpctr
757 \bt@if@elem{#1}{\bt@kv@req@list}{%
758 \bt@add@elem{#1}{\bt@sect@ref@list}%
759 }{}%
760 \def\endbt@item{\relax}%
761 \expandafter\bt@saveitem\bt@args{#1}%
762 }
763
764 \newbox\bt@tempboxa
765
766 \newcommand*\bt@dont@print@item{%
767 \def\endbt@item{%
768 \end{lrbox}%
769 }%
770 \begin{lrbox}{\bt@tempboxa}%
771 \bt@boxing@hook
772 }
773 \newcommand\bt@copy@verbatim[2]{%
774 \openin\bt@infilea=#1\relax
775 \immediate\openout\bt@outfile=#2\relax
776 \immediate\write\bt@outfile{%
777 \@percentchar%
778 \@percentchar%
779 \@percentchar%
780 \space produced automatically by bibtopic.sty v1.0k%
781 }%
782 \begingroup
783 \let\do\@makeother \dospecials
784 \endlinechar\m@ne
785 \ifeof\bt@infilea
786 \bt@info{Tried to copy #1, but couldn't find it}%
787 \else
788 \loop
789 \read\bt@infilea to\bt@tempa
790 % same trick as with \if!...!
791 \if\ifeof\bt@infilea 0\else 1\fi 1
792 \immediate\write\bt@outfile{\bt@tempa}%
793 \repeat
794 \fi
795 \endgroup
796 \closein\bt@infilea
797 }
798 \newcommand*\bt@can@overwrite[1]{%
799 \openin\bt@infilea=#1\relax
800 \bgroup
801 \let\do\@makeother \dospecials
802 \endlinechar\m@ne
803 \ifeof\bt@infilea
804 \bt@info{File `#1' doesn't exist}%
805 \else
806 \read\bt@infilea to\@tempa
807 \ifeof\bt@infilea
808 \bt@info{File `#1' is empty}%
809 \else
810 \bt@if@signatureline{\@tempa}{%
811 \relax
812 }{%
813 \PackageError{bibtopic}{%
814 file `#1' not written by bibtopic%
815 }{%
816 The file `#1' looks as if it hasn't been written
817 by bibtopic;^^J%
818 however, bibtopic would now try to overwrite this file.^^J%
819 (See section 3 in bibtopic.dvi for more details.)^^J%
820 If this file contains anything important, please^^J%
821 copy its contents to a safe place now.^^J^^J%
822 If you hit RETURN now, this file will be overwritten.^^J%
823 }%
824 }%
825 \fi
826 \fi
827 \egroup
828 \closein\bt@infilea
829 }
830
831 \newcommand\bt@version{0}
832 \newcommand\bt@if@@signatureline{}
833 \newcommand\bt@if@signatureline{}
834 {
835 \catcode`\ =12
836 \catcode`\%=12
837 \endlinechar\m@ne
838 \gdef\bt@if@signatureline#1{
839 \expandafter\bt@if@@signatureline
840 #1%%% produced automatically by bibtopic.sty v.%%%\end
841 }
842 \gdef\bt@if@@signatureline
843 #1%%% produced automatically by bibtopic.sty v#2.#3%%%#4\end{
844 \ifx\\#2\\
845 \let\bt@tempc\@secondoftwo
846 \else
847 \def\bt@version{#2.#3}
848 \let\bt@tempc\@firstoftwo
849 \fi
850 \bt@tempc
851 }
852 }
853
854 \newif\ifbt@cont
855 \newif\ifbt@files@diff
856 \newcommand\bt@line@cnt{}
857 \newcommand*\bt@if@files@differ[4]{%
858 \bt@files@difffalse
859 \def\bt@line@cnt{0}%
860 \bgroup
861 \let\do\@makeother
862 \dospecials
863 \endlinechar-1
864 \openin\bt@infilea=#1
865 \openin\bt@infileb=#2
866 \bt@conttrue
867 \loop
868 \ifeof\bt@infilea
869 \bt@contfalse
870 \ifeof\bt@infileb
871 \else
872 \global\bt@files@difftrue
873 \fi
874 \else
875 \ifeof\bt@infileb
876 \bt@contfalse
877 \global\bt@files@difftrue
878 \fi
879 \fi
880 \ifbt@cont
881 \read\bt@infilea to\bt@tempa
882 \read\bt@infileb to\bt@tempb
883 \bt@stepcnt{\bt@line@cnt}%
884 \ifnum\bt@line@cnt=1
885 \bt@if@signatureline{\bt@tempb}{%
886 \read\bt@infileb to\bt@tempb
887 }{}%
888 \fi
889 \ifx\bt@tempa\bt@tempb
890 \else
891 \bt@contfalse
892 \global\bt@files@difftrue
893 \fi
894 \repeat
895 \closein\bt@infilea
896 \closein\bt@infileb
897 \egroup
898 \ifthenelse{\boolean{bt@files@diff}}{%
899 #3%
900 }{%
901 #4%
902 }%
903 }
904
905 \newcommand*\bt@set@cnt[1]{%
906 \gdef\bt@totalctr{#1}%
907 }
908
909 \newcommand*\bt@keyval@list{}
910
911 \newcommand*\bt@kv@add[2]{%
912 \protected@edef\bt@tempa{\bt@keyval@list}%
913 \protected@xdef\bt@keyval@list{\noexpand\@elt{#1}{#2}\bt@tempa}%
914 }
915
916 \DeclareRobustCommand*\btCiteSect[1]{%
917 \btGetVal{#1}%
918 \cite{#1} (section\nobreakspace{}\ref{\btretval})%
919 }
920
921 \DeclareRobustCommand*\btRef[2]{%
922 % get section label of #1 from \bt@keyval@list
923 % reference type is #2
924 \ifx\bt@keyval@list\@undefined
925 {\bfseries{???}}%
926 \else
927 \bt@get@keyval{#1}{\bt@keyval@list}%
928 #2{\btretval}%
929 \fi
930 }
931
932 \DeclareRobustCommand*\btGetVal[1]{%
933 \bt@get@keyval{#1}{\bt@keyval@list}%
934 }
935 \newcommand*\bt@print@keyvals[2]{%
936 \let\bt@elt\@elt%
937 \def\@elt##1{%
938 \protected@write\@auxout{}{%
939 \string\bt@kv@add{##1}{#2}%
940 }%
941 }#1%
942 \let\@elt\bt@elt
943 }
944 \newcommand*\bt@get@keyval[2]{%
945 \gdef\btretval{???}%
946 \bt@add@elem{#1}{\bt@kv@req@list}%
947 %% get value of key #1 from list #2
948 \protected@edef\bt@tempa{#1}%
949 \bt@elemfalse
950 \let\bt@elt\@elt%
951 \def\@elt##1##2{\def\bt@tempb{##1}%
952 \ifx\bt@tempa\bt@tempb %##2
953 \gdef\btretval{##2}%
954 \fi
955 }%
956 #2%
957 \let\@elt\bt@elt
958 \ifthenelse{\equal{\btretval}{???}}{%
959 \PackageWarning{bibtopic}{%
960 Key `#1' not found\MessageBreak in list of cited works%
961 }%
962 }{}%
963 }
964
965 \newcommand*\bt@get@label[2]{%
966 \protected@edef\bt@tempa{#1}%
967 \let\bt@elt\@elt%
968 \def\@elt##1##2{\def\bt@tempb{##1}%
969 \ifx\bt@tempa\bt@tempb%
970 ##2
971 \fi
972 }%
973 #2%
974 \let\@elt\bt@elt
975 }
976
977 \newenvironment{btSect}[2][\bt@globalstyle]{%
978 \ifthenelse{\equal{#1}{}}{%
979 \PackageWarning{%
980 bibtopic%
981 }{%
982 No \string\bibliographystyle\space given
983 - \MessageBreak assuming `\bt@defaultstyle'%
984 }%
985 \def\bt@globalstyle{\bt@defaultstyle}%
986 }{}%
987 \expandafter\ifx\csname bt@sect\bt@unit@cnt%
988 \endcsname\relax
989 \expandafter\protected@xdef\csname bt@sect%
990 \bt@unit@cnt\endcsname{\bt@cited@list}%
991 \fi
992 \stepcounter{btauxfile}%
993 \bt@info{bibliographystyle is `#1'\MessageBreak
994 for file `\thebtauxfile .bbl'%
995 }%
996 \bt@inside@secttrue
997 \gdef\bt@curr@bib@file{#2}%
998 \gdef\bt@sect@ref@list{}%
999 \bt@change@thb%
1000 \if@filesw
1001 \@bt@write@auxfile{#1}{*}{#2}%
1002 \fi
1003 }{%
1004 \relax
1005 }%
1006 \newenvironment{btUnit}{%
1007 \ifthenelse{\boolean{bt@inside@unit}}{%
1008 \PackageError{%
1009 bibtopic%
1010 }{%
1011 The `btUnit' environment cannot be nested%
1012 }{%
1013 You cannot use a `btUnit' environment inside another^^J%
1014 `btUnit' environment.
1015 }%
1016 }{}%
1017 \global\bt@inside@unittrue
1018 \immediate\write\@auxout{%
1019 \string\csname\space change@bibcite\string\endcsname%
1020 }%
1021 \ifthenelse{\not\boolean{bt@natbib}}{%
1022 \bt@setcites
1023 }{}%
1024 \ifthenelse{\not\boolean{bt@part@cont@ctr}}{%
1025 \def\bt@save@cnt{0}%
1026 \ifthenelse{\boolean{bt@natbib}}{%
1027 \setcounter{NAT@ctr}{0}%
1028 }{%
1029 \setcounter{enumiv}{0}% for standard styles
1030 }%
1031 }{}%
1032 \protected@xdef\the@ipfilectr{\bt@unit@cnt}%
1033 \immediate\write\@auxout{\string\def\string\bt@cited@list{}^^J%
1034 \string\gdef\string\@extra@binfo{\@extra@b@citeb}}%
1035 }{%
1036 \immediate\write\@auxout{\string\bt@save@list{\bt@unit@cnt}}
1037 \bt@stepcnt\bt@unit@cnt
1038 \gdef\the@ipfilectr{}%
1039 \immediate\write\@auxout{%
1040 \string\gdef\string\@extra@binfo{\@extra@b@citeb}}%
1041 \global\bt@inside@unitfalse
1042 }
1043 \newcommand*\btPrintCited{%
1044 \ifthenelse{\boolean{bt@inside@sect}}{%
1045 \protected@edef\bt@curr@line{\the\inputlineno}%
1046 \def\bt@curr@cmd{\string\btPrintCited}%
1047 \bt@stepcnt\bt@internal@sect@cnt%
1048 \bt@print@citedtrue\bt@print@allfalse
1049 \label{Sec:\bt@internal@sect@cnt}%
1050 \bt@change@bibitem
1051 \bt@input@or@warn{\thebtauxfile}%
1052 \bt@print@keyvals{\bt@sect@ref@list}{%
1053 Sec:\bt@internal@sect@cnt
1054 }%
1055 }{%
1056 \bt@sect@err{btSect}{\btPrintCited}%
1057 }%
1058 }
1059 \newcommand*\btPrintNotCited{%
1060 \ifthenelse{\boolean{bt@inside@sect}}{%
1061 \protected@edef\bt@curr@line{\the\inputlineno}%
1062 \def\bt@curr@cmd{\string\btPrintNotCited}%
1063 \bt@stepcnt\bt@internal@sect@cnt
1064 \bt@print@citedfalse\bt@print@allfalse
1065 \label{Sec:\bt@internal@sect@cnt}%
1066 \bt@change@bibitem
1067 \bt@input@or@warn{\thebtauxfile}%
1068 }{%
1069 \bt@sect@err{btSect}{\btPrintNotCited}%
1070 }%
1071 }
1072 \newcommand*\btPrintAll{%
1073 \ifthenelse{\boolean{bt@inside@sect}}{%
1074 \protected@edef\bt@curr@line{\the\inputlineno}%
1075 \def\bt@curr@cmd{\string\btPrintAll}%
1076 \bt@stepcnt\bt@internal@sect@cnt
1077 \bt@print@citedfalse\bt@print@alltrue
1078 \label{Sec:\bt@internal@sect@cnt}%
1079 \bt@change@bibitem
1080 \bt@input@or@warn{\thebtauxfile}%
1081 \bt@print@keyvals{\bt@sect@ref@list}%
1082 {Sec:\bt@internal@sect@cnt}%
1083 }{%
1084 \bt@sect@err{btSect}{\btPrintAll}%
1085 }%
1086 }
1087 \newenvironment{bibtopics}[2]{%
1088 \begin{btSect}[#1]{#2}%
1089 \btPrintAll
1090 }{%
1091 \end{btSect}%
1092 }
1093 \newcommand\bt@bibstyle{}
1094 \newcommand\bt@citation{}
1095 \newcommand\bt@bibdata{}
1096 \newenvironment{bibunit}[1][\bt@globalstyle]{%
1097 \ifx#1\@empty
1098 \PackageWarning{%
1099 bibtopic%
1100 }{%
1101 No \string\bibliographystyle\space given
1102 - \MessageBreak assuming `\bt@defaultstyle'%
1103 }%
1104 \def\bt@globalstyle{\bt@defaultstyle}%
1105 \fi
1106 \def\bt@bibstyle{#1}%
1107 \def\nocite##1{\def\bt@citation{##1}}%
1108 \def\cite##1{\def\bt@citation{##1}}%
1109 \gdef\putbib[##1]{\gdef\bt@bibdata{##1}}%
1110 \stepcounter{btauxfile}%
1111 }{%
1112 \bt@change@thb
1113 \if@filesw
1114 \@bt@write@auxfile{\bt@bibstyle}{\bt@citation}{\bt@bibdata}%
1115 \fi
1116 \bt@inside@secttrue
1117 \btPrintAll
1118 }
1119 \newcommand*\bt@bibitemcheck{%
1120 \ifthenelse{\not\boolean{bt@found@item}}{%
1121 \PackageWarningNoLine{%
1122 bibtopic%
1123 }{%
1124 No appropriate bibitems found for command\MessageBreak %
1125 \bt@curr@cmd\space on line \bt@curr@line%
1126 }%
1127 }{}%
1128 }
1129 \newcommand*\bt@sect@err[2]{%
1130 \PackageError{%
1131 bibtopic%
1132 }{%
1133 You can't use `\string#2' outside of `#1'%
1134 }{%
1135 See the documentation on the `\string#2' command\MessageBreak
1136 in `bibtopic.dvi' for details.
1137 }%
1138 }
1139
1140 \newcommand*\bt@bibtex@warning[1]{%
1141 \PackageWarningNoLine{%
1142 bibtopic%
1143 }{%
1144 Please (re)run BibTeX on the file(s):%
1145 \expandafter\MessageBreak#1%
1146 and after that rerun LaTeX%
1147 }%
1148 }
1149
1150 \newcommand*\bt@files@warnings{%
1151 \ifthenelse{\boolean{bt@harvard@errs}}{%
1152 \PackageError{%
1153 bibtopic%
1154 }{%
1155 Your command \string\harvarditem\space was ignored%
1156 }{%
1157 `bibtopic' currently supports the `\string\harvarditem'
1158 command^^J
1159 only in connection with the `natbib' package. So either^^J%
1160 load this package, or change the `\string\citationstyle' command
1161 to some^^J%
1162 non-harvard style.^^J%
1163 If you hit RETURN now, some of your bibliographies will be empty.
1164 }%
1165 }{}%
1166 \ifthenelse{\boolean{bt@overridden@numargs}}{%
1167 \ifthenelse{\boolean{bt@warn@override}}{%
1168 \PackageWarningNoLine{%
1169 bibtopic%
1170 }{%
1171 The numerical argument in some `\string\bibitem' commands^^J%
1172 has been ignored. Using one of the package options^^J%
1173 `overridenumbers' or `dontoverridenumbers' will make^^J%
1174 this warning go away.^^J%
1175 Please see the documentation on these options^^J%
1176 in `bibtopic.dvi' for more details.
1177 }%
1178 }{}%
1179 }{}%
1180 \ifthenelse{\equal{\bt@warn@files}{}}{%
1181 \relax
1182 }{%
1183 \bt@mk@warning@list{\bt@warn@files}%
1184 \bt@bibtex@warning{\the\@temptokena}%
1185 \def\bt@helpctr{\bt@totalctr}%
1186 }%
1187 }
1188
1189 \newcommand*\bt@input@or@warn[1]{%
1190 \IfFileExists{#1.bbl}%
1191 {%
1192 \input#1.bbl%
1193 }{%
1194 \bt@if@elem{#1}{\bt@warn@files}{%
1195 \relax
1196 }{%
1197 \PackageWarningNoLine{%
1198 bibtopic%
1199 }{%
1200 No file #1.bbl%
1201 }%
1202 \ifbt@normalwarnings
1203 \else
1204 \bt@append@list{#1}{\bt@warn@files}%
1205 \fi
1206 }%
1207 }%
1208 }%
1209
1210 \newcommand*\bt@warn@outdated[1]{%
1211 \bt@if@elem{#1}{\bt@warn@files}{%
1212 \relax
1213 }{%
1214 \bt@infoNoLine{Marking #1.bbl as outdated}%
1215 \bt@append@list{#1}{\bt@warn@files}%
1216 }%
1217 \ifthenelse{\not\boolean{bt@natbib}}{%
1218 \global\let\bt@item\relax
1219 \global\let\endbt@item\relax
1220 }{}%
1221 }%
1222 \endinput
1223 %%
1224 %% End of file `bibtopic.sty'.