summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/natbib/bibentry.dtx
blob: cbf396d4b680ca5d46f13de73c25e5b42483c6c9 (plain)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                       {BIBENTRY.DTX}
%========================================================================
%</dtx>
%% Copyright 1997-2007 Patrick W Daly
%% Max-Planck-Institut f\"ur Sonnensystemforschung
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: daly@mps.mpg.de
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% This is a contributed file to the LaTeX2e system.
% -------------------------------------------------
%         This is a LaTeX package to all bibliography entries to be placed
%           anywhere in text.
% Installation:
%    LaTeX this file: creates docstrip installation file bibentry.ins
%                         AND the LaTeX documentation
%    (La)TeX bibentry.ins: creates package file bibentry.sty, and optionally
%                         the documentation driver bibentry.drv
%    (bibentry.ins and bibentry.drv may be edited as needed)
% Docstrip options available:
%        package - to produce a (LaTeX2e) package .sty file
%        driver  - to produce a driver file to print the documentation
%--------------------------------------------------------------------------
%  *** Identify the package file:-
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{bibentry}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{bibentry.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{bibentry}
          [2007/10/30 1.5 (PWD)]
% \changes{1.0}{1997 Jun 13}{Initial version}
% \changes{1.1}{1997 Nov 11}{Refine for use with \cs{bibliography}}
% \changes{1.1a}{1998 Mar 2}{Fix bug by using \cs{ifx} instead of \cs{if}}
% \changes{1.2}{1999 Feb 23}{Update copyright notice}
% \changes{1.3}{1999 Aug 26}{Works with \texttt{url} package}
% \changes{1.4}{2000 Jun 20}{Add \texttt{hyperref} compatibility}
% \changes{1.5}{2007 Oct 30}{Add \cs{doi} definition}
%
% \CheckSum{135}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run if it
%^^A    does not already exist
%^^A =============================================
\begin{filecontents*}{bibentry.ins}
% File: bibentry.ins
% Copyright 1999,2000 Patrick W. Daly
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% It is an installation file for extracting package and driver
% files from the original source file. Simply process it under
% TeX or LaTeX. It works with Docstrip versions before and after
% December 1995.

\def\batchfile{bibentry.ins}
\input docstrip

\preamble
=============================================
IMPORTANT NOTICE:

This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.

This is a generated file.
It may not be distributed without the original source file \inFileName.

Full documentation can be obtained by LaTeXing that original file.
Only a few abbreviated comments remain here to describe the usage.
=============================================
\endpreamble
\postamble

<<<<< End of generated file <<<<<<
\endpostamble
\keepsilent

% Docstrip before Dec 95 does not have \generate syntax, nor
%   \declarepreamble. Must redefine them. The \generateFile called
%   for each output file individually.
% Docstrip before Dec 96 cannot interprete multiline \if..\fi
%   Thus for maximum compatibility, have only one-line conditionals

\let\oldDS F\relax
\expandafter\ifx\csname generate\endcsname\relax \let\oldDS T\relax\fi
\if\oldDS T  \def\declarepreamble#1{\preamble}\fi
\if\oldDS T  \def\declarepostamble#1{\postamble}\fi
\if\oldDS T  \generateFile{bibentry.sty}{f}{\from{bibentry.dtx}{package}} \fi

\declarepreamble\driver
============================================
This is the driver file to produce the LaTeX documentation
from the original source file \inFileName.

Make changes to it as needed. (Never change the file \inFileName!)
============================================
\endpreamble

\declarepostamble\driverq

End of documentation driver file.
\endpostamble

\ifx\oldDS T \generateFile{bibentry.drv}{f}{\from{bibentry.dtx}{driver}}\fi

\ifx\oldDS T \let\askforoverwritefalse\relax\def\generate#1{}\fi

\askforoverwritefalse
\generate{\file{bibentry.sty}{\from{bibentry.dtx}{package}}
          \file{bibentry.drv}{\usepreamble\driver\usepostamble\driverq
                           \from{bibentry.dtx}{driver}}
         }

\obeyspaces
\Msg{*******************************************}%
\Msg{* For documentation, process bibentry.dtx *}%
\Msg{*    or the driver file      bibentry.drv *}%
\Msg{*******************************************}
\end{filecontents*}
%</install>
%<*driver>
\documentclass{ltxdoc}
%<driver>%\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[a4paper]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom

 %** To include the detailed explanation of the coding, comment out
 %**   the next line
\OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist bibentry
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o bibentry.gls bibentry.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{bibentry.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter}
% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography}
% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment}
% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi}
% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup}
% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine}
% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \GetFileInfo{bibentry}
%
% \title{\bfseries A \LaTeX\ Package to Place Bibliography Entries in Text}
%
% \author{Patrick W. Daly}
%
% \date{This paper describes package \texttt{\filename}\\
%       version \fileversion{} from \filedate
%  }
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{Bibliography Entries in Text}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother
%
%\begin{small}\begin{center}\textbf{Summary}\end{center}
% The stripped version of this file contains the following brief description:
%\iffalse
%<*package>
%\fi
% \begin{verbatim}
 % Bibliography Entries in Text
 %
 % In place of \bibliography{database}, enter \nobibliography{database}
 % No bibliography is written at this point, but afterwards,
 % \bibentry{key}  prints the bibliography entry for citation <key>
 % (whereas \cite{key} prints the citation, not the bib entry)
 %
 % If \bibliography is also to be given, then issue the starred variant
 % \nobibliography* (without argument).
% \end{verbatim}
%\iffalse
 %-----------------------------------------------------------
 % See documentation in the source .dtx file for more details.
%</package>
%\fi
%\end{small}
%
% \section{Introduction}
% This package allows one to be able to place bibliographic entries anywhere
% in the text. It is to be used to produce annotated bibliographies, such as
% \begin{quote}
%   For an intoduction to this topic, see Jones, J.~R., Basics on this topic,
%   {\it J.\ Last Resorts}, \textbf{13}, 234--254, 1994. For more advanced
%   information, see \dots.
% \end{quote}
%
% The idea is that the full reference is used, not just the citation Jones
% [1994].
%
% \section{Invoking the Package}
% The macros in this package are included in the main document
% with the |\usepackage| command of \LaTeXe,
% \begin{quote}
% |\documentclass[..]{...}|\\
% |\usepackage{|\texttt{\filename}|}|
% \end{quote}
%
% \section{Usage}
%
% \newcommand\btx{\textsc{Bib}\TeX}
% This package must be used with \btx, not with a hand-written
% \texttt{thebibliography} environment.
%
% More precisely, there must be a \texttt{.bbl} file external to the \LaTeX\
% file; whether this is written by hand or by \btx\ is unimportant.
%
% \DescribeMacro{\nobibliography}
% The bibliography entries are stored with the command
% |\nobibliography|\marg{bibfiles}, which is like the usual
% |\bibliography|\marg{bibfiles} except no bibliography is printed. The
% \texttt{.bbl} file is read in as usual but the \texttt{thebibliography} is
% redefined so that all the entries are stored, not printed.
%
% \DescribeMacro{\bibentry}
% The text of the entries may be printed with the command
% \begin{quote}
%    |\bibentry|\marg{key}
% \end{quote}
% These commands may only be issued after |\nobibliography|, for otherwise
% the reference texts are not known.
%
% The final period of the original text will be missing, so that one can add
% punctuation as one pleases.
%
% Regular |\cite| (or the \texttt{natbib} versions) may be issued anywhere as
% usual.
%
% \DescribeMacro{\nobibliography*}
% If a regular list of references is to be given too, with the
% |\bibliography|\marg{bibfiles} command, issue the starred version
% |\nobibliography*| (without argument) in order to store the bib entry texts.
% This will load the same \texttt{.bbl} file as |\bibliography|, but will avoid
% messages from \btx\ about multiple |\bibdata| commands and warnings from
% \LaTeX\ about multiply defined citations.
%
% The processing procedure is as usual:
% \begin{enumerate}
%  \item \LaTeX\ the file;
%  \item Run \btx;
%  \item \LaTeX\ the file twice.
% \end{enumerate}
%
% \noindent
% \textbf{Note:} it is highly recommended to make use of the \texttt{url}
% package, which will nicely format both url and doi addresses; in particular,
% they will break at convenient locations without a hyphen.
%
% \section{Caveats}
%
% The entries in the \texttt{.bbl} must be of the form
% \begin{quote}
%  |\bibitem|\oarg{label}\marg{key}\\
%  \emph{Text of the reference entry.}\\[1ex]
%  |\bibitem|\dots
% \end{quote}
% That is, there must be a new line after the \marg{key} (or at least a space)
% and a blank line before the next |\bibitem|. The final period in the text
% will be removed, if present, allowing one to place the |\bibentry| commands
% in mid-sentence. Of course, there may be other periods within the text that
% might look funny.
%
% The \texttt{\filename} package will work with \texttt{natbib} with its
% native |\bibitem| format, and with standard \LaTeX. Nothing else can be
% guaranteed.
%
% It will also work with Donald Arseneau's \texttt{url} package. This is
% highly recommended (almost obligatory) if the references contain Internet
% addresses (URLs) and any of my bibliography styles are being used. My styles
% pack the URL text into the |\url| command. Without the \texttt{url} package,
% this command defaults to |\texttt| which does a horrible job of printing URL
% addresses, especially if they contain special characters.
%
% The use of both |\nobibliography*| and |\bibliography| together is limited and
% perhaps unsatisfactory. There is only one \texttt{.bbl} file, and hence one
% list of references. Since |\nobibliography*| does not have its own list of
% database files, one cannot take the |\bibentry| citations from separate
% databases. Also, any |\bibentry| citation must appear in the list of
% references, something that one might reasonably not care for. (It must be
% in the \texttt{.bbl} file else its text cannot be stored for |\bibentry|
% use.)
%
% It would be better if |\nobibliography| and |\bibliography| could be used
% independently of each other, with different databases, different
% \texttt{.bbl} files. However, this involves enormous complications, with
% separate \texttt{.aux} files and naming problems for the \texttt{.bbl}s.
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Options with \texttt{docstrip}}
% The source \texttt{.dtx} file is meant to be processed with
% \texttt{docstrip}, for which a number of options are available:
% \begin{description}
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
%     comments removed;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
%     print out the documentation under \LaTeXe. The documentation cannot
%     be printed under \LaTeX~2.09.
%
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeXe.
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%</package>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package
% file.
%
% \begin{macro}{\nobibliography}
% \changes{1.1}{1997 Nov 11}{Add starred version; make changes local}
% The |\nobibliography| is used just as |\bibliography|; it locally redefines
% the \texttt{thebibliography} environment to do nothing, while |\bibitem| is
% redefined to save the ensuring entry text. Then |\bibliography| is called to
% input the |\jobname.bbl| file.
%
% The business with the counters is just for standard \LaTeX; \texttt{natbib}
% does not need it.
%
% The starred form is to be used when a true |\bibliography| command is also
% given. Thus we want to prevent writing duplicate |\bibdata| and |\bibcite|
% commands to the auxiliary file. Setting the |\ifBR@star| flag accomplishes
% this by turning off |\if@filesw| and |\BR@bibitem|.
%    \begin{macrocode}
%<*package>
\newif\ifBR@star
\newcommand\nobibliography{\@ifstar{\BR@nobib{}}{\BR@nobib}}
\newcommand\BR@nobib[1]{%
  \ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi
  \begingroup
  \ifBR@star\@fileswfalse\fi
  \renewenvironment{thebibliography}[1]{%
    \usecounter{enumiv}%
    \renewcommand\item[1][]{%
          \ifx\relax####1\relax\stepcounter\@listctr\fi}%
    \ifBR@star \newcommand\BR@bibitem[2][]{}\else
    \let\BR@bibitem=\bibitem\fi
    \let\bibitem=\BR@b@bibitem}{}%
    \let\@biblabel\@gobble
  \bibliography{#1}\endgroup
  \ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi}
%    \end{macrocode}
% Note: |\BR@star| must be set once again at the end since |\bibliography|
% always sets it to \meta{false}.
% \end{macro}
%
% \begin{macro}{\BR@b@bibitem}
% The new |\bibitem|; test for optional argument, call the old |\bibitem|
% (stored as |\BR@bibitem|) and then call the macro to store the remaining
% text. The old |\bibitem| must be called so the |\cite| can work.
%
% In the case of the starred |\nobibliography|, |\BR@bibitem| is not the old
% |\bibitem|, but one that throws away its arguments. This prevents an entry
% being made to the auxiliary file, an entry that is made by the real
% |\bibliography| command.
%    \begin{macrocode}
\newcommand\BR@b@bibitem[2][]{\ifx\relax#1\relax\BR@bibitem{#2}%
   \else \BR@bibitem[#1]{#2}\fi \BR@c@bibitem{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\BR@c@bibitem}
% \changes{1.1}{1997 Nov 11}{Remove need for reference to end with period}
% This macro stores all the text that follows up to ``space newpar'', removing a
% final period if present. It is assumed that a new line ($\equiv$space) comes
% between the |\bibitem| \marg{key} and the text, and that a blank line
% ($\equiv$|\par|) comes between references. These conditions are generally met
% by all bibliography styles.
%
% \changes{1.3}{1999 Aug 26}{Store with \cs{gdef} instead of \cs{xdef}}
% Originally I used |\xdef| to store the text, but this causes problems with
% the |\url| command of the \texttt{url} package. The simplest solution is to
% use |\gdef| instead so that |\url| is executed when the text is printed,
% not when it is stored.
%    \begin{macrocode}
\def\BR@c@bibitem#1 #2 \par{{\let\protect\@unexpandable@protect
      \expandafter \gdef\csname BR@r@#1\@extra@b@citeb\endcsname
      {\BR@nodot#2\relax.\relax\relax}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\BR@nodot}
% \changes{1.1}{1997 Nov 11}{Add macro}
% To remove a possible final period. This macro always adds a terminal
% |\relax|.
%    \begin{macrocode}
\def\BR@nodot#1.\relax#2\relax{#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibentry}
% \changes{1.4}{2000 Jun 20}{Add \texttt{hyperref} commands}
% The macro that prints the stored text. It also calls |\nocite| in order
% that the reference be entered in the \texttt{.aux} file for \btx\
% processing.
%    \begin{macrocode}
\newcommand\bibentry[1]{\nocite{#1}{\frenchspacing
     \hyper@natanchorstart{#1\@extra@b@citeb}%
     \@nameuse{BR@r@#1\@extra@b@citeb}\hyper@natanchorend}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@extra@b@citeb}
% This macro is provided to work with the \texttt{chapterbib} package.
%    \begin{macrocode}
\providecommand\@extra@b@citeb{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hyper@natanchorstart}
% \changes{1.4}{2000 Jun 20}{Add default definition}
% \begin{macro}{\hyper@natanchorend}
% \changes{1.4}{2000 Jun 20}{Add default definition}
% Provide dummy definitions for when \texttt{hyperref} package not present.
%    \begin{macrocode}
\providecommand\hyper@natanchorstart[1]{}
\providecommand\hyper@natanchorend{}
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{\urlprefix}
% \changes{1.3}{1999 Aug 26}{Add macro}
% \begin{macro}{\url}
% \changes{1.3}{1999 Aug 26}{Add macro}
% My \texttt{bst} files that support URL addresses make use of commands
% |\url| and |\urlprefix|, which are given default definitions in the
% \texttt{bbl} file. However, these definitions are local to the
% \texttt{thebibliography} environment. Since the bibliography text is stored
% unexpanded (|\gdef| instead of |\xdef|) these default definitions are lost
% when the text is printed. Thus they must be provided in this package as well.
%
% Define |\url| after the preamble in case \texttt{url} is loaded
% after \texttt{\filename}.
%    \begin{macrocode}
\AtBeginDocument{%
  \providecommand*{\urlprefix}{URL }
  \providecommand*{\url}[1]{\texttt{#1}}
}
%    \end{macrocode}
% Note: it is highly recommended always to use the \texttt{url} package; this
% default for |\url| will not allow line breaks within the URL text and any
% special characters like |$ _ #| will create serious problems.
% \end{macro}\end{macro}
%
% \begin{macro}{bibliography}
% \changes{1.1}{1997 Nov 11}{Add warning for missing \cs{bibliography}}
% \changes{1.3}{1999 Aug 26}{Set flag via \cs{bibliography}
%    not \cs{thebibliography}}
% Finally, test at the end of the document if |\nobibliography*| was used
% without a following |\bibliography| and issue a warning. Is this useful?
% Strictly speaking, the order could be interchanged and then a warning would
% be erroneously given. Or, one could produce the \texttt{.bbl} file and then
% remove the |\bibliography| command, and the |\bibentry| commands will still
% function. (Hence the warning is only that \btx\ will not process, not the
% |\bibentry| will not work.) Will there be problems with \texttt{chapterbib}?
%
% For all these reasons, this warning could be questionable. Keep it for now
% anyway.
%    \begin{macrocode}
\AtBeginDocument{\let\BR@bib\bibliography
  \def\bibliography{\global\BR@starfalse\BR@bib}}
\AtEndDocument{\ifBR@star\PackageWarningNoLine{bibentry}
  {You have used \string\nobibliography* \MessageBreak
   without a following \string\bibliography.\MessageBreak
   You may not be able to run BibTeX}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\doi}
% \changes{1.5}{2007 Oct 30}{Add macro}
% The |\doi| command is used in the modern \texttt{.bst} files, and is in fact
%  defined inside the |thebibliography| environment for these styles. However,
%  that means, it is undefined outside where |\bibentry| is used. So it is
%  necessary to provide a definition globally.
%    \begin{macrocode}
\AtBeginDocument{\@ifpackageloaded{url}
  {\providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}}
  {\providecommand{\doi}[1]{doi: #1}}}
%</package>
%    \end{macrocode}
% \end{macro}
%
% \Finale