| 1 |
% \iffalse THIS IS A META-COMMENT |
| 2 |
%<*dtx> |
| 3 |
\ProvidesFile |
| 4 |
%======================================================================== |
| 5 |
{BIBENTRY.DTX} |
| 6 |
%======================================================================== |
| 7 |
%</dtx> |
| 8 |
%% Copyright 1997-2007 Patrick W Daly |
| 9 |
%% Max-Planck-Institut f\"ur Sonnensystemforschung |
| 10 |
%% Max-Planck-Str. 2 |
| 11 |
%% D-37191 Katlenburg-Lindau |
| 12 |
%% Germany |
| 13 |
%% E-mail: [email protected] |
| 14 |
% |
| 15 |
% This program can be redistributed and/or modified under the terms |
| 16 |
% of the LaTeX Project Public License Distributed from CTAN |
| 17 |
% archives in directory macros/latex/base/lppl.txt; either |
| 18 |
% version 1 of the License, or any later version. |
| 19 |
% |
| 20 |
% This is a contributed file to the LaTeX2e system. |
| 21 |
% ------------------------------------------------- |
| 22 |
% This is a LaTeX package to all bibliography entries to be placed |
| 23 |
% anywhere in text. |
| 24 |
% Installation: |
| 25 |
% LaTeX this file: creates docstrip installation file bibentry.ins |
| 26 |
% AND the LaTeX documentation |
| 27 |
% (La)TeX bibentry.ins: creates package file bibentry.sty, and optionally |
| 28 |
% the documentation driver bibentry.drv |
| 29 |
% (bibentry.ins and bibentry.drv may be edited as needed) |
| 30 |
% Docstrip options available: |
| 31 |
% package - to produce a (LaTeX2e) package .sty file |
| 32 |
% driver - to produce a driver file to print the documentation |
| 33 |
%-------------------------------------------------------------------------- |
| 34 |
% *** Identify the package file:- |
| 35 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 36 |
%<package>\ProvidesPackage{bibentry} |
| 37 |
% |
| 38 |
% *** Identify the driver file:- |
| 39 |
%<driver>\NeedsTeXFormat{LaTeX2e} |
| 40 |
%<driver>\ProvidesFile{bibentry.drv} |
| 41 |
% |
| 42 |
% *** The DATE, VERSION, and other INFO |
| 43 |
%\fi |
| 44 |
%\ProvidesFile{bibentry} |
| 45 |
[2007/10/30 1.5 (PWD)] |
| 46 |
% \changes{1.0}{1997 Jun 13}{Initial version} |
| 47 |
% \changes{1.1}{1997 Nov 11}{Refine for use with \cs{bibliography}} |
| 48 |
% \changes{1.1a}{1998 Mar 2}{Fix bug by using \cs{ifx} instead of \cs{if}} |
| 49 |
% \changes{1.2}{1999 Feb 23}{Update copyright notice} |
| 50 |
% \changes{1.3}{1999 Aug 26}{Works with \texttt{url} package} |
| 51 |
% \changes{1.4}{2000 Jun 20}{Add \texttt{hyperref} compatibility} |
| 52 |
% \changes{1.5}{2007 Oct 30}{Add \cs{doi} definition} |
| 53 |
% |
| 54 |
% \CheckSum{135} |
| 55 |
% \CharacterTable |
| 56 |
% {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 |
| 57 |
% 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 |
| 58 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 59 |
% Exclamation \! Double quote \" Hash (number) \# |
| 60 |
% Dollar \$ Percent \% Ampersand \& |
| 61 |
% Acute accent \' Left paren \( Right paren \) |
| 62 |
% Asterisk \* Plus \+ Comma \, |
| 63 |
% Minus \- Point \. Solidus \/ |
| 64 |
% Colon \: Semicolon \; Less than \< |
| 65 |
% Equals \= Greater than \> Question mark \? |
| 66 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 67 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 68 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 69 |
% Right brace \} Tilde \~} |
| 70 |
% |
| 71 |
% \iffalse |
| 72 |
%<*install> |
| 73 |
%^^A ============================================= |
| 74 |
%^^A Here is the docstrip installation file |
| 75 |
%^^A It is written on first LaTeX run if it |
| 76 |
%^^A does not already exist |
| 77 |
%^^A ============================================= |
| 78 |
\begin{filecontents*}{bibentry.ins} |
| 79 |
% File: bibentry.ins |
| 80 |
% Copyright 1999,2000 Patrick W. Daly |
| 81 |
% |
| 82 |
% This file can be redistributed and/or modified under the terms |
| 83 |
% of the LaTeX Project Public License Distributed from CTAN |
| 84 |
% archives in directory macros/latex/base/lppl.txt; either |
| 85 |
% version 1 of the License, or any later version. |
| 86 |
% |
| 87 |
% It is an installation file for extracting package and driver |
| 88 |
% files from the original source file. Simply process it under |
| 89 |
% TeX or LaTeX. It works with Docstrip versions before and after |
| 90 |
% December 1995. |
| 91 |
|
| 92 |
\def\batchfile{bibentry.ins} |
| 93 |
\input docstrip |
| 94 |
|
| 95 |
\preamble |
| 96 |
============================================= |
| 97 |
IMPORTANT NOTICE: |
| 98 |
|
| 99 |
This program can be redistributed and/or modified under the terms |
| 100 |
of the LaTeX Project Public License Distributed from CTAN |
| 101 |
archives in directory macros/latex/base/lppl.txt; either |
| 102 |
version 1 of the License, or any later version. |
| 103 |
|
| 104 |
This is a generated file. |
| 105 |
It may not be distributed without the original source file \inFileName. |
| 106 |
|
| 107 |
Full documentation can be obtained by LaTeXing that original file. |
| 108 |
Only a few abbreviated comments remain here to describe the usage. |
| 109 |
============================================= |
| 110 |
\endpreamble |
| 111 |
\postamble |
| 112 |
|
| 113 |
<<<<< End of generated file <<<<<< |
| 114 |
\endpostamble |
| 115 |
\keepsilent |
| 116 |
|
| 117 |
% Docstrip before Dec 95 does not have \generate syntax, nor |
| 118 |
% \declarepreamble. Must redefine them. The \generateFile called |
| 119 |
% for each output file individually. |
| 120 |
% Docstrip before Dec 96 cannot interprete multiline \if..\fi |
| 121 |
% Thus for maximum compatibility, have only one-line conditionals |
| 122 |
|
| 123 |
\let\oldDS F\relax |
| 124 |
\expandafter\ifx\csname generate\endcsname\relax \let\oldDS T\relax\fi |
| 125 |
\if\oldDS T \def\declarepreamble#1{\preamble}\fi |
| 126 |
\if\oldDS T \def\declarepostamble#1{\postamble}\fi |
| 127 |
\if\oldDS T \generateFile{bibentry.sty}{f}{\from{bibentry.dtx}{package}} \fi |
| 128 |
|
| 129 |
\declarepreamble\driver |
| 130 |
============================================ |
| 131 |
This is the driver file to produce the LaTeX documentation |
| 132 |
from the original source file \inFileName. |
| 133 |
|
| 134 |
Make changes to it as needed. (Never change the file \inFileName!) |
| 135 |
============================================ |
| 136 |
\endpreamble |
| 137 |
|
| 138 |
\declarepostamble\driverq |
| 139 |
|
| 140 |
End of documentation driver file. |
| 141 |
\endpostamble |
| 142 |
|
| 143 |
\ifx\oldDS T \generateFile{bibentry.drv}{f}{\from{bibentry.dtx}{driver}}\fi |
| 144 |
|
| 145 |
\ifx\oldDS T \let\askforoverwritefalse\relax\def\generate#1{}\fi |
| 146 |
|
| 147 |
\askforoverwritefalse |
| 148 |
\generate{\file{bibentry.sty}{\from{bibentry.dtx}{package}} |
| 149 |
\file{bibentry.drv}{\usepreamble\driver\usepostamble\driverq |
| 150 |
\from{bibentry.dtx}{driver}} |
| 151 |
} |
| 152 |
|
| 153 |
\obeyspaces |
| 154 |
\Msg{*******************************************}% |
| 155 |
\Msg{* For documentation, process bibentry.dtx *}% |
| 156 |
\Msg{* or the driver file bibentry.drv *}% |
| 157 |
\Msg{*******************************************} |
| 158 |
\end{filecontents*} |
| 159 |
%</install> |
| 160 |
%<*driver> |
| 161 |
\documentclass{ltxdoc} |
| 162 |
%<driver>%\documentclass[twoside]{ltxdoc} |
| 163 |
%<driver>%\documentclass[a4paper]{ltxdoc} |
| 164 |
%<driver>%\documentclass[twoside,a4paper]{ltxdoc} |
| 165 |
\raggedbottom |
| 166 |
|
| 167 |
%** To include the detailed explanation of the coding, comment out |
| 168 |
%** the next line |
| 169 |
\OnlyDescription |
| 170 |
|
| 171 |
%** To produce a command index: add the following line for one run, |
| 172 |
%** then run makeindex -s gind.ist bibentry |
| 173 |
%** and reprocess, with or without this line (much faster without) |
| 174 |
%<driver>% \EnableCrossrefs\CodelineIndex |
| 175 |
|
| 176 |
%** To produce a change history: add the following line for one run, |
| 177 |
%** then run makeindex -s gglo.ist -o bibentry.gls bibentry.glo |
| 178 |
%** and reprocess, with or without this line (faster without) |
| 179 |
%<driver>% \RecordChanges |
| 180 |
|
| 181 |
\DisableCrossrefs %May stay; zapped by \EnableCrossrefs |
| 182 |
\CodelineNumbered %May stay |
| 183 |
|
| 184 |
\begin{document} |
| 185 |
\DocInput{bibentry.dtx} |
| 186 |
\end{document} |
| 187 |
%</driver> |
| 188 |
%\fi |
| 189 |
% |
| 190 |
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs} |
| 191 |
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} |
| 192 |
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} |
| 193 |
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} |
| 194 |
% \DoNotIndex{\filename,\fileversion,\filedate,\let} |
| 195 |
% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter} |
| 196 |
% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography} |
| 197 |
% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} |
| 198 |
% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} |
| 199 |
% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} |
| 200 |
% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup} |
| 201 |
% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine} |
| 202 |
% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem} |
| 203 |
% |
| 204 |
% \setcounter{IndexColumns}{2} |
| 205 |
% \setlength{\IndexMin}{10cm} |
| 206 |
% \setcounter{StandardModuleDepth}{1} |
| 207 |
% |
| 208 |
% \GetFileInfo{bibentry} |
| 209 |
% |
| 210 |
% \title{\bfseries A \LaTeX\ Package to Place Bibliography Entries in Text} |
| 211 |
% |
| 212 |
% \author{Patrick W. Daly} |
| 213 |
% |
| 214 |
% \date{This paper describes package \texttt{\filename}\\ |
| 215 |
% version \fileversion{} from \filedate |
| 216 |
% } |
| 217 |
% |
| 218 |
% \maketitle |
| 219 |
% |
| 220 |
% \pagestyle{myheadings} |
| 221 |
% \markboth{P. W. Daly}{Bibliography Entries in Text} |
| 222 |
% |
| 223 |
%^^A In order to keep all marginal notes on the one (left) side: |
| 224 |
%^^A (otherwise they switch sides disasterously with twoside option) |
| 225 |
% \makeatletter \@mparswitchfalse \makeatother |
| 226 |
% |
| 227 |
%\begin{small}\begin{center}\textbf{Summary}\end{center} |
| 228 |
% The stripped version of this file contains the following brief description: |
| 229 |
%\iffalse |
| 230 |
%<*package> |
| 231 |
%\fi |
| 232 |
% \begin{verbatim} |
| 233 |
% Bibliography Entries in Text |
| 234 |
% |
| 235 |
% In place of \bibliography{database}, enter \nobibliography{database} |
| 236 |
% No bibliography is written at this point, but afterwards, |
| 237 |
% \bibentry{key} prints the bibliography entry for citation <key> |
| 238 |
% (whereas \cite{key} prints the citation, not the bib entry) |
| 239 |
% |
| 240 |
% If \bibliography is also to be given, then issue the starred variant |
| 241 |
% \nobibliography* (without argument). |
| 242 |
% \end{verbatim} |
| 243 |
%\iffalse |
| 244 |
%----------------------------------------------------------- |
| 245 |
% See documentation in the source .dtx file for more details. |
| 246 |
%</package> |
| 247 |
%\fi |
| 248 |
%\end{small} |
| 249 |
% |
| 250 |
% \section{Introduction} |
| 251 |
% This package allows one to be able to place bibliographic entries anywhere |
| 252 |
% in the text. It is to be used to produce annotated bibliographies, such as |
| 253 |
% \begin{quote} |
| 254 |
% For an intoduction to this topic, see Jones, J.~R., Basics on this topic, |
| 255 |
% {\it J.\ Last Resorts}, \textbf{13}, 234--254, 1994. For more advanced |
| 256 |
% information, see \dots. |
| 257 |
% \end{quote} |
| 258 |
% |
| 259 |
% The idea is that the full reference is used, not just the citation Jones |
| 260 |
% [1994]. |
| 261 |
% |
| 262 |
% \section{Invoking the Package} |
| 263 |
% The macros in this package are included in the main document |
| 264 |
% with the |\usepackage| command of \LaTeXe, |
| 265 |
% \begin{quote} |
| 266 |
% |\documentclass[..]{...}|\\ |
| 267 |
% |\usepackage{|\texttt{\filename}|}| |
| 268 |
% \end{quote} |
| 269 |
% |
| 270 |
% \section{Usage} |
| 271 |
% |
| 272 |
% \newcommand\btx{\textsc{Bib}\TeX} |
| 273 |
% This package must be used with \btx, not with a hand-written |
| 274 |
% \texttt{thebibliography} environment. |
| 275 |
% |
| 276 |
% More precisely, there must be a \texttt{.bbl} file external to the \LaTeX\ |
| 277 |
% file; whether this is written by hand or by \btx\ is unimportant. |
| 278 |
% |
| 279 |
% \DescribeMacro{\nobibliography} |
| 280 |
% The bibliography entries are stored with the command |
| 281 |
% |\nobibliography|\marg{bibfiles}, which is like the usual |
| 282 |
% |\bibliography|\marg{bibfiles} except no bibliography is printed. The |
| 283 |
% \texttt{.bbl} file is read in as usual but the \texttt{thebibliography} is |
| 284 |
% redefined so that all the entries are stored, not printed. |
| 285 |
% |
| 286 |
% \DescribeMacro{\bibentry} |
| 287 |
% The text of the entries may be printed with the command |
| 288 |
% \begin{quote} |
| 289 |
% |\bibentry|\marg{key} |
| 290 |
% \end{quote} |
| 291 |
% These commands may only be issued after |\nobibliography|, for otherwise |
| 292 |
% the reference texts are not known. |
| 293 |
% |
| 294 |
% The final period of the original text will be missing, so that one can add |
| 295 |
% punctuation as one pleases. |
| 296 |
% |
| 297 |
% Regular |\cite| (or the \texttt{natbib} versions) may be issued anywhere as |
| 298 |
% usual. |
| 299 |
% |
| 300 |
% \DescribeMacro{\nobibliography*} |
| 301 |
% If a regular list of references is to be given too, with the |
| 302 |
% |\bibliography|\marg{bibfiles} command, issue the starred version |
| 303 |
% |\nobibliography*| (without argument) in order to store the bib entry texts. |
| 304 |
% This will load the same \texttt{.bbl} file as |\bibliography|, but will avoid |
| 305 |
% messages from \btx\ about multiple |\bibdata| commands and warnings from |
| 306 |
% \LaTeX\ about multiply defined citations. |
| 307 |
% |
| 308 |
% The processing procedure is as usual: |
| 309 |
% \begin{enumerate} |
| 310 |
% \item \LaTeX\ the file; |
| 311 |
% \item Run \btx; |
| 312 |
% \item \LaTeX\ the file twice. |
| 313 |
% \end{enumerate} |
| 314 |
% |
| 315 |
% \noindent |
| 316 |
% \textbf{Note:} it is highly recommended to make use of the \texttt{url} |
| 317 |
% package, which will nicely format both url and doi addresses; in particular, |
| 318 |
% they will break at convenient locations without a hyphen. |
| 319 |
% |
| 320 |
% \section{Caveats} |
| 321 |
% |
| 322 |
% The entries in the \texttt{.bbl} must be of the form |
| 323 |
% \begin{quote} |
| 324 |
% |\bibitem|\oarg{label}\marg{key}\\ |
| 325 |
% \emph{Text of the reference entry.}\\[1ex] |
| 326 |
% |\bibitem|\dots |
| 327 |
% \end{quote} |
| 328 |
% That is, there must be a new line after the \marg{key} (or at least a space) |
| 329 |
% and a blank line before the next |\bibitem|. The final period in the text |
| 330 |
% will be removed, if present, allowing one to place the |\bibentry| commands |
| 331 |
% in mid-sentence. Of course, there may be other periods within the text that |
| 332 |
% might look funny. |
| 333 |
% |
| 334 |
% The \texttt{\filename} package will work with \texttt{natbib} with its |
| 335 |
% native |\bibitem| format, and with standard \LaTeX. Nothing else can be |
| 336 |
% guaranteed. |
| 337 |
% |
| 338 |
% It will also work with Donald Arseneau's \texttt{url} package. This is |
| 339 |
% highly recommended (almost obligatory) if the references contain Internet |
| 340 |
% addresses (URLs) and any of my bibliography styles are being used. My styles |
| 341 |
% pack the URL text into the |\url| command. Without the \texttt{url} package, |
| 342 |
% this command defaults to |\texttt| which does a horrible job of printing URL |
| 343 |
% addresses, especially if they contain special characters. |
| 344 |
% |
| 345 |
% The use of both |\nobibliography*| and |\bibliography| together is limited and |
| 346 |
% perhaps unsatisfactory. There is only one \texttt{.bbl} file, and hence one |
| 347 |
% list of references. Since |\nobibliography*| does not have its own list of |
| 348 |
% database files, one cannot take the |\bibentry| citations from separate |
| 349 |
% databases. Also, any |\bibentry| citation must appear in the list of |
| 350 |
% references, something that one might reasonably not care for. (It must be |
| 351 |
% in the \texttt{.bbl} file else its text cannot be stored for |\bibentry| |
| 352 |
% use.) |
| 353 |
% |
| 354 |
% It would be better if |\nobibliography| and |\bibliography| could be used |
| 355 |
% independently of each other, with different databases, different |
| 356 |
% \texttt{.bbl} files. However, this involves enormous complications, with |
| 357 |
% separate \texttt{.aux} files and naming problems for the \texttt{.bbl}s. |
| 358 |
% |
| 359 |
% \StopEventually{\PrintIndex\PrintChanges} |
| 360 |
% |
| 361 |
% \section{Options with \texttt{docstrip}} |
| 362 |
% The source \texttt{.dtx} file is meant to be processed with |
| 363 |
% \texttt{docstrip}, for which a number of options are available: |
| 364 |
% \begin{description} |
| 365 |
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most |
| 366 |
% comments removed; |
| 367 |
% |
| 368 |
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will |
| 369 |
% print out the documentation under \LaTeXe. The documentation cannot |
| 370 |
% be printed under \LaTeX~2.09. |
| 371 |
% |
| 372 |
% \end{description} |
| 373 |
% The source file \texttt{\filename.dtx} is itself a driver file and can |
| 374 |
% be processed directly by \LaTeXe. |
| 375 |
% |
| 376 |
% \section{The Coding} |
| 377 |
% This section presents and explains the actual coding of the macros. |
| 378 |
% It is nested between |%<*package>| and |%</package>|, which |
| 379 |
% are indicators to \texttt{docstrip} that this coding belongs to the package |
| 380 |
% file. |
| 381 |
% |
| 382 |
% \begin{macro}{\nobibliography} |
| 383 |
% \changes{1.1}{1997 Nov 11}{Add starred version; make changes local} |
| 384 |
% The |\nobibliography| is used just as |\bibliography|; it locally redefines |
| 385 |
% the \texttt{thebibliography} environment to do nothing, while |\bibitem| is |
| 386 |
% redefined to save the ensuring entry text. Then |\bibliography| is called to |
| 387 |
% input the |\jobname.bbl| file. |
| 388 |
% |
| 389 |
% The business with the counters is just for standard \LaTeX; \texttt{natbib} |
| 390 |
% does not need it. |
| 391 |
% |
| 392 |
% The starred form is to be used when a true |\bibliography| command is also |
| 393 |
% given. Thus we want to prevent writing duplicate |\bibdata| and |\bibcite| |
| 394 |
% commands to the auxiliary file. Setting the |\ifBR@star| flag accomplishes |
| 395 |
% this by turning off |\if@filesw| and |\BR@bibitem|. |
| 396 |
% \begin{macrocode} |
| 397 |
%<*package> |
| 398 |
\newif\ifBR@star |
| 399 |
\newcommand\nobibliography{\@ifstar{\BR@nobib{}}{\BR@nobib}} |
| 400 |
\newcommand\BR@nobib[1]{% |
| 401 |
\ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi |
| 402 |
\begingroup |
| 403 |
\ifBR@star\@fileswfalse\fi |
| 404 |
\renewenvironment{thebibliography}[1]{% |
| 405 |
\usecounter{enumiv}% |
| 406 |
\renewcommand\item[1][]{% |
| 407 |
\ifx\relax####1\relax\stepcounter\@listctr\fi}% |
| 408 |
\ifBR@star \newcommand\BR@bibitem[2][]{}\else |
| 409 |
\let\BR@bibitem=\bibitem\fi |
| 410 |
\let\bibitem=\BR@b@bibitem}{}% |
| 411 |
\let\@biblabel\@gobble |
| 412 |
\bibliography{#1}\endgroup |
| 413 |
\ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi} |
| 414 |
% \end{macrocode} |
| 415 |
% Note: |\BR@star| must be set once again at the end since |\bibliography| |
| 416 |
% always sets it to \meta{false}. |
| 417 |
% \end{macro} |
| 418 |
% |
| 419 |
% \begin{macro}{\BR@b@bibitem} |
| 420 |
% The new |\bibitem|; test for optional argument, call the old |\bibitem| |
| 421 |
% (stored as |\BR@bibitem|) and then call the macro to store the remaining |
| 422 |
% text. The old |\bibitem| must be called so the |\cite| can work. |
| 423 |
% |
| 424 |
% In the case of the starred |\nobibliography|, |\BR@bibitem| is not the old |
| 425 |
% |\bibitem|, but one that throws away its arguments. This prevents an entry |
| 426 |
% being made to the auxiliary file, an entry that is made by the real |
| 427 |
% |\bibliography| command. |
| 428 |
% \begin{macrocode} |
| 429 |
\newcommand\BR@b@bibitem[2][]{\ifx\relax#1\relax\BR@bibitem{#2}% |
| 430 |
\else \BR@bibitem[#1]{#2}\fi \BR@c@bibitem{#2}} |
| 431 |
% \end{macrocode} |
| 432 |
% \end{macro} |
| 433 |
% |
| 434 |
% \begin{macro}{\BR@c@bibitem} |
| 435 |
% \changes{1.1}{1997 Nov 11}{Remove need for reference to end with period} |
| 436 |
% This macro stores all the text that follows up to ``space newpar'', removing a |
| 437 |
% final period if present. It is assumed that a new line ($\equiv$space) comes |
| 438 |
% between the |\bibitem| \marg{key} and the text, and that a blank line |
| 439 |
% ($\equiv$|\par|) comes between references. These conditions are generally met |
| 440 |
% by all bibliography styles. |
| 441 |
% |
| 442 |
% \changes{1.3}{1999 Aug 26}{Store with \cs{gdef} instead of \cs{xdef}} |
| 443 |
% Originally I used |\xdef| to store the text, but this causes problems with |
| 444 |
% the |\url| command of the \texttt{url} package. The simplest solution is to |
| 445 |
% use |\gdef| instead so that |\url| is executed when the text is printed, |
| 446 |
% not when it is stored. |
| 447 |
% \begin{macrocode} |
| 448 |
\def\BR@c@bibitem#1 #2 \par{{\let\protect\@unexpandable@protect |
| 449 |
\expandafter \gdef\csname BR@r@#1\@extra@b@citeb\endcsname |
| 450 |
{\BR@nodot#2\relax.\relax\relax}}} |
| 451 |
% \end{macrocode} |
| 452 |
% \end{macro} |
| 453 |
% |
| 454 |
% \begin{macro}{\BR@nodot} |
| 455 |
% \changes{1.1}{1997 Nov 11}{Add macro} |
| 456 |
% To remove a possible final period. This macro always adds a terminal |
| 457 |
% |\relax|. |
| 458 |
% \begin{macrocode} |
| 459 |
\def\BR@nodot#1.\relax#2\relax{#1} |
| 460 |
% \end{macrocode} |
| 461 |
% \end{macro} |
| 462 |
% |
| 463 |
% \begin{macro}{\bibentry} |
| 464 |
% \changes{1.4}{2000 Jun 20}{Add \texttt{hyperref} commands} |
| 465 |
% The macro that prints the stored text. It also calls |\nocite| in order |
| 466 |
% that the reference be entered in the \texttt{.aux} file for \btx\ |
| 467 |
% processing. |
| 468 |
% \begin{macrocode} |
| 469 |
\newcommand\bibentry[1]{\nocite{#1}{\frenchspacing |
| 470 |
\hyper@natanchorstart{#1\@extra@b@citeb}% |
| 471 |
\@nameuse{BR@r@#1\@extra@b@citeb}\hyper@natanchorend}} |
| 472 |
% \end{macrocode} |
| 473 |
% \end{macro} |
| 474 |
% |
| 475 |
% \begin{macro}{\@extra@b@citeb} |
| 476 |
% This macro is provided to work with the \texttt{chapterbib} package. |
| 477 |
% \begin{macrocode} |
| 478 |
\providecommand\@extra@b@citeb{} |
| 479 |
% \end{macrocode} |
| 480 |
% \end{macro} |
| 481 |
% |
| 482 |
% \begin{macro}{\hyper@natanchorstart} |
| 483 |
% \changes{1.4}{2000 Jun 20}{Add default definition} |
| 484 |
% \begin{macro}{\hyper@natanchorend} |
| 485 |
% \changes{1.4}{2000 Jun 20}{Add default definition} |
| 486 |
% Provide dummy definitions for when \texttt{hyperref} package not present. |
| 487 |
% \begin{macrocode} |
| 488 |
\providecommand\hyper@natanchorstart[1]{} |
| 489 |
\providecommand\hyper@natanchorend{} |
| 490 |
% \end{macrocode} |
| 491 |
% \end{macro}\end{macro} |
| 492 |
% \begin{macro}{\urlprefix} |
| 493 |
% \changes{1.3}{1999 Aug 26}{Add macro} |
| 494 |
% \begin{macro}{\url} |
| 495 |
% \changes{1.3}{1999 Aug 26}{Add macro} |
| 496 |
% My \texttt{bst} files that support URL addresses make use of commands |
| 497 |
% |\url| and |\urlprefix|, which are given default definitions in the |
| 498 |
% \texttt{bbl} file. However, these definitions are local to the |
| 499 |
% \texttt{thebibliography} environment. Since the bibliography text is stored |
| 500 |
% unexpanded (|\gdef| instead of |\xdef|) these default definitions are lost |
| 501 |
% when the text is printed. Thus they must be provided in this package as well. |
| 502 |
% |
| 503 |
% Define |\url| after the preamble in case \texttt{url} is loaded |
| 504 |
% after \texttt{\filename}. |
| 505 |
% \begin{macrocode} |
| 506 |
\AtBeginDocument{% |
| 507 |
\providecommand*{\urlprefix}{URL } |
| 508 |
\providecommand*{\url}[1]{\texttt{#1}} |
| 509 |
} |
| 510 |
% \end{macrocode} |
| 511 |
% Note: it is highly recommended always to use the \texttt{url} package; this |
| 512 |
% default for |\url| will not allow line breaks within the URL text and any |
| 513 |
% special characters like |$ _ #| will create serious problems. |
| 514 |
% \end{macro}\end{macro} |
| 515 |
% |
| 516 |
% \begin{macro}{bibliography} |
| 517 |
% \changes{1.1}{1997 Nov 11}{Add warning for missing \cs{bibliography}} |
| 518 |
% \changes{1.3}{1999 Aug 26}{Set flag via \cs{bibliography} |
| 519 |
% not \cs{thebibliography}} |
| 520 |
% Finally, test at the end of the document if |\nobibliography*| was used |
| 521 |
% without a following |\bibliography| and issue a warning. Is this useful? |
| 522 |
% Strictly speaking, the order could be interchanged and then a warning would |
| 523 |
% be erroneously given. Or, one could produce the \texttt{.bbl} file and then |
| 524 |
% remove the |\bibliography| command, and the |\bibentry| commands will still |
| 525 |
% function. (Hence the warning is only that \btx\ will not process, not the |
| 526 |
% |\bibentry| will not work.) Will there be problems with \texttt{chapterbib}? |
| 527 |
% |
| 528 |
% For all these reasons, this warning could be questionable. Keep it for now |
| 529 |
% anyway. |
| 530 |
% \begin{macrocode} |
| 531 |
\AtBeginDocument{\let\BR@bib\bibliography |
| 532 |
\def\bibliography{\global\BR@starfalse\BR@bib}} |
| 533 |
\AtEndDocument{\ifBR@star\PackageWarningNoLine{bibentry} |
| 534 |
{You have used \string\nobibliography* \MessageBreak |
| 535 |
without a following \string\bibliography.\MessageBreak |
| 536 |
You may not be able to run BibTeX}\fi} |
| 537 |
% \end{macrocode} |
| 538 |
% \end{macro} |
| 539 |
% |
| 540 |
% \begin{macro}{\doi} |
| 541 |
% \changes{1.5}{2007 Oct 30}{Add macro} |
| 542 |
% The |\doi| command is used in the modern \texttt{.bst} files, and is in fact |
| 543 |
% defined inside the |thebibliography| environment for these styles. However, |
| 544 |
% that means, it is undefined outside where |\bibentry| is used. So it is |
| 545 |
% necessary to provide a definition globally. |
| 546 |
% \begin{macrocode} |
| 547 |
\AtBeginDocument{\@ifpackageloaded{url} |
| 548 |
{\providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}} |
| 549 |
{\providecommand{\doi}[1]{doi: #1}}} |
| 550 |
%</package> |
| 551 |
% \end{macrocode} |
| 552 |
% \end{macro} |
| 553 |
% |
| 554 |
% \Finale |