Debian Codegraph @

texmf-dist/source/latex/koma-script/scrkernel-bibliography.dtx

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-bibliography.dtx
4 % Copyright (c) Markus Kohm, 2002-2023
5 %
6 % This file is part of the LaTeX2e KOMA-Script bundle.
7 %
8 % This work may be distributed and/or modified under the conditions of
9 % the LaTeX Project Public License, version 1.3c of the license.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3c or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later and of this work.
14 %
15 % This work has the LPPL maintenance status "author-maintained".
16 %
17 % The Current Maintainer and author of this work is Markus Kohm.
18 %
19 % This work consists of all files listed in MANIFEST.md.
20 % ======================================================================
21 %%% From File: $Id: scrkernel-bibliography.dtx 4032 2023-04-17 09:45:11Z kohm $
22 %<option>%%% (run: option)
23 %<body>%%% (run: body)
24 %<*dtx>
25 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
26 \begingroup
27 \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
28 \filedate$Date: 2023-04-17 11:45:11 +0200 (Mo, 17. Apr 2023) $
29 \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
30 \filerevision$Revision: 4032 $
31 \edef\reserved@a{%
32 \noexpand\endgroup
33 \noexpand\ProvidesFile{scrkernel-bibliography.dtx}%
34 [\filedate\space\filerevision\space
35 KOMA-Script source
36 (bibliography)]%
37 }%
38 \reserved@a
39 \documentclass[USenglish]{koma-script-source-doc}
40 \usepackage{babel}
41 \usepackage{hvlogos}
42 \setcounter{StandardModuleDepth}{2}
43 \begin{document}
44 \DocInput{scrkernel-bibliography.dtx}
45 \end{document}
46 %</dtx>
47 % \fi^^A meta-comment
48 %
49 % \changes{v2.95}{2002/06/30}{new by splitting \file{scrclass.dtx}}
50 % \changes{v3.36}{2022/02/21}{switch over from \cls*{scrdoc} to
51 % \cls*{koma-script-source-doc}}
52 % \changes{v3.36}{2022/02/21}{whole implementation documentation in English}
53 % \changes{v3.40}{2023/04/17}{guide names changed}
54 %
55 % \GetFileInfo{scrkernel-bibliography.dtx}
56 % \title{Bibliography and References with
57 % \href{https://komascript.de}{\KOMAScript} Classes and Packages}
58 % \author{\href{mailto:[email protected]}{Markus Kohm}}
59 % \date{Revision \fileversion{} of \filedate}
60 % \maketitle
61 % \begin{abstract}
62 % \file{scrkernel-bibliography.dtx} provides the usual functionality for the
63 % bibliography or references. In comparison with the standard classes
64 % several additions are available. Nevertheless it is fully compatible with
65 % the known features of the standard classes.
66 % \end{abstract}
67 % \tableofcontents
68 %
69 % \section{User Manual}
70 %
71 % You can find the user documentation of the commands implemented in
72 % \file{scrkernel-bibliography.dtx} in the \KOMAScript{} manual, either the
73 % German \file{scrguide-de.pdf} or the English \file{scrguide-en.pdf}.
74 %
75 %
76 % \MaybeStop{\PrintIndex}
77 %
78 % \section{Implementation of Bibliography or References}
79 %
80 % Bibliography or references are not available with the \KOMAScript{} letter
81 % class.
82 % \begin{macrocode}
83 %<*!letter>
84 % \end{macrocode}
85 %
86 %
87 % \subsection{Bibliography styles}
88 %
89 % \KOMAScript{} provides styles for the bibliography or references. This is
90 % similar to the redefinition of \cs{@openbib@code} and \cs{newblock} with the
91 % standard classes, but much more configurable.
92 %
93 % \begin{command}{\newbibstyle}
94 % \changes{v2.98c}{2008/02/15}{added}
95 % \changes{v3.17}{2015/03/12}{using internal storage of options \opt{bibliography}}
96 % Defining new bibliography style:
97 % \begin{quote}
98 % \cs{newbibstyle}\oarg{parent style}\marg{style name}\marg{style code}
99 % \end{quote}
100 % The command defines an internal command \cs{scr@bibstyle@\meta{style name}},
101 % that can be used to activate a bibliography style. If the \meta{parent
102 % style} is given, the code of the \meta{parent style} is executed before the
103 % \meta{style code}.
104 % \begin{macro}{\@openbib@code}
105 % \changes{v2.3g}{1996/01/14}{added}
106 % \changes{v2.98c}{2008/02/15}{earlier definition}
107 % Typically the \meta{style code} redefines the macro \cs{@openbib@code} and
108 % \cs{newblock}.
109 % The \cs{@openbib@code} is executed at the very beginning of a
110 % bibliography. Originally it has been used to implement the standard option
111 % \opt{openbib}. \KOMAScript{} uses it for compatibility for all bibliography
112 % styles.
113 % \begin{command}{\newblock}
114 % \changes{v2.3g}{1996/01/14}{initialization changed}
115 % \changes{v2.98c}{2008/02/15}{earlier definition}
116 % The command \cs{newblock} is used inside bibliography entries to mark a
117 % \emph{new block}. Usually such new blocks are inserted after the author and
118 % after the title. But the user or \BibTeX{} style is free to use it different.
119 % Both are initialized empty (before the code of a parent
120 % style is executed.
121 % \begin{macro}{\bib@beginhook,\bib@endhook}
122 % \changes{v2.98c}{2008/02/15}{added}
123 % Also \cs{bib@beginhook} and \cs{bib@endhook} are initialized empty. So
124 % activation of a new bibliography style always removes the hook
125 % code. Redefining an already existing style is not supported and results in
126 % an error.
127 % \begin{macrocode}
128 %<*option>
129 \newcommand{\newbibstyle}[3][]{%
130 \scr@ifundefinedorrelax{scr@bibstyle@#2}{%
131 \scr@ifundefinedorrelax{scr@bibstyle@#1}{%
132 \ClassError{\KOMAClassName}{%
133 parent bibliography style `#1' does not exist}{%
134 You've told me to define the new bibliography style `#2'\MessageBreak
135 to be a child of bibliography style `#1', but bibliography
136 style\MessageBreak
137 `#1' does not exist.\MessageBreak
138 You have to remove the parent declaration or use an existing parent!
139 See the KOMA-Script manual for more information.%
140 }%
141 }{%
142 \@namedef{scr@bibstyle@#2}{%
143 \let\@openbib@code\@empty
144 \let\newblock\@empty
145 \let\bib@beginhook\@empty
146 \let\bib@endhook\@empty
147 % \end{macrocode}
148 % \begin{macro}{\scr@current@bibstyle}
149 % \changes{v3.17}{2015/03/12}{added}
150 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
151 % \changes{v3.36}{2022/02/21}{add expanded name to list}
152 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
153 % option storage commands}
154 % To be able to change the current value of option \opt{bibliography} we need
155 % to know the current style and save it in \cs{scr@current@bibstyle}. We also
156 % have to correct the value in the storage by activating a style.
157 % \begin{macrocode}
158 \@ifundefined{scr@current@bibstyle}{}{%
159 \Ifstr{\scr@current@bibstyle}{}{}{%
160 \edef\reserved@a{%
161 \noexpand\KOMA@kav@remove{\KOMAClassFileName}{bibliography}%
162 {\scr@current@bibstyle}%
163 }\reserved@a
164 }%
165 }%
166 \def\scr@current@bibstyle{#2}%
167 % \end{macrocode}
168 % \end{macro}
169 % \begin{macrocode}
170 \KOMA@kav@xadd{\KOMAClassFileName}{bibliography}{#2}%
171 \csname scr@bibstyle@#1\endcsname
172 #3%
173 }%
174 \ifx\scr@bibstylelist\@empty
175 \edef\scr@bibstylelist{`#2'}%
176 \else
177 \edef\scr@bibstylelist{\scr@bibstylelist, `#2'}%
178 \fi
179 }%
180 }{%
181 \ClassError{\KOMAClassName}{bibliography style `#2' already exists}{%
182 You've told me to define the new bibliography style `#2',\MessageBreak
183 but this style already exists.\MessageBreak
184 You have to use another bibliography style name.\MessageBreak
185 See the KOMA-Script manual for more information.%
186 }%
187 }%
188 }
189 % \end{macrocode}
190 % \begin{macro}{\scr@bibstyle@}
191 % \changes{v2.98c}{2008/02/15}{added}
192 % Dummy of the empty parent style.
193 % \begin{macrocode}
194 \newcommand*{\scr@bibstyle@}{}
195 % \end{macrocode}
196 % \end{macro}^^A \scr@bibstyle@
197 % The hook macros are reserved.
198 % \begin{macrocode}
199 \newcommand*{\bib@beginhook}{}
200 \newcommand*{\bib@endhook}{}
201 % \end{macrocode}
202 % \end{macro}^^A \bib@beginhook,\bib@endhook
203 % \begin{macro}{\scr@bibstylelist}
204 % \changes{v2.98c}{2008/02/15}{added}
205 % \changes{v3.36}{2022/02/21}{\cs{@gobble} removed}
206 % \cs{scr@bibstylelist} is a printable comma-separated list of all known
207 % styles. Single quotes are used to quote the single styles. It is designated
208 % to be used in messages.
209 % \begin{macrocode}
210 \newcommand*{\scr@bibstylelist}{}
211 % \end{macrocode}
212 % And also \cs{@openbib@code} and \cs{newblock} are reserved.
213 % \begin{macrocode}
214 \newcommand*{\@openbib@code}{}
215 \newcommand*{\newblock}{}
216 % \end{macrocode}
217 % \end{macro}^^A \scr@bibstylelist
218 % \begin{macro}{\scr@bibstyle@openstyle,\scr@bibstyle@oldstyle}
219 % \changes{v2.98c}{2008/02/15}{added}
220 % The bibliography style \texttt{openstyle} corresponds to standard option
221 % \opt{openbib}. The \cs{newblock} starts a new paragraph.
222 % Style \texttt{oldstyle} is the default style where \cs{newblock} inserts a
223 % small horizontal distance only.
224 % \begin{macrocode}
225 \newbibstyle{openstyle}{%
226 \renewcommand*{\@openbib@code}{%
227 \advance\leftmargin\bibindent
228 \itemindent -\bibindent
229 \listparindent \itemindent
230 \parsep \z@
231 }%
232 \renewcommand*{\newblock}{\par}%
233 }
234 \newbibstyle{oldstyle}{%
235 \renewcommand*{\newblock}{\hskip .11em\@plus.33em\@minus.07em}%
236 }
237 \scr@bibstyle@oldstyle
238 % \end{macrocode}
239 % \end{macro}^^A \scr@bibstyle@openstyle,\scr@bibstyle@oldstyle
240 % \end{command}^^A \newblock
241 % \end{macro}^^A \@openbib@code
242 % \end{command}^^A \newbibstyle
243 %
244 %
245 % \subsection{Bibliography heading}
246 %
247 % \begin{macro}{\bib@heading}
248 % \changes{v2.3h}{1995/01/21}{added}
249 % \changes{v2.6c}{2000/06/10}{printing preamble}
250 % \changes{v2.7b}{2001/01/05}{using \cs{setchapterpreamble}}
251 % \changes{v2.7j}{2001/06/27}{printing preamble moved to \env{thebibliography}}
252 % \changes{v2.98c}{2008/02/15}{defined ealier}
253 % \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
254 % \changes{v3.12}{2012/02/06}{using \cs{ifbib@leveldown}}
255 % \changes{v3.13b}{2014/10/10}{running head with \texttt{leveldown} fixed}
256 % \changes{v3.25}{2017/10/13}{using always \cs{@mkright} and \cs{@mkdouble}}
257 % \changes{v3.25}{2017/10/13}{using \cs{bibliography@heading}}
258 % \begin{macro}{\bibliography@heading}
259 % \changes{v3.25}{2017/10/13}{added}
260 % \changes{v3.26}{2018/09/03}{using \cs{addsecmark} or \cs{subsectionmark}
261 % instead of \cs{@mkright}}
262 % \cs{bib@heading} runs the more generic \cs{bibliography@heading} with text
263 % \cs{refname} resp. \cs{bibname}. This indirect approach has been
264 % implemented, to that \pkg{biblatex} can simply call \cs{bibliography} with
265 % different texts for multiple bibliographies.
266 % \begin{macrocode}
267 \newcommand*{\bib@heading}{%
268 %<article> \bibliography@heading{\refname}%
269 %<book|report> \bibliography@heading{\bibname}%
270 }
271 \newcommand*{\bibliography@heading}[1]{%
272 \ifbib@leveldown
273 %<article> \subsection*{#1}%
274 %<book|report> \section*{#1}%
275 %<book|report> \addsecmark{#1}%
276 %<*article>
277 \begingroup
278 \c@secnumdepth=-\maxdimen
279 \subsectionmark{#1}%
280 \endgroup
281 %</article>
282 \else
283 %<article> \section*{#1}%
284 %<book|report> \chapter*{#1}%
285 \@mkdouble{\MakeMarkcase{#1}}%
286 \fi
287 }%
288 % \end{macrocode}
289 % \end{macro}^^A \bibliography@heading
290 % \end{macro}^^A \bib@heading
291 %
292 %
293 % \subsection{Options}
294 %
295 % \begin{option}{bibliography}
296 % \changes{v2.98c}{2008/02/15}{added}
297 % \changes{v3.10}{2011/08/31}{using \cs{MakeMarkcase}}
298 % \changes{v3.12}{2013/02/06}{new value \opt{leveldown}}
299 % \changes{v3.12}{2013/02/06}{new value \opt{standardlevel}}
300 % \changes{v3.12}{2013/03/05}{adapted to changes of \pkg*{scrbase}}
301 % \changes{v3.12}{2013/09/28}{using \cs{addxcontentsline} instead of
302 % \cs{addcontentsline}}
303 % \changes{v3.12}{2013/09/28}{do not write chapter entries to other directories}
304 % \changes{v3.17}{2015/03/12}{using internal value storage}
305 % \changes{v3.25}{2017/10/13}{using always \cs{@mkright} and \cs{@mkdouble}}
306 % \changes{v3.25}{2017/10/13}{redefining \cs{bibliography@heading} instead of
307 % \cs{bib@heading}}
308 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
309 % option storage commands}
310 % \KOMAScript provides several configurations for the bibliography or
311 % references using a single option.
312 % \begin{macro}{\bib@leveldownfalse,\bib@leveldowntrue,\ifbib@leveldown}
313 % \changes{v3.12}{2013/02/06}{added}
314 % The boolean \cs{ifbib@leveldown} is used to allow the
315 % bibliography/references have a lower heading level.
316 % \begin{macrocode}
317 \newif\ifbib@leveldown
318 % \end{macrocode}
319 % \end{macro}
320 % The supported values for option \opt{bibliography} are:
321 % \begin{macrocode}
322 \KOMA@key{bibliography}{%
323 \scr@ifundefinedorrelax{scr@bibstyle@#1}{%
324 \KOMA@set@ncmdkey{bibliography}{@tempa}{%
325 % \end{macrocode}
326 % \begin{description}
327 % \item[\opt{=notoc}:] (default) don't add the bibliography/references to the
328 % table of contents.
329 % \end{description}
330 % \begin{macrocode}
331 {notoc}{0},{nottotoc}{0},{plainheading}{0},%
332 % \end{macrocode}
333 % \begin{description}
334 % \item[\opt{=totoc}:] add the bibliography/references to the table of
335 % contents, but do not number it.
336 % \end{description}
337 % \begin{macrocode}
338 {totoc}{1},{toc}{1},{notnumbered}{1},%
339 % \end{macrocode}
340 % \begin{description}
341 % \item[\opt{=numbered}:] number the bibliography/references and so also add
342 % it to the table of contents.
343 % \end{description}
344 % \begin{macrocode}
345 {numbered}{2},{totocnumbered}{2},{tocnumbered}{2},{numberedtotoc}{2},%
346 {numberedtoc}{2},%
347 % \end{macrocode}
348 % \begin{description}
349 % \item[\opt{=leveldown}:] don't use the top heading level (chapters with
350 % \cls*{scrbook} or \cls*{scrreprt}, sections with \cs*{scrartcl}) but one
351 % level lower (sections with \cls*{scrbook} or \cls*{scrreprt}, subsection
352 % with \cs*{scrartcl}) for the bibliography/references.
353 % \end{description}
354 % \begin{macrocode}
355 {leveldown}{3},%
356 % \end{macrocode}
357 % \begin{description}
358 % \item[\opt{=standardlevel}:] use the top heading level (chapters with
359 % \cls*{scrbook} or \cls*{scrreprt}, sections with \cs*{scrartcl}) for the
360 % bibliography/references.
361 % \end{description}
362 % \begin{macrocode}
363 {standardlevel}{4}%
364 }{#1}%
365 \ifcase \@tempa\relax % notoc
366 \KOMA@kav@remove{\KOMAClassFileName}{toc}{nobibliography}%
367 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliography}%
368 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliographynumbered}%
369 \KOMA@kav@add{\KOMAClassFileName}{toc}{nobibliography}%
370 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{notoc}%
371 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{totoc}%
372 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{numbered}%
373 \KOMA@kav@add{\KOMAClassFileName}{bibliography}{notoc}%
374 \renewcommand*{\bibliography@heading}[1]{%
375 \ifbib@leveldown
376 %<article> \subsection*{##1}%
377 %<book|report> \section*{##1}%
378 \@mkright{\MakeMarkcase{##1}}%
379 \else
380 %<article> \section*{##1}%
381 %<book|report> \chapter*{##1}%
382 \@mkdouble{\MakeMarkcase{##1}}%
383 \fi
384 }%
385 \or% totoc
386 \KOMA@kav@remove{\KOMAClassFileName}{toc}{nobibliography}%
387 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliography}%
388 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliographynumbered}%
389 \KOMA@kav@add{\KOMAClassFileName}{toc}{bibliography}%
390 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{notoc}%
391 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{totoc}%
392 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{numbered}%
393 \KOMA@kav@add{\KOMAClassFileName}{bibliography}{totoc}%
394 \renewcommand*{\bibliography@heading}[1]{%
395 %<*article>
396 \ifbib@leveldown
397 % \end{macrocode}
398 % \changes{v3.23}{2017/02/23}{using \cs{ext@toc}}
399 % \changes{v3.25}{2017/10/13}{using \cs{addsubsectiontocentry} instead of
400 % \cs{addxcontentsline}}
401 % From version 3.23 \cs{ext@toc} of \pkg*{tocbasic} is used instead of hard
402 % coded |toc|.
403 % \begin{macrocode}
404 \subsection*{%
405 \addsubsectiontocentry{}{##1}%
406 ##1%
407 }%
408 \@mkright{\MakeMarkcase{##1}}%
409 \else
410 \addsec{##1}%
411 \@mkdouble{\MakeMarkcase{##1}}%
412 \fi
413 %</article>
414 %<*book|report>
415 \ifbib@leveldown
416 \addsec{##1}%
417 \else
418 \if@chaptertolists
419 \@chaptertolistsfalse\addchap{##1}\@chaptertoliststrue
420 \else
421 \addchap{##1}%
422 \fi
423 \@mkdouble{\MakeMarkcase{##1}}%
424 \fi
425 %</book|report>
426 }%
427 \or% numbered
428 \KOMA@kav@remove{\KOMAClassFileName}{toc}{nobibliography}%
429 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliography}%
430 \KOMA@kav@remove{\KOMAClassFileName}{toc}{bibliographynumbered}%
431 \KOMA@kav@add{\KOMAClassFileName}{toc}{bibliographynumbered}%
432 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{notoc}%
433 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{totoc}%
434 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{numbered}%
435 \KOMA@kav@add{\KOMAClassFileName}{bibliography}{numbered}%
436 \renewcommand*{\bibliography@heading}[1]{%
437 %<*article>
438 \ifbib@leveldown
439 \subsection{##1}%
440 \else
441 \section{##1}%
442 \@mkdouble{\MakeMarkcase{\sectionmarkformat ##1}}%
443 \fi
444 %</article>
445 %<*book|report>
446 \ifbib@leveldown
447 \section{##1}%
448 \else
449 \if@chaptertolists
450 \@chaptertolistsfalse\chapter{##1}\@chaptertoliststrue
451 \else
452 \chapter{##1}
453 \fi
454 \@mkdouble{\MakeMarkcase{\chaptermarkformat ##1}}%
455 \fi
456 %</book|report>
457 }
458 \or% leveldown
459 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{leveldown}%
460 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{standardlevel}%
461 \KOMA@kav@add{\KOMAClassFileName}{bibliography}{leveldown}%
462 \bib@leveldowntrue
463 \or% standardlevel
464 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{leveldown}%
465 \KOMA@kav@remove{\KOMAClassFileName}{bibliography}{standardlevel}%
466 \KOMA@kav@add{\KOMAClassFileName}{bibliography}{standardlevel}%
467 \bib@leveldownfalse
468 \fi
469 }{%
470 % \end{macrocode}
471 % \begin{description}
472 % \item[\opt{=\meta{style}}:] all other values are names of styles.
473 % \begin{description}
474 % \item[ToDo:] Here we should test for valid style names and report an
475 % unknown value for unknown styles.
476 % \end{description}
477 % \end{description}
478 % \begin{macrocode}
479 \FamilyKeyStateProcessed
480 \edef\reserved@a{%
481 \noexpand\KOMA@kav@remove{\KOMAClassFileName}{bibliography}%
482 {\scr@current@bibstyle}%
483 }\reserved@a
484 \csname scr@bibstyle@#1\endcsname
485 }%
486 }
487 % \end{macrocode}
488 % \end{option}
489 %
490 % \begin{option}{openbib}
491 % \begin{macro}{\@openbibfalse,\@openbibtrue,\if@openbib}
492 % \changes{v2.3g}{1996/01/14}{removed}
493 % \end{macro}
494 % \changes{v2.3g}{1996/01/14}{re-implemented}
495 % \changes{v2.98c}{2008/02/15}{obsolete}
496 % \changes{v3.01a}{2008/11/21}{standard instead of obsolete}
497 % The standard option \opt{openbib} is mapped to \opt{bibliography=openstyle}.
498 % \begin{macrocode}
499 \KOMA@DeclareStandardOption{openbib}{bibliography=openstyle}
500 % \end{macrocode}
501 % \end{option}
502 %
503 % \begin{option}{bibtotoc}
504 % \changes{v2.3h}{1995/01/21}{added}
505 % \changes{v2.6b}{2000/05/26}{\cs{@mkboth} added}
506 % \changes{v2.6c}{2000/06/10}{\cs{bibpreamble} added}
507 % \changes{v2.7}{2001/01/03}{braces fixed}
508 % \changes{v2.7j}{2001/06/27}{preamble printing moved to \env{thebibliography}}
509 % \changes{v2.98c}{2008/02/15}{obsolete}
510 % \changes{v3.01a}{2008/11/20}{deprecated}
511 % \changes{v3.39}{2022/11/16}{not with \KOMAScript~4}
512 % \begin{option}{bibtotocnumbered}
513 % \changes{v2.3h}{1995/01/21}{added}
514 % \changes{v2.6b}{2000/05/26}{\cs{@mkboth} added}
515 % \changes{v2.6c}{2000/06/10}{\cs{bibpreamble} added}
516 % \changes{v2.7}{2001/01/03}{braces fixed}
517 % \changes{v2.7b}{2001/01/05}{using \cs{setchapterpreamble}}
518 % \changes{v2.7i}{2001/05/17}{\cs{chapter} instead of \cs{addchap}}
519 % \changes{v2.7j}{2001/06/27}{preamble printing moved to \env{thebibliography}}
520 % \changes{v2.9p}{2003/07/07}{number in running head}
521 % \changes{v2.98c}{2008/02/15}{obsolete}
522 % \changes{v3.01a}{2008/11/20}{deprecated}
523 % \changes{v3.39}{2022/11/16}{not with \KOMAScript~4}
524 % Deprecated options \opt{bibtotoc} and \opt{bibtotocnumbered} are mapped to
525 % \opt{bibliography=totoc} resp. \opt{bibliography=totocnumbered}.
526 % \begin{macrocode}
527 %<*!v4>
528 \KOMA@DeclareDeprecatedOption{bibtotoc}{bibliography=totoc}
529 \KOMA@DeclareDeprecatedOption{bibtotocnumbered}{bibliography=totocnumbered}
530 %</!v4>
531 %</option>
532 % \end{macrocode}
533 % \end{option}^^A bibtotocnumbered
534 % \end{option}^^A bibtotoc
535 %
536 %
537 % \subsection{Names}
538 %
539 % \begin{command}{\refname,\bibname}
540 % \changes{v3.36}{2022/02/15}{explicit definition for English languages}
541 % Depending on the class either \cs{refname} or \cs{bibname} is used.
542 % \begin{macrocode}
543 %<*body>
544 %<*article>
545 \newcommand*\refname{References}
546 \providecaptionname{american,australian,british,canadian,english,newzealand,%
547 UKenglish,ukenglish,USenglish,usenglish}\refname{References}
548 %</article>
549 %<*book|report>
550 \newcommand*\bibname{Bibliography}
551 \providecaptionname{american,australian,british,canadian,english,newzealand,%
552 UKenglish,ukenglish,USenglish,usenglish}\bibname{Bibliography}
553 %</book|report>
554 % \end{macrocode}
555 % \end{command}
556 %
557 %
558 % \subsection{Printing the bibliography or references}
559 %
560 % \begin{command}{\setbibpreamble}
561 % \changes{v2.6c}{2000/06/10}{added}
562 % \changes{v2.7j}{2001/05/27}{\cs{renewcommand} replaced by \cs{def} for
563 % better \pkg{natbib} compatibility}
564 % \begin{macro}{\bibpreamble}
565 % \changes{v2.6c}{2000/06/10}{neue (intern)}
566 % \changes{v2.6d}{2000/07/20}{\cs{let} replaced by \cs{newcommand*}}
567 % \changes{v2.8q}{2002/01/10}{\cs{newcommand*} replaced by \cs{let}}
568 % \changes{v2.7j}{2001/05/27}{preamble printing moved to \env{thebibliography}}
569 % \cs{bibpreamble} should be interpreted as an internal macro. The user
570 % command name space has been used for compatibility with \pkg{natbib}
571 % only. The official \KOMAScript{} user interface is using
572 % \begin{quote}
573 % \cs{setbibpreamble}\marg{preamble}
574 % \end{quote}
575 % Also for compatibility \cs{bibpreamble} is not set by \cs{bib@heading} but
576 % inside environment \env{theenvironment}.
577 % \begin{macrocode}
578 \newcommand*{\bibpreamble}{\relax}
579 \let\bibpreamble\relax
580 \newcommand{\setbibpreamble}[1]{\def\bibpreamble{#1}}
581 % \end{macrocode}
582 % \end{macro}^^A \bibpreamble
583 % \end{command}^^A \setbibpreamble
584 %
585 % \begin{length}{bibindent}
586 % The indent of entries with option \opt{bibliography=openstyle}. Default is 1.5\,em.
587 % \begin{macrocode}
588 \newdimen\bibindent
589 \bibindent=1.5em
590 % \end{macrocode}
591 % \end{length}
592 %
593 % \begin{environment}{thebibliography}
594 % \changes{v2.2a}{1995/02/01}{for \cls*{scrartcl} \cs{bibname} replaced by
595 % \cs{refname}}
596 % \changes{v2.3h}{1995/01/21}{using \cs{bib@heading}}
597 % \changes{v2.8q}{2002/01/10}{handling empty preamble}
598 % \changes{v2.9o}{2003/03/06}{fix of comparing \cs{bibpreamble} with \cs{@empty}}
599 % \changes{v2.98c}{2008/02/15}{new hooks \cs{bib@before@hook} and
600 % \cs{bib@after@hook}}
601 % This environment is used to print the bibliography or references. Note: This
602 % environment is redefined by almost all bibliography packages like
603 % \pkg{natbib} or \pkg{biblatex}. No one of these supports all features of
604 % \KOMAScript{}. So if such a package is used, users should consult the
605 % package manual instead of using a \KOMAScript{} feature.
606 % \begin{macrocode}
607 \newenvironment{thebibliography}[1]{%
608 \if@bib@break@
609 \bib@beginhook
610 \else
611 %<*book|report>
612 \ifx\bibpreamble\relax\else\ifx\bibpreamble\@empty\else
613 \setchapterpreamble{\bibpreamble}%
614 \fi\fi
615 %</book|report>
616 \bib@heading
617 %<*article>
618 \ifx\bibpreamble\relax\else\ifx\bibpreamble\@empty\else
619 \noindent\bibpreamble\par\nobreak
620 \fi\fi
621 %</article>
622 \bib@beginhook
623 \bib@before@hook
624 \fi
625 % \end{macrocode}
626 % \begin{command}{\BreakBibliography}
627 % \changes{v2.98c}{2008/02/15}{added}
628 % Redefining \cs{BreakBibliography} to work with our definition of
629 % \env{thebibliography}.
630 % \begin{macrocode}
631 \renewcommand{\BreakBibliography}[1]{%
632 \@bib@break
633 \end{thebibliography}%
634 \begingroup ##1\endgroup
635 \begin{thebibliography}{#1}
636 }%
637 % \end{macrocode}
638 % \end{command}
639 % \begin{macrocode}
640 % Start the list for the entries.
641 \list{%
642 \@biblabel{\@arabic\c@enumiv}%
643 }{%
644 \settowidth\labelwidth{\@biblabel{#1}}%
645 \leftmargin\labelwidth
646 \advance\leftmargin\labelsep
647 \@openbib@code
648 \if@bib@break@
649 \edef\@tempa{%
650 \noexpand\usecounter{enumiv}%
651 \noexpand\setcounter{enumiv}{\the\c@enumiv}%
652 }\@tempa
653 \no@bib@break
654 \else
655 \usecounter{enumiv}%
656 \fi
657 \let\p@enumiv\@empty
658 \renewcommand*\theenumiv{\@arabic\c@enumiv}%
659 }%
660 \sloppy\clubpenalty4000 \widowpenalty4000
661 \sfcode`\.=\@m
662 }{%
663 \if@bib@break@
664 \def\@noitemerr{%
665 \@latex@warning{%
666 \string\BreakBibliography\space at begin of `thebibliography'
667 environment\MessageBreak
668 or following \string\BreakBibliography}%
669 }%
670 \else
671 \def\@noitemerr{%
672 \@latex@warning{%
673 Empty `thebibliography' environment or
674 \string\BreakBibliography\MessageBreak
675 before end of `thebibliography' environment}%
676 }%
677 \fi
678 \endlist
679 \if@bib@break@
680 \else
681 \bib@after@hook
682 \let\bib@before@hook\@empty
683 \let\bib@after@hook\@empty
684 \fi
685 \bib@endhook
686 }
687 % \end{macrocode}
688 % \begin{macro}{\if@bib@break@,\no@bib@break,\@bib@break}
689 % \changes{v2.98c}{2008/02/15}{added}
690 % To be used as global switch.
691 % \begin{description}
692 % \item[ToDo:] Maybe redefine \cs{@bib@break@true} and \cs{@bib@break@false}.
693 % \end{description}
694 % \begin{macrocode}
695 \newif\if@bib@break@
696 \newcommand{\no@bib@break}{\global\let\if@bib@break@\iffalse}
697 \newcommand*{\@bib@break}{\global\let\if@bib@break@\iftrue}
698 % \end{macrocode}
699 % \end{macro}^^A \if@bib@break@,\no@bib@break,\@bib@break
700 % \begin{macro}{\bib@before@hook,\bib@after@hook}
701 % \changes{v2.98c}{2008/02/15}{added}
702 % \begin{macrocode}
703 \newcommand*{\bib@before@hook}{}
704 \newcommand*{\bib@after@hook}{}
705 % \end{macrocode}
706 % \end{macro}^^A \bib@before@hook,\bib@after@hook
707 % \end{environment}^^A thebibliography
708 %
709 % \begin{command}{\BreakBibliography}
710 % \changes{v2.98c}{2008/02/15}{added}
711 % The initial definition is a do nothing but warn, because the command makes
712 % sense only inside \env{thebibliography}.
713 % \begin{macrocode}
714 \newcommand{\BreakBibliography}[1]{%
715 \ClassWarning{\KOMAClassName}{%
716 You've used \string\BreakBibliography\space either outside of\MessageBreak
717 the bibliography or `thebibliography' was redefined\MessageBreak
718 incompatible, e.g., using a bibliography package.\MessageBreak
719 \string\BreakBibliography\space ignored%
720 }%
721 }
722 % \end{macrocode}
723 % \end{command}^^A \BreakBibliography
724 %
725 % \begin{command}{\AfterBibliographyPreamble,\AtEndBibliography}
726 % \changes{v2.98c}{2008/02/15}{added}
727 % Add code to the two new hooks inside our definition of
728 % \env{thebibliography}. So any bibliography package can break this
729 % functionality.
730 % Note: The hooks are always emptied by selecting a style using
731 % \opt{bibliography=\meta{style name}}.
732 % \begin{macrocode}
733 \newcommand{\AfterBibliographyPreamble}{\g@addto@macro\bib@before@hook}
734 \newcommand{\AtEndBibliography}{\g@addto@macro\bib@after@hook}
735 %</body>
736 % \end{macrocode}
737 % \end{command}
738 %
739 %
740 % \begin{macrocode}
741 %</!letter>
742 % \end{macrocode}
743 %
744 % \Finale
745 % \PrintChanges
746 %
747 \endinput
748 % Local Variables:
749 % mode: doctex
750 % ispell-local-dictionary: "en_US"
751 % eval: (flyspell-mode 1)
752 % TeX-master: t
753 % TeX-engine: luatex-dev
754 % eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
755 % End: