Debian Codegraph @

texmf-dist/tex/latex/babelbib/babelbib.sty

raw
1 %%
2 %% This is file `babelbib.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% babelbib.dtx (with options: `latex,package')
8 %%
9 %% babelbib package
10 %%
11 %% Copyright 2003--2021 Harald Harders
12 %% Copyright 2019--2021 Norbert Preining
13 %%
14 %% This program can be redistributed and/or modified under the terms
15 %% of the LaTeX Project Public License Distributed from CTAN
16 %% archives in directory macros/latex/base/lppl.txt; either
17 %% version 1 of the License, or any later version.
18 %%
19 %% [email protected]
20 %% [email protected]
21 %%
22 \NeedsTeXFormat{LaTeX2e}[1998/06/01]
23 \ProvidesPackage{babelbib}
24 [2021/01/06 v1.34 babelbib: multilingual bibliographies]
25 \let\bbbbifpackageloaded=\@ifpackageloaded
26 \newif\ifbbbbfixlanguage
27 \DeclareOption{fixlanguage}{\bbbbfixlanguagetrue}
28 \DeclareOption{varlanguage}{\bbbbfixlanguagefalse}
29 \newif\ifbbbblanguagenames
30 \DeclareOption{nolanguagenames}{\bbbblanguagenamesfalse}
31 \DeclareOption{languagenames}{\bbbblanguagenamestrue}
32 \newif\ifbbbbannotations
33 \DeclareOption{annote}{\bbbbannotationstrue}
34 \DeclareOption{noannote}{\bbbbannotationsfalse}
35 \newif\ifbtx@printISBN
36 \newif\ifbtx@printISSN
37 \DeclareOption{isbn}{\btx@printISBNtrue}
38 \DeclareOption{noisbn}{\btx@printISBNfalse}
39 \DeclareOption{issn}{\btx@printISSNtrue}
40 \DeclareOption{noissn}{\btx@printISSNfalse}
41 \newcommand\btxprintmonthyear[4]{}
42 \newcommand*\btx@dateasis{%
43 \def\btxprintmonthyear##1##2##3##4{##2\ ##3}%
44 }
45 \newcommand*\btx@datenumeric{%
46 \def\btxprintmonthyear##1##2##3##4{%
47 \ifnumber{##2}{\btxprintmonthyearnum{##2}{##3}}{##2\ ##3}}%
48 }
49 \newcommand*\btx@datename{%
50 \def\btxprintmonthyear##1##2##3##4{%
51 \ifnumber{##2}{%
52 \ifcase ##2 \or
53 \csname btxmonjan##4\endcsname{##1}\or
54 \csname btxmonfeb##4\endcsname{##1}\or
55 \csname btxmonmar##4\endcsname{##1}\or
56 \csname btxmonapr##4\endcsname{##1}\or
57 \csname btxmonmay##4\endcsname{##1}\or
58 \csname btxmonjun##4\endcsname{##1}\or
59 \csname btxmonjul##4\endcsname{##1}\or
60 \csname btxmonaug##4\endcsname{##1}\or
61 \csname btxmonsep##4\endcsname{##1}\or
62 \csname btxmonoct##4\endcsname{##1}\or
63 \csname btxmonnov##4\endcsname{##1}\or
64 \csname btxmondec##4\endcsname{##1}\or
65 \PackageError{babelbib}{%
66 Month outside range 1 to 12 used}{%
67 Better use the BibTeX names jan, feb, mar, etc.}%
68 \fi
69 \ ##3%
70 }{%
71 ##2\ ##3}%
72 }%
73 }
74 \DeclareOption{dateasis}{\btx@dateasis}
75 \DeclareOption{datenumeric}{\btx@datenumeric}
76 \DeclareOption{datename}{\btx@datename}
77 \DeclareOption*{%
78 \InputIfFileExists{\CurrentOption.bdf}{%
79 \typeout{babelbib: \CurrentOption.bdf loaded due to explicit package
80 option \CurrentOption}%
81 \expandafter\def\csname bbbb\CurrentOption loaded\endcsname{\@empty}%
82 }{%
83 \PackageError{babelbib}{%
84 Language definition file \CurrentOption.bdf not found}{%
85 Maybe you misspelled the language option?}%
86 }%
87 }
88 \ExecuteOptions{varlanguage,nolanguagenames,noannote,isbn,issn,datename}
89 \ProcessOptions*
90 \newcommand*{\bbbbifundefined}[1]{%
91 \begingroup\expandafter\expandafter\expandafter\endgroup
92 \expandafter\ifx\csname #1\endcsname\relax
93 \expandafter\@firstoftwo
94 \else
95 \expandafter\@secondoftwo
96 \fi
97 }
98 \newcommand\bbbbaddto[2]{%
99 \expandafter\bbbbifundefined{extras#1}{}{%
100 \expandafter\addto\expandafter{\csname extras#1\endcsname}{%
101 \csname #2\endcsname}%
102 \typeout{babelbib extension \@backslashchar #2 added to
103 \string\extras #1}%
104 }%
105 }
106 \newcommand\inputbdf[2]{%
107 \bbbbifundefined{date#1}{}{%
108 \@ifundefined{bbbb#2loaded}{%
109 \expandafter\def\csname bbbb#2loaded\endcsname{\@empty}%
110 \typeout{babelbib: #2.bdf loaded because language #2 defined.}%
111 \input{#2.bdf}%
112 }{}%
113 }%
114 }
115 \ifbbbbfixlanguage
116 \newcommand\selectbiblanguage[1]{%
117 \AtBeginDocument{\@selectbiblanguage{#1}}%
118 }
119 \AtBeginDocument{%
120 \renewcommand\selectbiblanguage[1]{\@selectbiblanguage{#1}}%
121 }
122 \newcommand\@selectbiblanguage[1]{%
123 \bbbbifundefined{bibs#1}{%
124 \bbbbifundefined{date#1}{%
125 \PackageError{babelbib}{Language #1 in bibliography not loaded
126 by babel}{%
127 The language #1 hasn't been loaded by babel.
128 Add it to the\MessageBreak
129 options of the \string\usepackage{babel} command or to the
130 global options.}%
131 }{%
132 \PackageError{babelbib}{Language #1 in bibliography unknown by
133 babelbib}{%
134 There are no definitions for #1 available in the
135 current\MessageBreak
136 version of babelbib. Please contact [email protected].}%
137 }%
138 }{%
139 \typeout{babelbib: Set language for keywords in the bibliography fixed to #1}%
140 \csname bibs#1\endcsname
141 }%
142 }
143 \else
144 \newcommand\selectbiblanguage[1]{%
145 \PackageWarning{babelbib}{Command \string\selectbiblanguage\space
146 used without package\MessageBreak
147 option fixlanguage. Ignored}%
148 }
149 \AtBeginDocument{%
150 \typeout{babelbib: Use citation-dependent languages in bibliography}%
151 }
152 \fi
153 \newcommand\btxselectlanguage[1]{%
154 \bbbbifundefined{bibs#1}{%
155 \bbbbifundefined{date#1}{%
156 \PackageError{babelbib}{Language #1 in bibliography not loaded
157 by babel}{%
158 The language #1 hasn't been loaded by babel.
159 Add it to the\MessageBreak
160 options of the \string\usepackage{babel} command or to the
161 global options.}%
162 }{%
163 \ifbbbbfixlanguage
164 \PackageWarning{babelbib}{Language #1 in bibliography
165 unknown\MessageBreak
166 by babelbib. Hyphenation will be\MessageBreak
167 incorrect}%
168 \else
169 \PackageError{babelbib}{Language #1 in bibliography unknown by
170 babelbib}{%
171 There are no definitions for #1 available in the
172 current\MessageBreak
173 version of babelbib. Please contact [email protected].}%
174 \fi
175 }%
176 }{%
177 \csname extras#1\endcsname
178 \selectlanguage{#1}%
179 }%
180 }
181 \newcommand\biblanguage[1]{{%
182 \expandafter\selectlanguage\expandafter{\biblanguagename}#1}}
183 \newcommand\btxlanguagename[1]{%
184 \bbbbifundefined{btxlanguagename#1}{%
185 \PackageError{babelbib}{Languagename for #1 not
186 defined\MessageBreak
187 in \languagename\space language}{%
188 Either you have forgotten to specify the option `languagenames'
189 when loading\MessageBreak
190 babelbib, or the command \string\bibs\languagename\space does
191 not contain a definition\MessageBreak
192 for the command \string\btxlanguagename#1.
193 In the latter case, please\MessageBreak
194 contact [email protected].}%
195 #1%
196 }{%
197 \@nameuse{btxlanguagename#1}%
198 }%
199 }
200 \newcommand*\setbtxfallbacklanguage[1]{%
201 \edef\btxfallbacklanguage{#1}%
202 \typeout{babelbib: Set bibliography fall-back language to
203 \btxfallbacklanguage}%
204 }
205 \AtBeginDocument{%
206 \@ifundefined{btxfallbacklanguage}{%
207 \edef\btxfallbacklanguage{\languagename}%
208 \typeout{babelbib: Set bibliography fall-back language to
209 \btxfallbacklanguage}%
210 }{%
211 \typeout{babelbib: Bibliography fall-back language unchanged
212 (\btxfallbacklanguage)}%
213 }%
214 }
215 \newcommand*\declarebtxcommands[2]{%
216 \AtBeginDocument{%
217 \typeout{babelbib: Add a command to \string\bibs#1}%
218 \expandafter\g@addto@macro\csname bibs#1\endcsname{#2}%
219 \ifbbbbfixlanguage
220 \selectbiblanguage{\biblanguagename}%
221 \fi
222 }%
223 }
224 \@onlypreamble\declarebtxcommands
225 \newcommand*\btxifchangecaseon{%
226 \def\btxifchangecase{\@firstoftwo}%
227 }%
228 \newcommand*\btxifchangecaseoff{%
229 \def\btxifchangecase{\@secondoftwo}%
230 }%
231 \newcommand\setbibliographyfont{%
232 \@ifnextchar*{\@@setbibliographyfont}{\@setbibliographyfont}%
233 }
234 \newcommand\@setbibliographyfont[2]{%
235 \bbbbifundefined{btx#1font}{%
236 \PackageError{babelbib}{Bibliography font `#1' can't be set}{%
237 You have tried to define a font for the bibliographic element
238 \MessageBreak
239 `#1', which is unknown to babelbib}%
240 }{%
241 \expandafter\renewcommand\csname btx#1font\endcsname{#2}%
242 \typeout{babelbib: Bibliography font for `#1' changed.}%
243 }%
244 }
245 \newcommand\@@setbibliographyfont[3]{%
246 \bbbbifundefined{btx#2font}{%
247 \expandafter\newcommand\csname btx#2font\endcsname{#3}%
248 \typeout{babelbib: Bibliography font for `#2' newly defined.}%
249 }{%
250 \expandafter\renewcommand\csname btx#2font\endcsname{#3}%
251 \typeout{babelbib: Bibliography font for `#2' changed.}%
252 }%
253 }
254 \newcommand\providebibliographyfont{%
255 \@ifnextchar*{\@@providebibliographyfont}{\@providebibliographyfont}%
256 }
257 \newcommand\@providebibliographyfont[2]{%
258 \bbbbifundefined{btx#1font}{%
259 \PackageError{babelbib}{Bibliography font `#1' can't be set}{%
260 You have tried to define a font for the bibliographic element
261 \MessageBreak
262 `#1', which is unknown to babelbib}%
263 }{%
264 \expandafter\ifx\csname btx#1font\endcsname\@empty
265 \expandafter\renewcommand\csname btx#1font\endcsname{#2}%
266 \typeout{babelbib: Using the BibTeX style's default font for `#1'.}%
267 \else
268 \typeout{babelbib: Using user changed font for `#1'.}%
269 \fi
270 }%
271 }
272 \newcommand\@@providebibliographyfont[3]{%
273 \bbbbifundefined{btx#2font}{%
274 \expandafter\newcommand\csname btx#2font\endcsname{#3}%
275 \typeout{babelbib: Using the BibTeX style's default font for `#2'.}%
276 }{%
277 \expandafter\ifx\csname btx#2font\endcsname\@empty
278 \expandafter\renewcommand\csname btx#2font\endcsname{#3}%
279 \typeout{babelbib: Using the BibTeX style's default font for `#2'.}%
280 \else
281 \typeout{babelbib: Using user changed font for `#2'.}%
282 \fi
283 }%
284 }
285 \newcommand*\btxnamefont{}
286 \let\btxnamefont=\@empty
287 \newcommand*\btxlastnamefont{}
288 \let\btxlastnamefont=\@empty
289 \newcommand\btxtitlefont{}
290 \let\btxtitlefont=\@empty
291 \newcommand\btxjtitlefont{}
292 \let\btxjtitlefont=\@empty
293 \newcommand\btxetalfont{}
294 \let\btxetalfont=\@empty
295 \newcommand\btxjournalfont{}
296 \let\btxjournalfont=\@empty
297 \newcommand\btxpublisherfont{}
298 \let\btxpublisherfont=\@empty
299 \newcommand\btxvolumefont{}
300 \let\btxvolumefont=\@empty
301 \newcommand\btxISBNfont{}
302 \let\btxISBNfont=\@empty
303 \newcommand\btxISSNfont{}
304 \let\btxISSNfont=\@empty
305 \newcommand\btxurlfont{}
306 \let\btxurlfont=\@empty
307 \newcommand\btxurldatefont{}
308 \let\btxurldatefont=\@empty
309 \newcommand\btxnumeralfont{}
310 \let\btxnumeralfont=\@empty
311 \newcommand\btxauthorcolon{:}
312 \newcommand\btxISBN{ISBN}
313 \newcommand\btxISSN{ISSN}
314 \DeclareRobustCommand\ifbtxprintISBN[1]{\ifbtx@printISBN #1\fi}
315 \DeclareRobustCommand\ifbtxprintISSN[1]{\ifbtx@printISSN #1\fi}
316 \newcommand*\btxprintISBN[1]{\csname btx@printISBN#1\endcsname}
317 \newcommand*\btxprintISSN[1]{\csname btx@printISSN#1\endcsname}
318 \ifbbbbannotations
319 \DeclareRobustCommand\btxannotation[1]{%
320 \begin{quotation}%
321 \noindent
322 #1%
323 \end{quotation}%
324 }
325 \else
326 \DeclareRobustCommand\btxannotation[1]{}%
327 \fi
328 \providecommand\ifnumber[3]{%
329 \begingroup\@tempswafalse\let\scr@next\test@number
330 \expandafter\scr@next#1\scr@next
331 \if@tempswa\endgroup#2\else\endgroup#3\fi
332 }
333 \providecommand*\test@number[1]{%
334 \ifx \scr@next#1%
335 \let\scr@next\relax
336 \else
337 \@tempcnta=\expandafter\expandafter\expandafter\number
338 \expandafter`#1\relax
339 \ifnum \@tempcnta>47\relax
340 \ifnum \@tempcnta<58\relax
341 \@tempswatrue
342 \else\@tempswafalse\fi
343 \else\@tempswafalse\fi
344 \if@tempswa\else\let\scr@next\gobble@till@next\fi\fi
345 \scr@next
346 }
347 \def\gobble@till@next#1\scr@next{}
348 \def\btx@parsenum#1#2#3\@empty{%
349 #1%
350 \edef\btx@digitb{#3}%
351 \ifx\@empty\btx@digitb
352 #2%
353 \edef\btx@digita{#1}%
354 \edef\btx@digitb{#2}%
355 \else
356 \expandafter\btx@parsenum#2#3\@empty
357 \fi
358 }
359 \DeclareRobustCommand\btxnumeralfallback[2]{%
360 \foreignlanguage{#1}{%
361 \ifnumber{#2}{%
362 \PackageWarning{babelbib}{Handling of numerical editions not
363 handled\MessageBreak by language #1 for edition `#2'}%
364 }{}%
365 #2%
366 }%
367 }%
368 \DeclareRobustCommand\btxnumeraldot[2]{%
369 \foreignlanguage{#1}{\ifnumber{#2}{#2.}{#2}}%
370 }
371 \DeclareRobustCommand\btxnumeralenglish[2]{%
372 \foreignlanguage{#1}{%
373 \ifnumber{#2}{%
374 \expandafter\btx@parsenum#2\@empty\@empty\@empty
375 \btxnumeralfont{%
376 \ifx\btx@digitb\@empty
377 \ifcase\btx@digita th\or st\or nd\or rd\else th\fi
378 \else
379 \ifnum\btx@digita=1
380 th%
381 \else
382 \ifcase\btx@digitb th\or st\or nd\or rd\else th\fi
383 \fi
384 \fi
385 }%
386 }{#2}%
387 }%
388 }
389 \newcounter{btxromaniannumeral}%
390 \renewcommand\thebtxromaniannumeral{\Roman{btxromaniannumeral}}%
391 \DeclareRobustCommand\btxnumeralromanian[2]{%
392 \foreignlanguage{#1}{%
393 \ifnumber{#2}{%
394 \setcounter{btxromaniannumeral}{#2}%
395 \ifcase#2 0\or \thebtxromaniannumeral\else a \thebtxromaniannumeral-a \fi
396 }{#2}%
397 }%
398 }
399 \DeclareRobustCommand\btxnumeralfrench[2]{%
400 \foreignlanguage{#1}{%
401 \ifnumber{#2}{%
402 \expandafter\btx@parsenum#2\@empty\@empty\@empty
403 \btxnumeralfont{%
404 \ifx\btx@digitb\@empty
405 \ifcase\btx@digita \ieme\or \iere\else \ieme\fi
406 \else
407 \ifnum\btx@digita=1
408 th%
409 \else
410 \ifcase\btx@digitb \ieme\or \iere\else \ieme\fi
411 \fi
412 \fi
413 }%
414 }{#2}%
415 }%
416 }
417 \DeclareRobustCommand\btxnumeralswedish[2]{%
418 \foreignlanguage{#1}{%
419 \ifnumber{#2}{%
420 \expandafter\btx@parsenum#2\@empty\@empty\@empty
421 \btxnumeralfont{%
422 \ifx\btx@digitb\@empty
423 \ifcase\btx@digita :e\or :a\or :a\or :e\else :e\fi
424 \else
425 \ifnum\btx@digita=1
426 :a%
427 \else
428 \ifcase\btx@digitb :e\or :a\or :a\or :e\else :e\fi
429 \fi
430 \fi
431 }%
432 }{#2}%
433 }%
434 }
435 \AtBeginDocument{%
436 \providecommand\url[1]{%
437 \PackageError{babelbib}{No \string\url\space command defined but
438 field URL used\MessageBreak
439 in bibliography}{%
440 Please define a \string\url\space command for printing URLs
441 before \string\begin{document}, e.\,g.\MessageBreak
442 by loading the package `url.sty'.}%
443 \texttt{#1}%
444 }%
445 }
446 \AtBeginDocument{%
447 \RequirePackage{babel}
448 \inputbdf{afrikaans}{afrikaans}
449 \inputbdf{american}{english}
450 \inputbdf{austrian}{german}
451 \inputbdf{bahasa}{bahasa}
452 \inputbdf{brazil}{portuguese}
453 \inputbdf{brazilian}{portuguese}
454 \inputbdf{british}{english}
455 \inputbdf{canadian}{english}
456 \inputbdf{canadien}{french}
457 \inputbdf{catalan}{catalan}
458 \inputbdf{croatian}{croatian}
459 \inputbdf{czech}{czech}
460 \inputbdf{danish}{danish}
461 \inputbdf{dutch}{dutch}
462 \inputbdf{english}{english}
463 \inputbdf{esperanto}{esperanto}
464 \inputbdf{finnish}{finnish}
465 \inputbdf{francais}{french}
466 \inputbdf{french}{french}
467 \inputbdf{frenchb}{french}
468 \inputbdf{galician}{galician}
469 \inputbdf{german}{german}
470 \inputbdf{germanb}{german}
471 \inputbdf{greek}{greek}
472 \inputbdf{italian}{italian}
473 \inputbdf{norsk}{norsk}
474 \inputbdf{mexican}{spanish}
475 \inputbdf{naustrian}{german}
476 \inputbdf{ngerman}{german}
477 \inputbdf{portuges}{portuguese}
478 \inputbdf{portuguese}{portuguese}
479 \inputbdf{romanian}{romanian}
480 \inputbdf{russian}{russian}
481 \inputbdf{russianb}{russian}
482 \inputbdf{serbian}{serbian}
483 \inputbdf{spanish}{spanish}
484 \inputbdf{swedish}{swedish}
485 \inputbdf{turkish}{turkish}
486 \inputbdf{UKenglish}{english}
487 \inputbdf{USenglish}{english}
488 \ifbbbbfixlanguage
489 \typeout{babelbib: Load BibTeX extensions
490 \string\bibs\bbl@main@language\space for \bbl@main@language}%
491 \selectbiblanguage{\bbl@main@language}%
492 \else
493 \expandafter\selectlanguage\expandafter{\bbl@main@language}%
494 \fi
495 }
496
497 \endinput
498 %%
499 %% End of file `babelbib.sty'.