| 1 |
% \def\filename{amsrefs.dtx} |
| 2 |
% \def\fileversion{2.14} |
| 3 |
% \def\filedate{2013/03/07} |
| 4 |
% |
| 5 |
% \iffalse meta-comment |
| 6 |
% |
| 7 |
% American Mathematical Society |
| 8 |
% Technical Support |
| 9 |
% Publications Technical Group |
| 10 |
% 201 Charles Street |
| 11 |
% Providence, RI 02904 |
| 12 |
% USA |
| 13 |
% tel: (401) 455-4080 |
| 14 |
% (800) 321-4267 (USA and Canada only) |
| 15 |
% fax: (401) 331-3842 |
| 16 |
% email: [email protected] |
| 17 |
% |
| 18 |
% Copyright 2001, 2004, 2006, 2007, 2010, 2012, 2013 American Mathematical Society. |
| 19 |
% |
| 20 |
% This work may be distributed and/or modified under the |
| 21 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 22 |
% of this license or (at your option) any later version. |
| 23 |
% The latest version of this license is in |
| 24 |
% http://www.latex-project.org/lppl.txt |
| 25 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 26 |
% version 2005/12/01 or later. |
| 27 |
% |
| 28 |
% This work has the LPPL maintenance status `maintained'. |
| 29 |
% |
| 30 |
% The Current Maintainer of this work is the American Mathematical |
| 31 |
% Society. |
| 32 |
% |
| 33 |
% \fi |
| 34 |
% |
| 35 |
% \iffalse |
| 36 |
%<*driver> |
| 37 |
\NeedsTeXFormat{LaTeX2e} |
| 38 |
\documentclass[draft,oneside]{amsdtx} |
| 39 |
|
| 40 |
\setcounter{secnumdepth}{3} |
| 41 |
\setcounter{tocdepth}{3} |
| 42 |
|
| 43 |
\DoNotIndex{\bib,\BibSpec,\@apply,\citesel,\cite@cj,\cite} |
| 44 |
\DoNotIndex{\IfOption,\add@toks@,\@emptytoks} |
| 45 |
|
| 46 |
\makeatletter |
| 47 |
\DeclareRobustCommand{\fld}{\category@index{field}} |
| 48 |
\DeclareRobustCommand{\btype}{\category@index{entry type}} |
| 49 |
\DeclareRobustCommand{\attr}{\category@index{attribute}} |
| 50 |
\makeatother |
| 51 |
|
| 52 |
%\OnlyDescription |
| 53 |
|
| 54 |
\usepackage{amsrefs} |
| 55 |
\usepackage{multicol} |
| 56 |
|
| 57 |
\newcommand{\rpack}[1]{\pkg{amsrefs} package} |
| 58 |
|
| 59 |
\newcommand{\MacroArgs}{% |
| 60 |
\par |
| 61 |
\medskip \noindent\emph{Arguments}: \par} |
| 62 |
|
| 63 |
\newcommand{\macroarg}[2]{ |
| 64 |
\texttt{\arg{#1} <- }\emph{#2}\unkern\texttt{.}\par} |
| 65 |
|
| 66 |
\newenvironment{bug}{% |
| 67 |
\quote |
| 68 |
\emph{Known bug:}} |
| 69 |
{\endquote} |
| 70 |
|
| 71 |
% Make this a self-contained document without separate .bbl file. |
| 72 |
\newcommand{\PrintBibliography}{% |
| 73 |
\begin{bibsection}\begin{biblist}\raggedright |
| 74 |
\bib{Jones2004}{article}{ |
| 75 |
author={Jones, David M.}, |
| 76 |
title={User's Guide to the \pkg{amsrefs} Package}, |
| 77 |
note={distributed with the \pkg{amsrefs} code} |
| 78 |
} |
| 79 |
\bib{SOS99}{book}{ |
| 80 |
author={Swanson, Ellen}, |
| 81 |
author={O'Sean, Arlene}, |
| 82 |
author={Schleyer, Antoinette}, |
| 83 |
title={Mathematics into Type}, |
| 84 |
edition={updated}, |
| 85 |
year={1999}, |
| 86 |
publisher={American Mathematical Society}, |
| 87 |
} |
| 88 |
\end{biblist}\end{bibsection} |
| 89 |
} |
| 90 |
|
| 91 |
\makeatletter |
| 92 |
|
| 93 |
\def\nametest#1{% |
| 94 |
\par |
| 95 |
\begingroup |
| 96 |
\let\EmptyNameWarning\relax |
| 97 |
\vdef\@tempa{#1}% |
| 98 |
{\tt author=\embrace\@tempa}: |
| 99 |
\name@split#1,,,\@nil |
| 100 |
G=\@showname{given} |
| 101 |
S=\@showname{surname} |
| 102 |
J=\@showname{jr}% |
| 103 |
\endgroup |
| 104 |
} |
| 105 |
|
| 106 |
\def\@showname#1{% |
| 107 |
{\ntt\lbracechar}% |
| 108 |
{\tt\@xp\macrotext\csname bib'#1\endcsname}% |
| 109 |
{\ntt\rbracechar} |
| 110 |
} |
| 111 |
|
| 112 |
\def\initialtest#1{% |
| 113 |
\par |
| 114 |
\begingroup |
| 115 |
\vdef\@tempa{#1}% |
| 116 |
{\tt author=\embrace\@tempa}: |
| 117 |
\name@split#1,,,\@nil |
| 118 |
I={\ntt\lbracechar}\csname bib'initials\endcsname{\ntt\rbracechar}% |
| 119 |
\endgroup |
| 120 |
} |
| 121 |
|
| 122 |
\makeatother |
| 123 |
|
| 124 |
\CodelineIndex |
| 125 |
|
| 126 |
\begin{document} |
| 127 |
\title{The \pkg{amsrefs} package} |
| 128 |
\author{Michael Downes and David M. Jones\\American Mathematical Society} |
| 129 |
\date{Version \fileversion, \filedate} |
| 130 |
\DocInput{amsrefs.dtx} |
| 131 |
\PrintIndex |
| 132 |
\end{document} |
| 133 |
%</driver> |
| 134 |
% \fi |
| 135 |
% |
| 136 |
% \MakeShortVerb{\|} |
| 137 |
% |
| 138 |
% \maketitle |
| 139 |
% |
| 140 |
% \tableofcontents |
| 141 |
% |
| 142 |
% \section{Introduction} |
| 143 |
% |
| 144 |
% The \rpack/ is a \latex/ package for bibliographies that provides an |
| 145 |
% archival data format similar to the format of \bibtex/ database |
| 146 |
% files, but adapted to make direct processing by \latex/ easier. The |
| 147 |
% package can be used either in conjunction with \bibtex/ or as a |
| 148 |
% replacement for \bibtex/. |
| 149 |
% |
| 150 |
% This document is written for anyone who wants to implement a new |
| 151 |
% bibliography style for \pkg{amsrefs} or who is just curious about |
| 152 |
% how the package is implemented. |
| 153 |
% The reader should be familiar with the contents of the ``User's |
| 154 |
% Guide to the \pkg{amsrefs} Package''~\cite{Jones2004} |
| 155 |
% (\fn{amsrdoc.tex}). |
| 156 |
% |
| 157 |
% For the publisher or implementor, the chief advantages of the |
| 158 |
% \rpack/ are as follows: |
| 159 |
% \begin{description} |
| 160 |
% |
| 161 |
% \item[Preservation of structure] |
| 162 |
% |
| 163 |
% The internal structural information of the bibliography entries is not |
| 164 |
% lost when they are imported from the database file into the \latex/ |
| 165 |
% document. This takes on its greatest significance when archiving |
| 166 |
% documents in \latex/ form or transmitting them to another user (such as a |
| 167 |
% publisher). |
| 168 |
% |
| 169 |
% \item[Deferred formatting] |
| 170 |
% |
| 171 |
% This means that the style of the bibliography can be readily changed |
| 172 |
% without reimporting everything from the original database(s). |
| 173 |
% |
| 174 |
% \item[Setup requires only \latex/ knowledge] |
| 175 |
% |
| 176 |
% All bibliography setup can be done in \latex/; learning another |
| 177 |
% programming language (such as the one used in \bibtex/ \fn{bst} |
| 178 |
% files) is unnecessary. |
| 179 |
% |
| 180 |
% \end{description} |
| 181 |
% |
| 182 |
% \section{Package options} |
| 183 |
% |
| 184 |
% In addition to the options documented in the user's guide, there |
| 185 |
% are a few additional options that were omitted either because |
| 186 |
% they are obsolete or deprecated options included only for |
| 187 |
% backwards compatability or because they are still considered |
| 188 |
% experimental and not yet ready for widespread use. |
| 189 |
% |
| 190 |
% \begin{description} |
| 191 |
% |
| 192 |
% \item[?] |
| 193 |
% |
| 194 |
% Informational option. This causes \pkg{amsrefs} to |
| 195 |
% display a pointer to the User's Guide on the terminal an in the |
| 196 |
% log file. (In previous versions, it displayed much more |
| 197 |
% material, including a summary of package options.) |
| 198 |
% |
| 199 |
% \item[traditional-quotes, logical-quotes] |
| 200 |
% |
| 201 |
% With the \textit{traditional quotes} option |
| 202 |
% (default), quotation marks produced by \cn{bibquotes} |
| 203 |
% (\secref{misc-cmds}) fall outside of other punctuation, ``like |
| 204 |
% this,'' whereas with the \textit{logical quotes} option the order |
| 205 |
% is reversed, ``like this''. |
| 206 |
% |
| 207 |
% \end{description} |
| 208 |
% |
| 209 |
% \section{More about the \cn{bib} command}\label{bib-command} |
| 210 |
% |
| 211 |
% \subsection{Field names for the \cn{bib} command} |
| 212 |
% |
| 213 |
% In addition to the fields discussed in the user's guide, the |
| 214 |
% following fields are used internally: |
| 215 |
% \begin{description} |
| 216 |
% |
| 217 |
% \item[fulljournal] |
| 218 |
% |
| 219 |
% Used internally by \cn{DefineJournal}. |
| 220 |
% |
| 221 |
% \item[name] |
| 222 |
% |
| 223 |
% Used internally by the \btype{name} bibliography type and |
| 224 |
% \cn{DefineName}. |
| 225 |
% |
| 226 |
% \item[transition] |
| 227 |
% |
| 228 |
% A dummy field used inside \cs{BibSpec}s when we want to force an |
| 229 |
% action unconditionally. |
| 230 |
% |
| 231 |
% \end{description} |
| 232 |
% |
| 233 |
% The following fields are included for backwards compatibility: |
| 234 |
% \begin{description} |
| 235 |
% |
| 236 |
% \item[institution, school] |
| 237 |
% |
| 238 |
% These are provided as aliases for \fld{organization} for |
| 239 |
% compatibility with \BibTeX. |
| 240 |
% |
| 241 |
% \item[place] |
| 242 |
% |
| 243 |
% A synonym for \fld{address}. In earlier versions of |
| 244 |
% \pkg{amsrefs}, \fld{place} was preferred and \fld{address} was |
| 245 |
% considered as an alias for \fld{place}. However, this seemed |
| 246 |
% like a gratuitous incompatibility with \BibTeX\ to me, so I have |
| 247 |
% reinstated \fld{address} as the primary field and \fld{place} is |
| 248 |
% now an undocumented alias. |
| 249 |
% |
| 250 |
% \end{description} |
| 251 |
% |
| 252 |
% The following fields are reserved for future use: |
| 253 |
% \begin{description} |
| 254 |
% |
| 255 |
% \item[doi] Digital Object Identifier |
| 256 |
% |
| 257 |
% \item[setup] |
| 258 |
% |
| 259 |
% This is a special field that can be used to give arbitrary |
| 260 |
% commands to be executed at the beginning of the current \cn{bib} |
| 261 |
% entry, after all the fields have been read. The idea is that one |
| 262 |
% can alter the formatting of an individual entry through this |
| 263 |
% field, to handle special cases. |
| 264 |
% |
| 265 |
% This is fully implemented, but I've been unable to think of any |
| 266 |
% good examples of its use; so, I've decided to suppress it until |
| 267 |
% such an example comes to light. |
| 268 |
% |
| 269 |
% \item[url] Universal Resource Locator. |
| 270 |
% |
| 271 |
% \end{description} |
| 272 |
% |
| 273 |
% \subsection{Bibliography entry types} |
| 274 |
% |
| 275 |
% The following additional entry types (or, really, pseudo-entry |
| 276 |
% types) are used internally by \pkg{amsrefs}: |
| 277 |
% \begin{description} |
| 278 |
% |
| 279 |
% \item[collection.article] |
| 280 |
% |
| 281 |
% \item[proceedings.article] |
| 282 |
% |
| 283 |
% \item[partial] |
| 284 |
% |
| 285 |
% \item[conference] |
| 286 |
% |
| 287 |
% \item[innerbook] |
| 288 |
% |
| 289 |
% \item[name] |
| 290 |
% |
| 291 |
% \item[nameLE] |
| 292 |
% |
| 293 |
% \item[nameBE] |
| 294 |
% |
| 295 |
% \item[nameinverted] |
| 296 |
% |
| 297 |
% \item[publisher] |
| 298 |
% |
| 299 |
% \end{description} |
| 300 |
% |
| 301 |
% The following are currently undocumented aliases for various of |
| 302 |
% the standard types: |
| 303 |
% \begin{description} |
| 304 |
% |
| 305 |
% \item[miscellaneous] |
| 306 |
% |
| 307 |
% \item[periodical] |
| 308 |
% |
| 309 |
% \end{description} |
| 310 |
% |
| 311 |
% \section{Customizing the bibliography style}\label{other-styles} |
| 312 |
% |
| 313 |
% If you use the \rpack/ as is, the bibliography style you get is the |
| 314 |
% kind of style customarily seen in AMS publications. The recommended |
| 315 |
% way to get a different bibliography style is to write a \latex/ |
| 316 |
% package which loads the \rpack/ with \cn{RequirePackage} and |
| 317 |
% then makes the desired changes by using suitable \cn{BibSpec} |
| 318 |
% commands as explained below. Thus, the general form of the custom |
| 319 |
% package will be |
| 320 |
% \begin{verbatim} |
| 321 |
% \ProvidesPackage{xyzbib}[2002/11/06 v1.28] |
| 322 |
% |
| 323 |
% \RequirePackage{amsrefs}\relax |
| 324 |
% |
| 325 |
% \BibSpec{article}{ |
| 326 |
% ... |
| 327 |
% } |
| 328 |
% |
| 329 |
% \BibSpec{book}{ |
| 330 |
% ... |
| 331 |
% } |
| 332 |
%\end{verbatim} |
| 333 |
% |
| 334 |
% The interior formatting within entries is specified by \cn{BibSpec} |
| 335 |
% commands, one for each entry type. To illustrate, let's look at an |
| 336 |
% example style specification for entries of type \btype{article}: |
| 337 |
% \begin{verbatim} |
| 338 |
% \BibSpec{article}{% |
| 339 |
% +{}{\PrintAuthors} {author} |
| 340 |
% +{,}{ \textit} {title} |
| 341 |
% +{,}{ } {journal} |
| 342 |
% +{}{ \textbf} {volume} |
| 343 |
% +{}{ \parenthesize} {date} |
| 344 |
% +{,}{ } {pages} |
| 345 |
% +{,}{ } {note} |
| 346 |
% +{.}{} {transition} |
| 347 |
% +{}{ } {review} |
| 348 |
% } |
| 349 |
%\end{verbatim} |
| 350 |
% |
| 351 |
% It should be pretty obvious that each line specifies the formatting |
| 352 |
% for a particular field. After reading the data for a particular |
| 353 |
% \cn{bib} command, \latex/ steps through the style specification and |
| 354 |
% for each |
| 355 |
% field listed, prints the field with the given formatting \emph{if |
| 356 |
% and only if the field has a nonempty value}. The \verb'+' character |
| 357 |
% at the beginning of each field specification must be followed by three |
| 358 |
% arguments: the punctuation to be added if the field is nonempty; |
| 359 |
% space and/or other material to be added after the punctuation; and |
| 360 |
% the field name. It is permissible for the second part to end with a |
| 361 |
% command that takes an argument, such as \cn{textbf}, in which case |
| 362 |
% it will receive the field's value as its argument. By defining a |
| 363 |
% suitable command and using it here you can place material after the |
| 364 |
% field contents as well as before; \cn{parenthesize} is an example |
| 365 |
% of this. |
| 366 |
% |
| 367 |
% The reason that the punctuation and the following space are specified |
| 368 |
% separately is that between them there is a crucial boundary for line |
| 369 |
% breaks. If you put a \cn{linebreak} command at the end of a field value, |
| 370 |
% the break point will actually be carried onward to a suitable point after |
| 371 |
% the next bit of punctuation (whose actual value may vary depending on |
| 372 |
% which of the following fields is the first to turn up with a nonempty |
| 373 |
% value). |
| 374 |
% |
| 375 |
% The meaning of the \cn{parenthesize} command, supplied by |
| 376 |
% \pkg{amsrefs}, should be obvious. The meaning of the \cn{PrintAuthors} |
| 377 |
% command is a different story. But I don't think it is all that hard to |
| 378 |
% understand. If we have two or more author names which were given |
| 379 |
% separately, |
| 380 |
% and we need to combine them into a conventional name list using commas |
| 381 |
% and the word \qq{and}, then it would be nice if we had a command which |
| 382 |
% could take a list of names and Do The Right Thing. And that is just |
| 383 |
% what \cn{PrintAuthors} is. |
| 384 |
% |
| 385 |
% The \pkg{rkeyval} package allows keys to be defined as additive: if the |
| 386 |
% key occurs more than once, each successive value will be concatenated to |
| 387 |
% the previous value, along with a prefix. The setup done by |
| 388 |
% \pkg{amsrefs} for the \fld{author} field is |
| 389 |
% \begin{verbatim} |
| 390 |
% \DefineAdditiveKey{bib}{author}{\name} |
| 391 |
%\end{verbatim} |
| 392 |
% This means that if two names are given, as in |
| 393 |
% \begin{verbatim} |
| 394 |
% author={Bertram, A.}, |
| 395 |
% author={Wentworth, R.}, |
| 396 |
%\end{verbatim} |
| 397 |
% then the final value of the \fld{author} field seen when \latex/ |
| 398 |
% processes the style specification will be |
| 399 |
% \begin{verbatim} |
| 400 |
% \name{Bertram, A.}\name{Wentworth, R.} |
| 401 |
%\end{verbatim} |
| 402 |
% |
| 403 |
% The \fld{transition} field in our \cn{BibSpec} example is a dummy |
| 404 |
% field to be |
| 405 |
% used when punctuation or other material must be added at a certain point |
| 406 |
% in the bibliography without regard to the emptiness or non-emptiness of |
| 407 |
% the fields after it. The \fld{transition} field always tests as non-empty |
| 408 |
% but has no printed content. So when you use it you always get the |
| 409 |
% indicated punctuation and space at the indicated point in the list of |
| 410 |
% fields. If it were the last thing in this \cn{BibSpec} example, it could |
| 411 |
% serve just to put in the final period that is always wanted. But in AMS |
| 412 |
% bibliographies, if a \emph{Mathematical Reviews} reference is given, it is |
| 413 |
% conventionally printed \emph{after} the final period. Using the |
| 414 |
% \fld{transition} field as shown here ensures that the final period will |
| 415 |
% be always printed, even when the \fld{review} field is empty. |
| 416 |
% |
| 417 |
% \section{Miscellaneous commands provided by the \pkg{amsrefs} |
| 418 |
% package}\label{misc-cmds} |
| 419 |
% |
| 420 |
% Most of the following commands are helper commands for use in |
| 421 |
% \cn{BibSpec} statements. The others are intended for use in bibliography |
| 422 |
% data. |
| 423 |
% \begin{description} |
| 424 |
% |
| 425 |
% \item[\cn{parenthesize}]\SpecialUsageIndex{\parenthesize} |
| 426 |
% This command adds parentheses around its |
| 427 |
% argument. It is useful in \cn{BibSpec} statements because there is no |
| 428 |
% special provision for adding material after the field value. |
| 429 |
% |
| 430 |
% \item[\cn{bibquotes}]\SpecialUsageIndex{\bibquotes} |
| 431 |
% This command is much like \cn{parenthesize} but |
| 432 |
% it adds quotes around its argument and it has one other important |
| 433 |
% difference: there are special arrangements to print the closing quote |
| 434 |
% \emph{after} a following comma or similar punctuation (unless the |
| 435 |
% \pkg{amsrefs} package is invoked with the \opt{logical-quotes} option, |
| 436 |
% in which case \cn{bibquotes} puts the closing quote immediately after |
| 437 |
% the quoted material). |
| 438 |
% |
| 439 |
% \item[\cn{voltext}]\SpecialUsageIndex{\voltext} |
| 440 |
% This is used to format volume numbers. By default, it precedes |
| 441 |
% the volume number by ``vol.'' |
| 442 |
% |
| 443 |
% \item[\cn{issuetext}]\SpecialUsageIndex{\issuetext} |
| 444 |
% This is used to format issue numbers. By default, it precedes |
| 445 |
% the volume number by ``no.'' |
| 446 |
% |
| 447 |
% \item[\cn{editiontext}]\SpecialUsageIndex{\editiontext} |
| 448 |
% This command produces ``ed.''\ following an |
| 449 |
% edition number. See \cn{PrintEdition} for more information. |
| 450 |
% |
| 451 |
% \item[\cn{DashPages}]\SpecialUsageIndex{\DashPages} |
| 452 |
% This command is similar in spirit to |
| 453 |
% \cn{voltext} but more complicated in its implementation. It takes |
| 454 |
% one argument which is expected to contain one or more page numbers |
| 455 |
% or a range of page numbers. The argument is printed with a prefix |
| 456 |
% of \qq{p.} if it seems to be a single page number, otherwise with a |
| 457 |
% prefix of \qq{pp.}. |
| 458 |
% |
| 459 |
% \item[\cn{tsup}, \cn{tsub}, \cn{tprime}]\SpecialUsageIndex{\tsup} |
| 460 |
% \SpecialUsageIndex{\tsub}\SpecialUsageIndex{\prime} |
| 461 |
% These are for text subscripts |
| 462 |
% and superscripts, with \cn{tprime} producing a superscript prime |
| 463 |
% symbol. Unlike the standard \cn{textsuperscript} and |
| 464 |
% \cn{textsubscript} functions provided by \latex/, these do not use |
| 465 |
% math mode at all.\footnote{There is one drawback: If you don't |
| 466 |
% want to get the prime symbol for \cn{tprime} from the \fnt{cmsy} |
| 467 |
% font, you will need to redefine \cn{tprime} in some suitable |
| 468 |
% way.} |
| 469 |
% |
| 470 |
% \item[\cn{nopunct}]\SpecialUsageIndex{\nopunct} |
| 471 |
% This command causes following punctuation to be omitted if it is |
| 472 |
% added with the internal function \cs{@addpunct}. |
| 473 |
% |
| 474 |
% \item[\cn{PrintPrimary}]\SpecialUsageIndex{\PrintPrimary} |
| 475 |
% This is a relatively complicated function that determines the |
| 476 |
% ``primary'' contributors for an entry and formats them, or |
| 477 |
% replaces them by \cn{sameauthors} if appropriate. It should be |
| 478 |
% used when an entry type might have editors or translators instead |
| 479 |
% of authors. It prefers authors over editors and editors over |
| 480 |
% translators and generates a warning if there are no primary |
| 481 |
% contributors. |
| 482 |
% |
| 483 |
% \item[\cn{PrintAuthors}]\SpecialUsageIndex{\PrintAuthors} |
| 484 |
% This is used to format the list of authors as the primary |
| 485 |
% contributors for an entry type. |
| 486 |
% |
| 487 |
% \item[\cn{PrintEditorsA}]\SpecialUsageIndex{\PrintEditorsA} |
| 488 |
% This is similar to \cn{PrintAuthors} but adds |(ed.)| or |(eds.)| |
| 489 |
% following the editors. |
| 490 |
% |
| 491 |
% \item[\cn{PrintEditorsB}]\SpecialUsageIndex{\PrintEditorsB} |
| 492 |
% This is similar to \cn{PrintEditorsA} but puts parentheses around |
| 493 |
% the entire list of editors. It's used by, for example, the |
| 494 |
% \btype{article} type to print the editors of a |
| 495 |
% \btype{proceedings} or \btype{collection}. |
| 496 |
% |
| 497 |
% \item[\cn{PrintEditorsC}]\SpecialUsageIndex{\PrintEditorsC} |
| 498 |
% Similar to \cn{PrintEditorsA} but precedes the editors by |
| 499 |
% |Edited by|. It's used when the editors should be treated as |
| 500 |
% subsidiary contributors, rather than the primary contributor. |
| 501 |
% |
| 502 |
% \item[\cn{PrintTranslatorsA}]\SpecialUsageIndex{\PrintTranslatorsA} |
| 503 |
% This is similar to \cn{PrintEditorsA} but adds |(trans.)| |
| 504 |
% following the translators. |
| 505 |
% |
| 506 |
% \item[\cn{PrintTranslatorsB}]\SpecialUsageIndex{\PrintTranslatorsB} |
| 507 |
% This is similar to \cn{PrintEditorsB}. It's not currently used, |
| 508 |
% but is provided for symmetry. |
| 509 |
% |
| 510 |
% \item[\cn{PrintTranslatorsC}]\SpecialUsageIndex{\PrintTranslatorsC} |
| 511 |
% Similar to \cn{PrintEditorsC} but precedes the translators by |
| 512 |
% |Translated by|. |
| 513 |
% |
| 514 |
% \item[\cn{sameauthors}]\SpecialUsageIndex{\sameauthors} |
| 515 |
% This is a function of one argument. If you use |
| 516 |
% the default set of \cn{BibSpec}s from the \pkg{amsrefs}, |
| 517 |
% \cn{sameauthors} is applied to the author name for a given \cn{bib} |
| 518 |
% command if it matches exactly the author name of the preceding |
| 519 |
% \cn{bib} command. Change the definition of \cn{sameauthors} if you |
| 520 |
% don't want to get a bysame dash. |
| 521 |
% |
| 522 |
% \item[\cn{bysame}]\SpecialUsageIndex{\bysame} |
| 523 |
% This is a horizontal rule of length 3~em. The default |
| 524 |
% definition of \cn{sameauthors} prints \cn{bysame} instead of the |
| 525 |
% author names. |
| 526 |
% |
| 527 |
% \item[\cn{Plural}, \cn{SingularPlural}]\SpecialUsageIndex{\Plural} |
| 528 |
% \SpecialUsageIndex{\SingularPlural} |
| 529 |
% These are helper functions |
| 530 |
% that allow you to conditionally |
| 531 |
% print singular or plural forms such as \verb'(ed.)' or \verb'(eds.)' |
| 532 |
% depending on the number of names in the current name list. |
| 533 |
% The definition of \cn{PrintEditorsA} reads, in part, |
| 534 |
% \begin{verbatim} |
| 535 |
% ... (ed\Plural{s}.) ... |
| 536 |
%\end{verbatim} |
| 537 |
% |
| 538 |
% \item[\cn{PrintReviews}]\SpecialUsageIndex{\PrintReviews} |
| 539 |
% This is similar to \cn{AuthorList} but is used for |
| 540 |
% printing (possibly multiple) MR numbers given in the \fld{review} |
| 541 |
% field. |
| 542 |
% |
| 543 |
% \item[\cn{BibField}]\SpecialUsageIndex{\BibField} |
| 544 |
% This is for more complicated programming tasks such |
| 545 |
% as may be necessary for some \cn{BibSpec}s. It takes one |
| 546 |
% argument, a field name, and yields the contents of that field for |
| 547 |
% the current \cn{bib} entry. |
| 548 |
% |
| 549 |
% \item[\cn{IfEmptyBibField}]\SpecialUsageIndex{\IfEmptyBibField} |
| 550 |
% If one writes |
| 551 |
% \begin{verbatim} |
| 552 |
% \IfEmptyBibField{isbn}{A}{B} |
| 553 |
%\end{verbatim} |
| 554 |
% then the commands in A will be executed if the \fld{isbn} field is empty, |
| 555 |
% otherwise the commands in B. |
| 556 |
% |
| 557 |
% \item[\cn{PrintEdition}]\SpecialUsageIndex{\PrintEdition} |
| 558 |
% If a bibliography entry has |
| 559 |
% \begin{verbatim} |
| 560 |
% edition={2} |
| 561 |
%\end{verbatim} |
| 562 |
% and the \cn{BibSpec} used \cn{PrintEdition} to handle this field, then the |
| 563 |
% edition information will be printed as \qq{2nd ed.}\mdash that is, the |
| 564 |
% number is converted to cardinal form and \qq{ed.} is added (taken from |
| 565 |
% \cn{editiontext}). |
| 566 |
% |
| 567 |
% \item[\cn{CardinalNumeric}]\SpecialUsageIndex{\CardinalNumeric} |
| 568 |
% This provides the conversion to cardinal |
| 569 |
% number form used by \cn{PrintEdition}. |
| 570 |
% |
| 571 |
% \item[\cn{PrintDate}, \cn{PrintYear}]\SpecialUsageIndex{\PrintDate} |
| 572 |
% \SpecialUsageIndex{\PrintYear} |
| 573 |
% These functions convert a date in |
| 574 |
% canonical form (ISO 8601) to the form required by the current |
| 575 |
% bibliography style. You can get your preferred date form by |
| 576 |
% redefining these functions or by changing your \cn{BibSpec} statements |
| 577 |
% to use another function of your own devising. The original definition |
| 578 |
% of \cn{PrintDate} adds parentheses (as for the year of a journal article |
| 579 |
% in normal AMS style), whereas the \cn{PrintYear} function simply |
| 580 |
% prints the year without any additional material (as for a book's year |
| 581 |
% of publication in normal AMS style). |
| 582 |
% |
| 583 |
% \item[\cn{mdash}, \cn{ndash}]\SpecialUsageIndex{\mdash} |
| 584 |
% \SpecialUsageIndex{\ndash} |
| 585 |
% These are short forms for \cn{textemdash} |
| 586 |
% and \cn{textendash}, recommended instead of the more usual \verb'---' |
| 587 |
% and \verb'--' notation. From the \pkg{textcmds} package. |
| 588 |
% |
| 589 |
% \item[et cetera \dots] [mjd,2002-01-03] See the \fn{.dtx} files for |
| 590 |
% further possibilities that I have not managed to get properly |
| 591 |
% documented yet! |
| 592 |
% \end{description} |
| 593 |
% |
| 594 |
% \StopEventually{\PrintBibliography} |
| 595 |
% \iffalse |
| 596 |
% \clearpage |
| 597 |
% \typeout{@@@ That was the last page of the OnlyDescription} |
| 598 |
% \fi |
| 599 |
% |
| 600 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 601 |
% \section{Implementation} |
| 602 |
% |
| 603 |
% \subsection{Overview} |
| 604 |
% |
| 605 |
% It will be a while yet before we get to any actual code. First we |
| 606 |
% need to understand what the code needs to accomplish in order to |
| 607 |
% provide the user interface described above in a way that is as |
| 608 |
% compatible as possible with existing \latex/ mechanisms. |
| 609 |
% |
| 610 |
% \subsubsection{Normal \latex/ processing of cites} |
| 611 |
% |
| 612 |
% \paragraph{First \latex/ pass} |
| 613 |
% |
| 614 |
% Various commands are written to the \fn{.aux} file that are |
| 615 |
% mostly used by \bibtex/. |
| 616 |
% \begin{enumerate} |
| 617 |
% \item A \cnm{cite}{moo} command writes one line to the \fn{.aux} file: |
| 618 |
% \cnm{citation}{moo}. This indicates to \bibtex/ that it should |
| 619 |
% include `moo' in the list of cited items to be searched for. |
| 620 |
% The \cn{cite} command also checks to see if \cs{b@moo} contains |
| 621 |
% the corresponding citation label, but since this is the first |
| 622 |
% pass, the label won't be known yet, so \latex/ emits an `Undefined |
| 623 |
% citation' warning and prints a placeholder (i.e., \textbf{???}) |
| 624 |
% instead of the citation label. |
| 625 |
% |
| 626 |
% \item A \cnm{bibliographystyle}{har} command writes one line to the |
| 627 |
% \fn{.aux} file: \cnm{bibstyle}{har}. This indicates to \bibtex/ that it |
| 628 |
% should use \fn{har.bst} to determine the style for sorting and |
| 629 |
% formatting the bibliography items. |
| 630 |
% |
| 631 |
% \item A \cnm{bibliography}{hij,klm,...} command writes one line to the |
| 632 |
% \fn{.aux} file: \cnm{bibdata}{hij,klm,...}. This indicates to \bibtex/ |
| 633 |
% that it should look in \fn{hij.bib}, \fn{klm.bib}, \dots\ for |
| 634 |
% bibliographic data. The \cn{bibliography} also tries to input |
| 635 |
% the \fn{.bbl} file, but on the first pass it won't exist |
| 636 |
% yet. |
| 637 |
% |
| 638 |
% \end{enumerate} |
| 639 |
% |
| 640 |
% On the first pass all \cn{cite}'s normally are reported as |
| 641 |
% undefined because the \fn{.bbl} file has not yet been created. |
| 642 |
% |
| 643 |
% \paragraph{\bibtex/ pass} |
| 644 |
% |
| 645 |
% For a document named \fn{xyz.tex}, the command \verb'bibtex xyz' is |
| 646 |
% used to invoke \bibtex/. It looks in \fn{xyz.aux} to find the |
| 647 |
% citation information written there by \latex/. For each \cn{citation} line, |
| 648 |
% \bibtex/ searches for a corresponding entry in the specified |
| 649 |
% \fn{.bib} files and formats it. The entire list is then sorted in |
| 650 |
% whatever way dictated by the bibliography style, and written out to |
| 651 |
% the file \fn{xyz.bbl}. This normally produces entries that look |
| 652 |
% something like: |
| 653 |
% \begin{verbatim} |
| 654 |
% \bibitem{BGL} P. Busch, M. Grabowski and P. J. Lahti: |
| 655 |
% {\it Operational Quantum Physics.} |
| 656 |
% Springer Verlag, New York (1995). |
| 657 |
%\end{verbatim} |
| 658 |
% |
| 659 |
% \paragraph{Second \latex/ pass} |
| 660 |
% |
| 661 |
% Now the \fn{.bbl} file exists and contains some \cn{bibitem} |
| 662 |
% commands. At \cnm{begin}{document}, \latex/ reads the \fn{.aux} file, |
| 663 |
% hoping to find some \cn{bibcite} commands, but it will not find |
| 664 |
% them until the next time around. \cn{citation}, \cn{bibstyle}, and |
| 665 |
% \cn{bibdata} commands in the \fn{.aux} file are simply ignored by \latex/. |
| 666 |
% Then \latex/ proceeds to typeset the body of the document. |
| 667 |
% \begin{enumerate} |
| 668 |
% \item Instances of \cn{cite} still print question marks. |
| 669 |
% |
| 670 |
% \item The \cn{bibliography} command causes \latex/ to input \fn{xyz.bbl} |
| 671 |
% and typeset its contents. |
| 672 |
% |
| 673 |
% \item A \cnm{bibitem}{moo} command writes one line to the |
| 674 |
% \fn{.aux} file: \cnmm{bibcite}{moo}{9}, where 9 is the current item |
| 675 |
% number. |
| 676 |
% |
| 677 |
% \item A \cnom{bibitem}[Moody]{moo} command writes one line to the |
| 678 |
% \fn{.aux} file: \cnmm{bibcite}{moo}{Moody}, using the supplied label |
| 679 |
% instead of a number. |
| 680 |
% |
| 681 |
% \end{enumerate} |
| 682 |
% |
| 683 |
% \paragraph{Third \latex/ pass} |
| 684 |
% |
| 685 |
% Now the \fn{.aux} file contains some \cn{bibcite} commands. Once again, |
| 686 |
% \latex/ reads the \fn{.aux} file when it reaches \cnm{begin}{document}. |
| 687 |
% \begin{enumerate} |
| 688 |
% |
| 689 |
% \item A \cnmm{bibcite}{moo}{Moody} causes \latex/ to define \cs{b@moo} |
| 690 |
% with `Moody' as the replacement text. |
| 691 |
% |
| 692 |
% \item If two \cn{bibcite} commands have the same citation key, \latex/ |
| 693 |
% gives a warning message. This happens at \cnm{begin}{document}, |
| 694 |
% during the reading of the \fn{.aux} file. |
| 695 |
% |
| 696 |
% \item Instances of \cn{cite} in the body of the document will print |
| 697 |
% the appropriate labels obtained from the \fn{.aux} file. |
| 698 |
% |
| 699 |
% \item If there are any \cn{cite} commands for which the \fn{.aux} file did |
| 700 |
% not have a \cn{bibcite} command, \latex/ will give an `Undefined |
| 701 |
% citation' warning. This often happens if the \fn{.aux} file is incomplete |
| 702 |
% due to a \TeX{} error on the preceding pass. |
| 703 |
% \end{enumerate} |
| 704 |
% |
| 705 |
% \subsection{How cites are processed by \pkg{amsrefs}} |
| 706 |
% |
| 707 |
% In order to support its additional features (e.g., author-year |
| 708 |
% citations and the \opt{backrefs} option), the \rpack/ stores additional |
| 709 |
% information for each cite in the macro \cs{b@whatever}. Instead of |
| 710 |
% simply using the defined or undefined status of this macro to |
| 711 |
% trigger the standard warnings, we add some boolean flags to allow |
| 712 |
% us to discriminate more finely what the current situation is. |
| 713 |
% \begin{itemize} |
| 714 |
% \item Each time an item is cited in the body of the document, a |
| 715 |
% \texttt{backref} entry is added to the info of that item. The |
| 716 |
% \texttt{backref} info |
| 717 |
% is the current page and section location. Section location is a bit |
| 718 |
% hard to get right without better support from the document class. |
| 719 |
% So we provide a hook to allow it to work better when the support is |
| 720 |
% there. |
| 721 |
% |
| 722 |
% \item When a cite occurs, if the info is undefined then a warning is |
| 723 |
% issued and the info structure is created. A \cs{citation} command |
| 724 |
% and a \cs{citedest} command (providing backref info) are written to |
| 725 |
% the \fn{.aux} file. Because the backref info includes page number, it has |
| 726 |
% to be a non-immediate write. |
| 727 |
% |
| 728 |
% An undefined info structure would normally happen only on a first |
| 729 |
% pass when no \fn{.aux} file exists, or when a new cite is added. |
| 730 |
% I.e., when the corresponding \cs{citation} command is not yet |
| 731 |
% present in the \fn{.aux} file. |
| 732 |
% |
| 733 |
% \item When a citation command occurs in the \fn{.aux} file, it initializes |
| 734 |
% the info structure if necessary, setting the ``bib-info-present'' |
| 735 |
% flag to 0. |
| 736 |
% |
| 737 |
% \item When a \cs{citedest} command occurs in the \fn{.aux} file, it |
| 738 |
% initializes the info structure if necessary---but this shouldn't |
| 739 |
% happen: if the corresponding \cs{citation} command did not already |
| 740 |
% get processed, then something is wrong. So normally, the |
| 741 |
% \cs{citedest} command merely needs to add its backref info to the |
| 742 |
% existing info structure. |
| 743 |
% |
| 744 |
% \item When a \cs{bibcite} command occurs in the \fn{.aux} file, it will |
| 745 |
% normally find that \cs{b@whatever} is already defined, if the |
| 746 |
% bibliography occurs after all the \cn{cite} commands. What it must |
| 747 |
% do is fill in the appropriate blank slots in the info structure |
| 748 |
% set up by a previous \cs{citation} command. |
| 749 |
% |
| 750 |
% \item The \fn{.aux} file is actually processed two times, once at the |
| 751 |
% beginning of the document and once at the end. In the latter case, |
| 752 |
% \cs{bibcite} should give a warning if the backref-list is empty, |
| 753 |
% since that means there were no \cn{cite} commands for the given |
| 754 |
% key. |
| 755 |
% |
| 756 |
% \item When processing the bibliography: The \cn{bib} command needs to |
| 757 |
% check if it is using a key that is already used by another \cn{bib} |
| 758 |
% command. |
| 759 |
% \end{itemize} |
| 760 |
% |
| 761 |
% We therefore have |
| 762 |
% \begin{verbatim} |
| 763 |
% \b@xyz -> \citesel 00{label}{year}{backref-list} |
| 764 |
%\end{verbatim} |
| 765 |
% where the first~0 is replaced by~1 if there has already been another |
| 766 |
% citation for the same key earlier in the document (some citation |
| 767 |
% styles use abbreviated forms for all instances after the first), |
| 768 |
% and the second~0 is replaced by~1 if the same key was already |
| 769 |
% used by an earlier \cn{bib} command. |
| 770 |
% |
| 771 |
% Because the backref-list often includes page number information, it |
| 772 |
% cannot be built on the fly as we go along; instead we have to write |
| 773 |
% the information to the \fn{.aux} file and read it in at the beginning of |
| 774 |
% the next run. |
| 775 |
% |
| 776 |
% If there was no \cs{bibcite} in the \fn{.aux} file for a given key, then |
| 777 |
% the info is |
| 778 |
% \begin{verbatim} |
| 779 |
% \b@xyz -> \citesel 00{}{}{backref-list} |
| 780 |
%\end{verbatim} |
| 781 |
% If there was neither \cs{citation} nor \cs{bibcite} in the \fn{.aux} file |
| 782 |
% for a given key, then the \cn{cite} command should find that |
| 783 |
% \ncn{b@xyz} is undefined. |
| 784 |
% |
| 785 |
% If the author-year option is in effect, the \qq{label} contains |
| 786 |
% the author last names instead of a label: |
| 787 |
% \begin{verbatim} |
| 788 |
% \b@xyz -> \citesel 00{\name{Smith}\name{Jones}}{...}{...} |
| 789 |
%\end{verbatim} |
| 790 |
% Full name information is included in the data because some citation |
| 791 |
% styles give full names at the first citation and abbreviated forms |
| 792 |
% for subsequent instances. |
| 793 |
% |
| 794 |
% \subsection{Data structures} |
| 795 |
% |
| 796 |
% The result of scanning the key/value pairs of a \cn{bib} command is |
| 797 |
% an assignment statement for \cs{rsk@toks}. (Cf.\@ the \pkg{rkeyval} |
| 798 |
% package.) For example, consider the entry |
| 799 |
% \begin{verbatim} |
| 800 |
% \bib{miller83}{article}{ |
| 801 |
% author={Miller, G.}, |
| 802 |
% title={Eine Bemerkung zur Darstellung von Polynomen \"{u}ber |
| 803 |
% Verb\"{a}nden}*{language={german}}, |
| 804 |
% journal={J. Math. Sent.}, |
| 805 |
% volume={10}, |
| 806 |
% year={1983}, |
| 807 |
% pages={26\ndash 30}, |
| 808 |
% } |
| 809 |
%\end{verbatim} |
| 810 |
% The scanned result is to assign |
| 811 |
% \begin{verbatim} |
| 812 |
% \global\rsk@toks{% |
| 813 |
% \set:bib'author{Miller, G.}{}% |
| 814 |
% \set:bib'title{Eine Bemerkung zur Darstellung von Polynomen |
| 815 |
% \"{u}ber Verb\"{a}nden}{language={german}}% |
| 816 |
% \set:bib'journal{J. Math. Sent.}{}% |
| 817 |
% \set:bib'volume{10}{}% |
| 818 |
% \set:bib'year{1983}{}% |
| 819 |
% \set:bib'pages{26\ndash 30}{}% |
| 820 |
% } |
| 821 |
%\end{verbatim} |
| 822 |
% The code in the last arg of \cn{RestrictedSetKeys} then invokes |
| 823 |
% \cs{bib@exec} to do something with the value of \cs{rsk@toks}. |
| 824 |
% \begin{verbatim} |
| 825 |
% \bib@exec{miller83}{\the\rsk@toks}{\setbib@article}{} |
| 826 |
%\end{verbatim} |
| 827 |
% |
| 828 |
% \subsection{Preliminaries} |
| 829 |
% |
| 830 |
% \begin{macrocode} |
| 831 |
%<*pkg> |
| 832 |
% \end{macrocode} |
| 833 |
% |
| 834 |
% Standard declaration of package name and date. |
| 835 |
% \begin{macrocode} |
| 836 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 837 |
\ProvidesPackage{amsrefs}[2013/03/07 v2.14] |
| 838 |
% \end{macrocode} |
| 839 |
% |
| 840 |
% \begin{macro}{\amsrefs@warning@nl} |
| 841 |
% \begin{macrocode} |
| 842 |
\def\amsrefs@warning@nl{\PackageWarningNoLine{amsrefs}} |
| 843 |
% \end{macrocode} |
| 844 |
% \end{macro} |
| 845 |
% |
| 846 |
% Backward handling for beta and jpa options. |
| 847 |
% \begin{macrocode} |
| 848 |
\@ifpackagewith{amsrefs}{beta}{% |
| 849 |
\amsrefs@warning@nl{The beta option is obsolete}% |
| 850 |
}{} |
| 851 |
\@ifpackagewith{amsrefs}{jpa}{% |
| 852 |
\amsrefs@warning@nl{The jpa option is obsolete}% |
| 853 |
}{} |
| 854 |
% \end{macrocode} |
| 855 |
% |
| 856 |
% \begin{macrocode} |
| 857 |
\IfFileExists{url.sty}{% |
| 858 |
\RequirePackage{url}\relax |
| 859 |
\@gobble |
| 860 |
}{% |
| 861 |
\@firstofone |
| 862 |
} |
| 863 |
{ |
| 864 |
\DeclareRobustCommand{\url}[1]{% |
| 865 |
\def\@tempa{#1}% |
| 866 |
\texttt{\@urlsetup $\expandafter\strip@prefix\meaning\@tempa$}% |
| 867 |
}% |
| 868 |
\def\@urlsetup{% |
| 869 |
\check@mathfonts \textfont\@ne\the\font \textfont\z@\the\font |
| 870 |
\@apply\@urlfix{\do\+\do\=\do\:\do\-\do\.\do\,\do\;}% |
| 871 |
\@apply\@urlbreak{\do\&\do\/\do\?}% |
| 872 |
}% |
| 873 |
\def\@urlbreak#1{% |
| 874 |
\mathcode`#1="8000 |
| 875 |
\begingroup \lccode`\~=`#1 \lowercase{\endgroup \edef~}% |
| 876 |
{\mathchar\number`#1\penalty\hyphenpenalty}% |
| 877 |
}% |
| 878 |
\def\@urlfix#1{% |
| 879 |
\mathcode`#1=`#1\relax |
| 880 |
}% |
| 881 |
} |
| 882 |
% \end{macrocode} |
| 883 |
% |
| 884 |
% \begin{macrocode} |
| 885 |
\@ifundefined{NormalCatcodes}{\RequirePackage{pcatcode}\relax}{} |
| 886 |
\PushCatcodes\NormalCatcodes |
| 887 |
% \end{macrocode} |
| 888 |
% |
| 889 |
% \begin{macrocode} |
| 890 |
%% WARNING WARNING WARNING: Catcode of apostrophe ' is letter |
| 891 |
%% throughout this file. |
| 892 |
\catcode`\'=11 % letter |
| 893 |
% \end{macrocode} |
| 894 |
% |
| 895 |
% \subsection{Utilities} |
| 896 |
% |
| 897 |
% Some of these useful functions are also found in AMS |
| 898 |
% document classes. |
| 899 |
% |
| 900 |
% \begin{macro}{\after@deleting@token} |
| 901 |
% Similar in concept to \cs{afterassignment}, except it deletes the |
| 902 |
% next token in the stream before putting its argument |
| 903 |
% back into the input. Useful for skipping past tokens during |
| 904 |
% parsing. |
| 905 |
% \begin{macrocode} |
| 906 |
\def\after@deleting@token#1{% |
| 907 |
\afterassignment#1% |
| 908 |
\let\@let@token= % Don't delete this space! |
| 909 |
} |
| 910 |
% \end{macrocode} |
| 911 |
% \end{macro} |
| 912 |
% |
| 913 |
% \begin{macro}{\@ifempty} |
| 914 |
% \begin{macro}{\@ifnotempty} |
| 915 |
% Some frequently used tests for empty arguments. Note that an |
| 916 |
% argument consisting entirely of spaces (e.g., |
| 917 |
% \verb*|\@ifempty{ }|) counts as empty. |
| 918 |
% \begin{macrocode} |
| 919 |
\long\def\@ifempty#1{\@xifempty#1@@..\@nil} |
| 920 |
|
| 921 |
\long\def\@xifempty#1#2@#3#4#5\@nil{% |
| 922 |
\ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi |
| 923 |
} |
| 924 |
|
| 925 |
\long\def\@ifnotempty#1{\@ifempty{#1}{}} |
| 926 |
% \end{macrocode} |
| 927 |
% \end{macro} |
| 928 |
% \end{macro} |
| 929 |
% |
| 930 |
% \begin{macro}{\macrotext} |
| 931 |
% \begin{macrocode} |
| 932 |
\def\macrotext{\expandafter\strip@prefix\meaning} |
| 933 |
% \end{macrocode} |
| 934 |
% \end{macro} |
| 935 |
% |
| 936 |
% \begin{macro}{\vdef} |
| 937 |
% ``Verbatim'' def. |
| 938 |
% \begin{macrocode} |
| 939 |
\def\vdef#1#2{% |
| 940 |
\def#1{#2}% |
| 941 |
\edef#1{\macrotext#1}% |
| 942 |
} |
| 943 |
% \end{macrocode} |
| 944 |
% \end{macro} |
| 945 |
% |
| 946 |
% \begin{macro}{\auto@protect} |
| 947 |
% Sometimes it's convenient to render a given control sequence |
| 948 |
% unexpandable for a time. \cs{auto@protect} provides a way to do |
| 949 |
% that.\footnote{There really should be a special name for macros |
| 950 |
% that, like \cs{auto@protect}, take a control sequence as an |
| 951 |
% argument and redefine that control sequence in order to achieve |
| 952 |
% some special effect. Pending happier inspiration, I'm |
| 953 |
% going to call them ``wrapper'' macros.\index{wrapper macros, |
| 954 |
% definition}} |
| 955 |
% |
| 956 |
% An earlier version of this code read simply |\let#1\relax| but |
| 957 |
% that had the disadvantage of making all \cs{auto@protect}ed |
| 958 |
% macros compare equal via \cs{ifx}. This version allows macros to |
| 959 |
% keep their identities under comparisons. |
| 960 |
% \begin{macrocode} |
| 961 |
\def\auto@protect#1{\def#1{\@nx#1}} |
| 962 |
% \end{macrocode} |
| 963 |
% \end{macro} |
| 964 |
% |
| 965 |
% \begin{macro}{\auto@stringify} |
| 966 |
% \begin{macrocode} |
| 967 |
\def\auto@stringify#1{\def#1{\string#1}} |
| 968 |
% \end{macrocode} |
| 969 |
% \end{macro} |
| 970 |
% |
| 971 |
% \begin{macro}{\g@undef} |
| 972 |
% Globally undefine a control sequence. |
| 973 |
% \begin{macrocode} |
| 974 |
\def\g@undef#1{\global\let#1\relax} |
| 975 |
% \end{macrocode} |
| 976 |
% \end{macro} |
| 977 |
% |
| 978 |
% \begin{macro}{\@concat} |
| 979 |
% Concatenate onto the end of a token list. Expands everything. |
| 980 |
% \begin{macrocode} |
| 981 |
\def\@concat#1#2{\edef#1{#1#2}} |
| 982 |
% \end{macrocode} |
| 983 |
% \end{macro} |
| 984 |
% |
| 985 |
% \begin{macro}{\add@toks@} |
| 986 |
% This saves a few tokens of main memory and a lot of typing. |
| 987 |
% \begin{macrocode} |
| 988 |
\def\add@toks@{\addto@hook\toks@} |
| 989 |
% \end{macrocode} |
| 990 |
% \end{macro} |
| 991 |
% |
| 992 |
% \begin{macro}{\@lappend} |
| 993 |
% Append an element to a \cs{do}-delimited list. As long as the |
| 994 |
% element to be appended (|#2|) is a single token, nothing is |
| 995 |
% expanded. If it contains multiple tokens, all tokens after the |
| 996 |
% first will be expanded. |
| 997 |
% \begin{macrocode} |
| 998 |
\def\@lappend#1#2{% |
| 999 |
\begingroup |
| 1000 |
\def\do{\@nx\do\@nx}% |
| 1001 |
\edef\@tempa{\def\@nx#1{#1\do#2}}% |
| 1002 |
\@xp\endgroup |
| 1003 |
\@tempa |
| 1004 |
} |
| 1005 |
% \end{macrocode} |
| 1006 |
% \end{macro} |
| 1007 |
% |
| 1008 |
% \begin{macro}{\@apply} |
| 1009 |
% Apply a macro to each element of a \cs{do}-delimited list. |
| 1010 |
% \begin{macrocode} |
| 1011 |
\def\@apply#1#2{% |
| 1012 |
\let\do#1% |
| 1013 |
#2% |
| 1014 |
} |
| 1015 |
% \end{macrocode} |
| 1016 |
% \end{macro} |
| 1017 |
% |
| 1018 |
% \begin{macro}{\get@numberof} |
| 1019 |
% This is a generic macro for counting the number of elements in a |
| 1020 |
% \latex/-style list. |
| 1021 |
% The first argument is a \cs{count} register that will receive the |
| 1022 |
% final count; the second argument is the control sequence that |
| 1023 |
% separates elements of the list, and the third argument is the |
| 1024 |
% list itself. So, for example, |
| 1025 |
% \begin{verbatim} |
| 1026 |
% \get@numberof\@tempcnta\do\dospecials |
| 1027 |
%\end{verbatim} |
| 1028 |
% would count the number of special characters in \cs{dospecials} |
| 1029 |
% and store the number in \cs{@tempcnta}. |
| 1030 |
% \begin{macrocode} |
| 1031 |
\def\get@numberof#1#2#3{% |
| 1032 |
\begingroup |
| 1033 |
\def#2{\advance\@tempcnta\@ne \@gobble}% |
| 1034 |
\@tempcnta\z@ |
| 1035 |
#3\relax |
| 1036 |
\edef\@tempb{#1=\the\@tempcnta\relax}% |
| 1037 |
\@xp\endgroup |
| 1038 |
\@tempb |
| 1039 |
} |
| 1040 |
% \end{macrocode} |
| 1041 |
% \end{macro} |
| 1042 |
% |
| 1043 |
% \begin{macro}{\safe@set} |
| 1044 |
% This is a quick and dirty way of extracting an integer prefix |
| 1045 |
% from a string and assigning it to a counter. If the string does |
| 1046 |
% not begin with an integer, the counter receives the value~0. The |
| 1047 |
% suffix after the integer prefix is discarded. (But bad things |
| 1048 |
% will happen if the string contains the token \cs{@nil}.) |
| 1049 |
% \begin{macrocode} |
| 1050 |
\def\safe@set#1#2{% |
| 1051 |
\afterassignment\@nilgobble |
| 1052 |
#1=0#2\relax\@nil |
| 1053 |
} |
| 1054 |
% \end{macrocode} |
| 1055 |
% \end{macro} |
| 1056 |
% |
| 1057 |
% \begin{macro}{\@chomp} |
| 1058 |
% Vaguely reminiscent of Perl's \texttt{chomp} function, which removes |
| 1059 |
% a substring from the end of a variable, but ours works with |
| 1060 |
% tokens (more-or-less) and takes the substring to be removed as |
| 1061 |
% its second argument. Note the use of \cs{@empty} to anchor the |
| 1062 |
% chomped substring to the end of the string. Note also that the |
| 1063 |
% second argument will be fully expanded during the chomping. |
| 1064 |
% \begin{macrocode} |
| 1065 |
\def\@chomp#1#2{% |
| 1066 |
\begingroup |
| 1067 |
\toks@\@emptytoks |
| 1068 |
\def\@chomper##1##2#2\@empty##3\@nil{% |
| 1069 |
\ifx\@let@token\bgroup |
| 1070 |
\toks@{{##1}##2}% |
| 1071 |
\else |
| 1072 |
\toks@{##1##2}% |
| 1073 |
\fi |
| 1074 |
}% |
| 1075 |
\@xp\chomp@ #1\@empty#2\@empty\@nil |
| 1076 |
\edef\@tempa{\def\@nx#1\@xp{\the\toks@}}% |
| 1077 |
\@xp\endgroup |
| 1078 |
\@tempa |
| 1079 |
} |
| 1080 |
% \end{macrocode} |
| 1081 |
% \end{macro} |
| 1082 |
% |
| 1083 |
% \begin{macro}{\chomp@} |
| 1084 |
% Before passing control to \cs{@chomper}, we peek ahead at the |
| 1085 |
% next token in the stream. That way, if the next token is an open |
| 1086 |
% brace, we know we need to surround \cs{@chomper}'s first argument |
| 1087 |
% with braces. Unfortunately, this might still remove braces from |
| 1088 |
% the second argument, but I think that's ok for our purposes. |
| 1089 |
% \begin{macrocode} |
| 1090 |
\def\chomp@{% |
| 1091 |
\futurelet\@let@token |
| 1092 |
\@chomper |
| 1093 |
} |
| 1094 |
% \end{macrocode} |
| 1095 |
% \end{macro} |
| 1096 |
% |
| 1097 |
% \begin{macro}{\amsrefs@warning} |
| 1098 |
% \begin{macrocode} |
| 1099 |
\def\amsrefs@warning{\PackageWarning{amsrefs}} |
| 1100 |
% \end{macrocode} |
| 1101 |
% \end{macro} |
| 1102 |
% |
| 1103 |
% \begin{macro}{\amsrefs@error} |
| 1104 |
% \begin{macrocode} |
| 1105 |
\def\amsrefs@error{\PackageError{amsrefs}} |
| 1106 |
% \end{macrocode} |
| 1107 |
% \end{macro} |
| 1108 |
% |
| 1109 |
% \begin{macro}{\MessageBreakNS} |
| 1110 |
% This suppresses the leading space in \cs{on@line} in error and |
| 1111 |
% warning messages. |
| 1112 |
% \begin{macrocode} |
| 1113 |
\def\MessageBreakNS{\MessageBreak\romannumeral`\^^@} |
| 1114 |
% \end{macrocode} |
| 1115 |
% \end{macro} |
| 1116 |
% |
| 1117 |
% \begin{macro}{\@addpunct} |
| 1118 |
% The \cs{@addpunct} function is defined by AMS document classes and |
| 1119 |
% the \pkg{amsgen} package. But if we find it undefined we had better |
| 1120 |
% define it. |
| 1121 |
% \begin{macrocode} |
| 1122 |
\@ifundefined{@addpunct}{% |
| 1123 |
\def\@addpunct#1{% |
| 1124 |
\relax\ifhmode |
| 1125 |
\ifnum\spacefactor>\@m \else#1\fi |
| 1126 |
\fi |
| 1127 |
} |
| 1128 |
\def\frenchspacing{% |
| 1129 |
\sfcode`\.1006 |
| 1130 |
\sfcode`\?1005 |
| 1131 |
\sfcode`\!1004 |
| 1132 |
\sfcode`\:1003 |
| 1133 |
\sfcode`\;1002 |
| 1134 |
\sfcode`\,1001\relax |
| 1135 |
} |
| 1136 |
}{} |
| 1137 |
% \end{macrocode} |
| 1138 |
% \end{macro} |
| 1139 |
% |
| 1140 |
% \begin{macro}{\nopunct} |
| 1141 |
% Omit any following punctuation that would normally be inserted by |
| 1142 |
% \cs{@addpunct}. |
| 1143 |
% \begin{macrocode} |
| 1144 |
\providecommand{\nopunct}{\spacefactor \@nopunctsfcode} |
| 1145 |
% \end{macrocode} |
| 1146 |
% \end{macro} |
| 1147 |
% |
| 1148 |
% \begin{macro}{\@nopunctsfcode} |
| 1149 |
% \begin{macrocode} |
| 1150 |
\def\@nopunctsfcode{1007 } |
| 1151 |
% \end{macrocode} |
| 1152 |
% \end{macro} |
| 1153 |
% |
| 1154 |
% \subsection{Declaring package options} |
| 1155 |
% |
| 1156 |
% We call the \pkg{ifoption} package to facilitate some option tests. |
| 1157 |
% \begin{macrocode} |
| 1158 |
\RequirePackage{ifoption}[2000/02/15] |
| 1159 |
% \end{macrocode} |
| 1160 |
% |
| 1161 |
% The \opt{sorted} option is a no-op and is no longer documented. |
| 1162 |
% I'm only leaving it here for backwards compatibility. |
| 1163 |
% \begin{macrocode} |
| 1164 |
\DeclareExclusiveOptions{sorted,citation-order} |
| 1165 |
% \end{macrocode} |
| 1166 |
% The \opt{alphabetic} option corresponds to the standard \bst{alpha} |
| 1167 |
% biblio style with labels like Knu66 (three letters from name plus |
| 1168 |
% two digits of year). Maybe should provide an alias LllYY for this |
| 1169 |
% option. Numeric is the default since it is commoner in AMS |
| 1170 |
% publications. |
| 1171 |
% \begin{macrocode} |
| 1172 |
\DeclareExclusiveOptions{alphabetic,shortalphabetic,author-year,numeric} |
| 1173 |
% \end{macrocode} |
| 1174 |
% |
| 1175 |
% \begin{option}{y2k} |
| 1176 |
% \begin{macrocode} |
| 1177 |
\DeclareBooleanOption{y2k} |
| 1178 |
% \end{macrocode} |
| 1179 |
% \end{option} |
| 1180 |
% |
| 1181 |
% \begin{option}{nobysame} |
| 1182 |
% \begin{macrocode} |
| 1183 |
\DeclareBooleanOption{nobysame} |
| 1184 |
% \end{macrocode} |
| 1185 |
% \end{option} |
| 1186 |
% |
| 1187 |
% The standard \bst{abbrv} bibliography style uses abbreviations for |
| 1188 |
% month names and journal names, and first names of people are |
| 1189 |
% abbreviated to their initials. Since the second test bibliography |
| 1190 |
% that I tested with had unabbreviated month names but abbreviated |
| 1191 |
% journal names, perhaps it is a good idea to let these choices be |
| 1192 |
% specified separately. |
| 1193 |
% \begin{macrocode} |
| 1194 |
\DeclareBooleanOption{short-journals} |
| 1195 |
% \end{macrocode} |
| 1196 |
% \begin{macrocode} |
| 1197 |
\DeclareBooleanOption{short-publishers} |
| 1198 |
% \end{macrocode} |
| 1199 |
% The \opt{short-journals} and \opt{short-publishers} options only |
| 1200 |
% affect journal and publisher names that are defined with |
| 1201 |
% \cn{DefineJournal} and \cn{DefinePublisher} commands. |
| 1202 |
% \begin{macrocode} |
| 1203 |
\DeclareBooleanOption{short-months} |
| 1204 |
% \end{macrocode} |
| 1205 |
% |
| 1206 |
% \begin{macrocode} |
| 1207 |
\DeclareBooleanOption{initials} |
| 1208 |
% \end{macrocode} |
| 1209 |
% Nevertheless, it's to be expected that the preceding four options |
| 1210 |
% would typically be used together, so we provide a short-hand for |
| 1211 |
% requesting them all. |
| 1212 |
% \begin{macrocode} |
| 1213 |
\DeclareOption{abbrev}{% |
| 1214 |
\@pass@ptions |
| 1215 |
\@currext |
| 1216 |
{initials,short-months,short-journals,short-publishers}% |
| 1217 |
\@currname |
| 1218 |
} |
| 1219 |
% \end{macrocode} |
| 1220 |
% |
| 1221 |
% In the bibliography, if a title or something is enclosed in quotes, |
| 1222 |
% should the closing quotes go inside the punctuation (logical |
| 1223 |
% position) rather than outside (traditional)? These options give you |
| 1224 |
% a choice. |
| 1225 |
% \begin{macrocode} |
| 1226 |
\DeclareExclusiveOptions{traditional-quotes,logical-quotes} |
| 1227 |
% \end{macrocode} |
| 1228 |
% |
| 1229 |
% A sequence of cites will be sorted and ranges of length three or |
| 1230 |
% greater will be compressed if these options so indicate. Note |
| 1231 |
% that the \opt{non-sorted-cites} option automatically disables |
| 1232 |
% compression. This is probably a feature. |
| 1233 |
% \begin{macrocode} |
| 1234 |
\DeclareExclusiveOptions{sorted-cites,non-sorted-cites} |
| 1235 |
\DeclareExclusiveOptions{non-compressed-cites,compressed-cites} |
| 1236 |
% \end{macrocode} |
| 1237 |
% |
| 1238 |
% In the bibliography, print page numbers showing where each |
| 1239 |
% entry was cited. |
| 1240 |
% \begin{macrocode} |
| 1241 |
\DeclareBooleanOption{backrefs} |
| 1242 |
% \end{macrocode} |
| 1243 |
% |
| 1244 |
% Option for giving information about the available options: |
| 1245 |
% \begin{macrocode} |
| 1246 |
\DeclareBooleanOption{?} |
| 1247 |
% \end{macrocode} |
| 1248 |
% |
| 1249 |
% This option means to forgo loading of the \pkg{textcmds} and |
| 1250 |
% \pkg{mathscinet} packages. |
| 1251 |
% \begin{macrocode} |
| 1252 |
\DeclareBooleanOption{lite} |
| 1253 |
% \end{macrocode} |
| 1254 |
% |
| 1255 |
% This option can be used by later releases as a sign that fall-back |
| 1256 |
% adaptations need to be done. |
| 1257 |
% \begin{macrocode} |
| 1258 |
\DeclareBooleanOption{beta} |
| 1259 |
% \end{macrocode} |
| 1260 |
% |
| 1261 |
% \begin{macrocode} |
| 1262 |
\DeclareBooleanOption{bibtex-style} |
| 1263 |
% \end{macrocode} |
| 1264 |
% |
| 1265 |
% \begin{macrocode} |
| 1266 |
\DeclareBooleanOption{msc-links} |
| 1267 |
% \end{macrocode} |
| 1268 |
% |
| 1269 |
% \begin{macrocode} |
| 1270 |
\ExecuteOptions{numeric,traditional-quotes,sorted-cites,compressed-cites} |
| 1271 |
|
| 1272 |
\ProcessOptions\relax |
| 1273 |
|
| 1274 |
\ProcessExclusiveOptions |
| 1275 |
% \end{macrocode} |
| 1276 |
% |
| 1277 |
% \begin{macrocode} |
| 1278 |
\IfOption{backrefs}{% |
| 1279 |
\IfFileExists{backref.sty}{% |
| 1280 |
\RequirePackage{backref}[1999/05/30] |
| 1281 |
}{% |
| 1282 |
\amsrefs@warning@nl{The backrefs option cannot be used^^J% |
| 1283 |
unless the backref package is also installed.^^J% |
| 1284 |
(backref is part of the hyperref package)}% |
| 1285 |
}% |
| 1286 |
}{} |
| 1287 |
|
| 1288 |
\IfOption{msc-links}{% |
| 1289 |
\IfFileExists{hyperref.sty}{% |
| 1290 |
\RequirePackage{hyperref}[1999/07/08] |
| 1291 |
}{ |
| 1292 |
\amsrefs@warning@nl{The msc-links option cannot be used^^J% |
| 1293 |
unless the hyperref package is installed}% |
| 1294 |
}% |
| 1295 |
}{} |
| 1296 |
% \end{macrocode} |
| 1297 |
% |
| 1298 |
% \subsubsection{The \opt{?} option} |
| 1299 |
% |
| 1300 |
% \begin{macrocode} |
| 1301 |
\IfOption{?}{% |
| 1302 |
\typeout{^^J% |
| 1303 |
Documentation for the amsrefs package is found in amsrdoc.dvi^^J% |
| 1304 |
(or .pdf or .tex). |
| 1305 |
^^J% |
| 1306 |
}% |
| 1307 |
}{}% |
| 1308 |
% \end{macrocode} |
| 1309 |
% |
| 1310 |
% \subsection{Loading auxiliary packages} |
| 1311 |
% Now, if these other packages make use of the \pkg{pcatcode} package |
| 1312 |
% like they should, then we don't need to make any fuss here about |
| 1313 |
% the special catcode of \texttt{'}. Just load the packages. |
| 1314 |
% \begin{macrocode} |
| 1315 |
\RequirePackage{rkeyval}[2001/12/22] |
| 1316 |
% \end{macrocode} |
| 1317 |
% |
| 1318 |
% \subsubsection{The \opt{lite} option} |
| 1319 |
% |
| 1320 |
% In my opinion, this is misguided, since \pkg{amsrefs} shouldn't |
| 1321 |
% be loading these packages to begin with. But it's too late to |
| 1322 |
% change it now. |
| 1323 |
% |
| 1324 |
% \begin{macrocode} |
| 1325 |
\IfOption{lite}{% True? Then don't load the next two packages. |
| 1326 |
}{% False? OK, let's load them: |
| 1327 |
\RequirePackage{textcmds}[2001/12/14] |
| 1328 |
\RequirePackage{mathscinet}[2002/01/01] |
| 1329 |
} |
| 1330 |
% \end{macrocode} |
| 1331 |
% |
| 1332 |
% \subsection{Key-value setup} |
| 1333 |
% |
| 1334 |
% \begin{macro}{\BibField} |
| 1335 |
% This provides easy access to individual fields for user-defined |
| 1336 |
% formatting functions. |
| 1337 |
% \begin{macrocode} |
| 1338 |
\newcommand{\BibField}[1]{\csname bib'#1\endcsname} |
| 1339 |
% \end{macrocode} |
| 1340 |
% \end{macro} |
| 1341 |
% |
| 1342 |
% \begin{macro}{\IfEmptyBibField} |
| 1343 |
% A convenient partial application of \cn{rkvIfEmpty}. |
| 1344 |
% \begin{macrocode} |
| 1345 |
\newcommand{\IfEmptyBibField}{\rkvIfEmpty{bib}} |
| 1346 |
% \end{macrocode} |
| 1347 |
% \end{macro} |
| 1348 |
% |
| 1349 |
% \subsubsection{Standard field names (the \texttt{bib} group)} |
| 1350 |
% |
| 1351 |
% And here are the predefined key names. You could always add some |
| 1352 |
% more if you needed them. Only worry is about compatibility if you |
| 1353 |
% want to share your data with other people. |
| 1354 |
% |
| 1355 |
% \begin{macro}{\fld@elt} |
| 1356 |
% \begin{macro}{\name} |
| 1357 |
% We want the list macros used above to be unexpandable except when |
| 1358 |
% special processing is done. (It's not clear to me there's any |
| 1359 |
% real benefit to using these instead of just using \cn{do}.---dmj) |
| 1360 |
% \begin{macrocode} |
| 1361 |
\let\fld@elt=? |
| 1362 |
\let\name=? |
| 1363 |
% \end{macrocode} |
| 1364 |
% \end{macro} |
| 1365 |
% \end{macro} |
| 1366 |
% |
| 1367 |
% First the fields that could be repeated more than once in a single |
| 1368 |
% entry. Maybe publisher should be allowed to repeat also, for |
| 1369 |
% co-published works. But then need to worry about the address |
| 1370 |
% handling. |
| 1371 |
% \begin{macrocode} |
| 1372 |
\DefineAdditiveKey{bib}{author}{\name} |
| 1373 |
\DefineAdditiveKey{bib}{editor}{\name} |
| 1374 |
\DefineAdditiveKey{bib}{translator}{\name} |
| 1375 |
\DefineAdditiveKey{bib}{contribution}{\fld@elt} |
| 1376 |
\DefineAdditiveKey{bib}{isbn}{\fld@elt} |
| 1377 |
\DefineAdditiveKey{bib}{issn}{\fld@elt} |
| 1378 |
\DefineAdditiveKey{bib}{review}{\fld@elt} |
| 1379 |
\DefineAdditiveKey{bib}{partial}{\fld@elt} |
| 1380 |
% \end{macrocode} |
| 1381 |
% |
| 1382 |
% \begin{macrocode} |
| 1383 |
\DefineSimpleKey{bib}{accessdate} |
| 1384 |
\DefineSimpleKey{bib}{address} |
| 1385 |
\DefineSimpleKey{bib}{book} |
| 1386 |
\DefineSimpleKey{bib}{booktitle} |
| 1387 |
\DefineSimpleKey{bib}{conference} |
| 1388 |
%\DefineSimpleKey{bib}{contributor} |
| 1389 |
\DefineSimpleKey{bib}{copula} |
| 1390 |
\DefineSimpleKey{bib}{date} |
| 1391 |
\DefineSimpleKey{bib}{doi} |
| 1392 |
\DefineSimpleKey{bib}{edition} |
| 1393 |
\DefineSimpleKey{bib}{eprint} |
| 1394 |
\DefineSimpleKey{bib}{fulljournal} |
| 1395 |
\DefineSimpleKey{bib}{hyphenation} |
| 1396 |
\DefineSimpleKey{bib}{institution} |
| 1397 |
\DefineSimpleKey{bib}{journal} |
| 1398 |
\DefineSimpleKey{bib}{label} |
| 1399 |
\DefineSimpleKey{bib}{language} |
| 1400 |
\DefineSimpleKey{bib}{name} |
| 1401 |
\DefineSimpleKey{bib}{note} |
| 1402 |
\DefineSimpleKey{bib}{number} |
| 1403 |
\DefineSimpleKey{bib}{organization} |
| 1404 |
\DefineSimpleKey{bib}{pages} |
| 1405 |
\DefineSimpleKey{bib}{part} |
| 1406 |
\DefineSimpleKey{bib}{place} |
| 1407 |
\DefineSimpleKey{bib}{publisher} |
| 1408 |
\DefineSimpleKey{bib}{reprint} |
| 1409 |
\DefineSimpleKey{bib}{school} |
| 1410 |
\DefineSimpleKey{bib}{series} |
| 1411 |
\DefineSimpleKey{bib}{setup} |
| 1412 |
\DefineSimpleKey{bib}{status} |
| 1413 |
\DefineSimpleKey{bib}{subtitle} |
| 1414 |
\DefineSimpleKey{bib}{title} |
| 1415 |
\DefineSimpleKey{bib}{translation} |
| 1416 |
\DefineSimpleKey{bib}{type} |
| 1417 |
\DefineSimpleKey{bib}{url} |
| 1418 |
\DefineSimpleKey{bib}{volume} |
| 1419 |
\DefineSimpleKey{bib}{xref} |
| 1420 |
\DefineSimpleKey{bib}{year} |
| 1421 |
% \end{macrocode} |
| 1422 |
% The \fld{transition} key is used when we want to insert punctuation |
| 1423 |
% or other material at a given point in the sequence |
| 1424 |
% unconditionally. The key appears to have a non-empty value to |
| 1425 |
% \cn{IfEmptyBibField}, but its value (expansion) is empty. |
| 1426 |
% \begin{macrocode} |
| 1427 |
\DefineDummyKey{bib}{transition} |
| 1428 |
% \end{macrocode} |
| 1429 |
% |
| 1430 |
% \subsubsection{Auxiliary properties (the \texttt{prop} group)} |
| 1431 |
% |
| 1432 |
% \begin{macrocode} |
| 1433 |
\DefineSimpleKey{prop}{inverted} |
| 1434 |
\DefineSimpleKey{prop}{language} |
| 1435 |
% \end{macrocode} |
| 1436 |
% |
| 1437 |
% \subsection{Bibliography type specifications} |
| 1438 |
% |
| 1439 |
% \begin{macro}{\BibSpec} |
| 1440 |
% Accumulate specification material in \cs{toks@}, then define |
| 1441 |
% \cs{setbib@TYPE} from it. |
| 1442 |
% \begin{macrocode} |
| 1443 |
\newcommand{\BibSpec}[2]{% |
| 1444 |
\toks@\@emptytoks |
| 1445 |
\@ifnotempty{#2}{% |
| 1446 |
% \end{macrocode} |
| 1447 |
% The \cs{@ifnextchar} removes an optional |+| at the beginning of |
| 1448 |
% a specification. From then on, each time \cs{bibspec@scan} is |
| 1449 |
% invoked, it expects to find four arguments. The four |
| 1450 |
% \cs{@empty}s appended to the specification (|#2|) below ensure |
| 1451 |
% that this is so. |
| 1452 |
% \begin{macrocode} |
| 1453 |
\@ifnextchar{+}{\@xp\bibspec@scan\@gobble}{\bibspec@scan}% |
| 1454 |
#2\@empty\@empty\@empty\@empty |
| 1455 |
}% |
| 1456 |
\@xp\edef\csname setbib@#1\endcsname{\the\toks@}% |
| 1457 |
} |
| 1458 |
% \end{macrocode} |
| 1459 |
% \end{macro} |
| 1460 |
% |
| 1461 |
% \begin{macro}{\bibspec@scan} |
| 1462 |
% The \cs{bibspec@scan} function scans one field specification |
| 1463 |
% from the second arg of \cn{BibSpec}. Each field specification has |
| 1464 |
% the form |
| 1465 |
% \begin{verbatim} |
| 1466 |
% +{punctuation}{prelim material}{field name} |
| 1467 |
%\end{verbatim} |
| 1468 |
% Note however that because the initial |+| is stripped off by |
| 1469 |
% \cs{BibSpec} (see above), the actual order that \cs{bibspec@scan} |
| 1470 |
% reads the field specification is |
| 1471 |
% \begin{verbatim} |
| 1472 |
% #1={punctuation} #2={prelim material} #3={field name} #4=+ |
| 1473 |
%\end{verbatim} |
| 1474 |
% where the fourth argument is actually expected to be either the |
| 1475 |
% |+| from the following specification, or one of the special |
| 1476 |
% \cs{@empty} tokens inserted by \cs{BibSpec}. If it is neither of |
| 1477 |
% these special values, it means we have a malformed specification; |
| 1478 |
% so, we issue an error and then try to pick up where we left off. |
| 1479 |
% \begin{macrocode} |
| 1480 |
\def\bibspec@scan#1#2#3#4{% |
| 1481 |
\add@toks@{\bib@append{#1}{#2}}% |
| 1482 |
\edef\@tempa{% |
| 1483 |
\toks@{\the\toks@ \@xp\@nx\csname bib'#3\endcsname}% |
| 1484 |
}% |
| 1485 |
\@tempa |
| 1486 |
\ifx\@empty#4% |
| 1487 |
\@xp\@gobble % end the recursion |
| 1488 |
\else |
| 1489 |
\ifx +#4\else\bibspec@scan@error\fi |
| 1490 |
\fi |
| 1491 |
\bibspec@scan |
| 1492 |
} |
| 1493 |
% \end{macrocode} |
| 1494 |
% \end{macro} |
| 1495 |
% |
| 1496 |
% \begin{macro}{\bibspec@scan@error} |
| 1497 |
% \begin{macrocode} |
| 1498 |
\def\bibspec@scan@error{\amsrefs@error{Bad BibSpec: Expected '+'}} |
| 1499 |
% \end{macrocode} |
| 1500 |
% \end{macro} |
| 1501 |
% |
| 1502 |
% \begin{macro}{\bib@append} |
| 1503 |
% The function \cs{bib@append} prints the value of a field, together |
| 1504 |
% with associated punctuation and font changes, unless the value is |
| 1505 |
% empty. Arg 1 is punctuation (that may need to be swapped with a |
| 1506 |
% preceding line break), arg 2 gives the space to be added after the |
| 1507 |
% punctuation, and possibly a function to be applied to the contents |
| 1508 |
% of arg 3, which is |
| 1509 |
% a macro containing the field |
| 1510 |
% value. So if we have \cn{moo} and \cn{bib'pages}, from |
| 1511 |
% \verb'pages={21\ndash 44}', then we want to arrange to call |
| 1512 |
% \begin{verbatim} |
| 1513 |
% \moo{21\ndash 44} |
| 1514 |
%\end{verbatim} |
| 1515 |
% We don't want to simply call \cs{moo}\cs{bib'bar} because that makes |
| 1516 |
% it rather difficult for \cs{moo} to look at the contents of |
| 1517 |
% \cs{bib@bar}. |
| 1518 |
% \begin{macrocode} |
| 1519 |
\def\bib@append#1#2#3{% |
| 1520 |
\ifx\@empty#3% |
| 1521 |
\else |
| 1522 |
% \end{macrocode} |
| 1523 |
% \begin{bug} |
| 1524 |
% Need better error message here. |
| 1525 |
% \end{bug} |
| 1526 |
% \begin{macrocode} |
| 1527 |
\ifx\relax#3% |
| 1528 |
\errmessage{#3=\relax}% |
| 1529 |
\else |
| 1530 |
\begingroup |
| 1531 |
\series@index\m@ne |
| 1532 |
\def\current@bibfield{#3}% |
| 1533 |
\@ifempty{#1}{% |
| 1534 |
\@temptokena{\ifnum\lastkern=\@ne\ignorespaces\fi #2}% |
| 1535 |
}{% |
| 1536 |
\@temptokena{\SwapBreak{#1}#2}% |
| 1537 |
}% |
| 1538 |
\toks@\@xp{#3}% |
| 1539 |
\edef\@tempa{\the\@temptokena{\the\toks@}}% |
| 1540 |
\rkvIfAdditive#3{}{% |
| 1541 |
\get@current@properties |
| 1542 |
\select@auxlanguage |
| 1543 |
}% |
| 1544 |
\@tempa |
| 1545 |
\endgroup |
| 1546 |
\fi |
| 1547 |
\fi |
| 1548 |
} |
| 1549 |
% \end{macrocode} |
| 1550 |
% \end{macro} |
| 1551 |
% |
| 1552 |
% \begin{macro}{\select@auxlanguage} |
| 1553 |
% \begin{macrocode} |
| 1554 |
\def\select@auxlanguage{% |
| 1555 |
\ifx\prop'language\@empty |
| 1556 |
\else |
| 1557 |
\@xp\selectlanguage\@xp{\prop'language}% |
| 1558 |
\fi |
| 1559 |
} |
| 1560 |
% \end{macrocode} |
| 1561 |
% \end{macro} |
| 1562 |
% |
| 1563 |
% \begin{macro}{\erase@field} |
| 1564 |
% There are some fields that can appear in more than one place in a |
| 1565 |
% reference, depending on context. For example, if a book has an |
| 1566 |
% editor but no author, the editor appears at the beginning of the |
| 1567 |
% entry, but if the book has both an editor and an author, the |
| 1568 |
% editor appears at the end of the entry. A simple way to handle |
| 1569 |
% this is to ``erase'' the \fld{editor} field after printing it, |
| 1570 |
% which is what \cs{erase@field} is for. |
| 1571 |
% |
| 1572 |
% The obvious definition of \cs{erase@field} is |
| 1573 |
% \begin{verbatim} |
| 1574 |
% \def\erase@field#1{\global\let#1\@empty} |
| 1575 |
%\end{verbatim} |
| 1576 |
% but that doesn't work because the top-level value of |
| 1577 |
% \pkg{rkeyval} fields isn't \cs{@empty}; instead, it contains a |
| 1578 |
% setter function used by \cs{RestrictedSetKeys} when processing a |
| 1579 |
% key-value list (see \cs{rkv@DSAK}, \cs{rsk@set@a} and |
| 1580 |
% \cs{rsk@set@b}). |
| 1581 |
% |
| 1582 |
% On the other hand, rewriting the field locally won't work |
| 1583 |
% either, since \cs{erase@field} will typically be executed inside |
| 1584 |
% the group established by \cs{bib@append}. Instead, we want to |
| 1585 |
% rewrite the value right after \cs{bib@append}'s group ends. One |
| 1586 |
% way to do this would be to keep a list of fields to be erased and |
| 1587 |
% have \cs{bib@append} iterate over the list after its |
| 1588 |
% \ncn{endgroup}. |
| 1589 |
% |
| 1590 |
% However, as long as the call to \cs{erase@field} |
| 1591 |
% is never nested within any deeper groups, it's simpler just to |
| 1592 |
% use \cs{aftergroup}, which is what we'll do (``Sufficient unto |
| 1593 |
% the day is the evil thereof'' and all that). |
| 1594 |
% \begin{macrocode} |
| 1595 |
\def\erase@field#1{% |
| 1596 |
\aftergroup\let\aftergroup#1\aftergroup\@empty |
| 1597 |
} |
| 1598 |
% \end{macrocode} |
| 1599 |
% \end{macro} |
| 1600 |
% |
| 1601 |
% \begin{macro}{\get@current@properties} |
| 1602 |
% This retrieves the auxiliary properties for the current field |
| 1603 |
% value, as defined by \cs{current@bibfield} and |
| 1604 |
% \cs{series@index}. |
| 1605 |
% \begin{macrocode} |
| 1606 |
\def\get@current@properties{% |
| 1607 |
\begingroup |
| 1608 |
\@xp\get@nth@property\@xp\@tempa\current@bibfield\series@index |
| 1609 |
\edef\@tempa{% |
| 1610 |
\@nx\RestrictedSetKeys{}{prop}{% |
| 1611 |
\def\@nx\@tempa{\@nx\prop@reset \@nx\the\@nx\rsk@toks}% |
| 1612 |
}{\@tempa}% |
| 1613 |
}% |
| 1614 |
\@tempa |
| 1615 |
\@xp\endgroup |
| 1616 |
\@tempa |
| 1617 |
} |
| 1618 |
% \end{macrocode} |
| 1619 |
% \end{macro} |
| 1620 |
% |
| 1621 |
% \begin{macro}{\BibSpecAlias} |
| 1622 |
% This is a \cs{def} rather than a \cs{let} because using \cs{let} |
| 1623 |
% would make \cn{BibSpecAlias} statements order-sensitive in a way |
| 1624 |
% that seems frequently to be a stumbling block to unwary package |
| 1625 |
% writers. But then we should probably do at least the simplest |
| 1626 |
% kind of infinite loop check. |
| 1627 |
% \begin{macrocode} |
| 1628 |
\newcommand{\BibSpecAlias}[2]{% |
| 1629 |
\@xp\def\@xp\@tempa\@xp{\csname setbib@#1\@xp\endcsname}% |
| 1630 |
\@xp\ifx\csname setbib@#2\endcsname\@tempa |
| 1631 |
\amsrefs@error{% |
| 1632 |
Mirror alias #1->#2 not allowed (infinite loop)}\@ehc |
| 1633 |
\else |
| 1634 |
\@xp\def\csname setbib@#1\@xp\endcsname |
| 1635 |
\@xp{\csname setbib@#2\endcsname}% |
| 1636 |
\fi |
| 1637 |
} |
| 1638 |
% \end{macrocode} |
| 1639 |
% \end{macro} |
| 1640 |
% |
| 1641 |
% \subsection{The standard bibliography types} |
| 1642 |
% |
| 1643 |
% \begin{macrocode} |
| 1644 |
\BibSpec{article}{% |
| 1645 |
+{} {\PrintAuthors} {author} |
| 1646 |
+{,} { \textit} {title} |
| 1647 |
+{.} { } {part} |
| 1648 |
+{:} { \textit} {subtitle} |
| 1649 |
+{,} { \PrintContributions} {contribution} |
| 1650 |
+{.} { \PrintPartials} {partial} |
| 1651 |
+{,} { } {journal} |
| 1652 |
+{} { \textbf} {volume} |
| 1653 |
% \end{macrocode} |
| 1654 |
% The date form is tricky depending on presence or absence of DOI. |
| 1655 |
% \begin{macrocode} |
| 1656 |
+{} { \PrintDatePV} {date} |
| 1657 |
+{,} { \issuetext} {number} |
| 1658 |
+{,} { \eprintpages} {pages} |
| 1659 |
+{,} { } {status} |
| 1660 |
+{,} { \PrintDOI} {doi} |
| 1661 |
+{,} { available at \eprint} {eprint} |
| 1662 |
+{} { \parenthesize} {language} |
| 1663 |
+{} { \PrintTranslation} {translation} |
| 1664 |
+{;} { \PrintReprint} {reprint} |
| 1665 |
+{.} { } {note} |
| 1666 |
+{.} {} {transition} |
| 1667 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 1668 |
} |
| 1669 |
|
| 1670 |
\BibSpec{partial}{% |
| 1671 |
+{} {} {part} |
| 1672 |
+{:} { \textit} {subtitle} |
| 1673 |
+{,} { \PrintContributions} {contribution} |
| 1674 |
+{,} { } {journal} |
| 1675 |
+{} { \textbf} {volume} |
| 1676 |
+{} { \PrintDatePV} {date} |
| 1677 |
+{,} { \issuetext} {number} |
| 1678 |
+{,} { \eprintpages} {pages} |
| 1679 |
} |
| 1680 |
|
| 1681 |
\BibSpec{contribution}{% |
| 1682 |
+{} {} {type} |
| 1683 |
+{} { by \PrintNameList} {author} |
| 1684 |
} |
| 1685 |
|
| 1686 |
\BibSpec{book}{% |
| 1687 |
+{} {\PrintPrimary} {transition} |
| 1688 |
+{,} { \textit} {title} |
| 1689 |
+{.} { } {part} |
| 1690 |
+{:} { \textit} {subtitle} |
| 1691 |
+{,} { \PrintEdition} {edition} |
| 1692 |
+{} { \PrintEditorsB} {editor} |
| 1693 |
+{,} { \PrintTranslatorsC} {translator} |
| 1694 |
+{,} { \PrintContributions} {contribution} |
| 1695 |
+{,} { } {series} |
| 1696 |
+{,} { \voltext} {volume} |
| 1697 |
+{,} { } {publisher} |
| 1698 |
+{,} { } {organization} |
| 1699 |
+{,} { } {address} |
| 1700 |
+{,} { \PrintDateB} {date} |
| 1701 |
+{,} { } {status} |
| 1702 |
+{} { \parenthesize} {language} |
| 1703 |
+{} { \PrintTranslation} {translation} |
| 1704 |
+{;} { \PrintReprint} {reprint} |
| 1705 |
+{.} { } {note} |
| 1706 |
+{.} {} {transition} |
| 1707 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 1708 |
} |
| 1709 |
|
| 1710 |
\BibSpec{collection.article}{% |
| 1711 |
+{} {\PrintAuthors} {author} |
| 1712 |
+{,} { \textit} {title} |
| 1713 |
+{.} { } {part} |
| 1714 |
+{:} { \textit} {subtitle} |
| 1715 |
+{,} { \PrintContributions} {contribution} |
| 1716 |
+{,} { \PrintConference} {conference} |
| 1717 |
+{} {\PrintBook} {book} |
| 1718 |
+{,} { } {booktitle} |
| 1719 |
+{,} { \PrintDateB} {date} |
| 1720 |
+{,} { pp.~} {pages} |
| 1721 |
+{,} { } {status} |
| 1722 |
+{,} { \PrintDOI} {doi} |
| 1723 |
+{,} { available at \eprint} {eprint} |
| 1724 |
+{} { \parenthesize} {language} |
| 1725 |
+{} { \PrintTranslation} {translation} |
| 1726 |
+{;} { \PrintReprint} {reprint} |
| 1727 |
+{.} { } {note} |
| 1728 |
+{.} {} {transition} |
| 1729 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 1730 |
} |
| 1731 |
|
| 1732 |
\BibSpec{conference}{% |
| 1733 |
+{} {} {title} |
| 1734 |
+{} {\PrintConferenceDetails} {transition} |
| 1735 |
} |
| 1736 |
|
| 1737 |
\BibSpec{innerbook}{% |
| 1738 |
+{,} { } {title} |
| 1739 |
+{.} { } {part} |
| 1740 |
+{:} { } {subtitle} |
| 1741 |
+{,} { \PrintEdition} {edition} |
| 1742 |
+{} { \PrintEditorsB} {editor} |
| 1743 |
+{,} { \PrintTranslatorsC} {translator} |
| 1744 |
+{,} { \PrintContributions} {contribution} |
| 1745 |
+{,} { } {series} |
| 1746 |
+{,} { \voltext} {volume} |
| 1747 |
+{,} { } {publisher} |
| 1748 |
+{,} { } {organization} |
| 1749 |
+{,} { } {address} |
| 1750 |
+{,} { \PrintDateB} {date} |
| 1751 |
+{.} { } {note} |
| 1752 |
} |
| 1753 |
|
| 1754 |
\BibSpec{report}{% |
| 1755 |
+{} {\PrintPrimary} {transition} |
| 1756 |
+{,} { \textit} {title} |
| 1757 |
+{.} { } {part} |
| 1758 |
+{:} { \textit} {subtitle} |
| 1759 |
+{,} { \PrintEdition} {edition} |
| 1760 |
+{,} { \PrintContributions} {contribution} |
| 1761 |
+{,} { Technical Report } {number} |
| 1762 |
+{,} { } {series} |
| 1763 |
+{,} { } {organization} |
| 1764 |
+{,} { } {address} |
| 1765 |
+{,} { \PrintDateB} {date} |
| 1766 |
+{,} { \eprint} {eprint} |
| 1767 |
+{,} { } {status} |
| 1768 |
+{} { \parenthesize} {language} |
| 1769 |
+{} { \PrintTranslation} {translation} |
| 1770 |
+{;} { \PrintReprint} {reprint} |
| 1771 |
+{.} { } {note} |
| 1772 |
+{.} {} {transition} |
| 1773 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 1774 |
} |
| 1775 |
|
| 1776 |
\BibSpec{thesis}{% |
| 1777 |
+{} {\PrintAuthors} {author} |
| 1778 |
+{,} { \textit} {title} |
| 1779 |
+{:} { \textit} {subtitle} |
| 1780 |
+{,} { \PrintThesisType} {type} |
| 1781 |
+{,} { } {organization} |
| 1782 |
+{,} { } {address} |
| 1783 |
+{,} { \PrintDateB} {date} |
| 1784 |
+{,} { \eprint} {eprint} |
| 1785 |
+{,} { } {status} |
| 1786 |
+{} { \parenthesize} {language} |
| 1787 |
+{} { \PrintTranslation} {translation} |
| 1788 |
+{;} { \PrintReprint} {reprint} |
| 1789 |
+{.} { } {note} |
| 1790 |
+{.} {} {transition} |
| 1791 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 1792 |
} |
| 1793 |
|
| 1794 |
\BibSpec{webpage}{% |
| 1795 |
+{} {\PrintAuthors} {author} |
| 1796 |
+{,} { \emph} {title} |
| 1797 |
+{:} { \emph} {subtitle} |
| 1798 |
+{} { \PrintDate} {date} |
| 1799 |
+{,} { \url} {url} |
| 1800 |
+{.} { Accessed \PrintDateField} {accessdate} |
| 1801 |
+{.} { } {note} |
| 1802 |
+{.} {} {transition} |
| 1803 |
} |
| 1804 |
% \begin{macrocode} |
| 1805 |
\BibSpecAlias{periodical}{book} |
| 1806 |
\BibSpecAlias{collection}{book} |
| 1807 |
\BibSpecAlias{proceedings}{book} |
| 1808 |
\BibSpecAlias{manual}{book} |
| 1809 |
\BibSpecAlias{miscellaneous}{book} |
| 1810 |
\BibSpecAlias{misc}{miscellaneous} |
| 1811 |
\BibSpecAlias{unpublished}{book} |
| 1812 |
\BibSpecAlias{proceedings.article}{collection.article} |
| 1813 |
\BibSpecAlias{techreport}{report} |
| 1814 |
% \end{macrocode} |
| 1815 |
% |
| 1816 |
% \begin{macro}{\setbib@incollection} |
| 1817 |
% \begin{macrocode} |
| 1818 |
\edef\setbib@incollection{% |
| 1819 |
\@xp\@nx\csname [email protected]\endcsname |
| 1820 |
} |
| 1821 |
% \end{macrocode} |
| 1822 |
% \end{macro} |
| 1823 |
% |
| 1824 |
% \begin{macro}{\setbib@inproceedings} |
| 1825 |
% \begin{macrocode} |
| 1826 |
\edef\setbib@inproceedings{% |
| 1827 |
\@xp\@nx\csname [email protected]\endcsname |
| 1828 |
} |
| 1829 |
% \end{macrocode} |
| 1830 |
% \end{macro} |
| 1831 |
% |
| 1832 |
% Some more entry types for implementing abbreviations. |
| 1833 |
% \begin{macrocode} |
| 1834 |
\BibSpec{name}{% |
| 1835 |
+{} {\PrintAuthors} {name} |
| 1836 |
} |
| 1837 |
|
| 1838 |
\BibSpec{publisher}{% |
| 1839 |
+{,} { } {publisher} |
| 1840 |
+{,} { } {address} |
| 1841 |
} |
| 1842 |
% \end{macrocode} |
| 1843 |
% |
| 1844 |
% \subsection{The \env{biblist} environment} |
| 1845 |
% |
| 1846 |
% The \env{biblist} environment can be used with a section or chapter |
| 1847 |
% heading. |
| 1848 |
% |
| 1849 |
% Use a standard \latex/ counter for numbering bibliography items. |
| 1850 |
% \begin{macrocode} |
| 1851 |
\newcounter{bib} |
| 1852 |
% \end{macrocode} |
| 1853 |
% |
| 1854 |
% \begin{macrocode} |
| 1855 |
\DefineSimpleKey{biblist}{prefix} |
| 1856 |
\DefineSimpleKey{biblist}{labels} |
| 1857 |
% \end{macrocode} |
| 1858 |
% |
| 1859 |
% \begin{environment}{biblist} |
| 1860 |
% \begin{macrocode} |
| 1861 |
\newenvironment{biblist}{% |
| 1862 |
\setcounter{bib}\z@ |
| 1863 |
\@biblist |
| 1864 |
}{% |
| 1865 |
\@endbiblist |
| 1866 |
} |
| 1867 |
% \end{macrocode} |
| 1868 |
% \end{environment} |
| 1869 |
% |
| 1870 |
% \begin{environment}{biblist*} |
| 1871 |
% \begin{macrocode} |
| 1872 |
\newenvironment{biblist*}{% |
| 1873 |
\@biblist |
| 1874 |
}{% |
| 1875 |
\@endbiblist |
| 1876 |
} |
| 1877 |
% \end{macrocode} |
| 1878 |
% \end{environment} |
| 1879 |
% |
| 1880 |
% \begin{macro}{\biblistfont} |
| 1881 |
% \begin{macrocode} |
| 1882 |
\newcommand{\biblistfont}{% |
| 1883 |
\normalfont |
| 1884 |
\footnotesize |
| 1885 |
} |
| 1886 |
% \end{macrocode} |
| 1887 |
% \end{macro} |
| 1888 |
% |
| 1889 |
% \begin{macro}{\amsrefs@@lbibitem} |
| 1890 |
% \begin{macro}{\amsrefs@bibitem} |
| 1891 |
% Reference processing at the AMS sometimes results in raw |
| 1892 |
% \cs{bibitem} entries being interspersed with \cs{bib} entries in |
| 1893 |
% a bibliography. For that to work, we need to modify |
| 1894 |
% \cs{@lbibitem} and \cs{@bibitem} to interoperate more smoothly |
| 1895 |
% with \pkg{amsrefs}. |
| 1896 |
% \begin{macrocode} |
| 1897 |
\def\amsrefs@lbibitem[#1]#2{% |
| 1898 |
\begingroup |
| 1899 |
\def\CurrentBib{#2}% |
| 1900 |
\def\thebib{#1}% |
| 1901 |
\@nmbrlistfalse |
| 1902 |
\item\leavevmode |
| 1903 |
\if@filesw |
| 1904 |
{\let\protect\noexpand |
| 1905 |
\immediate\write\@auxout{\string\bibcite{#2}{{#1}{}}}}% |
| 1906 |
\fi |
| 1907 |
\endgroup |
| 1908 |
\ignorespaces |
| 1909 |
} |
| 1910 |
|
| 1911 |
\def\amsrefs@bibitem#1{% |
| 1912 |
\def\CurrentBib{#1}% |
| 1913 |
\item |
| 1914 |
\if@filesw |
| 1915 |
\immediate\write\@auxout{\string\bibcite{#1}{{\the\value{\@listctr}}{}}}% |
| 1916 |
\fi |
| 1917 |
\ignorespaces |
| 1918 |
} |
| 1919 |
% \end{macrocode} |
| 1920 |
% \end{macro} |
| 1921 |
% \end{macro} |
| 1922 |
% |
| 1923 |
% \begin{macro}{\@biblist} |
| 1924 |
% \begin{macrocode} |
| 1925 |
\newcommand\@biblist[1][]{% |
| 1926 |
\stepcounter{bib@env} |
| 1927 |
\biblistfont |
| 1928 |
\labelsep .5em\relax |
| 1929 |
\let\@bibitem\amsrefs@bibitem |
| 1930 |
\let\@lbibitem\amsrefs@lbibitem |
| 1931 |
\list{\BibLabel}{% |
| 1932 |
\restore@labelwidth |
| 1933 |
\@maxlabelwidth\z@ |
| 1934 |
\@nmbrlisttrue |
| 1935 |
\def\@listctr{bib}% |
| 1936 |
\let\makelabel\bib@mklab |
| 1937 |
#1\relax |
| 1938 |
}% |
| 1939 |
\sloppy |
| 1940 |
% \end{macrocode} |
| 1941 |
% Discourage page breaks within bibliography entries and disable them |
| 1942 |
% completely for entries that are less than four lines long. |
| 1943 |
% \begin{macrocode} |
| 1944 |
\interlinepenalty\@m |
| 1945 |
\clubpenalty\@M |
| 1946 |
\widowpenalty\clubpenalty |
| 1947 |
\frenchspacing |
| 1948 |
\ResetCapSFCodes |
| 1949 |
\@ifstar{\@biblistsetup}{}% |
| 1950 |
} |
| 1951 |
% \end{macrocode} |
| 1952 |
% \end{macro} |
| 1953 |
% |
| 1954 |
% \begin{macro}{\@biblistsetup} |
| 1955 |
% \begin{macrocode} |
| 1956 |
\newcommand{\@biblistsetup}[1]{% |
| 1957 |
\RestrictedSetKeys{}{biblist}{\the\rsk@toks}{#1}% |
| 1958 |
\rkvIfEmpty{biblist}{prefix}{}{% |
| 1959 |
\let\amsrefs@label@prefix\biblist'prefix |
| 1960 |
}% |
| 1961 |
\rkvIfEmpty{biblist}{labels}{}{% |
| 1962 |
\@ifundefined{amsrefs@option@\biblist'labels}{% |
| 1963 |
\amsrefs@warning{Invalid label style `\biblist'labels`}% |
| 1964 |
}{% |
| 1965 |
\csname amsrefs@option@\biblist'labels\endcsname |
| 1966 |
}% |
| 1967 |
}% |
| 1968 |
} |
| 1969 |
% \end{macrocode} |
| 1970 |
% \end{macro} |
| 1971 |
% |
| 1972 |
% \begin{macro}{\@endbiblist} |
| 1973 |
% Change error for empty list (no items) to warning, to allow authors |
| 1974 |
% to leave their bibliography temporarily empty during writing: |
| 1975 |
% \begin{macrocode} |
| 1976 |
\def\@endbiblist{% |
| 1977 |
\save@labelwidth |
| 1978 |
\def\@noitemerr{\@latex@warning{Empty bibliography list}}% |
| 1979 |
\global\let\previous@primary\@empty |
| 1980 |
\endlist |
| 1981 |
} |
| 1982 |
% \end{macrocode} |
| 1983 |
% \end{macro} |
| 1984 |
% |
| 1985 |
% \begin{macro}{\@maxlabelwidth} |
| 1986 |
% \begin{macrocode} |
| 1987 |
\newdimen\@maxlabelwidth |
| 1988 |
% \end{macrocode} |
| 1989 |
% \end{macro} |
| 1990 |
% |
| 1991 |
% \begin{macro}{\bib@mklab} |
| 1992 |
% \begin{macrocode} |
| 1993 |
\def\bib@mklab#1{% |
| 1994 |
\settowidth\@tempdima{#1}% |
| 1995 |
\ifdim \@tempdima > \@maxlabelwidth |
| 1996 |
\global\@maxlabelwidth\@tempdima |
| 1997 |
\fi |
| 1998 |
#1\hfil |
| 1999 |
} |
| 2000 |
% \end{macrocode} |
| 2001 |
% \end{macro} |
| 2002 |
% |
| 2003 |
% \begin{macrocode} |
| 2004 |
\newcounter{bib@env} |
| 2005 |
% \end{macrocode} |
| 2006 |
% |
| 2007 |
% \begin{macro}{\save@labelwidth} |
| 2008 |
% \begin{macrocode} |
| 2009 |
\def\save@labelwidth{% |
| 2010 |
\if@filesw |
| 2011 |
\immediate\write\@auxout{% |
| 2012 |
\string\newlabel{[bibenv:\the\c@bib@env]}{\the\@maxlabelwidth}% |
| 2013 |
}% |
| 2014 |
\fi |
| 2015 |
} |
| 2016 |
% \end{macrocode} |
| 2017 |
% \end{macro} |
| 2018 |
% |
| 2019 |
% \begin{macro}{\restore@labelwidth} |
| 2020 |
% \begin{macrocode} |
| 2021 |
\def\restore@labelwidth{% |
| 2022 |
\@xp\ifx \csname r@[bibenv:\the\c@bib@env]\endcsname \relax |
| 2023 |
\resetbiblist{00}% |
| 2024 |
\else |
| 2025 |
\@xp\labelwidth\csname r@[bibenv:\the\c@bib@env]\endcsname |
| 2026 |
\leftmargin\labelwidth |
| 2027 |
\advance\leftmargin\labelsep |
| 2028 |
\fi |
| 2029 |
} |
| 2030 |
% \end{macrocode} |
| 2031 |
% \end{macro} |
| 2032 |
% |
| 2033 |
% \begin{macro}{\ResetCapSFCodes} |
| 2034 |
% Presumably this is here because there has been a problem in the |
| 2035 |
% past with packages that change the \cs{catcode}s of capital |
| 2036 |
% letters. |
| 2037 |
% \begin{macrocode} |
| 2038 |
\providecommand{\ResetCapSFCodes}{% |
| 2039 |
\count@=`\A |
| 2040 |
\def\@tempa{% |
| 2041 |
\sfcode\count@=\@m |
| 2042 |
\advance\count@\@ne |
| 2043 |
\ifnum\count@>`\Z\relax \expandafter\@gobble \fi |
| 2044 |
\@tempa |
| 2045 |
}% |
| 2046 |
\@tempa |
| 2047 |
} |
| 2048 |
% \end{macrocode} |
| 2049 |
% \end{macro} |
| 2050 |
% |
| 2051 |
% \begin{macro}{\CurrentBib} |
| 2052 |
% In case this is undefined sometimes. |
| 2053 |
% \begin{macrocode} |
| 2054 |
\def\CurrentBib{??} |
| 2055 |
% \end{macrocode} |
| 2056 |
% \end{macro} |
| 2057 |
% |
| 2058 |
% \begin{macro}{\BibLabel} |
| 2059 |
% \begin{macrocode} |
| 2060 |
\newcommand{\BibLabel}{% |
| 2061 |
\hfill |
| 2062 |
\Hy@raisedlink{\hyper@anchorstart{cite.\CurrentBib}\hyper@anchorend}% |
| 2063 |
[\thebib]% |
| 2064 |
} |
| 2065 |
% \end{macrocode} |
| 2066 |
% \end{macro} |
| 2067 |
% |
| 2068 |
% \begin{macro}{\resetbiblist} |
| 2069 |
% \begin{macrocode} |
| 2070 |
\newcommand{\resetbiblist}[1]{% |
| 2071 |
\settowidth\labelwidth{\def\thebib{#1}\BibLabel}% |
| 2072 |
\leftmargin\labelwidth |
| 2073 |
\ifdim\labelwidth=\z@ |
| 2074 |
\leftmargin=1em |
| 2075 |
\itemindent=-\leftmargin |
| 2076 |
\else |
| 2077 |
\advance\leftmargin\labelsep |
| 2078 |
\fi |
| 2079 |
} |
| 2080 |
% \end{macrocode} |
| 2081 |
% \end{macro} |
| 2082 |
% |
| 2083 |
% \subsection{Processing bibliography entries} |
| 2084 |
% |
| 2085 |
% There are several things one might want to do when a \cn{bib} entry |
| 2086 |
% is encountered: |
| 2087 |
% \begin{enumerate} |
| 2088 |
% |
| 2089 |
% \item Format and print it. This corresponds to the direct entry |
| 2090 |
% of bibliography items as described in section~2.1 of the users's |
| 2091 |
% guide. |
| 2092 |
% |
| 2093 |
% \item Copy it into a \fn{.bbl} file. This corresponds to the use |
| 2094 |
% of \cn{bibselect} and an external \fn{.ltb} database as described |
| 2095 |
% in section~2.2 of the user's guide. |
| 2096 |
% |
| 2097 |
% \item Store the full information in memory. This is done by |
| 2098 |
% \cn{bib*}. |
| 2099 |
% |
| 2100 |
% \end{enumerate} |
| 2101 |
% |
| 2102 |
% \begin{macro}{\bib} |
| 2103 |
% Here is where the rubber hits the road. |
| 2104 |
% \begin{macrocode} |
| 2105 |
\newcommand{\bib}{% |
| 2106 |
\begingroup |
| 2107 |
\@ifstar{% |
| 2108 |
\@tempswatrue |
| 2109 |
\let\@bibdef\star@bibdef |
| 2110 |
\BibItem |
| 2111 |
}{% |
| 2112 |
\@tempswafalse |
| 2113 |
\BibItem |
| 2114 |
}% |
| 2115 |
} |
| 2116 |
% \end{macrocode} |
| 2117 |
% \end{macro} |
| 2118 |
% |
| 2119 |
% \begin{macro}{\BibItem} |
| 2120 |
% \MacroArgs |
| 2121 |
% \macroarg{1}{citekey} |
| 2122 |
% \macroarg{2}{bibtype} |
| 2123 |
% \begin{macrocode} |
| 2124 |
\newcommand{\BibItem}[2]{% |
| 2125 |
\vdef\@tempa{#1}% |
| 2126 |
\edef\@tempa{% |
| 2127 |
\edef\@nx\@tempa{\@nx\@xp\@nx\zap@space\@tempa\space\@nx\@empty}% |
| 2128 |
}% |
| 2129 |
\@tempa |
| 2130 |
\edef\@tempb{% |
| 2131 |
\@nx\@bibdef\@xp\@nx\csname setbib@#2\endcsname{#2}{\@tempa}% |
| 2132 |
}% |
| 2133 |
\@tempb |
| 2134 |
} |
| 2135 |
% \end{macrocode} |
| 2136 |
% \end{macro} |
| 2137 |
% |
| 2138 |
% \begin{macro}{\@bibdef} |
| 2139 |
% \cs{@bibdef} is a pointer to the procedure that should be handed |
| 2140 |
% the entry's key-value pairs. It has one of four values: |
| 2141 |
% \begin{enumerate} |
| 2142 |
% |
| 2143 |
% \item \cs{star@bibdef} |
| 2144 |
% |
| 2145 |
% \item \cs{normal@bibdef} |
| 2146 |
% |
| 2147 |
% \item \cs{copy@bibdef} |
| 2148 |
% |
| 2149 |
% \item \cs{selective@bibdef} |
| 2150 |
% |
| 2151 |
% \end{enumerate} |
| 2152 |
% \MacroArgs |
| 2153 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2154 |
% \macroarg{2}{bibtype} |
| 2155 |
% \macroarg{3}{citekey} |
| 2156 |
% \begin{macrocode} |
| 2157 |
\AtBeginDocument{\let\@bibdef\normal@bibdef} |
| 2158 |
% \end{macrocode} |
| 2159 |
% \end{macro} |
| 2160 |
% |
| 2161 |
% \begin{macro}{\bib@exec} |
| 2162 |
% And \cs{bib@exec} is a pointer to the procedure that |
| 2163 |
% \cs{normal@bibdef} will invoke to process the key-value pairs |
| 2164 |
% after they've been parsed. It has one |
| 2165 |
% of these values: |
| 2166 |
% \begin{enumerate} |
| 2167 |
% |
| 2168 |
% \item \cs{bib@store} |
| 2169 |
% |
| 2170 |
% \item \cs{bib@print} |
| 2171 |
% |
| 2172 |
% \end{enumerate} |
| 2173 |
% \MacroArgs |
| 2174 |
% \macroarg{1}{citekey} |
| 2175 |
% \macroarg{2}{\cs{the}\cs{rsk@toks}} |
| 2176 |
% \macroarg{3}{\cs{setbib@}bibtype} |
| 2177 |
% \begin{macrocode} |
| 2178 |
\AtBeginDocument{\let\bib@exec\bib@print} |
| 2179 |
% \end{macrocode} |
| 2180 |
% \end{macro} |
| 2181 |
% |
| 2182 |
% \subsubsection{\cs{@bibdef} Implementations} |
| 2183 |
% |
| 2184 |
% \begin{macro}{\normal@bibdef} |
| 2185 |
% \MacroArgs |
| 2186 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2187 |
% \macroarg{2}{bibtype} |
| 2188 |
% \macroarg{3}{citekey} |
| 2189 |
% \begin{macrocode} |
| 2190 |
\def\normal@bibdef#1#2#3{% |
| 2191 |
% \end{macrocode} |
| 2192 |
% \cs{CurrentBibType} is used by \pkg{export-bibtex}, but there |
| 2193 |
% might be a better way to handle it. (dmj) |
| 2194 |
% \begin{macrocode} |
| 2195 |
\def\CurrentBibType{#2}% |
| 2196 |
\ifx\relax#1% |
| 2197 |
\amsrefs@error{Undefined entry type: #2}\@ehc |
| 2198 |
\let#1\setbib@misc |
| 2199 |
\fi |
| 2200 |
\RestrictedSetKeys{}{bib}% |
| 2201 |
{\bib@exec{#3}{\the\rsk@toks}{#1}\endgroup}% |
| 2202 |
} |
| 2203 |
|
| 2204 |
\let\@bibdef\normal@bibdef |
| 2205 |
% \end{macrocode} |
| 2206 |
% \end{macro} |
| 2207 |
% |
| 2208 |
% \begin{macro}{\star@bibdef} |
| 2209 |
% \MacroArgs |
| 2210 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2211 |
% \macroarg{2}{bibtype} |
| 2212 |
% \macroarg{3}{citekey} |
| 2213 |
% \begin{macrocode} |
| 2214 |
\def\star@bibdef{% |
| 2215 |
\let\bib@exec\bib@store |
| 2216 |
\normal@bibdef |
| 2217 |
} |
| 2218 |
% \end{macrocode} |
| 2219 |
% \end{macro} |
| 2220 |
% |
| 2221 |
% \begin{macro}{\copy@bibdef} |
| 2222 |
% This is a variation that copies everything into the \fn{.bbl} |
| 2223 |
% file. Used by \cn{bibselect*} and \cn{bib*} inside \fn{.ltb} |
| 2224 |
% files. |
| 2225 |
% \begin{macrocode} |
| 2226 |
\def\copy@bibdef{% |
| 2227 |
\if@tempswa |
| 2228 |
\@xp\defer@bibdef |
| 2229 |
\else |
| 2230 |
\@xp\copy@bibdef@a |
| 2231 |
\fi |
| 2232 |
} |
| 2233 |
% \end{macrocode} |
| 2234 |
% \end{macro} |
| 2235 |
% |
| 2236 |
% \begin{macro}{\copy@bibdef@a} |
| 2237 |
% \begin{macrocode} |
| 2238 |
\def\copy@bibdef@a#1#2#3#4{% |
| 2239 |
\@open@bbl@file |
| 2240 |
\process@xrefs{#4}% |
| 2241 |
\bbl@write{% |
| 2242 |
\string\bib\if@tempswa*\fi{#3}{#2}\string{\iffalse}\fi |
| 2243 |
}% |
| 2244 |
% \end{macrocode} |
| 2245 |
% Since we're supplying our own definition of \cs{rsk@set}, we |
| 2246 |
% don't actually need the group argument, so we leave it out to |
| 2247 |
% save a few tokens. |
| 2248 |
% \begin{macrocode} |
| 2249 |
\RestrictedSetKeys{\global\let\rsk@set\bbl@copy}\@empty |
| 2250 |
{\bbl@write{\iffalse{\fi\string}^^J}% |
| 2251 |
\endgroup}{#4}% |
| 2252 |
} |
| 2253 |
% \end{macrocode} |
| 2254 |
% \end{macro} |
| 2255 |
% |
| 2256 |
% \begin{macrocode} |
| 2257 |
\catcode`\:=11 |
| 2258 |
|
| 2259 |
\def\modify@xref@fields{% |
| 2260 |
\let\set:bib'author\output@xref@a |
| 2261 |
\let\set:bib'editor\output@xref@a |
| 2262 |
\let\set:bib'translator\output@xref@a |
| 2263 |
\let\set:bib'journal\output@xref@a |
| 2264 |
\let\set:bib'publisher\output@xref@a |
| 2265 |
\def\set:bib'xref##1##2{\output@xref@{##1}\@empty}% |
| 2266 |
\def\set:bib'book##1##2{\output@inner@xref@{##1}\@empty}% |
| 2267 |
\let\set:bib'conference\set:bib'book |
| 2268 |
\let\set:bib'partial\set:bib'book |
| 2269 |
\let\set:bib'reprint\set:bib'book |
| 2270 |
\let\set:bib'translation\set:bib'book |
| 2271 |
} |
| 2272 |
|
| 2273 |
\catcode`\:=12 |
| 2274 |
|
| 2275 |
\def\process@xrefs#1{% |
| 2276 |
\begingroup |
| 2277 |
\RestrictedSetKeys{\modify@xref@fields}{bib}{\the\rsk@toks}{#1}% |
| 2278 |
\endgroup |
| 2279 |
} |
| 2280 |
|
| 2281 |
\def\output@xref@a#1#2{% |
| 2282 |
\def\@tempa{#1}% |
| 2283 |
\lowercase{\def\@tempb{#1}}% |
| 2284 |
\ifx\@tempa\@tempb |
| 2285 |
\output@xref@{#1}% |
| 2286 |
\fi |
| 2287 |
} |
| 2288 |
|
| 2289 |
\def\output@xref@#1{% |
| 2290 |
\@ifnotempty{#1}{% |
| 2291 |
\@ifundefined{bi@#1}{}{% |
| 2292 |
\begingroup |
| 2293 |
\let\star@bibdef\copy@bibdef@a |
| 2294 |
\csname bi@#1\endcsname |
| 2295 |
\endgroup |
| 2296 |
}% |
| 2297 |
\@xp\g@undef\csname bi@#1\endcsname |
| 2298 |
}% |
| 2299 |
} |
| 2300 |
|
| 2301 |
\def\output@inner@xref@#1{% |
| 2302 |
\in@={#1}% |
| 2303 |
\ifin@\else |
| 2304 |
\output@xref@{#1}% |
| 2305 |
\fi |
| 2306 |
} |
| 2307 |
% \end{macrocode} |
| 2308 |
% |
| 2309 |
% \begin{macro}{\bbl@copy} |
| 2310 |
% \begin{macrocode} |
| 2311 |
\def\bbl@copy#1\endcsname#2{% |
| 2312 |
\begingroup |
| 2313 |
\def\@tempa{#1}% |
| 2314 |
\toks@{{#2}}% |
| 2315 |
\star@{\bbl@copy@a}{}% |
| 2316 |
} |
| 2317 |
% \end{macrocode} |
| 2318 |
% \end{macro} |
| 2319 |
% |
| 2320 |
% \begin{macro}{\bbl@copy@a} |
| 2321 |
% \begin{macrocode} |
| 2322 |
\def\bbl@copy@a#1{% |
| 2323 |
\@ifnotempty{#1}{% |
| 2324 |
\add@toks@{*{#1}}% |
| 2325 |
}% |
| 2326 |
\bbl@write{ \space\@tempa=\the\toks@,}% |
| 2327 |
\endgroup |
| 2328 |
\rsk@resume |
| 2329 |
} |
| 2330 |
% \end{macrocode} |
| 2331 |
% \end{macro} |
| 2332 |
% |
| 2333 |
% \begin{macro}{\selective@bibdef} |
| 2334 |
% This is a variation that ignores anything not having a known |
| 2335 |
% citation key. Used by \cn{bibselect}. |
| 2336 |
% |
| 2337 |
% \MacroArgs |
| 2338 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2339 |
% \macroarg{2}{bibtype} |
| 2340 |
% \macroarg{3}{citekey} |
| 2341 |
% \begin{macrocode} |
| 2342 |
\def\selective@bibdef#1#2#3{% |
| 2343 |
\@xp\selbibdef@a\csname b@#3\endcsname{#1}{#2}{#3}% |
| 2344 |
} |
| 2345 |
% \end{macrocode} |
| 2346 |
% \end{macro} |
| 2347 |
% |
| 2348 |
% \begin{macro}{\selbibdef@a} |
| 2349 |
% \begin{macrocode} |
| 2350 |
\def\selbibdef@a#1{% |
| 2351 |
\def\@tempa{\endgroup\@gobblefour}% |
| 2352 |
\ifx\relax#1\else \@xp\selbibdef@b#1\@nil \fi |
| 2353 |
\@tempa |
| 2354 |
} |
| 2355 |
% \end{macrocode} |
| 2356 |
% \end{macro} |
| 2357 |
% |
| 2358 |
% \begin{macro}{\selbibdef@b} |
| 2359 |
% \begin{macrocode} |
| 2360 |
\def\selbibdef@b#1#2#3\@nil{% |
| 2361 |
\ifx 1#2\let\@tempa\copy@bibdef\fi |
| 2362 |
} |
| 2363 |
% \end{macrocode} |
| 2364 |
% \end{macro} |
| 2365 |
% |
| 2366 |
% \begin{macro}{\defer@bibdef} |
| 2367 |
% This is a variation that ignores anything not having a known |
| 2368 |
% citation key. Used by \cn{bibselect}. |
| 2369 |
% |
| 2370 |
% \MacroArgs |
| 2371 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2372 |
% \macroarg{2}{bibtype} |
| 2373 |
% \macroarg{3}{citekey} |
| 2374 |
% \macroarg{4}{key-val pairs} |
| 2375 |
% \begin{macrocode} |
| 2376 |
\def\defer@bibdef#1#2#3#4{% |
| 2377 |
\@xp\gdef\csname bi@#3\endcsname{% |
| 2378 |
\bib*{#3}{#2}{#4}% |
| 2379 |
}% |
| 2380 |
\@xp\addto@defer@list \csname bi@#3\endcsname |
| 2381 |
\endgroup |
| 2382 |
} |
| 2383 |
% \end{macrocode} |
| 2384 |
% \end{macro} |
| 2385 |
% |
| 2386 |
% \begin{macro}{\bibdefer@list} |
| 2387 |
% \begin{macrocode} |
| 2388 |
\let\bibdefer@list\@empty |
| 2389 |
% \end{macrocode} |
| 2390 |
% \end{macro} |
| 2391 |
% |
| 2392 |
% \begin{macro}{\addto@defer@list} |
| 2393 |
% \begin{macrocode} |
| 2394 |
\def\addto@defer@list#1{% |
| 2395 |
\begingroup |
| 2396 |
\def\do{\@nx\do\@nx}% |
| 2397 |
\xdef\bibdefer@list{\bibdefer@list\do#1}% |
| 2398 |
\endgroup |
| 2399 |
} |
| 2400 |
% \end{macrocode} |
| 2401 |
% \end{macro} |
| 2402 |
% |
| 2403 |
% \subsubsection{\cs{bib@exec} Implementations} |
| 2404 |
% |
| 2405 |
% \begin{macro}{\bib@store} |
| 2406 |
% This is the easy one. It just stores the entire set of key-value |
| 2407 |
% pairs in \cs{bi@}\emph{citekey}. |
| 2408 |
% \begin{macrocode} |
| 2409 |
\def\bib@store#1{% |
| 2410 |
\afterassignment\@gobble |
| 2411 |
\@xp\xdef\csname bi@#1\endcsname |
| 2412 |
} |
| 2413 |
% \end{macrocode} |
| 2414 |
% \end{macro} |
| 2415 |
% |
| 2416 |
% \begin{macro}{\bib@print} |
| 2417 |
% \MacroArgs |
| 2418 |
% \macroarg{1}{citekey} |
| 2419 |
% \macroarg{2}{\cs{the}\cs{rsk@toks}} |
| 2420 |
% \macroarg{3}{\cs{setbib@}bibtype} |
| 2421 |
% \begin{macrocode} |
| 2422 |
\def\bib@print#1#2#3{% |
| 2423 |
\bib@start{#1}% |
| 2424 |
\let\setbib@@#3% |
| 2425 |
#2\relax % execute definitions locally |
| 2426 |
\bib@resolve@xrefs |
| 2427 |
\bib@field@patches |
| 2428 |
\bib@selectlanguage |
| 2429 |
\generate@label |
| 2430 |
\bib'setup |
| 2431 |
\bib@cite{#1}% |
| 2432 |
\kern\@ne sp |
| 2433 |
\ifx\setbib@@\setbib@article |
| 2434 |
\ifx\bib'booktitle\@empty |
| 2435 |
\ifx\bib'book\@empty |
| 2436 |
\ifx\bib'conference\@empty |
| 2437 |
\else |
| 2438 |
\let\setbib@@\setbib@incollection |
| 2439 |
\fi |
| 2440 |
\else |
| 2441 |
\let\setbib@@\setbib@incollection |
| 2442 |
\fi |
| 2443 |
\else |
| 2444 |
\let\setbib@@\setbib@incollection |
| 2445 |
\fi |
| 2446 |
\fi |
| 2447 |
\setbib@@ |
| 2448 |
\bib@end |
| 2449 |
} |
| 2450 |
% \end{macrocode} |
| 2451 |
% \end{macro} |
| 2452 |
% |
| 2453 |
% \begin{macro}{\bib@print@inner} |
| 2454 |
% Note that the order of the arguments is reversed with respect to |
| 2455 |
% \cs{bib@print}. Maybe that isn't such a great idea. |
| 2456 |
% \MacroArgs |
| 2457 |
% \macroarg{1}{\cs{setbib@}bibtype} |
| 2458 |
% \macroarg{2}{\cs{the}\cs{rsk@toks}} |
| 2459 |
% \begin{macrocode} |
| 2460 |
\def\bib@print@inner#1#2{% |
| 2461 |
\begingroup |
| 2462 |
#2\relax % execute definitions locally |
| 2463 |
\bib@resolve@xrefs |
| 2464 |
\bib@field@patches |
| 2465 |
\bib'setup |
| 2466 |
#1% |
| 2467 |
\endgroup |
| 2468 |
} |
| 2469 |
% \end{macrocode} |
| 2470 |
% \end{macro} |
| 2471 |
% |
| 2472 |
% \begin{macro}{\current@citekey} |
| 2473 |
% \begin{macrocode} |
| 2474 |
\let\current@citekey\@empty |
| 2475 |
% \end{macrocode} |
| 2476 |
% \end{macro} |
| 2477 |
% |
| 2478 |
% \begin{macro}{\prev@citekey} |
| 2479 |
% \begin{macrocode} |
| 2480 |
\let\prev@citekey\@empty |
| 2481 |
% \end{macrocode} |
| 2482 |
% \end{macro} |
| 2483 |
% |
| 2484 |
% \begin{macro}{\bib@start} |
| 2485 |
% There used to be more to it. |
| 2486 |
% \begin{macrocode} |
| 2487 |
\def\bib@start#1{% |
| 2488 |
\begingroup |
| 2489 |
\def\current@citekey{#1}% |
| 2490 |
} |
| 2491 |
% \end{macrocode} |
| 2492 |
% \end{macro} |
| 2493 |
% |
| 2494 |
% \begin{macro}{\bib@end} |
| 2495 |
% Instead of being handled by \cs{bib@end}, ending punctuation is |
| 2496 |
% normally handled via the \fld{transition} field (q.v.) |
| 2497 |
% \begin{macrocode} |
| 2498 |
\def\bib@end{% |
| 2499 |
\relax |
| 2500 |
\@xp\PrintBackRefs\@xp{\CurrentBib}% |
| 2501 |
\par |
| 2502 |
\save@primary |
| 2503 |
\global\let\prev@citekey\current@citekey |
| 2504 |
\endgroup |
| 2505 |
} |
| 2506 |
% \end{macrocode} |
| 2507 |
% \end{macro} |
| 2508 |
% |
| 2509 |
% \subsubsection{Resolving cross-references} |
| 2510 |
% |
| 2511 |
% \begin{macro}{\bib@resolve@xrefs} |
| 2512 |
% \begin{macrocode} |
| 2513 |
\def\bib@resolve@xrefs{% |
| 2514 |
\xref@check@c\bib'xref |
| 2515 |
\xref@check@a\bib'author |
| 2516 |
\xref@check@a\bib'editor |
| 2517 |
\xref@check@a\bib'translator |
| 2518 |
\xref@check@b\bib'journal |
| 2519 |
\xref@check@b\bib'publisher |
| 2520 |
} |
| 2521 |
% \end{macrocode} |
| 2522 |
% \end{macro} |
| 2523 |
% |
| 2524 |
% \begin{macro}{\xref@check@a} |
| 2525 |
% Resolve a contributor (typically a \cn{DefineName}) alias. |
| 2526 |
% Requires rebuilding the list. |
| 2527 |
% \begin{macrocode} |
| 2528 |
\def\xref@check@a#1{% |
| 2529 |
\ifx\@empty#1\relax |
| 2530 |
\else |
| 2531 |
\begingroup |
| 2532 |
\toks@\@emptytoks |
| 2533 |
\@temptokenb\@emptytoks |
| 2534 |
\series@index\z@ |
| 2535 |
\def\name{\xref@check@aa#1}% |
| 2536 |
#1\relax |
| 2537 |
\edef\@tempa{% |
| 2538 |
\def\@nx#1{\the\toks@}% |
| 2539 |
\the\@temptokenb |
| 2540 |
}% |
| 2541 |
\@xp\endgroup |
| 2542 |
\@tempa |
| 2543 |
\fi |
| 2544 |
} |
| 2545 |
% \end{macrocode} |
| 2546 |
% \end{macro} |
| 2547 |
% |
| 2548 |
% \begin{macro}{\xref@check@aa} |
| 2549 |
% \begin{macrocode} |
| 2550 |
\def\xref@check@aa#1#2{% |
| 2551 |
\advance\series@index\@ne |
| 2552 |
\def\@tempa{#2}% |
| 2553 |
\lowercase{\def\@tempb{#2}}% |
| 2554 |
\ifx\@tempa\@tempb |
| 2555 |
\ifx\@tempa\@empty |
| 2556 |
\add@toks@{\name{}}% |
| 2557 |
\else |
| 2558 |
\@ifundefined{bi@#2}{% |
| 2559 |
\BibAbbrevWarning{#2}% |
| 2560 |
\add@toks@{\name{#2}}% |
| 2561 |
}{% |
| 2562 |
\xref@check@ab#1{#2}% |
| 2563 |
}% |
| 2564 |
\fi |
| 2565 |
\else |
| 2566 |
\add@toks@{\name{#2}}% |
| 2567 |
\fi |
| 2568 |
} |
| 2569 |
% \end{macrocode} |
| 2570 |
% \end{macro} |
| 2571 |
% |
| 2572 |
% \begin{macro}{\xref@check@ab} |
| 2573 |
% \begin{macrocode} |
| 2574 |
\def\xref@check@ab#1#2{% |
| 2575 |
\csname bi@#2\endcsname |
| 2576 |
\ifx\@empty\bib'name |
| 2577 |
\@temptokena{#2}% |
| 2578 |
\else |
| 2579 |
\@temptokena\@xp{\bib'name}% |
| 2580 |
\get@property\@tempa\bib'name |
| 2581 |
\edef\@tempa{% |
| 2582 |
\@nx\addto@hook\@temptokenb{% |
| 2583 |
\@nx\reset@nth@property\@nx#1\the\series@index{\@tempa}% |
| 2584 |
}% |
| 2585 |
}% |
| 2586 |
\@tempa |
| 2587 |
\fi |
| 2588 |
\edef\@tempa{\@nx\add@toks@{\@nx\name{\the\@temptokena}}}% |
| 2589 |
\@tempa |
| 2590 |
} |
| 2591 |
% \end{macrocode} |
| 2592 |
% \end{macro} |
| 2593 |
% |
| 2594 |
% \begin{macro}{\xref@check@b} |
| 2595 |
% Resolve a \fld{journal} or \fld{publisher} alias (typically a |
| 2596 |
% \cn{DefinePublisher} or \cn{DefineJournal} alias). |
| 2597 |
% \begin{macrocode} |
| 2598 |
\def\xref@check@b#1{% |
| 2599 |
\ifx\@empty#1% |
| 2600 |
\else |
| 2601 |
\toks@\@xp{#1}% |
| 2602 |
\edef\@tempb{\lowercase{\def\@nx\@tempa{\the\toks@}}}% |
| 2603 |
\@tempb |
| 2604 |
\ifx\@tempa#1\relax % all lowercase |
| 2605 |
\@ifundefined{bi@#1}{% |
| 2606 |
\BibAbbrevWarning{#1}% |
| 2607 |
}{% |
| 2608 |
% \end{macrocode} |
| 2609 |
% We pass control to \cs{xref@check@c} here to handle inheritance |
| 2610 |
% of multiple fields properly. This means some of the checking |
| 2611 |
% we've just done gets done again, but I can live with that. |
| 2612 |
% \begin{macrocode} |
| 2613 |
\let#1\@empty |
| 2614 |
\xref@check@c\@tempa |
| 2615 |
}% |
| 2616 |
\fi |
| 2617 |
\fi |
| 2618 |
} |
| 2619 |
% \end{macrocode} |
| 2620 |
% \end{macro} |
| 2621 |
% |
| 2622 |
% \begin{macro}{\xref@check@c} |
| 2623 |
% Resolve an \fld{xref} field. |
| 2624 |
% \begin{macrocode} |
| 2625 |
\def\xref@check@c#1{% |
| 2626 |
\ifx#1\@empty |
| 2627 |
\else |
| 2628 |
\begingroup |
| 2629 |
\@apply\auto@protect\amsrefs@textsymbols |
| 2630 |
\@apply\auto@protect\amsrefs@textaccents |
| 2631 |
\let\DSK@def\xref@add@toks |
| 2632 |
\let\DSK@append\xref@append |
| 2633 |
\toks@\@emptytoks |
| 2634 |
\let\bib@reset\@empty |
| 2635 |
% \end{macrocode} |
| 2636 |
% The \cs{@for} here is just a fancy way of expanding \arg{1}. (Or |
| 2637 |
% is it?) |
| 2638 |
% \begin{macrocode} |
| 2639 |
\@for\xref@ID:=#1\do{% |
| 2640 |
\@ifundefined{bi@\xref@ID}{% |
| 2641 |
\XRefWarning{\xref@ID}% |
| 2642 |
}{% |
| 2643 |
\csname bi@\xref@ID\endcsname |
| 2644 |
}% |
| 2645 |
}% |
| 2646 |
\edef\@tempa{\endgroup\the\toks@}% |
| 2647 |
\@tempa |
| 2648 |
\fi |
| 2649 |
} |
| 2650 |
% \end{macrocode} |
| 2651 |
% \end{macro} |
| 2652 |
% |
| 2653 |
% \begin{macro}{\xref@add@toks} |
| 2654 |
% If any title occurs in an \fld{xref}ed item, assume that it is a book |
| 2655 |
% title. This might not always be the best assumption? Let's see how |
| 2656 |
% it goes though. [mjd,2001-12-11] |
| 2657 |
% |
| 2658 |
% \MacroArgs |
| 2659 |
% \macroarg{1}{\cs{bib'}field} |
| 2660 |
% \macroarg{2}{value} |
| 2661 |
% \begin{macrocode} |
| 2662 |
\def\xref@add@toks#1#2#3{% |
| 2663 |
\ifx#1\@empty |
| 2664 |
\edef\@tempa{% |
| 2665 |
\@nx\add@toks@{\@xp\@nx\csname\rkv@setter#1\endcsname{#2}{#3}}% |
| 2666 |
}% |
| 2667 |
\@tempa |
| 2668 |
\else |
| 2669 |
\in@\bib'title{#1}% |
| 2670 |
\ifin@ |
| 2671 |
\ifx\bib'booktitle\@empty |
| 2672 |
\edef\@tempa{% |
| 2673 |
\@nx\add@toks@{% |
| 2674 |
\@xp\@nx\csname set:bib'booktitle\endcsname |
| 2675 |
}% |
| 2676 |
}% |
| 2677 |
\@tempa |
| 2678 |
\add@toks@{{#2}{#3}}% |
| 2679 |
\fi |
| 2680 |
\fi |
| 2681 |
\fi |
| 2682 |
} |
| 2683 |
% \end{macrocode} |
| 2684 |
% \end{macro} |
| 2685 |
% |
| 2686 |
% \begin{macrocode} |
| 2687 |
\def\xref@append#1#2#3#4{% |
| 2688 |
\edef\@tempa{% |
| 2689 |
\@nx\add@toks@{\@xp\@nx\csname\rkv@setter#2\endcsname{#3}{#4}}% |
| 2690 |
}% |
| 2691 |
\@tempa |
| 2692 |
} |
| 2693 |
% \end{macrocode} |
| 2694 |
% |
| 2695 |
% \begin{macro}{\BibAbbrevWarning} |
| 2696 |
% \begin{macrocode} |
| 2697 |
\def\BibAbbrevWarning#1{\amsrefs@warning{Abbreviation '#1' undefined}} |
| 2698 |
% \end{macrocode} |
| 2699 |
% \end{macro} |
| 2700 |
% |
| 2701 |
% \begin{macro}{\XrefWarning} |
| 2702 |
% \begin{macrocode} |
| 2703 |
\def\XRefWarning#1{\amsrefs@warning{Xref '#1' undefined}} |
| 2704 |
% \end{macrocode} |
| 2705 |
% \end{macro} |
| 2706 |
% |
| 2707 |
% \subsubsection{Bib field preprocessing} |
| 2708 |
% |
| 2709 |
% \begin{macro}{\current@primary} |
| 2710 |
% \begin{macrocode} |
| 2711 |
\let\current@primary\@empty |
| 2712 |
% \end{macrocode} |
| 2713 |
% \end{macro} |
| 2714 |
% |
| 2715 |
% \begin{macro}{\previous@primary} |
| 2716 |
% \begin{macrocode} |
| 2717 |
\let\previous@primary\@empty |
| 2718 |
% \end{macrocode} |
| 2719 |
% \end{macro} |
| 2720 |
% |
| 2721 |
% \begin{macro}{\save@primary} |
| 2722 |
% \begin{macrocode} |
| 2723 |
\IfOption{nobysame}{% |
| 2724 |
\let\save@primary\@empty |
| 2725 |
}{% |
| 2726 |
\def\save@primary{% |
| 2727 |
\global\let\previous@primary\current@primary |
| 2728 |
}% |
| 2729 |
} |
| 2730 |
% \end{macrocode} |
| 2731 |
% \end{macro} |
| 2732 |
% |
| 2733 |
% \begin{macro}{\bib@field@patches} |
| 2734 |
% Depending on your point of view, this macro either puts the |
| 2735 |
% bibitem into a canonical form or, alternatively, it fudges the |
| 2736 |
% data to fit our model. Either way, it simplifies formatting the |
| 2737 |
% bibliography. |
| 2738 |
% \begin{macrocode} |
| 2739 |
\def\bib@field@patches{% |
| 2740 |
\ifx\bib'author\@empty |
| 2741 |
\ifx\bib'editor\@empty |
| 2742 |
\let\current@primary\bib'translator |
| 2743 |
\let\print@primary\PrintTranslatorsA |
| 2744 |
\else |
| 2745 |
\let\current@primary\bib'editor |
| 2746 |
\let\print@primary\PrintEditorsA |
| 2747 |
\fi |
| 2748 |
\else |
| 2749 |
\let\current@primary\bib'author |
| 2750 |
\let\print@primary\PrintAuthors |
| 2751 |
\fi |
| 2752 |
\ifx\bib'address\@empty |
| 2753 |
\let\bib'address\bib'place |
| 2754 |
\fi |
| 2755 |
\ifx\bib'organization\@empty |
| 2756 |
\ifx\bib'institution\@empty |
| 2757 |
\let\bib'organization\bib'school |
| 2758 |
\else |
| 2759 |
\let\bib'organization\bib'institution |
| 2760 |
\fi |
| 2761 |
\fi |
| 2762 |
\ifx\bib'date\@empty |
| 2763 |
\ifx\bib'year\@empty |
| 2764 |
\let\bib@year\bib'status |
| 2765 |
\else |
| 2766 |
\bib@parsedate\bib'year |
| 2767 |
\fi |
| 2768 |
\else |
| 2769 |
\bib@parsedate\bib'date |
| 2770 |
\fi |
| 2771 |
% \end{macrocode} |
| 2772 |
% Example~21 on page~74 of \emph{Mathematics into |
| 2773 |
% Type}~\cite{SOS99} seems to indicate that when the year serves as |
| 2774 |
% the volume number, the date should be suppressed. If so, this is |
| 2775 |
% where that is done. |
| 2776 |
% \begin{macrocode} |
| 2777 |
\def\@tempa{year}% |
| 2778 |
\ifx\bib'volume\@tempa |
| 2779 |
\let\bib'volume\bib@year |
| 2780 |
\let\bib'date\@empty |
| 2781 |
\fi |
| 2782 |
% \end{macrocode} |
| 2783 |
% Some journals have ``numbers'' but no ``volumes''. AMS house |
| 2784 |
% style is to treat the number as volume. |
| 2785 |
% \begin{macrocode} |
| 2786 |
\ifx\setbib@@\setbib@article |
| 2787 |
\ifx\bib'volume\@empty |
| 2788 |
\ifx\bib'number\@empty\else |
| 2789 |
\let\bib'volume\bib'number |
| 2790 |
\let\bib'number\@empty |
| 2791 |
\fi |
| 2792 |
\fi |
| 2793 |
\fi |
| 2794 |
% \end{macrocode} |
| 2795 |
% \cs{bib'language} is used for producing the printed rendition of |
| 2796 |
% the language. \cs{bib@language} needs to be in the form required by |
| 2797 |
% \cn{selectlanguage}. |
| 2798 |
% \begin{macrocode} |
| 2799 |
\bib@language@fixup |
| 2800 |
} |
| 2801 |
% \end{macrocode} |
| 2802 |
% \end{macro} |
| 2803 |
% |
| 2804 |
% \subsubsection{Date setup} |
| 2805 |
% |
| 2806 |
% \begin{macro}{\bib@year} |
| 2807 |
% \begin{macrocode} |
| 2808 |
\let\bib@year\@empty |
| 2809 |
% \end{macrocode} |
| 2810 |
% \end{macro} |
| 2811 |
% |
| 2812 |
% \begin{macro}{\bib@month} |
| 2813 |
% \begin{macrocode} |
| 2814 |
\let\bib@month\@empty |
| 2815 |
% \end{macrocode} |
| 2816 |
% \end{macro} |
| 2817 |
% |
| 2818 |
% \begin{macro}{\bib@day} |
| 2819 |
% \begin{macrocode} |
| 2820 |
\let\bib@day\@empty |
| 2821 |
% \end{macrocode} |
| 2822 |
% \end{macro} |
| 2823 |
% |
| 2824 |
% \begin{macro}{\bib@parsedate} |
| 2825 |
% Parse an ISO 8601 date into its year, month and day components, |
| 2826 |
% but without actually verifying that any of the components are |
| 2827 |
% numeric. Hmmm. |
| 2828 |
% \begin{macrocode} |
| 2829 |
\def\bib@parsedate#1{% |
| 2830 |
\@xp\bib@parsedate@a#1---\@nil |
| 2831 |
} |
| 2832 |
% \end{macrocode} |
| 2833 |
% \end{macro} |
| 2834 |
% |
| 2835 |
% \begin{macro}{\bib@parsedate@a} |
| 2836 |
% \begin{macrocode} |
| 2837 |
\def\bib@parsedate@a#1-#2-#3-#4\@nil{% |
| 2838 |
\def\bib@year{#1}% |
| 2839 |
\def\bib@month{#2}% |
| 2840 |
\def\bib@day{#3}% |
| 2841 |
% \end{macrocode} |
| 2842 |
% The rest of this macro tries to rewrite \cs{bib'date} into a |
| 2843 |
% normalized form. I'm not sure if this is a good idea. |
| 2844 |
% \begin{macrocode} |
| 2845 |
\ifx\@empty\bib@day |
| 2846 |
\ifx\@empty\bib@month |
| 2847 |
\let\bib'date\bib@year |
| 2848 |
\else |
| 2849 |
\def\bib'date{#1-#2}% |
| 2850 |
\fi |
| 2851 |
\else |
| 2852 |
\def\bib'date{#1-#2-#3}% |
| 2853 |
\fi |
| 2854 |
} |
| 2855 |
% \end{macrocode} |
| 2856 |
% \end{macro} |
| 2857 |
% |
| 2858 |
% \subsubsection{Language setup} |
| 2859 |
% |
| 2860 |
% \begin{macro}{\bib@language@fixup} |
| 2861 |
% \begin{macrocode} |
| 2862 |
\def\bib@language@fixup{% |
| 2863 |
\ifx\bib'hyphenation\@empty |
| 2864 |
\ifx\bib'language\@empty |
| 2865 |
\let\bib@language\biblanguagedefault |
| 2866 |
\else |
| 2867 |
\let\bib@language\bib'language |
| 2868 |
\fi |
| 2869 |
\else |
| 2870 |
\let\bib@language\bib'hyphenation |
| 2871 |
\fi |
| 2872 |
\def\@tempa##1 ##2\@nil{\lowercase{\def\bib@language{##1}}}% |
| 2873 |
% \end{macrocode} |
| 2874 |
% The mysterious \cs{@firstofone} here is to preserve the space |
| 2875 |
% before the \cs{@nil}. |
| 2876 |
% \begin{macrocode} |
| 2877 |
\@firstofone{\@xp\@tempa\bib@language} \@nil |
| 2878 |
} |
| 2879 |
% \end{macrocode} |
| 2880 |
% \end{macro} |
| 2881 |
% |
| 2882 |
% \begin{macro}{\bib@selectlanguage} |
| 2883 |
% For \cn{bib} purposes we are interested mainly in testing whether |
| 2884 |
% the hyphenation patterns are the same. So we use an |
| 2885 |
% if-same-patterns test (by which \pkg{babel}'s `english' and |
| 2886 |
% `american' compare as equal) rather than an if-same-language test. |
| 2887 |
% Also, the way that the \cn{selectlanguage} command checks to see |
| 2888 |
% whether a language has been properly defined for babel use is to |
| 2889 |
% see if \cs{dateLANGUAGE} is defined. And if we tried to select an |
| 2890 |
% undefined language, the result would be a \latex/ error. |
| 2891 |
% \begin{macrocode} |
| 2892 |
\def\bib@selectlanguage{% |
| 2893 |
\@ifsame@patterns{\languagename}{\bib@language}{}{% |
| 2894 |
\@ifundefined{date\bib@language}{}{% |
| 2895 |
\@xp\selectlanguage\@xp{\bib@language}% |
| 2896 |
}% |
| 2897 |
}% |
| 2898 |
} |
| 2899 |
% \end{macrocode} |
| 2900 |
% \end{macro} |
| 2901 |
% |
| 2902 |
% \begin{macro}{\@ifsame@patterns} |
| 2903 |
% \begin{macrocode} |
| 2904 |
\def\@ifsame@patterns#1#2{% |
| 2905 |
\@xp\@ifsamepat\csname l@#1\@xp\endcsname\csname l@#2\endcsname |
| 2906 |
} |
| 2907 |
% \end{macrocode} |
| 2908 |
% \end{macro} |
| 2909 |
% |
| 2910 |
% \begin{macro}{\@ifsamepat} |
| 2911 |
% \begin{macrocode} |
| 2912 |
\def\@ifsamepat#1#2{% |
| 2913 |
\ifnum \ifx\relax#1\m@ne\else#1\fi = \ifx\relax#2\m@ne\else#2\fi |
| 2914 |
\@xp\@firstoftwo |
| 2915 |
\else |
| 2916 |
\@xp\@secondoftwo |
| 2917 |
\fi |
| 2918 |
} |
| 2919 |
% \end{macrocode} |
| 2920 |
% \end{macro} |
| 2921 |
% |
| 2922 |
% \begin{macro}{\languagename} |
| 2923 |
% \begin{macro}{\biblanguageEnglish} |
| 2924 |
% \begin{macro}{\biblanguagedefault} |
| 2925 |
% \begin{macro}{\bib@language} |
| 2926 |
% \begin{macrocode} |
| 2927 |
\providecommand{\languagename}{english} |
| 2928 |
\def\biblanguageEnglish{english} |
| 2929 |
\let\biblanguagedefault\biblanguageEnglish |
| 2930 |
\let\bib@language\@empty |
| 2931 |
% \end{macrocode} |
| 2932 |
% \end{macro} |
| 2933 |
% \end{macro} |
| 2934 |
% \end{macro} |
| 2935 |
% \end{macro} |
| 2936 |
% |
| 2937 |
% \subsubsection{Citation label setup} |
| 2938 |
% |
| 2939 |
% \begin{macro}{\generate@label} |
| 2940 |
% \begin{macrocode} |
| 2941 |
\let\generate@label\relax |
| 2942 |
% \end{macrocode} |
| 2943 |
% \end{macro} |
| 2944 |
% |
| 2945 |
% \begin{macro}{\cite@label} |
| 2946 |
% \begin{macrocode} |
| 2947 |
\def\cite@label{\@currentlabel} |
| 2948 |
% \end{macrocode} |
| 2949 |
% \end{macro} |
| 2950 |
% |
| 2951 |
% \begin{macro}{\alpha@label} |
| 2952 |
% \begin{macrocode} |
| 2953 |
\let\alpha@label\relax |
| 2954 |
% \end{macrocode} |
| 2955 |
% \end{macro} |
| 2956 |
% |
| 2957 |
% \begin{macro}{\alpha@label@} |
| 2958 |
% \begin{macrocode} |
| 2959 |
\def\alpha@label@{% |
| 2960 |
\ifx\@empty\bib'label |
| 2961 |
\def\thebib{\CurrentBib}% |
| 2962 |
\else |
| 2963 |
\let\thebib\bib'label |
| 2964 |
\fi |
| 2965 |
}% |
| 2966 |
% \end{macrocode} |
| 2967 |
% \end{macro} |
| 2968 |
% |
| 2969 |
% \begin{macro}{\amsrefs@option@numeric} |
| 2970 |
% \begin{macrocode} |
| 2971 |
\def\amsrefs@option@numeric{% |
| 2972 |
\let\alpha@label\relax |
| 2973 |
\let\generate@label\relax |
| 2974 |
% \@nmbrlisttrue |
| 2975 |
} |
| 2976 |
% \end{macrocode} |
| 2977 |
% \end{macro} |
| 2978 |
% |
| 2979 |
% \begin{macro}{\amsrefs@option@alphabetic} |
| 2980 |
% \begin{macrocode} |
| 2981 |
\def\amsrefs@option@alphabetic{% |
| 2982 |
\let\alpha@label\alpha@label@ |
| 2983 |
\let\generate@label\generate@alphalabel |
| 2984 |
\let\calc@author@part\calc@author@part@ |
| 2985 |
\let\@suffix@format\@alph |
| 2986 |
\let\append@label@year\append@label@year@ |
| 2987 |
% \@nmbrlistfalse |
| 2988 |
} |
| 2989 |
% \end{macrocode} |
| 2990 |
% \end{macro} |
| 2991 |
% |
| 2992 |
% \begin{macro}{\amsrefs@option@shortalphabetic} |
| 2993 |
% \begin{macrocode} |
| 2994 |
\def\amsrefs@option@shortalphabetic{% |
| 2995 |
\let\alpha@label\alpha@label@ |
| 2996 |
\let\generate@label\generate@alphalabel |
| 2997 |
\let\calc@author@part\calc@author@part@short |
| 2998 |
\let\@suffix@format\@arabic |
| 2999 |
\let\append@label@year\@empty |
| 3000 |
% \@nmbrlistfalse |
| 3001 |
} |
| 3002 |
% \end{macrocode} |
| 3003 |
% \end{macro} |
| 3004 |
% |
| 3005 |
% \begin{macro}{\bib@cite} |
| 3006 |
% When \cs{bib@cite} is called, author name and year are available |
| 3007 |
% in \cs{bib@author} and \cs{bib@year}. |
| 3008 |
% \MacroArgs |
| 3009 |
% \macroarg{1}{citekey} |
| 3010 |
% \begin{macrocode} |
| 3011 |
\def\bib@cite#1{% |
| 3012 |
\def\CurrentBib{#1}% |
| 3013 |
\alpha@label % modify \thebib if necessary |
| 3014 |
\item\leavevmode |
| 3015 |
\SK@\SK@@label{#1}% |
| 3016 |
\@xp\bib@cite@a\csname b@#1\endcsname |
| 3017 |
\bibcite@write{#1}% |
| 3018 |
} |
| 3019 |
% \end{macrocode} |
| 3020 |
% \end{macro} |
| 3021 |
% |
| 3022 |
% \begin{macrocode} |
| 3023 |
\def\bib@cite@a#1{% |
| 3024 |
\ifx\relax#1% |
| 3025 |
\begingroup |
| 3026 |
\auto@protect\etaltext |
| 3027 |
\protected@edef\@tempa{% |
| 3028 |
\gdef\@nx#1{% |
| 3029 |
\@nx\citesel 01{\cite@label}{\bib@label@year}{}% |
| 3030 |
}% |
| 3031 |
}% |
| 3032 |
\@xp\endgroup |
| 3033 |
\@tempa |
| 3034 |
\else |
| 3035 |
\@xp\bib@cite@check\@xp#1#1\@empty\@empty\@empty\@empty\@empty |
| 3036 |
\fi |
| 3037 |
} |
| 3038 |
% \end{macrocode} |
| 3039 |
% |
| 3040 |
% \begin{macro}{\bib@cite@check} |
| 3041 |
% For the citation key we want to check if it is already defined. But |
| 3042 |
% there is a slight problem. There is already one control |
| 3043 |
% sequence in use for each bibliography entry, to store the label or |
| 3044 |
% the author/year information needed by \cn{cite}. If we introduce |
| 3045 |
% another control sequence to check whether a particular cite is |
| 3046 |
% multiply defined, then we double the number of control sequences |
| 3047 |
% used. For a large bibliography in a book this is fairly serious. |
| 3048 |
% This is addressed by using a \cs{citesel} function. |
| 3049 |
% |
| 3050 |
% \MacroArgs |
| 3051 |
% \macroarg{1}{\cs{b@}citekey} |
| 3052 |
% \macroarg{2}{\cs{citesel}} |
| 3053 |
% \macroarg{3}{cited?} |
| 3054 |
% \macroarg{4}{used?} |
| 3055 |
% \macroarg{5}{label} |
| 3056 |
% \macroarg{6}{year} |
| 3057 |
% \macroarg{7}{backrefs} |
| 3058 |
% \begin{macrocode} |
| 3059 |
\def\bib@cite@check#1#2#3#4#5#6#7{% |
| 3060 |
\ifx 1#4\relax |
| 3061 |
\DuplicateBibKeyWarning |
| 3062 |
\else |
| 3063 |
% \end{macrocode} |
| 3064 |
% This has gotten \emph{way} out of hand. |
| 3065 |
% \begin{macrocode} |
| 3066 |
\begingroup |
| 3067 |
\auto@protect\etaltext |
| 3068 |
\@apply\auto@protect\amsrefs@textsymbols |
| 3069 |
\@apply\auto@protect\amsrefs@textaccents |
| 3070 |
\@tempswafalse |
| 3071 |
\in@\CitePrintUndefined{#5}% |
| 3072 |
\ifin@ |
| 3073 |
\let\@tempa\@empty |
| 3074 |
\else |
| 3075 |
\def\@tempa{#5}% |
| 3076 |
\fi |
| 3077 |
\ifx\@tempa\@empty |
| 3078 |
\else |
| 3079 |
\@xp\ifx\@xp\@currentlabel\cite@label |
| 3080 |
\edef\@tempb{\cite@label}% |
| 3081 |
\else |
| 3082 |
\let\@tempb\cite@label |
| 3083 |
\fi |
| 3084 |
\ifx\@tempa\@tempb |
| 3085 |
\def\@tempa{#6}% |
| 3086 |
\ifx\@tempa\bib@label@year |
| 3087 |
\else |
| 3088 |
\@tempswatrue |
| 3089 |
\fi |
| 3090 |
\else |
| 3091 |
\@tempswatrue |
| 3092 |
\fi |
| 3093 |
\fi |
| 3094 |
\if@tempswa |
| 3095 |
\@ifempty{#6}{% |
| 3096 |
\def\@tempa{#5}% |
| 3097 |
\let\@tempb\cite@label |
| 3098 |
}{% |
| 3099 |
\def\@tempa{#5, #6}% |
| 3100 |
\def\@tempb{\cite@label, \bib@label@year}% |
| 3101 |
}% |
| 3102 |
\amsrefs@warning{Citation label for \extr@cite#1 is |
| 3103 |
changing from `\@tempa ' to `\@tempb '}% |
| 3104 |
\fi |
| 3105 |
\protected@edef\@tempa{% |
| 3106 |
\gdef\@nx#1{% |
| 3107 |
\@nx\citesel #31{\cite@label}{\bib@label@year}{#7}% |
| 3108 |
}% |
| 3109 |
}% |
| 3110 |
\@xp\endgroup |
| 3111 |
\@tempa |
| 3112 |
\fi |
| 3113 |
} |
| 3114 |
% \end{macrocode} |
| 3115 |
% \end{macro} |
| 3116 |
% |
| 3117 |
% \begin{macro}{\bib@label@year} |
| 3118 |
% \begin{macrocode} |
| 3119 |
\let\bib@label@year\@empty |
| 3120 |
% \end{macrocode} |
| 3121 |
% \end{macro} |
| 3122 |
% |
| 3123 |
% \begin{macro}{\DuplicateBibKeyWarning} |
| 3124 |
% \begin{macrocode} |
| 3125 |
\def\DuplicateBibKeyWarning{% |
| 3126 |
\amsrefs@warning{% |
| 3127 |
Duplicate \protect\bib\space key |
| 3128 |
`\CurrentBib ' detected\MessageBreakNS}% |
| 3129 |
} |
| 3130 |
% \end{macrocode} |
| 3131 |
% \end{macro} |
| 3132 |
% |
| 3133 |
% \begin{macro}{\DuplicateBibKeyWarning} |
| 3134 |
% \begin{macrocode} |
| 3135 |
\def\DuplicateBibLabelWarning{% |
| 3136 |
\amsrefs@warning{% |
| 3137 |
Duplicate biblabel stem `\current@stem ' detected.\MessageBreakNS |
| 3138 |
This usually means the order of the bibitems\MessageBreakNS |
| 3139 |
is incompatible with the style of labels\MessageBreakNS |
| 3140 |
you are using}% |
| 3141 |
} |
| 3142 |
% \end{macrocode} |
| 3143 |
% \end{macro} |
| 3144 |
% |
| 3145 |
% \begin{macro}{\bibcite@write} |
| 3146 |
% \begin{macrocode} |
| 3147 |
\def\bibcite@write#1{% |
| 3148 |
\if@filesw |
| 3149 |
\begingroup |
| 3150 |
\let\citesel\citesel@write |
| 3151 |
\csname b@#1\endcsname |
| 3152 |
\endgroup |
| 3153 |
\fi |
| 3154 |
} |
| 3155 |
% \end{macrocode} |
| 3156 |
% \end{macro} |
| 3157 |
% |
| 3158 |
% \begin{macro}{\citesel@write} |
| 3159 |
% \begin{macrocode} |
| 3160 |
\def\citesel@write#1#2#3#4#5{% |
| 3161 |
\toks@{{#3}{#4}}% |
| 3162 |
\immediate\write\@auxout{\string\bibcite{\CurrentBib}{\the\toks@}}% |
| 3163 |
} |
| 3164 |
% \end{macrocode} |
| 3165 |
% \end{macro} |
| 3166 |
% |
| 3167 |
% Because duplicate bibs are caught immediately, we don't need |
| 3168 |
% \cs{bibcite} to run \cs{@testdef}. |
| 3169 |
% \begin{macrocode} |
| 3170 |
\AtEndDocument{\let\bibcite\@gobbletwo} |
| 3171 |
% \end{macrocode} |
| 3172 |
% |
| 3173 |
% \subsubsection{Printing the bibliography} |
| 3174 |
% |
| 3175 |
% \begin{macro}{\bibname} |
| 3176 |
% \begin{macrocode} |
| 3177 |
\providecommand{\bibname}{Bibliography} |
| 3178 |
% \end{macrocode} |
| 3179 |
% \end{macro} |
| 3180 |
% |
| 3181 |
% \begin{macro}{\refname} |
| 3182 |
% \begin{macrocode} |
| 3183 |
\providecommand{\refname}{References} |
| 3184 |
% \end{macrocode} |
| 3185 |
% \end{macro} |
| 3186 |
% |
| 3187 |
% \begin{macro}{\bib@div@mark} |
| 3188 |
% The AMS document classes automatically take care of the page |
| 3189 |
% marks for \cn{section*} and \cn{chapter*}, but for the standard |
| 3190 |
% classes, we need to make sure that \cn{@mkboth} gets invoked. |
| 3191 |
% \begin{macrocode} |
| 3192 |
\let\bib@div@mark\@gobble |
| 3193 |
% \end{macrocode} |
| 3194 |
% This is verbose, but probably safer than any alternative. |
| 3195 |
% \begin{macrocode} |
| 3196 |
\@ifclassloaded{amsbook}{}{% |
| 3197 |
\@ifclassloaded{amsart}{}{% |
| 3198 |
\@ifclassloaded{amsproc}{}{% |
| 3199 |
\def\bib@div@mark#1{% |
| 3200 |
\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}% |
| 3201 |
}% |
| 3202 |
}% |
| 3203 |
}% |
| 3204 |
} |
| 3205 |
% \end{macrocode} |
| 3206 |
% \end{macro} |
| 3207 |
% |
| 3208 |
% \begin{environment}{bibchapter} |
| 3209 |
% We need to take a little extra trouble here to pre-expand the |
| 3210 |
% \cn{bibname}. |
| 3211 |
% \begin{macrocode} |
| 3212 |
\newenvironment{bibchapter}[1][\bibname]{% |
| 3213 |
\begingroup |
| 3214 |
\protected@edef\@{% |
| 3215 |
\endgroup |
| 3216 |
\protect\chapter*{#1}% |
| 3217 |
\protect\bib@div@mark{#1}% |
| 3218 |
}% |
| 3219 |
\@ |
| 3220 |
}{\par} |
| 3221 |
% \end{macrocode} |
| 3222 |
% \end{environment} |
| 3223 |
% |
| 3224 |
% \begin{environment}{bibsection} |
| 3225 |
% And here to pre-expand the \cn{refname}. |
| 3226 |
% \begin{macrocode} |
| 3227 |
\newenvironment{bibsection}[1][\refname]{% |
| 3228 |
\begingroup |
| 3229 |
\protected@edef\@{% |
| 3230 |
\endgroup |
| 3231 |
\ifx\@bibtitlestyle\undefined |
| 3232 |
\protect\section*{#1}% |
| 3233 |
\else |
| 3234 |
\protect\@bibtitlestyle |
| 3235 |
\fi |
| 3236 |
\protect\bib@div@mark{#1}% |
| 3237 |
}% |
| 3238 |
\@ |
| 3239 |
}{\par} |
| 3240 |
% \end{macrocode} |
| 3241 |
% \end{environment} |
| 3242 |
% |
| 3243 |
% \begin{environment}{bibdiv} |
| 3244 |
% Here we try to guess whether this is a book-like document or an |
| 3245 |
% article-like document. |
| 3246 |
% \begin{macrocode} |
| 3247 |
\@ifundefined{chapter}{% |
| 3248 |
\newenvironment{bibdiv}{\bibsection}{\endbibsection} |
| 3249 |
}{% |
| 3250 |
\newenvironment{bibdiv}{\bibchapter}{\endbibchapter} |
| 3251 |
} |
| 3252 |
% \end{macrocode} |
| 3253 |
% \end{environment} |
| 3254 |
% |
| 3255 |
% This is what the standard \cls{book} class has for the bibliography |
| 3256 |
% title: |
| 3257 |
% \begin{verbatim} |
| 3258 |
% \newenvironment{thebibliography}[1] |
| 3259 |
% {\chapter*{\bibname |
| 3260 |
% \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}% |
| 3261 |
% \list{\@biblabel{\@arabic\c@enumiv}}% |
| 3262 |
%\end{verbatim} |
| 3263 |
% |
| 3264 |
% \begin{environment}{thebibliography} |
| 3265 |
% \begin{macrocode} |
| 3266 |
\renewenvironment{thebibliography}[1]{% |
| 3267 |
\bibdiv |
| 3268 |
\biblist[\resetbiblist{#1}]% |
| 3269 |
}{% |
| 3270 |
\endbiblist |
| 3271 |
\endbibdiv |
| 3272 |
} |
| 3273 |
% \end{macrocode} |
| 3274 |
% \end{environment} |
| 3275 |
% |
| 3276 |
% \subsection{Name, journal and publisher abbreviations} |
| 3277 |
% |
| 3278 |
% The commands \cn{DefineName}, \cn{DefinePublisher}, and |
| 3279 |
% \cn{DefineJournal} are provided to make abbreviations a little |
| 3280 |
% easier. |
| 3281 |
% |
| 3282 |
% \begin{macro}{\DefineName} |
| 3283 |
% \begin{macrocode} |
| 3284 |
\newcommand{\DefineName}[2]{% |
| 3285 |
\bib*{#1}{name}{name={#2}}% |
| 3286 |
} |
| 3287 |
% \end{macrocode} |
| 3288 |
% \end{macro} |
| 3289 |
% |
| 3290 |
% \begin{macro}{\DefineJournal} |
| 3291 |
% \begin{macrocode} |
| 3292 |
\newcommand{\DefineJournal}[4]{% |
| 3293 |
\bib*{#1}{periodical}{ |
| 3294 |
issn={#2}, |
| 3295 |
journal={#4} |
| 3296 |
}% |
| 3297 |
} |
| 3298 |
% \end{macrocode} |
| 3299 |
% \end{macro} |
| 3300 |
% |
| 3301 |
% \begin{macro}{\DefinePublisher} |
| 3302 |
% Note that an explicit \fld{address} field in a \cn{bib} entry will |
| 3303 |
% override the \fld{address} supplied as part of a |
| 3304 |
% \cn{DefinePublisher}. |
| 3305 |
% \begin{macrocode} |
| 3306 |
\newcommand{\DefinePublisher}[4]{% |
| 3307 |
\bib*{#1}{publisher}{% |
| 3308 |
publisher={#3}, |
| 3309 |
address={#4} |
| 3310 |
}% |
| 3311 |
} |
| 3312 |
% \end{macrocode} |
| 3313 |
% \end{macro} |
| 3314 |
% |
| 3315 |
% \subsection{Processing \fn{.ltb} files} |
| 3316 |
% |
| 3317 |
% If you have a file that contains \pkg{amsrefs}-style |
| 3318 |
% \cn{bib} entries, you can use it as a database and extract items |
| 3319 |
% from it for use in another document. In typical relatively simple |
| 3320 |
% scenarios, the extraction can be done by \latex/ itself on the first |
| 3321 |
% pass, so that citations in the text will be successfully resolved |
| 3322 |
% on the second pass (possibly even the first, depending on what kind |
| 3323 |
% of bibliography sorting is used). |
| 3324 |
% |
| 3325 |
% \begin{macro}{\bibselect} |
| 3326 |
% \begin{macrocode} |
| 3327 |
\newcommand{\bibselect}{% |
| 3328 |
\@ifstar{% |
| 3329 |
\let\@bibdef\copy@bibdef |
| 3330 |
\BibSelect |
| 3331 |
}{% |
| 3332 |
\let\@bibdef\selective@bibdef |
| 3333 |
\BibSelect |
| 3334 |
}% |
| 3335 |
} |
| 3336 |
% \end{macrocode} |
| 3337 |
% \end{macro} |
| 3338 |
% |
| 3339 |
% \begin{macro}{\BibSelect} |
| 3340 |
% \begin{macrocode} |
| 3341 |
\newcommand{\BibSelect}[2][\bblname]{% |
| 3342 |
\if@filesw |
| 3343 |
\typeout{Trying to create bbl file `#1.bbl' ...}% |
| 3344 |
\def\bibselect@msg{% |
| 3345 |
\typeout{ ... rats. Unable to create bbl file.}% |
| 3346 |
}% |
| 3347 |
\let\@open@bbl@file\OpenBBLFile |
| 3348 |
\@for\@tempa:=#2\do{\ReadBibData{\@tempa}}% |
| 3349 |
\fi |
| 3350 |
\@close@bbl@file |
| 3351 |
\@apply\g@undef\bibdefer@list |
| 3352 |
\global\let\bibdefer@list\@empty |
| 3353 |
% \end{macrocode} |
| 3354 |
% Now read the \fn{.bbl} file we just created. |
| 3355 |
% \begin{macrocode} |
| 3356 |
\let\@bibdef\normal@bibdef |
| 3357 |
\@input@{#1.bbl}% |
| 3358 |
\let\BibSelect\MultipleBibSelectWarning |
| 3359 |
} |
| 3360 |
% \end{macrocode} |
| 3361 |
% \end{macro} |
| 3362 |
% |
| 3363 |
% \begin{macro}{\MultipleBibSelectWarning} |
| 3364 |
% \begin{macrocode} |
| 3365 |
\newcommand\MultipleBibSelectWarning[2][]{% |
| 3366 |
\amsrefs@warning{% |
| 3367 |
Multiple \string\bibselect 's found (only one |
| 3368 |
\string\bibselect\space per biblist environment is allowed)% |
| 3369 |
}% |
| 3370 |
} |
| 3371 |
% \end{macrocode} |
| 3372 |
% \end{macro} |
| 3373 |
% |
| 3374 |
% \begin{macro}{\bblname} |
| 3375 |
% \begin{macrocode} |
| 3376 |
\def\bblname{\jobname} |
| 3377 |
% \end{macrocode} |
| 3378 |
% \end{macro} |
| 3379 |
% |
| 3380 |
% \begin{macro}{\bib@dbfile} |
| 3381 |
% \begin{macrocode} |
| 3382 |
\newread\bib@dbfile |
| 3383 |
% \end{macrocode} |
| 3384 |
% \end{macro} |
| 3385 |
% |
| 3386 |
% \begin{macro}{\ReadBibData} |
| 3387 |
% \begin{macrocode} |
| 3388 |
\newcommand{\ReadBibData}[1]{% |
| 3389 |
\IfFileExists{#1.ltb}{% |
| 3390 |
\openin\bib@dbfile=\@filef@und \relax |
| 3391 |
}{% |
| 3392 |
\IfFileExists{#1.ltx}{% |
| 3393 |
\openin\bib@dbfile=\@filef@und \relax |
| 3394 |
}{% |
| 3395 |
\IfFileExists{#1.tex}{% |
| 3396 |
\openin\bib@dbfile=\@filef@und \relax |
| 3397 |
}{% |
| 3398 |
\begingroup |
| 3399 |
\NoBibDBFile{#1}% |
| 3400 |
\let\ReadBibData@a\endgroup |
| 3401 |
}% |
| 3402 |
}% |
| 3403 |
}% |
| 3404 |
\ReadBibData@a |
| 3405 |
} |
| 3406 |
% \end{macrocode} |
| 3407 |
% \end{macro} |
| 3408 |
% |
| 3409 |
% \begin{macro}{\NoBibDBFile} |
| 3410 |
% \begin{macrocode} |
| 3411 |
\def\NoBibDBFile#1{% |
| 3412 |
\amsrefs@warning{No data file #1.ltb (.ltx, .tex) found}% |
| 3413 |
} |
| 3414 |
% \end{macrocode} |
| 3415 |
% \end{macro} |
| 3416 |
% |
| 3417 |
% \begin{macro}{\ReadBibData@a} |
| 3418 |
% \begin{macrocode} |
| 3419 |
\def\ReadBibData@a{% |
| 3420 |
\ProvidesFile{\@filef@und}\relax |
| 3421 |
\begingroup |
| 3422 |
\let\star@bibdef\defer@bibdef |
| 3423 |
\ReadBibLoop |
| 3424 |
\endgroup |
| 3425 |
\closein\bib@dbfile |
| 3426 |
} |
| 3427 |
% \end{macrocode} |
| 3428 |
% \end{macro} |
| 3429 |
% |
| 3430 |
% \begin{macro}{\ReadBibLoop} |
| 3431 |
% \begin{macrocode} |
| 3432 |
\def\ReadBibLoop{% |
| 3433 |
\ifeof\bib@dbfile |
| 3434 |
\@xp\@gobble |
| 3435 |
\else |
| 3436 |
\read\bib@dbfile to\CurLine |
| 3437 |
% \end{macrocode} |
| 3438 |
% The \cs{@empty} is in case \cs{CurLine} is empty. |
| 3439 |
% \begin{macrocode} |
| 3440 |
\@xp\ReadBibLoop@a\CurLine\@empty\@nil |
| 3441 |
\fi |
| 3442 |
\ReadBibLoop |
| 3443 |
} |
| 3444 |
% \end{macrocode} |
| 3445 |
% \end{macro} |
| 3446 |
% |
| 3447 |
% \begin{macro}{\ReadBibLoop@e} |
| 3448 |
% This traps top-level \cn{bib} commands. Note that: |
| 3449 |
% \begin{itemize} |
| 3450 |
% |
| 3451 |
% \item |
| 3452 |
% If \cs{CurLine} doesn't contain a complete \cn{bib} entry, the |
| 3453 |
% code chokes. |
| 3454 |
% |
| 3455 |
% \item |
| 3456 |
% I \cn{bib} is not the very first non-space token in a line, it |
| 3457 |
% will not be recognized. |
| 3458 |
% |
| 3459 |
% \end{itemize} |
| 3460 |
% |
| 3461 |
% \begin{macrocode} |
| 3462 |
\long\def\ReadBibLoop@a#1#2\@nil{% |
| 3463 |
\ifx\bib#1% |
| 3464 |
\CurLine % just exec it |
| 3465 |
\else |
| 3466 |
% \end{macrocode} |
| 3467 |
% We're not done yet. The line may contain something like |
| 3468 |
% \cn{DefineName}, so we need to expand the first macro in the line |
| 3469 |
% and see if it starts with \cn{bib}. But first we check to make |
| 3470 |
% sure that the token we're about to expand isn't \cn{endinput}. |
| 3471 |
% \begin{macrocode} |
| 3472 |
\ifx\endinput#1% |
| 3473 |
\let\ReadBibLoop\@empty |
| 3474 |
\else |
| 3475 |
% \end{macrocode} |
| 3476 |
% And this \cs{@empty} is for the admittedly unlikely case that |
| 3477 |
% \cs{CurLine} isn't empty, but its expansion is. |
| 3478 |
% \begin{macrocode} |
| 3479 |
\@xp\ReadBibLoop@b#1#2\@empty\@nil |
| 3480 |
\fi |
| 3481 |
\fi |
| 3482 |
} |
| 3483 |
% \end{macrocode} |
| 3484 |
% \end{macro} |
| 3485 |
% |
| 3486 |
% \begin{macro}{\ReadBibLoop@b} |
| 3487 |
% \begin{macrocode} |
| 3488 |
\long\def\ReadBibLoop@b#1#2\@nil{% |
| 3489 |
\ifx\bib#1% |
| 3490 |
\CurLine % just exec it |
| 3491 |
\fi |
| 3492 |
} |
| 3493 |
% \end{macrocode} |
| 3494 |
% \end{macro} |
| 3495 |
% |
| 3496 |
% \begin{macrocode} |
| 3497 |
\let\bbl@out=\relax |
| 3498 |
\let\bbl@write\@gobble |
| 3499 |
\let\@open@bbl@file\relax |
| 3500 |
\let\@close@bbl@file\relax |
| 3501 |
% \end{macrocode} |
| 3502 |
% |
| 3503 |
% \begin{macro}{\OpenBBLFile} |
| 3504 |
% \begin{macrocode} |
| 3505 |
\def\OpenBBLFile{% |
| 3506 |
\if@filesw |
| 3507 |
% Just use the next unused output stream |
| 3508 |
\count@\count17 |
| 3509 |
\advance\count@\@ne |
| 3510 |
\ifnum\count@<\sixt@@n |
| 3511 |
\global\chardef\bbl@out=\count@ |
| 3512 |
\immediate\openout\bbl@out=\bblname.bbl\relax |
| 3513 |
\global\let\@close@bbl@file\CloseBBLFile |
| 3514 |
\gdef\bbl@write{\immediate\write\bbl@out}% |
| 3515 |
\else |
| 3516 |
\ch@ck\count@\sixt@@n\write |
| 3517 |
\fi |
| 3518 |
\fi |
| 3519 |
\global\let\@open@bbl@file\relax |
| 3520 |
} |
| 3521 |
% \end{macrocode} |
| 3522 |
% \end{macro} |
| 3523 |
% |
| 3524 |
% \begin{macro}{\CloseBBLFile} |
| 3525 |
% \begin{macrocode} |
| 3526 |
\def\CloseBBLFile{% |
| 3527 |
\immediate\closeout\bbl@out\relax |
| 3528 |
\global\let\@close@bbl@file\relax |
| 3529 |
\global\let\bbl@write\@gobble |
| 3530 |
\global\let\bbl@out\relax |
| 3531 |
} |
| 3532 |
% \end{macrocode} |
| 3533 |
% \end{macro} |
| 3534 |
% |
| 3535 |
% \subsection{Citation processing} |
| 3536 |
% |
| 3537 |
% \subsubsection{The \cs{citesel} structure} |
| 3538 |
% |
| 3539 |
% The information used by \cn{cite} for key \texttt{moo} is stored in |
| 3540 |
% \cs{b@moo} in the form |
| 3541 |
% \begin{verbatim} |
| 3542 |
% \citesel{status1}{status2}{label}{year}{backref-info} |
| 3543 |
%\end{verbatim}% |
| 3544 |
% |
| 3545 |
% The first status flag is~1 if this key has already been cited |
| 3546 |
% earlier in the same document; 0~otherwise. This is used in some |
| 3547 |
% bibliography schemes to print a full list of author names for the first |
| 3548 |
% citation and an abbreviated author list for subsequent citations. |
| 3549 |
% |
| 3550 |
% The second status flag is~1 if this key has already been used by a |
| 3551 |
% define-cite command (such as \cn{bib}); 0~otherwise. This makes it |
| 3552 |
% possible to issue a warning message as soon as the conflict is seen, |
| 3553 |
% on the first \latex/ run, instead of on a subsequent run during the |
| 3554 |
% processing of the \fn{.aux} file. |
| 3555 |
% |
| 3556 |
% When an author/year citation scheme is in use, args 3 and~4 hold |
| 3557 |
% respectively author names and year. Otherwise arg~3 simply holds |
| 3558 |
% a cite label and arg~4 is empty. |
| 3559 |
% |
| 3560 |
% And finally, arg~5 holds a list of backref pointers indicating the |
| 3561 |
% locations in the document where this entry has been cited. |
| 3562 |
% |
| 3563 |
% \begin{macro}{\citesel@update} |
| 3564 |
% \begin{macrocode} |
| 3565 |
\def\citesel@update#1#2#3#4#5#6{% |
| 3566 |
\gdef#6{\citesel 1#2{#3}{#4}{#5}}% |
| 3567 |
} |
| 3568 |
% \end{macrocode} |
| 3569 |
% \end{macro} |
| 3570 |
% |
| 3571 |
% \begin{macro}{\citesel@number} |
| 3572 |
% \begin{macrocode} |
| 3573 |
\def\citesel@number#1#2#3#4#5{#3} |
| 3574 |
% \end{macrocode} |
| 3575 |
% \end{macro} |
| 3576 |
% |
| 3577 |
% \begin{macro}{\citesel@year} |
| 3578 |
% \begin{macrocode} |
| 3579 |
\def\citesel@year#1#2#3#4#5{#4} |
| 3580 |
% \end{macrocode} |
| 3581 |
% \end{macro} |
| 3582 |
% |
| 3583 |
% \begin{macro}{\citesel} |
| 3584 |
% \begin{macrocode} |
| 3585 |
\let\citesel\citesel@number |
| 3586 |
% \end{macrocode} |
| 3587 |
% \end{macro} |
| 3588 |
% |
| 3589 |
% \subsubsection{The basic \cn{cite} command} |
| 3590 |
% |
| 3591 |
% Here is the difference between the various optional forms of |
| 3592 |
% \cn{cite}: |
| 3593 |
% \begin{verbatim} |
| 3594 |
% \cite{xyz} -> \cite@a\citesel{xyz}{} |
| 3595 |
% -> \cite@bc\b@xyz\citesel{} |
| 3596 |
% |
| 3597 |
% \cite{xyz}*{blub} -> \cite@a\citesel{xyz}{blub} |
| 3598 |
% -> \cite@bc\b@xyz\citesel{blub} |
| 3599 |
% |
| 3600 |
% \cite[blub]{xyz} -> \cite@a\citesel{xyz}{blub} |
| 3601 |
% -> \cite@bc\b@xyz\citesel{blub} |
| 3602 |
%\end{verbatim} |
| 3603 |
% |
| 3604 |
% Canceling the old \latex/ definition of \verb*'\cite ' prevents |
| 3605 |
% certain problems that could arise with the \pkg{showkeys} package. |
| 3606 |
% \begin{macrocode} |
| 3607 |
\expandafter\let\csname cite \endcsname\relax |
| 3608 |
% \end{macrocode} |
| 3609 |
% |
| 3610 |
% \begin{macro}{\cite} |
| 3611 |
% Need to handle the standard [...] option for compatibility's sake. |
| 3612 |
% \begin{macrocode} |
| 3613 |
\renewcommand{\cite}[2][]{% |
| 3614 |
\if\cite@single#2,\@gobble \else\MultipleCiteKeyWarning{#2}{#1}\fi |
| 3615 |
\@ifempty{#1}{% |
| 3616 |
\cites@o{#2}% |
| 3617 |
}{% |
| 3618 |
\ObsoleteCiteOptionWarning |
| 3619 |
\cites@a{*{#1}}{#2}% |
| 3620 |
}% |
| 3621 |
} |
| 3622 |
% \end{macrocode} |
| 3623 |
% \end{macro} |
| 3624 |
% |
| 3625 |
% \begin{macro}{\MultipleCiteKeyWarning} |
| 3626 |
% \begin{macrocode} |
| 3627 |
\def\MultipleCiteKeyWarning#1#2{% |
| 3628 |
\amsrefs@warning{% |
| 3629 |
Use of \string\cites\space is recommended instead of % |
| 3630 |
\string\cite\space\MessageBreak |
| 3631 |
for multiple cites '#1'}% |
| 3632 |
\@ifnotempty{#2}{% |
| 3633 |
\amsrefs@warning{Star option requires \string\citelist\space here}% |
| 3634 |
}% |
| 3635 |
\global\let\MultipleCiteKeyWarning\@gobbletwo |
| 3636 |
} |
| 3637 |
% \end{macrocode} |
| 3638 |
% \end{macro} |
| 3639 |
% |
| 3640 |
% \begin{macro}{\ObsoleteCiteOptionWarning} |
| 3641 |
% \begin{macrocode} |
| 3642 |
\def\ObsoleteCiteOptionWarning{% |
| 3643 |
\amsrefs@warning{% |
| 3644 |
The form \string\cite{...}*{...} is recommended\MessageBreak |
| 3645 |
instead of \string\cite[...]{...}}% |
| 3646 |
\global\let\ObsoleteCiteOptionWarning\@empty |
| 3647 |
} |
| 3648 |
% \end{macrocode} |
| 3649 |
% \end{macro} |
| 3650 |
% |
| 3651 |
% \begin{macro}{\cite@single} |
| 3652 |
% \begin{macrocode} |
| 3653 |
\edef\cite@single#1,#2{\iffalse{\fi\iffalse{\fi\string}#2.\string}} |
| 3654 |
% \end{macrocode} |
| 3655 |
% \end{macro} |
| 3656 |
% |
| 3657 |
% \begin{macro}{\cites@o} |
| 3658 |
% \begin{macrocode} |
| 3659 |
\def\cites@o#1{\star@{\cites@oo{#1}}{}} |
| 3660 |
% \end{macrocode} |
| 3661 |
% \end{macro} |
| 3662 |
% |
| 3663 |
% \begin{macro}{\cites@oo} |
| 3664 |
% \begin{macrocode} |
| 3665 |
\def\cites@oo#1#2{\@ifempty{#2}{\cites@a{}{#1}}{\cites@a{*{#2}}{#1}}} |
| 3666 |
% \end{macrocode} |
| 3667 |
% \end{macro} |
| 3668 |
% |
| 3669 |
% \begin{macro}{\cites@a} |
| 3670 |
% \begin{macrocode} |
| 3671 |
\def\cites@a#1#2{% |
| 3672 |
\begingroup |
| 3673 |
\toks@{\endgroup \cites@b{#1}}% |
| 3674 |
\vdef\@tempa{#2}% |
| 3675 |
\edef\@tempa{% |
| 3676 |
\the\toks@ \@firstofone{\@xp\zap@space\@tempa} \@empty |
| 3677 |
}% |
| 3678 |
\@tempa,\@empty |
| 3679 |
\edef\@tempa{\endgroup\@nx\citelist{\the\toks@}}% |
| 3680 |
\@tempa |
| 3681 |
} |
| 3682 |
% \end{macrocode} |
| 3683 |
% \end{macro} |
| 3684 |
% |
| 3685 |
% \begin{macro}{\cites@b} |
| 3686 |
% \begin{macrocode} |
| 3687 |
\def\cites@b#1#2,#3{% |
| 3688 |
\begingroup |
| 3689 |
\toks@{\InnerCite{#2}#1}% |
| 3690 |
\ifx\@empty#3\@xp\@gobble\fi |
| 3691 |
\cites@c#3% |
| 3692 |
} |
| 3693 |
% \end{macrocode} |
| 3694 |
% \end{macro} |
| 3695 |
% |
| 3696 |
% \begin{macro}{\cites@c} |
| 3697 |
% \begin{macrocode} |
| 3698 |
\def\cites@c#1,#2{% |
| 3699 |
\add@toks@{\InnerCite{#1}}% |
| 3700 |
\ifx\@empty#2\@xp\@gobble\fi |
| 3701 |
\cites@c#2% |
| 3702 |
} |
| 3703 |
% \end{macrocode} |
| 3704 |
% \end{macro} |
| 3705 |
% |
| 3706 |
% \begin{macro}{\citeleft} |
| 3707 |
% \begin{macro}{\citeright} |
| 3708 |
% \begin{macro}{\citemid} |
| 3709 |
% \begin{macro}{\citepunct} |
| 3710 |
% These variables are named to follow the precedent set by |
| 3711 |
% Arseneau's \pkg{cite} package. \cs{citemid} is used to separate a |
| 3712 |
% citation label from additional information such as \qq{Theorem |
| 3713 |
% 4.9}. \cs{citepunct} is used to separate multiple cites, unless |
| 3714 |
% one of the cites has additional associated information, in which |
| 3715 |
% case \cs{CiteAltPunct} is used. |
| 3716 |
% \begin{macrocode} |
| 3717 |
\def\citeleft{[} |
| 3718 |
\def\citeright{]} |
| 3719 |
% \end{macrocode} |
| 3720 |
% \begin{macrocode} |
| 3721 |
\def\citemid{,\penalty9999 \space} |
| 3722 |
\def\citepunct{,\penalty9999 \hskip.13em plus.1em minus.05em\relax} |
| 3723 |
% \end{macrocode} |
| 3724 |
% \end{macro} |
| 3725 |
% \end{macro} |
| 3726 |
% \end{macro} |
| 3727 |
% \end{macro} |
| 3728 |
% |
| 3729 |
% \begin{macro}{\citeAltPunct} |
| 3730 |
% When a citation list contains one or more citations with optional |
| 3731 |
% arguments, we replace \cs{citemid} by \cs{CiteAltPunct}. |
| 3732 |
% \begin{macrocode} |
| 3733 |
\def\citeAltPunct{;\ } |
| 3734 |
% \end{macrocode} |
| 3735 |
% \end{macro} |
| 3736 |
% |
| 3737 |
% \begin{macro}{\citeform} |
| 3738 |
% This is used for formatting the citation label. It can be used, |
| 3739 |
% for example, to bolden the labels (as in \cls{amsbook} and |
| 3740 |
% \cls{amsproc}) or to do more elaborate things such as convert the |
| 3741 |
% numbers to roman numerals. By default, it's just a no-op. |
| 3742 |
% |
| 3743 |
% Note that currently there is no corresponding macro for changing |
| 3744 |
% the formatting of \cn{cite}'s optional argument. This is |
| 3745 |
% probably a bug. |
| 3746 |
% \begin{macrocode} |
| 3747 |
\providecommand{\citeform}{\@firstofone} |
| 3748 |
% \end{macrocode} |
| 3749 |
% \end{macro} |
| 3750 |
% |
| 3751 |
% \begin{macro}{\citelist} |
| 3752 |
% The \cs{@citelist} indirection turns out to be helpful in |
| 3753 |
% implementing the \cs{ocites} command for the \opt{author-year} |
| 3754 |
% option. |
| 3755 |
% \begin{macrocode} |
| 3756 |
\DeclareRobustCommand{\citelist}{\@citelist} |
| 3757 |
% \end{macrocode} |
| 3758 |
% \end{macro} |
| 3759 |
% |
| 3760 |
% \begin{macro}{\@citelist} |
| 3761 |
% \begin{macrocode} |
| 3762 |
\def\@citelist#1{% |
| 3763 |
\leavevmode |
| 3764 |
\begingroup |
| 3765 |
\@citestyle |
| 3766 |
\citeleft\nopunct % suppress first \citepunct |
| 3767 |
\cite@begingroup |
| 3768 |
\in@*{#1}% |
| 3769 |
\ifin@ |
| 3770 |
\let\citepunct\citeAltPunct |
| 3771 |
\fi |
| 3772 |
\let\cite@endgroup\@empty |
| 3773 |
\cites@init |
| 3774 |
\def\citeleft{\@addpunct{\citepunct}}% |
| 3775 |
\let\citeright\ignorespaces |
| 3776 |
\def\cite{\InnerCite}% |
| 3777 |
\process@citelist{#1}% |
| 3778 |
\endgroup |
| 3779 |
\citeright |
| 3780 |
\endgroup |
| 3781 |
} |
| 3782 |
% \end{macrocode} |
| 3783 |
% \end{macro} |
| 3784 |
% |
| 3785 |
% \begin{macro}{\@citestyle} |
| 3786 |
% Reset the font to an upright, medium font (e.g. \fnt{cmr}), per |
| 3787 |
% AMS style. Also set $\cs{mathsurround} = 0\,\mathrm{pt}$ just in |
| 3788 |
% case there are subscripts in the cite numbers (from |
| 3789 |
% \cn{etalchar}, for example). |
| 3790 |
% \begin{macrocode} |
| 3791 |
\providecommand{\@citestyle}{\m@th\upshape\mdseries} |
| 3792 |
% \end{macrocode} |
| 3793 |
% \end{macro} |
| 3794 |
% |
| 3795 |
% \begin{macro}{\cite@begingroup} |
| 3796 |
% Grouping that encloses an entire cite block (a single cite or a |
| 3797 |
% list of cites). |
| 3798 |
% \begin{macrocode} |
| 3799 |
\def\cite@begingroup{\begingroup\let\cite@begingroup\relax} |
| 3800 |
% \end{macrocode} |
| 3801 |
% \end{macro} |
| 3802 |
% |
| 3803 |
% \begin{macro}{\cite@endgroup} |
| 3804 |
% \begin{macrocode} |
| 3805 |
\let\cite@endgroup\endgroup |
| 3806 |
% \end{macrocode} |
| 3807 |
% \end{macro} |
| 3808 |
% |
| 3809 |
% \begin{macro}{\cites@init} |
| 3810 |
% This needs to be called at the beginning of a list of cites to |
| 3811 |
% reset a few things. |
| 3812 |
% \begin{macrocode} |
| 3813 |
\def\cites@init{% |
| 3814 |
\gdef\prev@names{???}% |
| 3815 |
\let\cites@init\@empty |
| 3816 |
} |
| 3817 |
% \end{macrocode} |
| 3818 |
% \end{macro} |
| 3819 |
% |
| 3820 |
% \begin{macro}{\InnerCite} |
| 3821 |
% \begin{macrocode} |
| 3822 |
\newcommand{\InnerCite}[1]{\star@{\cite@a\citesel{#1}}{}} |
| 3823 |
% \end{macrocode} |
| 3824 |
% \end{macro} |
| 3825 |
% |
| 3826 |
% \begin{macro}{\cite@a} |
| 3827 |
% The job of \cs{cite@a} is to convert the cite key to all catcode-12 |
| 3828 |
% characters and remove any spaces it might contain before passing |
| 3829 |
% it on to \cs{cite@b}. |
| 3830 |
% |
| 3831 |
% \MacroArgs |
| 3832 |
% \macroarg{1}{\cs{CITESEL}} |
| 3833 |
% \macroarg{2}{citekey} |
| 3834 |
% \begin{macrocode} |
| 3835 |
\def\cite@a#1#2{% |
| 3836 |
\BackCite{#2}% |
| 3837 |
\cite@begingroup |
| 3838 |
\cites@init |
| 3839 |
\let\citesel#1\relax |
| 3840 |
\ifx\citesel\citesel@author |
| 3841 |
\let\citeleft\@empty |
| 3842 |
\let\citeright\@empty |
| 3843 |
\fi |
| 3844 |
\begingroup |
| 3845 |
\toks@{\endgroup \cite@b}% |
| 3846 |
\vdef\@tempa{#2}% |
| 3847 |
\edef\@tempa{% |
| 3848 |
\the\toks@{\@firstofone{\@xp\zap@space\@tempa} \@empty}% |
| 3849 |
}% |
| 3850 |
\@tempa |
| 3851 |
} |
| 3852 |
% \end{macrocode} |
| 3853 |
% \end{macro} |
| 3854 |
% |
| 3855 |
% \begin{macro}{\cite@b} |
| 3856 |
% \MacroArgs |
| 3857 |
% \macroarg{1}{citekey} |
| 3858 |
% \macroarg{2}{star-optional-arg} |
| 3859 |
% \begin{macrocode} |
| 3860 |
\def\cite@b#1#2{% |
| 3861 |
\@xp\cite@bc\csname b@#1\@xp\endcsname {#1}{#2}% |
| 3862 |
} |
| 3863 |
% \end{macrocode} |
| 3864 |
% \end{macro} |
| 3865 |
% |
| 3866 |
% \begin{macro}{\cite@bc} |
| 3867 |
% If it's uninitialized, plug in an empty cite structure. |
| 3868 |
% \cs{cite@bc} should be executed only once for a given instance of a |
| 3869 |
% cite key. All further processing should go through \cs{cite@cj}. |
| 3870 |
% \begin{macrocode} |
| 3871 |
\def\cite@bc#1#2{% |
| 3872 |
\ifx#1\@@undefined \global\let#1\relax \fi |
| 3873 |
\ifx#1\relax \global\let#1\empty@cite \fi |
| 3874 |
\@xp\cite@nobib@test#1{}{}{}{}\@nil#1% |
| 3875 |
\cite@cj#1% |
| 3876 |
} |
| 3877 |
% \end{macrocode} |
| 3878 |
% \end{macro} |
| 3879 |
% |
| 3880 |
% \begin{macro}{\empty@cite} |
| 3881 |
% \begin{macrocode} |
| 3882 |
\def\empty@cite{\citesel 00{}{}{}} |
| 3883 |
% \end{macrocode} |
| 3884 |
% \end{macro} |
| 3885 |
% |
| 3886 |
% \begin{macro}{\cite@nobib@test} |
| 3887 |
% If arg 4 is empty, it means there wasn't any \cn{bib} command that |
| 3888 |
% defined a valid label. |
| 3889 |
% |
| 3890 |
% \MacroArgs |
| 3891 |
% \macroarg{1}{\cs{citesel}} |
| 3892 |
% \macroarg{2}{cited?} |
| 3893 |
% \macroarg{3}{used?} |
| 3894 |
% \macroarg{4}{label} |
| 3895 |
% \macroarg{5}{backrefs} |
| 3896 |
% \macroarg{6}{\cs{b@}citekey} |
| 3897 |
% \begin{macrocode} |
| 3898 |
\def\cite@nobib@test#1#2#3#4#5\@nil#6{% |
| 3899 |
\@ifempty{#4}{% |
| 3900 |
\G@refundefinedtrue |
| 3901 |
\UndefinedCiteWarning#6% |
| 3902 |
\xdef#6{\@nx\citesel #2#3{% |
| 3903 |
\@nx\CitePrintUndefined{\extr@cite#6}}{}{}}% |
| 3904 |
}{}% |
| 3905 |
} |
| 3906 |
% \end{macrocode} |
| 3907 |
% \end{macro} |
| 3908 |
% |
| 3909 |
% \begin{macro}{\UndefinedCiteWarning} |
| 3910 |
% This is a copy of the standard warning from \cs{@citex}. |
| 3911 |
% \begin{macrocode} |
| 3912 |
\def\UndefinedCiteWarning#1{% |
| 3913 |
\@latex@warning{% |
| 3914 |
Citation `\extr@cite#1' on page \thepage\space undefined}% |
| 3915 |
} |
| 3916 |
% \end{macrocode} |
| 3917 |
% \end{macro} |
| 3918 |
% |
| 3919 |
% \begin{macro}{\CitePrintUndefined} |
| 3920 |
% \begin{macrocode} |
| 3921 |
\DeclareRobustCommand{\CitePrintUndefined}[1]{% |
| 3922 |
\begingroup\fontshape{n}\fontseries\mddefault \ttfamily ?#1\endgroup |
| 3923 |
} |
| 3924 |
% \end{macrocode} |
| 3925 |
% \end{macro} |
| 3926 |
% |
| 3927 |
% \begin{macro}{\CPU@normal} |
| 3928 |
% This has to be a \cs{let}, not a \cs{def}. |
| 3929 |
% \begin{macrocode} |
| 3930 |
\let\CPU@normal\CitePrintUndefined |
| 3931 |
% \end{macrocode} |
| 3932 |
% \end{macro} |
| 3933 |
% |
| 3934 |
% \begin{macro}{\cite@cj} |
| 3935 |
% \MacroArgs |
| 3936 |
% \macroarg{1}{\cs{b@}citekey} |
| 3937 |
% \macroarg{2}{star-optional-arg} |
| 3938 |
% \begin{macrocode} |
| 3939 |
\def\cite@cj#1#2{% |
| 3940 |
\leavevmode |
| 3941 |
\begingroup |
| 3942 |
\cite@cb#1% write info to aux file |
| 3943 |
\ar@SK@cite#1% |
| 3944 |
\@citeleft |
| 3945 |
\ar@hyperlink{#1}% |
| 3946 |
\@ifnotempty{#2}{\citemid{#2}}% |
| 3947 |
\citeright |
| 3948 |
\endgroup |
| 3949 |
\ignorespaces % ignore spaces inside \citelist |
| 3950 |
\cite@endgroup |
| 3951 |
} |
| 3952 |
% \end{macrocode} |
| 3953 |
% \end{macro} |
| 3954 |
% |
| 3955 |
% \begin{macro}{\@citeleft} |
| 3956 |
% The following definition provides some indirection that helps to |
| 3957 |
% deal with author-year object cites. |
| 3958 |
% \begin{macrocode} |
| 3959 |
\def\@citeleft{\citeleft} |
| 3960 |
% \end{macrocode} |
| 3961 |
% \end{macro} |
| 3962 |
% |
| 3963 |
% \begin{macro}{\cite@cb} |
| 3964 |
% \begin{macrocode} |
| 3965 |
\def\cite@cb#1{% |
| 3966 |
\if@filesw |
| 3967 |
\immediate\write\@auxout{\string\citation{\extr@cite#1}}% |
| 3968 |
\fi |
| 3969 |
% \end{macrocode} |
| 3970 |
% Define \cs{citesel} to make \cs{b@whatever} update itself. |
| 3971 |
% \begin{macrocode} |
| 3972 |
\begingroup |
| 3973 |
\let\citesel\citesel@update |
| 3974 |
#1#1% |
| 3975 |
\endgroup |
| 3976 |
} |
| 3977 |
% \end{macrocode} |
| 3978 |
% \end{macro} |
| 3979 |
% |
| 3980 |
% \begin{macro}{\extr@cite} |
| 3981 |
% Extract \emph{citekey} from \cs{b@}\emph{citekey}. |
| 3982 |
% \begin{macrocode} |
| 3983 |
\def\extr@cite{\@xp\@gobblethree\string} |
| 3984 |
% \end{macrocode} |
| 3985 |
% \end{macro} |
| 3986 |
% |
| 3987 |
% \subsubsection{Fancier \cn{cite} commands} |
| 3988 |
% |
| 3989 |
% \begin{macro}{\cites} |
| 3990 |
% A list of simple cites. Make it robust in case used inside a figure |
| 3991 |
% caption. (But then also, by the way, listoffigures should provide |
| 3992 |
% special handling.) |
| 3993 |
% \begin{macrocode} |
| 3994 |
\DeclareRobustCommand{\cites}{\cites@a{}} |
| 3995 |
% \end{macrocode} |
| 3996 |
% \end{macro} |
| 3997 |
% |
| 3998 |
% \begin{macro}{\citen} |
| 3999 |
% This is just to keep the showkeys package from clobbering the wrong |
| 4000 |
% part of our definition of \cn{cite}: |
| 4001 |
% \begin{macrocode} |
| 4002 |
\providecommand{\citen}{\ocite} |
| 4003 |
% \end{macrocode} |
| 4004 |
% \end{macro} |
| 4005 |
% |
| 4006 |
% \begin{macro}{\ycite} |
| 4007 |
% \cn{cite} gets redefined inside of \cn{citelist}, so we need to |
| 4008 |
% \cs{def} \cn{ycite} here instead of just \cs{let}ting everything |
| 4009 |
% to \cn{cite}. |
| 4010 |
% \begin{macrocode} |
| 4011 |
\def\ycite{\cite} |
| 4012 |
% \end{macrocode} |
| 4013 |
% \end{macro} |
| 4014 |
% |
| 4015 |
% \begin{macro}{\ycites} |
| 4016 |
% \begin{macrocode} |
| 4017 |
\let\ycites\cites |
| 4018 |
% \end{macrocode} |
| 4019 |
% \end{macro} |
| 4020 |
% |
| 4021 |
% \begin{macro}{\ocite} |
| 4022 |
% \begin{macrocode} |
| 4023 |
\let\ocite\ycite |
| 4024 |
% \end{macrocode} |
| 4025 |
% \end{macro} |
| 4026 |
% |
| 4027 |
% \begin{macro}{\ocites} |
| 4028 |
% \begin{macrocode} |
| 4029 |
\let\ocites\cites |
| 4030 |
% \end{macrocode} |
| 4031 |
% \end{macro} |
| 4032 |
% |
| 4033 |
% \begin{macro}{\fullcite} |
| 4034 |
% \begin{macrocode} |
| 4035 |
\let\fullcite\cite |
| 4036 |
% \end{macrocode} |
| 4037 |
% \end{macro} |
| 4038 |
% |
| 4039 |
% \begin{macro}{\fullocite} |
| 4040 |
% \begin{macrocode} |
| 4041 |
\let\fullocite\ocite |
| 4042 |
% \end{macrocode} |
| 4043 |
% \end{macro} |
| 4044 |
% |
| 4045 |
% \begin{macro}{\citeauthor} |
| 4046 |
% \begin{macrocode} |
| 4047 |
\let\citeauthor\ycite |
| 4048 |
% \end{macrocode} |
| 4049 |
% \end{macro} |
| 4050 |
% |
| 4051 |
% \begin{macro}{\citeauthory} |
| 4052 |
% \begin{macrocode} |
| 4053 |
\let\citeauthory\ycite |
| 4054 |
% \end{macrocode} |
| 4055 |
% \end{macro} |
| 4056 |
% |
| 4057 |
% \subsubsection{The \cn{nocite} command} |
| 4058 |
% |
| 4059 |
% \begin{macro}{\nocite} |
| 4060 |
% \begin{macrocode} |
| 4061 |
\renewcommand{\nocite}[1]{\othercites{#1}} |
| 4062 |
% \end{macrocode} |
| 4063 |
% \end{macro} |
| 4064 |
% |
| 4065 |
% \begin{macro}{\othercites} |
| 4066 |
% \begin{macrocode} |
| 4067 |
\newcommand{\othercites}[1]{% |
| 4068 |
\cite@begingroup |
| 4069 |
\let\BackCite\@gobble |
| 4070 |
\let\cite@endgroup\@empty |
| 4071 |
\def\citelist{\othercitelist}% |
| 4072 |
\cites{#1}% |
| 4073 |
} |
| 4074 |
% \end{macrocode} |
| 4075 |
% \end{macro} |
| 4076 |
% |
| 4077 |
% \begin{macro}{\othercitelist} |
| 4078 |
% \begin{macrocode} |
| 4079 |
\newcommand{\othercitelist}[1]{% |
| 4080 |
\cite@begingroup |
| 4081 |
\let\cite@endgroup\@empty |
| 4082 |
\cites@init |
| 4083 |
\let\citeleft\relax |
| 4084 |
\let\citeright\ignorespaces |
| 4085 |
\def\InnerCite{\OtherCite}% |
| 4086 |
\def\cite@cj ##1##2{% |
| 4087 |
\begingroup |
| 4088 |
\@xp\citesel##1% |
| 4089 |
\cite@cb ##1% |
| 4090 |
\endgroup |
| 4091 |
% \end{macrocode} |
| 4092 |
% If we detect |\nocite{*}|, we globally alias |
| 4093 |
% \cs{selective@bibdef} to \cs{copy@bibdef} so that all succeeding |
| 4094 |
% \cn{bibselect} commands act like \cn{bibselect*}. |
| 4095 |
% \begin{macrocode} |
| 4096 |
\@xp\ifx\csname b@*\endcsname ##1% |
| 4097 |
\global\let\selective@bibdef\copy@bibdef |
| 4098 |
\fi |
| 4099 |
\ignorespaces |
| 4100 |
\cite@endgroup |
| 4101 |
}% |
| 4102 |
#1\relax |
| 4103 |
\endgroup |
| 4104 |
} |
| 4105 |
% \end{macrocode} |
| 4106 |
% \end{macro} |
| 4107 |
% |
| 4108 |
% \begin{macro}{\OtherCite} |
| 4109 |
% \begin{macrocode} |
| 4110 |
\def\OtherCite#1{\cite@a\citesel@other{#1}{}{}} |
| 4111 |
% \end{macrocode} |
| 4112 |
% \end{macro} |
| 4113 |
% |
| 4114 |
% \begin{macro}{\citesel@other} |
| 4115 |
% \begin{macrocode} |
| 4116 |
\def\citesel@other#1#2#3#4#5#6{} |
| 4117 |
% \end{macrocode} |
| 4118 |
% \end{macro} |
| 4119 |
% |
| 4120 |
% \begin{macro}{\b@*} |
| 4121 |
% This provides a dummy definition to keep things like |\nocite{*}| |
| 4122 |
% from generating an error message. |
| 4123 |
% \begin{macrocode} |
| 4124 |
\@namedef{b@*}{\citesel 11{*}{*}{*}} |
| 4125 |
% \end{macrocode} |
| 4126 |
% \end{macro} |
| 4127 |
% |
| 4128 |
% \subsubsection{Citation sorting} |
| 4129 |
% |
| 4130 |
% \begin{macro}{\process@citelist@sorted} |
| 4131 |
% \begin{macrocode} |
| 4132 |
\def\process@citelist@sorted#1{% |
| 4133 |
\ifx\citesel\citesel@number |
| 4134 |
\cite@sorted@s #1\cite@sorted@e |
| 4135 |
\else |
| 4136 |
\NonNumericCiteWarning |
| 4137 |
\process@citelist@unsorted{#1}% |
| 4138 |
\fi |
| 4139 |
} |
| 4140 |
% \end{macrocode} |
| 4141 |
% \end{macro} |
| 4142 |
% |
| 4143 |
% \begin{macro}{\NonNumericCiteWarning} |
| 4144 |
% \begin{macrocode} |
| 4145 |
\def\NonNumericCiteWarning{% |
| 4146 |
\amsrefs@warning{% |
| 4147 |
Unable to confirm that cite keys are numeric: not sorting% |
| 4148 |
}% |
| 4149 |
} |
| 4150 |
% \end{macrocode} |
| 4151 |
% \end{macro} |
| 4152 |
% |
| 4153 |
% \begin{macro}{\process@citelist@unsorted} |
| 4154 |
% \begin{macrocode} |
| 4155 |
\def\process@citelist@unsorted#1{% |
| 4156 |
\ignorespaces#1\relax |
| 4157 |
} |
| 4158 |
% \end{macrocode} |
| 4159 |
% \end{macro} |
| 4160 |
% |
| 4161 |
% \begin{macro}{\process@citelist} |
| 4162 |
% By default, citation lists will be sorted. |
| 4163 |
% \begin{macrocode} |
| 4164 |
\let\process@citelist\process@citelist@sorted |
| 4165 |
% \end{macrocode} |
| 4166 |
% \end{macro} |
| 4167 |
% |
| 4168 |
% \begin{macro}{\CPU@sort} |
| 4169 |
% By defining this as \TeX's maxint, undefined cites migrate to the |
| 4170 |
% end of a sorted list. |
| 4171 |
% \begin{macrocode} |
| 4172 |
\def\CPU@sort#1{2147483647} |
| 4173 |
% \end{macrocode} |
| 4174 |
% \end{macro} |
| 4175 |
% |
| 4176 |
% \begin{macro}{\cite@sorted@s} |
| 4177 |
% Here's where we prepare to sort the citations and (optionally) |
| 4178 |
% compress ranges. |
| 4179 |
% \begin{macrocode} |
| 4180 |
\def\cite@sorted@s{% |
| 4181 |
\begingroup |
| 4182 |
\let\CitePrintUndefined\CPU@sort |
| 4183 |
\let\cite@cjs\cite@cj |
| 4184 |
\let\cite@cj\cite@compress |
| 4185 |
\begingroup |
| 4186 |
\toks@\@emptytoks |
| 4187 |
\let\cite@cj\cite@sort |
| 4188 |
\ignorespaces |
| 4189 |
} |
| 4190 |
% \end{macrocode} |
| 4191 |
% \end{macro} |
| 4192 |
% |
| 4193 |
% \begin{macro}{\cite@sorted@e} |
| 4194 |
% \begin{macrocode} |
| 4195 |
\def\cite@sorted@e{% |
| 4196 |
\@xp\endgroup |
| 4197 |
\the\toks@ |
| 4198 |
\cite@dash |
| 4199 |
\prev@cite |
| 4200 |
\endgroup |
| 4201 |
} |
| 4202 |
% \end{macrocode} |
| 4203 |
% \end{macro} |
| 4204 |
% |
| 4205 |
% \begin{macro}{\cite@sort} |
| 4206 |
% This is essentially an insertion sort. I think. |
| 4207 |
% |
| 4208 |
% \MacroArgs |
| 4209 |
% \macroarg{1}{\cs{b@}citekey} |
| 4210 |
% \macroarg{2}{optional arg} |
| 4211 |
% \begin{macrocode} |
| 4212 |
\def\cite@sort#1#2{% |
| 4213 |
\safe@set\@tempcnta#1% highest number so far |
| 4214 |
\toks@{\cite@cj#1{#2}}% |
| 4215 |
\@temptokena\toks@ |
| 4216 |
\let\cite@cj\cite@sort@a |
| 4217 |
\ignorespaces |
| 4218 |
} |
| 4219 |
% \end{macrocode} |
| 4220 |
% \end{macro} |
| 4221 |
% |
| 4222 |
% \begin{macro}{\cite@sort@a} |
| 4223 |
% \begin{macrocode} |
| 4224 |
\def\cite@sort@a#1#2{% |
| 4225 |
\safe@set\@tempcntb#1% |
| 4226 |
\ifnum\@tempcntb > \@tempcnta |
| 4227 |
\add@toks@{\cite@cj#1{#2}}% |
| 4228 |
\@tempcnta\@tempcntb |
| 4229 |
\else |
| 4230 |
\let\cite@cj\cite@sort@b |
| 4231 |
\toks@\@emptytoks |
| 4232 |
\def\@tempb{\add@toks@{\cite@cj#1{#2}}}% |
| 4233 |
\the\@temptokena |
| 4234 |
\@tempb |
| 4235 |
\let\cite@cj\cite@sort@a |
| 4236 |
\fi |
| 4237 |
\@temptokena\toks@ |
| 4238 |
\ignorespaces |
| 4239 |
} |
| 4240 |
% \end{macrocode} |
| 4241 |
% \end{macro} |
| 4242 |
% |
| 4243 |
% \begin{macro}{\cite@sort@b} |
| 4244 |
% \begin{macrocode} |
| 4245 |
\def\cite@sort@b#1#2{% |
| 4246 |
\safe@set\count@#1% |
| 4247 |
\ifnum\@tempcntb < \count@ |
| 4248 |
\@tempb |
| 4249 |
\let\@tempb\@empty |
| 4250 |
\fi |
| 4251 |
\add@toks@{\cite@cj#1{#2}}% |
| 4252 |
\ignorespaces |
| 4253 |
} |
| 4254 |
% \end{macrocode} |
| 4255 |
% \end{macro} |
| 4256 |
% |
| 4257 |
% \subsubsection{Range compression} |
| 4258 |
% |
| 4259 |
% When the time comes to apply compression, we have at our disposal a |
| 4260 |
% list of internal cite calls that looks like this: |
| 4261 |
% \begin{verbatim} |
| 4262 |
% \cite@cj\b@aaa{opta}\cite@cj\b@bbb{optb}...\cite@cj\b@zzz{optz} |
| 4263 |
%\end{verbatim} |
| 4264 |
% where |
| 4265 |
% \[ \ncn{b@aaa} < \ncn{b@bbb} < \cdots < \ncn{b@zzz} \] |
| 4266 |
% and the \texttt{opt} arguments are possibly null. |
| 4267 |
% To print the citations while collapsing sequences of 3 or more |
| 4268 |
% contiguous numbers into ranges of the form $n$--$m$, we bind |
| 4269 |
% \cs{cite@cj} to a suitably clever function and then execute the |
| 4270 |
% list. In the absence of optional arguments, here's the algorithm: |
| 4271 |
% |
| 4272 |
% \begin{enumerate} |
| 4273 |
% \item[Begin.] |
| 4274 |
% Enter state~0. This is done by \cs{cite@sorted@s}. |
| 4275 |
% \item[State 0.] |
| 4276 |
%^^A This is the initial state. |
| 4277 |
% The current citation is the beginning |
| 4278 |
% of a range (possibly a singleton range). Print it. Then, set |
| 4279 |
% $\mathit{prevnum} := \mathit{number}$ and enter state~1. |
| 4280 |
% |
| 4281 |
% \item[State 1.] |
| 4282 |
% The current citation might be the second element of a range. |
| 4283 |
% \begin{enumerate} |
| 4284 |
% \item[Case a)] |
| 4285 |
% $\mathit{number} = \mathit{prevnum} + 1$. Then the current |
| 4286 |
% item is definitely the second element of a range. It might be |
| 4287 |
% the last element of the range, but we won't know until we examine |
| 4288 |
% the following citation. So, save the current citation in |
| 4289 |
% \cs{prev@cite}, set $\mathit{prevnum} := \mathit{number}$, and go |
| 4290 |
% to state~2. |
| 4291 |
% |
| 4292 |
% \item[Case b)] |
| 4293 |
% $\mathit{number} \ne \mathit{prevnum} + 1$. The current citation |
| 4294 |
% is the beginning of a new range. Print it, set |
| 4295 |
% $\mathit{prevnum} := \mathit{number}$ and remain in state~1. |
| 4296 |
% (This is essentially identical to stage~0.) |
| 4297 |
% |
| 4298 |
% \end{enumerate} |
| 4299 |
% |
| 4300 |
% \item[State 2.]\leavevmode |
| 4301 |
% The current citation might be the third (or later) element of a |
| 4302 |
% range. |
| 4303 |
% \begin{enumerate} |
| 4304 |
% \item[Case a)] |
| 4305 |
% $\mathit{number} = \mathit{prevnum} + 1$. The current element is |
| 4306 |
% definitely part of a range. It might be the last |
| 4307 |
% element of the range, but again we won't know until we examine |
| 4308 |
% the following citation. Save the current citation |
| 4309 |
% in \cs{prev@cite} and set $\mathit{prevnum} := \mathit{number}$. |
| 4310 |
% Remain in state~2. |
| 4311 |
% |
| 4312 |
% \item[Case b)] |
| 4313 |
% $\mathit{number} \ne \mathit{prevnum} + 1$. The previous |
| 4314 |
% citation was the end of a range and the current citation is the |
| 4315 |
% beginning of a new range. Print a dash followed by |
| 4316 |
% \cs{prev@cite}, then set $\mathit{prevnum} := \mathit{number}$ |
| 4317 |
% and enter state~1. |
| 4318 |
% |
| 4319 |
% \end{enumerate} |
| 4320 |
% |
| 4321 |
% \item[End.] If \cs{prev@cite} is not empty, print it, preceded by a |
| 4322 |
% dash if we were in the middle of a range. (This is done by |
| 4323 |
% \cs{cite@sorted@e}.) |
| 4324 |
% |
| 4325 |
% \end{enumerate} |
| 4326 |
% |
| 4327 |
% The presence of optional arguments complicates things |
| 4328 |
% somewhat, since a citation with an optional argument should never |
| 4329 |
% participate in range compression. In other words, when we come |
| 4330 |
% across an optional argument, we should finish off the preceding |
| 4331 |
% range, print the current citation, and then return to the initial |
| 4332 |
% state. More precisely, here are the actions taken in each state |
| 4333 |
% when there is an optional argument: |
| 4334 |
% |
| 4335 |
% \begin{enumerate} |
| 4336 |
% |
| 4337 |
% \item[State 0.] |
| 4338 |
% Print the current citation and remain in state~0. |
| 4339 |
% |
| 4340 |
% \item[State 1.] |
| 4341 |
% Print the current citation and return to state~0. |
| 4342 |
% |
| 4343 |
% \item[State 2.] |
| 4344 |
% Print a dash followed by \cs{prev@cite}. Then print the current |
| 4345 |
% citation and return to state~0. |
| 4346 |
% |
| 4347 |
% \end{enumerate} |
| 4348 |
% |
| 4349 |
% \begin{macro}{\prev@cite} |
| 4350 |
% \begin{macrocode} |
| 4351 |
\let\prev@cite\@empty |
| 4352 |
% \end{macrocode} |
| 4353 |
% \end{macro} |
| 4354 |
% |
| 4355 |
% \begin{macro}{\prev@cite@cb} |
| 4356 |
% There's one further complication: Even though we're suppressing |
| 4357 |
% some of the citation numbers, we need to make sure that each |
| 4358 |
% citation is recorded in the \fn{.aux} file. So, in case~2a, |
| 4359 |
% before we overwrite \cs{prev@cite}, we first invoke |
| 4360 |
% \cs{prev@cite@cb} to record the previous citation (if any). |
| 4361 |
% \begin{macrocode} |
| 4362 |
\def\prev@cite@cb{% |
| 4363 |
\ifx\@prev@cite\@empty |
| 4364 |
\else |
| 4365 |
\begingroup |
| 4366 |
\def\cite@print##1##2{% |
| 4367 |
\cite@cb##1% |
| 4368 |
}% |
| 4369 |
\prev@cite |
| 4370 |
\endgroup |
| 4371 |
\fi |
| 4372 |
} |
| 4373 |
% \end{macrocode} |
| 4374 |
% \end{macro} |
| 4375 |
% |
| 4376 |
% \begin{macro}{\cite@print} |
| 4377 |
% \begin{macrocode} |
| 4378 |
\def\cite@print#1#2{% |
| 4379 |
\begingroup |
| 4380 |
\let\CitePrintUndefined\CPU@normal |
| 4381 |
\cite@cjs#1{#2}% |
| 4382 |
\endgroup |
| 4383 |
} |
| 4384 |
% \end{macrocode} |
| 4385 |
% \end{macro} |
| 4386 |
% |
| 4387 |
% \begin{macro}{\cite@dash} |
| 4388 |
% Ok, I lied. There was more than one further complication. |
| 4389 |
% Suppose that when we hit the end of the list, we're in state~2. |
| 4390 |
% We need to know whether to output a dash or a comma. (For |
| 4391 |
% example, both the sequences $[2, 3]$ and $[1, 2, 3]$ will end in |
| 4392 |
% state~2 with $\mathit{prevcite} = 3$, but in the former case we |
| 4393 |
% want a comma before the~3 and in the latter case we want a dash.) |
| 4394 |
% So, rather than printing the dash explicitly, we use |
| 4395 |
% \cs{cite@dash} to keep track of whether a dash is needed. |
| 4396 |
% \begin{macrocode} |
| 4397 |
\let\cite@dash\@empty |
| 4398 |
% \end{macrocode} |
| 4399 |
% \end{macro} |
| 4400 |
% |
| 4401 |
% \begin{macro}{\print@one@dash} |
| 4402 |
% \begin{macrocode} |
| 4403 |
\def\print@one@dash{% |
| 4404 |
\textendash \nopunct |
| 4405 |
\let\cite@dash\@empty |
| 4406 |
} |
| 4407 |
% \end{macrocode} |
| 4408 |
% \end{macro} |
| 4409 |
% |
| 4410 |
% State 0, 1 and~2 each correspond to a different binding for |
| 4411 |
% \cs{cite@cj}. Here they are. The role of $\mathit{prevnum}$ is |
| 4412 |
% played by \cs{@tempcnta}, with \cs{@tempcntb} assisting as |
| 4413 |
% $\mathit{number}$ at times. |
| 4414 |
% |
| 4415 |
% \begin{macro}{\cite@compress} |
| 4416 |
% State~0: |
| 4417 |
% \begin{macrocode} |
| 4418 |
\def\cite@compress#1#2{% |
| 4419 |
\cite@print#1{#2}% |
| 4420 |
\@ifempty{#2}{% |
| 4421 |
\safe@set\@tempcnta#1% |
| 4422 |
\let\cite@cj\cite@compress@a |
| 4423 |
}{}% |
| 4424 |
} |
| 4425 |
% \end{macrocode} |
| 4426 |
% \end{macro} |
| 4427 |
% |
| 4428 |
% \begin{macro}{\cite@compress@a} |
| 4429 |
% State~1: |
| 4430 |
% \begin{macrocode} |
| 4431 |
\def\cite@compress@a#1#2{% |
| 4432 |
\@ifempty{#2}{% |
| 4433 |
\advance\@tempcnta\@ne |
| 4434 |
\safe@set\@tempcntb#1% |
| 4435 |
\ifnum\@tempcnta=\@tempcntb |
| 4436 |
\def\prev@cite{\cite@print#1{}}% |
| 4437 |
\let\cite@cj\cite@compress@b |
| 4438 |
\else |
| 4439 |
\cite@print#1{}% |
| 4440 |
\@tempcnta\@tempcntb |
| 4441 |
\fi |
| 4442 |
}{% |
| 4443 |
\cite@print#1{#2}% |
| 4444 |
\let\cite@cj\cite@compress |
| 4445 |
}% |
| 4446 |
} |
| 4447 |
% \end{macrocode} |
| 4448 |
% \end{macro} |
| 4449 |
% |
| 4450 |
% \begin{macro}{\cite@compress@b} |
| 4451 |
% State~2: |
| 4452 |
% \begin{macrocode} |
| 4453 |
\def\cite@compress@b#1#2{% |
| 4454 |
\@ifempty{#2}{% |
| 4455 |
\advance\@tempcnta\@ne |
| 4456 |
\safe@set\@tempcntb#1% |
| 4457 |
\ifnum\@tempcnta=\@tempcntb |
| 4458 |
\let\cite@dash\print@one@dash |
| 4459 |
\prev@cite@cb |
| 4460 |
\def\prev@cite{\cite@print#1{}}% |
| 4461 |
\else |
| 4462 |
\cite@dash |
| 4463 |
\prev@cite |
| 4464 |
\let\prev@cite\@empty |
| 4465 |
\cite@print#1{}% |
| 4466 |
\@tempcnta\@tempcntb |
| 4467 |
\let\cite@cj\cite@compress@a |
| 4468 |
\fi |
| 4469 |
}{% |
| 4470 |
\cite@dash |
| 4471 |
\prev@cite |
| 4472 |
\let\prev@cite\@empty |
| 4473 |
\cite@print#1{#2}% |
| 4474 |
\let\cite@cj\cite@compress |
| 4475 |
}% |
| 4476 |
} |
| 4477 |
% \end{macrocode} |
| 4478 |
% \end{macro} |
| 4479 |
% |
| 4480 |
% \subsubsection{Munging the \fn{.aux} file} |
| 4481 |
% |
| 4482 |
% \begin{macro}{\amsrefs@bibcite} |
| 4483 |
% When processing the \fn{.aux} file at begin-document, this is what |
| 4484 |
% \cs{bibcite} will do: |
| 4485 |
% \begin{macrocode} |
| 4486 |
\def\amsrefs@bibcite#1{\@xp\bibcite@a\csname b@#1\endcsname} |
| 4487 |
% \end{macrocode} |
| 4488 |
% \end{macro} |
| 4489 |
% However, \pkg{hyperref} also redefines \cs{bibcite}, so to avoid |
| 4490 |
% conflicts and also ensure that it doesn't matter whether |
| 4491 |
% \pkg{amsrefs} or \pkg{hyperref} is loaded first, rather than |
| 4492 |
% redefining \cs{bibcite} directly, we redefine it inside the |
| 4493 |
% \fn{.aux} file. |
| 4494 |
% \begin{macrocode} |
| 4495 |
\AtBeginDocument{% |
| 4496 |
\if@filesw |
| 4497 |
\immediate\write\@auxout{% |
| 4498 |
\string\@ifundefined{amsrefs@bibcite}{}{% |
| 4499 |
\string\let\string\bibcite\string\amsrefs@bibcite |
| 4500 |
}% |
| 4501 |
}% |
| 4502 |
\fi |
| 4503 |
% \end{macrocode} |
| 4504 |
% For good measure, we'll redefine it here as well, even though it |
| 4505 |
% really shouldn't matter any longer. |
| 4506 |
% \begin{macrocode} |
| 4507 |
\let\bibcite\amsrefs@bibcite |
| 4508 |
} |
| 4509 |
% \end{macrocode} |
| 4510 |
% |
| 4511 |
% \begin{macro}{\bibcite@a} |
| 4512 |
% \MacroArgs |
| 4513 |
% \macroarg{1}{\cs{b@}citekey} |
| 4514 |
% \macroarg{2}{\embrace{\emph{label}}\embrace{} or \embrace{\emph{author}}\embrace{\emph{year}}} |
| 4515 |
% \begin{macrocode} |
| 4516 |
\def\bibcite@a#1#2{% |
| 4517 |
% \end{macrocode} |
| 4518 |
% Most of the time arg 1 will already be defined, by an earlier |
| 4519 |
% \cs{citedest} command in the \fn{.aux} file. Then we just need to change |
| 4520 |
% the number. |
| 4521 |
% \begin{macrocode} |
| 4522 |
\ifx\relax#1% |
| 4523 |
\gdef#1{\citesel 00#2{}}% |
| 4524 |
\else |
| 4525 |
\begingroup |
| 4526 |
\@xp\bibcite@b\@xp#1#1{#2}% |
| 4527 |
\endgroup |
| 4528 |
\fi |
| 4529 |
} |
| 4530 |
% \end{macrocode} |
| 4531 |
% \end{macro} |
| 4532 |
% |
| 4533 |
% \begin{macro}{\bibcite@b} |
| 4534 |
% |
| 4535 |
% \MacroArgs |
| 4536 |
% \macroarg{1}{\cs{b@}citekey} |
| 4537 |
% \macroarg{2}{\cs{citesel}} |
| 4538 |
% \macroarg{3}{cited?} |
| 4539 |
% \macroarg{4}{used?} |
| 4540 |
% \macroarg{5}{label} |
| 4541 |
% \macroarg{6}{year} |
| 4542 |
% \macroarg{7}{backrefs} |
| 4543 |
% \macroarg{8}{\embrace{\emph{newlabel}}\embrace{\emph{newyear}}} |
| 4544 |
% \begin{macrocode} |
| 4545 |
\def\bibcite@b#1#2#3#4#5#6#7#8{\gdef#1{\citesel#3#4#8{#7}}} |
| 4546 |
% \end{macrocode} |
| 4547 |
% \end{macro} |
| 4548 |
% |
| 4549 |
% \begin{macro}{\citedest} |
| 4550 |
% The \cs{citedest} command goes into the \fn{.aux} file to provide |
| 4551 |
% back-reference support. |
| 4552 |
% \begin{macrocode} |
| 4553 |
\newcommand{\citedest}[1]{\@xp\cite@dest\csname b@#1\endcsname} |
| 4554 |
% \end{macrocode} |
| 4555 |
% \end{macro} |
| 4556 |
% |
| 4557 |
% \begin{macro}{\cite@dest} |
| 4558 |
% \begin{macrocode} |
| 4559 |
\def\cite@dest#1{% |
| 4560 |
\ifx\relax#1% |
| 4561 |
\gdef#1{\citesel 00{}{}{}}% |
| 4562 |
\fi |
| 4563 |
\@xp\cite@dest@b\@xp#1#1% |
| 4564 |
} |
| 4565 |
% \end{macrocode} |
| 4566 |
% \end{macro} |
| 4567 |
% |
| 4568 |
% \begin{macro}{\cite@dest@b} |
| 4569 |
% \MacroArgs |
| 4570 |
% \macroarg{1}{\cs{b@}citekey} |
| 4571 |
% \macroarg{2}{\cs{citesel}} |
| 4572 |
% \macroarg{3}{cited?} |
| 4573 |
% \macroarg{4}{used?} |
| 4574 |
% \macroarg{5}{label} |
| 4575 |
% \macroarg{6}{year} |
| 4576 |
% \macroarg{7}{backrefs} |
| 4577 |
% \macroarg{8}{\embrace{\emph{more backrefs}}} |
| 4578 |
% \begin{macrocode} |
| 4579 |
\def\cite@dest@b#1#2#3#4#5#6#7#8{% |
| 4580 |
\@ifempty{#7}{% |
| 4581 |
\def#1{\citesel #3#4{#5}{#6}{{#8}}}% |
| 4582 |
}{% |
| 4583 |
\gdef#1{\citesel #3#4{#5}{#6}{#7,{#8}}}% |
| 4584 |
}% |
| 4585 |
} |
| 4586 |
% \end{macrocode} |
| 4587 |
% \end{macro} |
| 4588 |
% |
| 4589 |
% \subsubsection{Back references} |
| 4590 |
% |
| 4591 |
% \begin{macro}{\ifBR@verbose} |
| 4592 |
% \begin{macrocode} |
| 4593 |
\@ifundefined{ifBR@verbose}{\let\ifBR@verbose\iffalse \let\fi\fi}{}% |
| 4594 |
% \end{macrocode} |
| 4595 |
% \end{macro} |
| 4596 |
% |
| 4597 |
% \begin{macro}{\BackCite} |
| 4598 |
% \begin{macrocode} |
| 4599 |
\let\BackCite\@gobble |
| 4600 |
% \end{macrocode} |
| 4601 |
% \end{macro} |
| 4602 |
% |
| 4603 |
% \begin{macro}{\back@cite} |
| 4604 |
% \begin{macrocode} |
| 4605 |
\def\back@cite#1{% |
| 4606 |
\ifBR@verbose |
| 4607 |
\PackageInfo{backref}{back cite \string `\extr@cite#1'}% |
| 4608 |
\fi |
| 4609 |
\Hy@backout{#1}% |
| 4610 |
} |
| 4611 |
% \end{macrocode} |
| 4612 |
% \end{macro} |
| 4613 |
% |
| 4614 |
% \begin{macro}{\print@backrefs} |
| 4615 |
% In an AMS-style bibliography, the backref info might follow the |
| 4616 |
% final period of the reference, or it might follow some |
| 4617 |
% \emph{Mathematical Reviews} info, without a period. |
| 4618 |
% \begin{macrocode} |
| 4619 |
\def\print@backrefs#1{% |
| 4620 |
\space\SentenceSpace$\uparrow$\csname br@#1\endcsname |
| 4621 |
} |
| 4622 |
% \end{macrocode} |
| 4623 |
% \end{macro} |
| 4624 |
% |
| 4625 |
% \begin{macro}{\PrintBackRefs} |
| 4626 |
% \begin{macrocode} |
| 4627 |
\let\PrintBackRefs\@gobble |
| 4628 |
% \end{macrocode} |
| 4629 |
% \end{macro} |
| 4630 |
% |
| 4631 |
% \subsubsection{\pkg{hyperref}, \pkg{showkeys} and \pkg{shaderef} |
| 4632 |
% support} |
| 4633 |
% |
| 4634 |
% \begin{macro}{\shade@cite} |
| 4635 |
% \begin{macrocode} |
| 4636 |
\newcommand{\shade@cite}{\printref} |
| 4637 |
% \end{macrocode} |
| 4638 |
% \end{macro} |
| 4639 |
% |
| 4640 |
% \begin{macro}{\format@cite} |
| 4641 |
% \begin{macrocode} |
| 4642 |
\def\format@cite#1{\shade@cite{\citeform{#1}}} |
| 4643 |
% \end{macrocode} |
| 4644 |
% \end{macro} |
| 4645 |
% |
| 4646 |
% \begin{macro}{\ar@hyperlink} |
| 4647 |
% \begin{macrocode} |
| 4648 |
\def\ar@hyperlink#1{% |
| 4649 |
\hyper@@link[cite]{}{cite.\extr@cite#1}{\format@cite{#1}}% |
| 4650 |
} |
| 4651 |
% \end{macrocode} |
| 4652 |
% \end{macro} |
| 4653 |
% |
| 4654 |
% \begin{macro}{\ar@SK@cite} |
| 4655 |
% \begin{macrocode} |
| 4656 |
\def\ar@SK@cite#1{\@bsphack\@xp\SK@\@xp\SK@@ref\@xp{\extr@cite#1}\@esphack} |
| 4657 |
% \end{macrocode} |
| 4658 |
% \end{macro} |
| 4659 |
% |
| 4660 |
% Turn off \pkg{hyperref} and \pkg{showkeys} support if those |
| 4661 |
% packages don't appear to be loaded. |
| 4662 |
% \begin{macrocode} |
| 4663 |
\AtBeginDocument{% |
| 4664 |
\@ifpackageloaded{shaderef}{}{% |
| 4665 |
\let\shade@cite\@firstofone |
| 4666 |
}% |
| 4667 |
\@ifpackageloaded{hyperref}{}{% |
| 4668 |
\def\ar@hyperlink{\format@cite}% |
| 4669 |
\let\hyper@anchorstart\@gobble |
| 4670 |
\let\hyper@anchorend\relax |
| 4671 |
\let\Hy@raisedlink\@firstofone |
| 4672 |
}% |
| 4673 |
\@ifpackageloaded{showkeys}{% |
| 4674 |
\@ifpackagewith{showkeys}{notcite}{% |
| 4675 |
\let\ar@SK@cite\@gobble |
| 4676 |
}{} |
| 4677 |
}{% |
| 4678 |
\let\ar@SK@cite\@gobble |
| 4679 |
\let\SK@@label\@gobble |
| 4680 |
\let\SK@\@gobbletwo |
| 4681 |
}% |
| 4682 |
} |
| 4683 |
% \end{macrocode} |
| 4684 |
% |
| 4685 |
% \subsection{Lexical structure of names} |
| 4686 |
% |
| 4687 |
% Before we can begin parsing names, we need to give some thought |
| 4688 |
% to the lexical structure of names. For the remainder of this |
| 4689 |
% document, when we refer to a ``name'' and especially when we |
| 4690 |
% speak of a name as a macro argument, we assume that the only |
| 4691 |
% tokens contained in the name are |
| 4692 |
% \begin{itemize} |
| 4693 |
% |
| 4694 |
% \item |
| 4695 |
% letters and punctuation (i.e., characters with catcode 11 or~12), |
| 4696 |
% |
| 4697 |
% \item |
| 4698 |
% ties (the token |~|$_{13}$), |
| 4699 |
% |
| 4700 |
% \item |
| 4701 |
% accent commands, such as |\"| or |\k|, |
| 4702 |
% |
| 4703 |
% \item |
| 4704 |
% text symbol macros, such as |\i|, |\ae| or |\cprime|, |
| 4705 |
% |
| 4706 |
% \item |
| 4707 |
% grouping characters (braces). |
| 4708 |
% |
| 4709 |
% \end{itemize} |
| 4710 |
% |
| 4711 |
% In addition to their normal function of delimiting macro |
| 4712 |
% arguments, braces inside names have the following special |
| 4713 |
% functions: |
| 4714 |
% \begin{enumerate} |
| 4715 |
% |
| 4716 |
% \item They are used to indicate that multiple characters should |
| 4717 |
% be considered a single ``compound'' character when extracting |
| 4718 |
% initials. For example, |Yuri| becomes |Y.|, but |{Yu}ri| becomes |
| 4719 |
% |Yu.| |
| 4720 |
% |
| 4721 |
% \label{initial-braces} |
| 4722 |
% An important aspect of this use of braces is that it only applies |
| 4723 |
% to the first characters of a given name. As we'll see below, |
| 4724 |
% this has important implications for our parsing code, which must |
| 4725 |
% preserve braces at the beginning of given names, but can be more |
| 4726 |
% cavalier with braces in other positions. |
| 4727 |
% |
| 4728 |
% \item |
| 4729 |
% Spaces and commas are ordinarily interpreted as name separators, |
| 4730 |
% rather than name components. Similarly, periods and hyphens |
| 4731 |
% usually have a special interpretation. All these characters can |
| 4732 |
% be stripped of their special meanings by putting them within |
| 4733 |
% braces. |
| 4734 |
% |
| 4735 |
% \end{enumerate} |
| 4736 |
% |
| 4737 |
% In practice, it might be possible to insert other tokens (such as |
| 4738 |
% macros) into names as long as they either (a)~are non-expandable |
| 4739 |
% or (b)~expand into a series of tokens of the above enumerated |
| 4740 |
% types. However, in such cases it will probably be safer to |
| 4741 |
% declare the macro in question as either a text accent or a text |
| 4742 |
% symbol. |
| 4743 |
% |
| 4744 |
% \subsubsection{Text accents} |
| 4745 |
% |
| 4746 |
% Syntactically, a text accent is a macro that takes a single, |
| 4747 |
% undelimited argument, i.e, it has a ``prototype'' of |
| 4748 |
% |macro:#1->|. Semantically, the implication is that it takes a |
| 4749 |
% letter (the \emph{base}) as an argument and produces a glyph that |
| 4750 |
% for certain purposes can be considered equivalent to the |
| 4751 |
% base (see the discussion of stem comparison on |
| 4752 |
% page~\pageref{stem-comparison}).\footnote{Note that this is meant |
| 4753 |
% to be a pragmatic definition for the purposes of this package. |
| 4754 |
% No claim is made to greater generality.} |
| 4755 |
% |
| 4756 |
% \begin{macro}{\amsrefs@textaccents} |
| 4757 |
% This will contain a list of accent commands in standard \LaTeX\ |
| 4758 |
% format (i.e., separated by the token \cs{do}). For example, |
| 4759 |
% after registering the \cn{"} and \cn{'} accents, it will contain |
| 4760 |
% \begin{verbatim} |
| 4761 |
% \do \"\do \' |
| 4762 |
%\end{verbatim} |
| 4763 |
% \begin{macrocode} |
| 4764 |
\let\amsrefs@textaccents\@empty |
| 4765 |
% \end{macrocode} |
| 4766 |
% \end{macro} |
| 4767 |
% |
| 4768 |
% \begin{macro}{\DeclareNameAccent} |
| 4769 |
% \MacroArgs |
| 4770 |
% \macroarg{1}{accent} |
| 4771 |
% \begin{macrocode} |
| 4772 |
\def\DeclareNameAccent{% |
| 4773 |
\@lappend\amsrefs@textaccents |
| 4774 |
} |
| 4775 |
% \end{macrocode} |
| 4776 |
% \end{macro} |
| 4777 |
% |
| 4778 |
% Here are all the standard \LaTeX\ accents, as well as a few |
| 4779 |
% nonstandard accents from the \pkg{mathscinet} package. |
| 4780 |
% \begin{macrocode} |
| 4781 |
\DeclareNameAccent\" |
| 4782 |
\DeclareNameAccent\' |
| 4783 |
\DeclareNameAccent\. |
| 4784 |
\DeclareNameAccent\= |
| 4785 |
\DeclareNameAccent\^ |
| 4786 |
\DeclareNameAccent\` |
| 4787 |
\DeclareNameAccent\~% |
| 4788 |
\DeclareNameAccent\b |
| 4789 |
\DeclareNameAccent\c |
| 4790 |
\DeclareNameAccent\d |
| 4791 |
\DeclareNameAccent\H |
| 4792 |
\DeclareNameAccent\k |
| 4793 |
\DeclareNameAccent\r |
| 4794 |
\DeclareNameAccent\t |
| 4795 |
\DeclareNameAccent\u |
| 4796 |
\DeclareNameAccent\v |
| 4797 |
% \end{macrocode} |
| 4798 |
% From \pkg{mathscinet}: |
| 4799 |
% \begin{macrocode} |
| 4800 |
\DeclareNameAccent\utilde |
| 4801 |
\DeclareNameAccent\uarc |
| 4802 |
\DeclareNameAccent\dudot |
| 4803 |
\DeclareNameAccent\lfhook |
| 4804 |
\DeclareNameAccent\udot |
| 4805 |
\DeclareNameAccent\polhk |
| 4806 |
\DeclareNameAccent\soft |
| 4807 |
% \end{macrocode} |
| 4808 |
% \cn{etalchar} and \cn{etaltext} are sort of accent-like if you |
| 4809 |
% look at them in the right light. |
| 4810 |
% \begin{macrocode} |
| 4811 |
\DeclareNameAccent\etalchar |
| 4812 |
%\DeclareNameAccent\etaltext |
| 4813 |
% \end{macrocode} |
| 4814 |
% |
| 4815 |
% \subsubsection{Text symbols} |
| 4816 |
% |
| 4817 |
% Syntactically, a text symbol is a macro with a empty parameter |
| 4818 |
% text, i.e., a prototype of |macro:->|. Semantically, it's a |
| 4819 |
% letter-like glyph that should not be considered equivalent |
| 4820 |
% to any other glyph or group of glyphs. In addition, it may exist |
| 4821 |
% in both upper- and lowercase variants, unlike text accents, where |
| 4822 |
% we consider the case to be an attribute of the base letter, not |
| 4823 |
% of the accent.\footnote{As with text accents, this is not |
| 4824 |
% intended as a fully general definition.} |
| 4825 |
% |
| 4826 |
% \begin{macro}{\amsrefs@textsymbols} |
| 4827 |
% This is analogous to \cs{amsrefs@textaccents} but a little more |
| 4828 |
% complicated due to the need to store lowercase equivalents. It |
| 4829 |
% consists of a list of double entries of the form |
| 4830 |
% \begin{verbatim} |
| 4831 |
% \do \symbol \do \lcsymbol |
| 4832 |
%\end{verbatim} |
| 4833 |
% which means that \cs{symbol} is a text symbol whose corresponding |
| 4834 |
% lowercase version is \cs{lcsymbol}. (Note that nothing is |
| 4835 |
% implied about whether \cs{symbol} is to be considered as |
| 4836 |
% uppercase or lowercase.) For example, in |
| 4837 |
% \begin{verbatim} |
| 4838 |
% \do \ae \do \ae \do \OE \do \oe |
| 4839 |
%\end{verbatim} |
| 4840 |
% the first four tokens indicate that \cn{ae} is a text symbol with |
| 4841 |
% lowercase equivalent \cn{ae}, while the last four tokens indicate |
| 4842 |
% that \cn{OE} is a text symbol with lowercase equivalent \cn{oe}. |
| 4843 |
% This scheme is somewhat redundant, but pleasingly simple. |
| 4844 |
% |
| 4845 |
% This also duplicates some of the information in \cs{@uclclist}, |
| 4846 |
% but it seems safer to do this than to modify \cs{@uclclist}. |
| 4847 |
% \begin{macrocode} |
| 4848 |
\let\amsrefs@textsymbols\@empty |
| 4849 |
% \end{macrocode} |
| 4850 |
% \end{macro} |
| 4851 |
% |
| 4852 |
% \begin{macro}{\DeclareNameSymbol} |
| 4853 |
% \MacroArgs |
| 4854 |
% \macroarg{1}{symbol} |
| 4855 |
% \macroarg{2}{lowercase} |
| 4856 |
% \begin{macrocode} |
| 4857 |
\def\DeclareNameSymbol#1#2{% |
| 4858 |
\@lappend\amsrefs@textsymbols#1% |
| 4859 |
\@lappend\amsrefs@textsymbols#2% |
| 4860 |
\ifx#1#2\else |
| 4861 |
\@lappend\amsrefs@textsymbols#2% |
| 4862 |
\@lappend\amsrefs@textsymbols#2% |
| 4863 |
\fi |
| 4864 |
} |
| 4865 |
% \end{macrocode} |
| 4866 |
% \end{macro} |
| 4867 |
% |
| 4868 |
% Here are the standard \LaTeX\ and \pkg{mathscinet} text |
| 4869 |
% symbols. |
| 4870 |
% |
| 4871 |
% \label{anomalies} |
| 4872 |
% Note that \cn{i} and \cn{j} are anomalous in being syntactically |
| 4873 |
% like text symbols, but semantically more like text accents. |
| 4874 |
% \begin{macrocode} |
| 4875 |
\DeclareNameSymbol\i\i |
| 4876 |
\DeclareNameSymbol\j\j |
| 4877 |
\DeclareNameSymbol\AE\ae |
| 4878 |
\DeclareNameSymbol\OE\oe |
| 4879 |
\DeclareNameSymbol\O\o |
| 4880 |
\DeclareNameSymbol\DH\dh |
| 4881 |
\DeclareNameSymbol\DJ\dj |
| 4882 |
\DeclareNameSymbol\L\l |
| 4883 |
\DeclareNameSymbol\NG\ng |
| 4884 |
\DeclareNameSymbol\SS\ss |
| 4885 |
\DeclareNameSymbol\TH\th |
| 4886 |
% \end{macrocode} |
| 4887 |
% From \pkg{mathscinet}: |
| 4888 |
% \begin{macrocode} |
| 4889 |
\DeclareNameSymbol\Dbar\dbar |
| 4890 |
\DeclareNameSymbol\lasp\lasp |
| 4891 |
\DeclareNameSymbol\rasp\rasp |
| 4892 |
\DeclareNameSymbol\cprime\cprime |
| 4893 |
\DeclareNameSymbol\cdprime\cdprime |
| 4894 |
\DeclareNameSymbol\bud\bud |
| 4895 |
\DeclareNameSymbol\cydot\cydot |
| 4896 |
% \end{macrocode} |
| 4897 |
% |~| can be considered a text symbol in much the same way that |
| 4898 |
% \cn{etalchar} can be considered an accent. |
| 4899 |
% \begin{macrocode} |
| 4900 |
\DeclareNameSymbol~~% |
| 4901 |
% \end{macrocode} |
| 4902 |
% |
| 4903 |
% \subsubsection{\cs{edef}-like macros for names} |
| 4904 |
% The following macros all behave sort of like \cs{edef}, in the |
| 4905 |
% sense that |
| 4906 |
% \begin{verbatim} |
| 4907 |
% \X@edef\foo{name} |
| 4908 |
%\end{verbatim} |
| 4909 |
% defines \cs{foo} to be the result of expanding |name| and |
| 4910 |
% applying a certain transformation to it. |
| 4911 |
% |
| 4912 |
% \begin{macro}{\normalize@edef} |
| 4913 |
% This converts accents in the name to a normalized form where the |
| 4914 |
% accent and its argument are surrounded by braces. E.g., after |
| 4915 |
% \begin{verbatim} |
| 4916 |
% \normalize@edef\cs{P\'olya} |
| 4917 |
%\end{verbatim} |
| 4918 |
% \cs{cs} will contain |P{\'o}lya|. (This might result in a |
| 4919 |
% redundant layer of braces if the original text contained, say, |
| 4920 |
% ``\verb+P{\'o}lya+'', but that's ok.) This lets us extract the |
| 4921 |
% first $n$ characters from a name by using \TeX's macro |
| 4922 |
% argument-gobbling mechanism without worrying that an accent |
| 4923 |
% will be separated from its base letter. |
| 4924 |
% As a bonus, it also replaces ties (|~|) by spaces. |
| 4925 |
% \begin{macrocode} |
| 4926 |
\def\normalize@edef#1#2{% |
| 4927 |
\begingroup |
| 4928 |
\@apply\auto@protect\amsrefs@textsymbols |
| 4929 |
\@apply\wrap@accent\amsrefs@textaccents |
| 4930 |
% \end{macrocode} |
| 4931 |
% Redefine \cs{@tabacckludge} in case someone wants to use this |
| 4932 |
% with the \pkg{inputenc} package. |
| 4933 |
% \begin{macrocode} |
| 4934 |
\let\@tabacckludge\use@accent |
| 4935 |
\let~\space |
| 4936 |
\edef\@tempa{\def\@nx#1{#2}}% |
| 4937 |
\@xp\endgroup |
| 4938 |
\@tempa |
| 4939 |
} |
| 4940 |
% \end{macrocode} |
| 4941 |
% \end{macro} |
| 4942 |
% |
| 4943 |
% \begin{macro}{\use@accent} |
| 4944 |
% This is identical to \cs{@nameuse} except for the addition of the |
| 4945 |
% \cs{string}, which, as per \fn{ltoutenc.dtx}, guards against the |
| 4946 |
% eventuality that something like |'| might be active at the point |
| 4947 |
% of use. We don't expect to find a \cs{bib} in the middle of a |
| 4948 |
% \env{tabbing} environment (do we?)\ so we |
| 4949 |
% \begin{macrocode} |
| 4950 |
\def\use@accent#1{\csname\string#1\endcsname} |
| 4951 |
% \end{macrocode} |
| 4952 |
% \end{macro} |
| 4953 |
% |
| 4954 |
% \begin{macro}{\wrap@accent} |
| 4955 |
% Here's a wrapper macro that causes an accent to become |
| 4956 |
% auto-wrapping. E.g., after \verb+\wrap@accent\'+, \verb+\'o+ |
| 4957 |
% will expand to \verb+{\'o}+. |
| 4958 |
% \begin{macrocode} |
| 4959 |
\def\wrap@accent#1{% |
| 4960 |
\def#1##1{{\@nx#1##1}}% |
| 4961 |
} |
| 4962 |
% \end{macrocode} |
| 4963 |
% \end{macro} |
| 4964 |
% |
| 4965 |
% \begin{macro}{\lc@edef} |
| 4966 |
% This converts all the characters in a name to all lowercase, |
| 4967 |
% using the mapping defined by \cs{amsrefs@textsymbols}. So, after |
| 4968 |
% \begin{verbatim} |
| 4969 |
% \lc@edef\cs{P\'olya} |
| 4970 |
%\end{verbatim} |
| 4971 |
% \cs{cs} will contain |p\'olya|. Note that accents are not |
| 4972 |
% wrapped and ties are passed through unmolested. |
| 4973 |
% \begin{macrocode} |
| 4974 |
\def\lc@edef#1#2{% |
| 4975 |
\begingroup |
| 4976 |
\let\@tabacckludge\use@accent %%?? |
| 4977 |
\@apply\auto@protect\amsrefs@textaccents |
| 4978 |
\@apply\lc@do\amsrefs@textsymbols |
| 4979 |
\edef\@tempa{\lowercase{\def\@nx#1{#2}}}% |
| 4980 |
\@xp\endgroup |
| 4981 |
\@tempa |
| 4982 |
} |
| 4983 |
% \end{macrocode} |
| 4984 |
% \end{macro} |
| 4985 |
% |
| 4986 |
% \begin{macro}{\lc@do} |
| 4987 |
% This is a slighly more complicated wrapper macro than previous |
| 4988 |
% ones. |
| 4989 |
% The first argument is a text symbol; the second argument is the |
| 4990 |
% lowercase variant of the symbol. If they're the same (i.e., the |
| 4991 |
% first argument is a lowercase text symbol), we \cs{auto@protect} |
| 4992 |
% it. Otherwise we define the first symbol to expand to the |
| 4993 |
% second. |
| 4994 |
% \begin{macrocode} |
| 4995 |
\def\lc@do#1\do#2{% |
| 4996 |
\ifx#1#2% |
| 4997 |
\auto@protect#1% |
| 4998 |
\else |
| 4999 |
\def#1{#2}% |
| 5000 |
\fi |
| 5001 |
} |
| 5002 |
% \end{macrocode} |
| 5003 |
% \end{macro} |
| 5004 |
% |
| 5005 |
% \begin{macro}{\purge@edef} |
| 5006 |
% Removes accents and braces from a name and converts ties to |
| 5007 |
% spaces, leaving only letters, punctuation and text symbols. For |
| 5008 |
% example, |
| 5009 |
% \begin{verbatim} |
| 5010 |
% \lc@edef\cs{P{\'o}lya} |
| 5011 |
%\end{verbatim} |
| 5012 |
% will put |Polya| in~\cs{cs}. |
| 5013 |
% \begin{macrocode} |
| 5014 |
\def\purge@edef#1#2{% |
| 5015 |
\begingroup |
| 5016 |
\@apply\auto@protect\amsrefs@textsymbols |
| 5017 |
\let~\space |
| 5018 |
\@apply\purge@accent\amsrefs@textaccents |
| 5019 |
\let\@tabacckludge\@gobble |
| 5020 |
% \end{macrocode} |
| 5021 |
% As mentioned above (page~\pageref{anomalies}), \cn{i} and \cn{j} |
| 5022 |
% are semantically like text accents; hence, they require special |
| 5023 |
% treatment here. |
| 5024 |
% \begin{macrocode} |
| 5025 |
\def\i{i}% |
| 5026 |
\def\j{j}% |
| 5027 |
\edef\@tempa{#2}% |
| 5028 |
\toks@\@emptytoks |
| 5029 |
\@xp\purge@edef@ \@tempa \@nil |
| 5030 |
\edef\@tempa{\def\@nx#1{\the\toks@}}% |
| 5031 |
\@xp\endgroup |
| 5032 |
\@tempa |
| 5033 |
} |
| 5034 |
% \end{macrocode} |
| 5035 |
% \end{macro} |
| 5036 |
% |
| 5037 |
% \begin{macro}{\purge@edef@} |
| 5038 |
% Peek ahead so \cs{purge@edef@a} will know whether its argument |
| 5039 |
% was originally surrounded by braces. |
| 5040 |
% \begin{macrocode} |
| 5041 |
\def\purge@edef@{% |
| 5042 |
\futurelet\@let@token |
| 5043 |
\purge@edef@a |
| 5044 |
} |
| 5045 |
% \end{macrocode} |
| 5046 |
% \end{macro} |
| 5047 |
% |
| 5048 |
% \begin{macro}{\purge@edef@a} |
| 5049 |
% Process a single ``chunk'' (i.e., one macro-argument's worth) of |
| 5050 |
% the name. |
| 5051 |
% \begin{macrocode} |
| 5052 |
\def\purge@edef@a#1{% |
| 5053 |
% \end{macrocode} |
| 5054 |
% If we've run into the \cs{@nil} terminator, we're done. |
| 5055 |
% \begin{macrocode} |
| 5056 |
\ifx\@let@token\@nil |
| 5057 |
\let\@tempa\@empty |
| 5058 |
\else |
| 5059 |
% \end{macrocode} |
| 5060 |
% Otherwise, if the argument was originally surrounded by braces, |
| 5061 |
% process it recursively before processing the remainder of the |
| 5062 |
% token stream. |
| 5063 |
% \begin{macrocode} |
| 5064 |
\ifx\@let@token\bgroup |
| 5065 |
\def\@tempa{% |
| 5066 |
\purge@edef@ #1\@nil |
| 5067 |
\purge@edef@ |
| 5068 |
}% |
| 5069 |
\else |
| 5070 |
% \end{macrocode} |
| 5071 |
% If the argument is a single unbracketed token, just copy it into |
| 5072 |
% the output. |
| 5073 |
% \begin{macrocode} |
| 5074 |
\add@toks@{#1}% |
| 5075 |
\let\@tempa\purge@edef@ |
| 5076 |
\fi |
| 5077 |
\fi |
| 5078 |
\@tempa |
| 5079 |
} |
| 5080 |
% \end{macrocode} |
| 5081 |
% \end{macro} |
| 5082 |
% |
| 5083 |
% \begin{macro}{\purge@accent} |
| 5084 |
% This is similar to \cs{wrap@accent} but it removes the accent |
| 5085 |
% command (and possibly a layer of braces surrounding the accent's |
| 5086 |
% argument). |
| 5087 |
% \begin{macrocode} |
| 5088 |
\def\purge@accent#1{% |
| 5089 |
\def#1##1{##1}% |
| 5090 |
} |
| 5091 |
% \end{macrocode} |
| 5092 |
% \end{macro} |
| 5093 |
% |
| 5094 |
% \subsection{Name parsing} |
| 5095 |
% |
| 5096 |
% Parsing names is somewhat complicated because parts of the name |
| 5097 |
% can (in principle) be empty (G=given, S=surname, J=jr)): |
| 5098 |
% \begin{quote} |
| 5099 |
% \nametest{Doe, John, Jr.} |
| 5100 |
% \nametest{Doe, John} |
| 5101 |
% \nametest{Doe, , Jr.} |
| 5102 |
% \nametest{Doe} |
| 5103 |
% \nametest{, John, Jr.} |
| 5104 |
% \nametest{, John} |
| 5105 |
% \nametest{, , Jr.} |
| 5106 |
% \nametest{} |
| 5107 |
% \end{quote} |
| 5108 |
% Not all of these forms are legal, of course, but that's no excuse |
| 5109 |
% for not parsing them correctly. |
| 5110 |
% |
| 5111 |
% We also want to be somewhat lenient about the placement of |
| 5112 |
% spaces: |
| 5113 |
% \begin{quote} |
| 5114 |
% \nametest{ Doe,John,Jr.} |
| 5115 |
% \end{quote} |
| 5116 |
% |
| 5117 |
% However, because one must have some standards, we assume there |
| 5118 |
% are no spaces in the following positions in the input: |
| 5119 |
% \begin{enumerate} |
| 5120 |
% \item before periods, |
| 5121 |
% |
| 5122 |
% \item before commas, |
| 5123 |
% |
| 5124 |
% \item at the end of the name, |
| 5125 |
% |
| 5126 |
% \item before or after hyphens. |
| 5127 |
% \end{enumerate} |
| 5128 |
% |
| 5129 |
% Thus, we make no attempt to compensate for the misplaced spaces |
| 5130 |
% in examples like these: |
| 5131 |
% \begin{quote} |
| 5132 |
% \nametest{Doe , J ., Jr. } |
| 5133 |
% \nametest{Doe, J. - M.} |
| 5134 |
% \end{quote} |
| 5135 |
% |
| 5136 |
% Also, unless we are generating initials, we don't try to |
| 5137 |
% normalize spaces \emph{after} periods: |
| 5138 |
% \begin{quote} |
| 5139 |
% \nametest{Doe, J.M.}\\ (not G=\embrace{J. M.}) |
| 5140 |
% \end{quote} |
| 5141 |
% |
| 5142 |
% Finally, since we allow authors to group together characters that |
| 5143 |
% should be treated as a single unit, we need to be careful to |
| 5144 |
% preserve the author's markup in cases like these: |
| 5145 |
% |
| 5146 |
% \begin{quote} |
| 5147 |
% \nametest{Doe, {Yu}ri} |
| 5148 |
% \nametest{Doe, {Yu}} |
| 5149 |
% \end{quote} |
| 5150 |
% |
| 5151 |
% This is harder than it seems. For example, consider a naive |
| 5152 |
% implementation that uses delimited arguments to pull the name |
| 5153 |
% apart: |
| 5154 |
% \begin{verbatim} |
| 5155 |
% \def\parsename#1,#2\@nil{% |
| 5156 |
% \def\bib'surname{#1}% |
| 5157 |
% \def\bib'given{#2}% |
| 5158 |
% } |
| 5159 |
% |
| 5160 |
% \parsename Doe, {Yu}ri\@nil |
| 5161 |
%\end{verbatim} |
| 5162 |
% Unfortunately, this results in the space after the comma |
| 5163 |
% becoming part of \cs{bib'given}: ``\verb+ {Yu}ri+''. |
| 5164 |
% |
| 5165 |
% Our next thought would be to modify the definition slightly to |
| 5166 |
% trick \TeX\ into gobbling the space: |
| 5167 |
% \begin{verbatim} |
| 5168 |
% \def\parsename#1,#2#3\@nil{% |
| 5169 |
% \def\bib'surname{#1}% |
| 5170 |
% \def\bib'given{#2#3}% |
| 5171 |
% } |
| 5172 |
%\end{verbatim} |
| 5173 |
% Now the space is gone, but---surprise!---so are the braces: |
| 5174 |
% ``\verb+Yuri+''. In addition, this approach makes it difficult |
| 5175 |
% to handle empty name parts correctly. |
| 5176 |
% |
| 5177 |
% To sidestep these problems, instead of blindly gobbling macro |
| 5178 |
% arguments, we use \cs{futurelet} to look ahead at certain |
| 5179 |
% strategic moments so we can take the appropriate action (see |
| 5180 |
% \cs{get@namepart@d}--|f|). We only really care about preserving |
| 5181 |
% braces at the start of names (page~\pageref{initial-braces}), |
| 5182 |
% which simplifies things somewhat.\label{brace-preservation} |
| 5183 |
% |
| 5184 |
% \begin{macro}{\name@split} |
| 5185 |
% \cs{name@split} parses a name into its three parts and stores |
| 5186 |
% them in \cs{bib'surname}, \cs{bib'given} and \cs{bib'jr}. If the |
| 5187 |
% \opt{initials} option is in force, it also extracts the initials |
| 5188 |
% from the given name and stores them in \cs{bib'initials}. |
| 5189 |
% |
| 5190 |
% It expects the name to be parsed to be terminated by \cs{@nil} |
| 5191 |
% and to contain at least three commas. Thus the usual way to |
| 5192 |
% invoke it is |
| 5193 |
% \begin{quote} |
| 5194 |
% \cs{name@split} $\langle\mathit{name}\rangle$\verb+,,,\@nil+ |
| 5195 |
% \end{quote} |
| 5196 |
% |
| 5197 |
% \cs{name@split} just uses \cs{get@namepart} to peal off the |
| 5198 |
% surname and then passes control to \cs{name@split@given}. |
| 5199 |
% (Note the spiffy continuation-passing programming style.) |
| 5200 |
% \begin{macrocode} |
| 5201 |
\def\name@split{% |
| 5202 |
\get@namepart\bib'surname\name@split@given |
| 5203 |
} |
| 5204 |
% \end{macrocode} |
| 5205 |
% \end{macro} |
| 5206 |
% |
| 5207 |
% \begin{macro}{\name@split@given} |
| 5208 |
% Pretty much the same, \em{mutatis mutandis}\ldots |
| 5209 |
% \begin{macrocode} |
| 5210 |
\def\name@split@given{% |
| 5211 |
\get@namepart\bib'given\name@split@jr |
| 5212 |
} |
| 5213 |
% \end{macrocode} |
| 5214 |
% \end{macro} |
| 5215 |
% |
| 5216 |
% \begin{macro}{\name@split@jr} |
| 5217 |
% And again\ldots |
| 5218 |
% \begin{macrocode} |
| 5219 |
\def\name@split@jr{% |
| 5220 |
\get@namepart\bib'jr\name@split@finish |
| 5221 |
} |
| 5222 |
% \end{macrocode} |
| 5223 |
% \end{macro} |
| 5224 |
% |
| 5225 |
% \begin{macro}{\name@split@finish} |
| 5226 |
% We have all three parts now. Do some consistency checking, |
| 5227 |
% extract the initials from the given name, and then call |
| 5228 |
% \cs{@nilgobble} to remove anything (such as extra commas) left on |
| 5229 |
% the stack. |
| 5230 |
% \begin{macrocode} |
| 5231 |
\def\name@split@finish{% |
| 5232 |
\ifx\bib'surname\@empty \EmptyNameWarning \fi |
| 5233 |
% \end{macrocode} |
| 5234 |
% Theoretically, we could try to check for uninverted names here, |
| 5235 |
% but only at the risk of producing spurious warnings when the name |
| 5236 |
% really does only have one part (\verb+author={Arvind}+). |
| 5237 |
% |
| 5238 |
% A possible solution: Now that we have the |
| 5239 |
% \attr{inverted} attribute, we could issue a warning if the given |
| 5240 |
% name is empty and the family name contains a space. I'm sure |
| 5241 |
% someone could find valid input that would still generate a |
| 5242 |
% spurious warning, but this would take care of the most common |
| 5243 |
% cases. This bears more thinking about. |
| 5244 |
% \begin{macrocode} |
| 5245 |
%% \ifx\@empty\bib'given |
| 5246 |
%% \NameCheck \bib'surname ??\@nil |
| 5247 |
%% \else |
| 5248 |
\extract@initials\bib'given |
| 5249 |
%% \fi |
| 5250 |
\@nilgobble |
| 5251 |
} |
| 5252 |
% \end{macrocode} |
| 5253 |
% \end{macro} |
| 5254 |
% |
| 5255 |
% \begin{macro}{\get@namepart} |
| 5256 |
% Now for the fun part. \cs{get@namepart} takes two arguments. |
| 5257 |
% The first (the destination) should be a control sequence; the |
| 5258 |
% second (the continuation) will normally also be a control |
| 5259 |
% sequence, though technically we only require that it be a single |
| 5260 |
% token. \cs{get@namepart} scans everything up to the next level-0 |
| 5261 |
% comma, places it in the destination, and then calls the |
| 5262 |
% continuation. |
| 5263 |
% \begin{macrocode} |
| 5264 |
\def\get@namepart#1#2{% |
| 5265 |
% \end{macrocode} |
| 5266 |
% Save the destination in \cs{toks@} and the continuation in |
| 5267 |
% \cs{@temptokena}. It's unfortunate that this trashes the |
| 5268 |
% previous contents of those token lists (as well as the contents |
| 5269 |
% of \cs{@tempa} later on), but preliminary attempts to rewrite the |
| 5270 |
% code to leave the calling environment unchanged were not |
| 5271 |
% encouraging. |
| 5272 |
% \begin{macrocode} |
| 5273 |
\toks@{#1}% |
| 5274 |
\@temptokena{#2}% |
| 5275 |
\get@namepart@a |
| 5276 |
} |
| 5277 |
% \end{macrocode} |
| 5278 |
% \end{macro} |
| 5279 |
% |
| 5280 |
% \begin{macro}{\get@namepart@a} |
| 5281 |
% Now peek ahead at the next token in the stream and call |
| 5282 |
% \cs{get@namepart@b} to examine it. |
| 5283 |
% \begin{macrocode} |
| 5284 |
\def\get@namepart@a{% |
| 5285 |
\futurelet\@let@token |
| 5286 |
\get@namepart@b |
| 5287 |
} |
| 5288 |
% \end{macrocode} |
| 5289 |
% \end{macro} |
| 5290 |
% |
| 5291 |
% \begin{macro}{\get@namepart@b} |
| 5292 |
% If the next token is a space token, we want to delete it. |
| 5293 |
% Otherwise we're ready to read the name. |
| 5294 |
% \begin{macrocode} |
| 5295 |
\def\get@namepart@b{% |
| 5296 |
\ifx\@let@token\@sptoken |
| 5297 |
\@xp\get@namepart@c |
| 5298 |
\else |
| 5299 |
\@xp\get@namepart@d |
| 5300 |
\fi |
| 5301 |
} |
| 5302 |
% \end{macrocode} |
| 5303 |
% \end{macro} |
| 5304 |
% |
| 5305 |
% \begin{macro}{\get@namepart@c} |
| 5306 |
% The next token is a space; we delete it and restart |
| 5307 |
% \cs{get@namepart@a}, in case there are multiple spaces. |
| 5308 |
% \begin{macrocode} |
| 5309 |
\def\get@namepart@c{% |
| 5310 |
\after@deleting@token\get@namepart@a |
| 5311 |
} |
| 5312 |
% \end{macrocode} |
| 5313 |
% \end{macro} |
| 5314 |
% |
| 5315 |
% \begin{macro}{\get@namepart@d} |
| 5316 |
% We're at the beginning of the name part. However, there are |
| 5317 |
% still two special cases we have to watch out for. First, the |
| 5318 |
% next token might be a comma, meaning that this name part is |
| 5319 |
% empty. Second, the next token might be an open brace (\verb+{+), |
| 5320 |
% which we have to be sure to copy into the destination. So, we |
| 5321 |
% peek ahead again before proceeding. |
| 5322 |
% \begin{macrocode} |
| 5323 |
\def\get@namepart@d{% |
| 5324 |
\futurelet\@let@token |
| 5325 |
\get@namepart@e |
| 5326 |
} |
| 5327 |
% \end{macrocode} |
| 5328 |
% \end{macro} |
| 5329 |
% |
| 5330 |
% \begin{macro}{\get@namepart@e} |
| 5331 |
% If the next token is a comma, it means the name part is empty; |
| 5332 |
% so, we set the destination to an empty list and then arrange to |
| 5333 |
% execute the continuation after deleting the comma. Otherwise we |
| 5334 |
% call \cs{get@namepart@f} to read a non-empty name, leaving |
| 5335 |
% \cs{@let@token} undisturbed so that \cs{get@namepart@f} knows |
| 5336 |
% what's coming up. |
| 5337 |
% \begin{macrocode} |
| 5338 |
\def\get@namepart@e{% |
| 5339 |
\ifx\@let@token,% |
| 5340 |
\@xp\let\the\toks@\@empty |
| 5341 |
\edef\@tempa{% |
| 5342 |
\@nx\after@deleting@token\the\@temptokena |
| 5343 |
}% |
| 5344 |
\@xp\@tempa |
| 5345 |
\else |
| 5346 |
\@xp\get@namepart@f |
| 5347 |
\fi |
| 5348 |
} |
| 5349 |
% \end{macrocode} |
| 5350 |
% \end{macro} |
| 5351 |
% |
| 5352 |
% \begin{macro}{\get@namepart@f} |
| 5353 |
% We know whether or not the name begins with a brace, but we don't |
| 5354 |
% know if the corresponding group contains the entire name or only |
| 5355 |
% part of it. By reading the name as two arguments, we can handle |
| 5356 |
% all cases correctly.\footnote{More or less. If the second |
| 5357 |
% argument is brace-delimited, the braces will be lost. But as |
| 5358 |
% mentioned above (page~\pageref{brace-preservation}), we don't |
| 5359 |
% really care.} |
| 5360 |
% |
| 5361 |
% Note that the arguments are not expanded. |
| 5362 |
% \begin{macrocode} |
| 5363 |
\def\get@namepart@f#1#2,{% |
| 5364 |
\ifx\@let@token\bgroup |
| 5365 |
\@xp\def\the\toks@{{#1}#2}% |
| 5366 |
\else |
| 5367 |
\@xp\def\the\toks@{#1#2}% |
| 5368 |
\fi |
| 5369 |
\the\@temptokena |
| 5370 |
} |
| 5371 |
% \end{macrocode} |
| 5372 |
% \end{macro} |
| 5373 |
% |
| 5374 |
% \begin{macro}{\EmptyNameWarning} |
| 5375 |
% Or translator or contributor or\ldots |
| 5376 |
% \begin{macrocode} |
| 5377 |
\def\EmptyNameWarning{\amsrefs@warning{Empty contributor name}} |
| 5378 |
% \end{macrocode} |
| 5379 |
% \end{macro} |
| 5380 |
% |
| 5381 |
% \subsection{Extracting initials} |
| 5382 |
% |
| 5383 |
% Extracting initials from the author's given name is tricky |
| 5384 |
% because of the numerous special cases that need to be |
| 5385 |
% handled. Consider the following examples, some of which are |
| 5386 |
% admittedly contrived: |
| 5387 |
% \begin{quote} |
| 5388 |
% \initialtest{Arvind} |
| 5389 |
% \initialtest{Bing, R H} |
| 5390 |
% \initialtest{Harish, \'Etienne} |
| 5391 |
% \initialtest{Harish, \'E.} |
| 5392 |
% \initialtest{Harish, \'{E}.} |
| 5393 |
% \initialtest{Harish, {\'E}.} |
| 5394 |
% \initialtest{Harish, \'E} |
| 5395 |
% \initialtest{Harish, \'Etienne-P\^{\i}erre} |
| 5396 |
% \initialtest{Jones, David} |
| 5397 |
% \initialtest{Jones, David-Michael} |
| 5398 |
% \initialtest{Katzenbach, Nicholas {deB}elleville} |
| 5399 |
% \initialtest{Katzenbach, Nicholas deB.} |
| 5400 |
% \initialtest{Matiyasevich, {Yu}ri} |
| 5401 |
% \initialtest{Matiyasevich, {Yu}} |
| 5402 |
% \initialtest{Matiyasevich, Yu.} |
| 5403 |
% \end{quote} |
| 5404 |
% When processing initials, we loosen our strictures on spaces |
| 5405 |
% inside the given name by not requiring spaces after periods and |
| 5406 |
% tolerating them around hyphens and after the name: |
| 5407 |
% \begin{quote} |
| 5408 |
% \initialtest{Jones, D.M.} |
| 5409 |
% \initialtest{Jones, David - Michael} |
| 5410 |
% \initialtest{Jones, David , Jr.} |
| 5411 |
% \end{quote} |
| 5412 |
% (Strictly speaking, only the support for the first of these |
| 5413 |
% examples was a deliberate design decision; the other two are |
| 5414 |
% side-effects of the implementation. In any case, toleration of |
| 5415 |
% these quirks is in no way an endorsement of them, especially |
| 5416 |
% since they may make it more difficult for third-party software to |
| 5417 |
% correctly process bibliography entries.) |
| 5418 |
% |
| 5419 |
%^^A We also make one additional assumption: a hyphen does not occur |
| 5420 |
%^^A as the last character in the name. |
| 5421 |
% |
| 5422 |
% \subsubsection{The algorithm} |
| 5423 |
% |
| 5424 |
% As a running example, consider the following contrived input: |
| 5425 |
% \begin{quote} |
| 5426 |
% {\tt \verb+\'E.-P\^{\i}erre J.K. M+} |
| 5427 |
% \end{quote} |
| 5428 |
% which we want to turn into {\makeatletter``{\'E}.~\ini@hyphen |
| 5429 |
% P.~J.~K.~M''}. |
| 5430 |
% |
| 5431 |
% We precede by stages. |
| 5432 |
% \begin{enumerate} |
| 5433 |
% |
| 5434 |
% \item |
| 5435 |
% Normalize the name by surrounding accents and their arguments by |
| 5436 |
% braces: |
| 5437 |
% \begin{quote} |
| 5438 |
% \verb+{\'E}.-P{\^\i }erre J.K. M+ |
| 5439 |
% \end{quote} |
| 5440 |
% We also replace \verb+~+s by spaces at this stage. |
| 5441 |
% |
| 5442 |
% \item |
| 5443 |
% Replace each hyphen (\verb+-+) by ``\verb*+ \ini@hyphen +'': |
| 5444 |
% \begin{quote} |
| 5445 |
% \verb+{\'E}. \ini@hyphen P{\^\i }erre J.K. M+ |
| 5446 |
% \end{quote} |
| 5447 |
% |
| 5448 |
% \item |
| 5449 |
% Add a space after each period: |
| 5450 |
% \begin{quote} |
| 5451 |
% \verb+{\'E}. \ini@hyphen P{\^\i }erre J. K. M+ |
| 5452 |
% \end{quote} |
| 5453 |
% |
| 5454 |
% \item |
| 5455 |
% Now we have the name as a list of space-separated components. |
| 5456 |
% (In our example, the components are ``\verb+{\'E}.+'', |
| 5457 |
% ``\verb+\ini@hyphen+'', ``\verb+P{\^\i }erre+'', ``\verb+J.+'', |
| 5458 |
% ``\verb+K.+'', and ``\verb+M+''.) We loop through the compoments |
| 5459 |
% and replace each one by its ``initialized'' form. There are |
| 5460 |
% four cases:\label{initial_cases} |
| 5461 |
% \begin{enumerate} |
| 5462 |
% |
| 5463 |
% \item |
| 5464 |
% The component ends in a period. Copy it and add the token |
| 5465 |
% \verb+~+. (In our example, these are the |
| 5466 |
% components ``\verb+{\'E}.+'', ``\verb+J.+'' and ``\verb+K.+''.) |
| 5467 |
% |
| 5468 |
% \item |
| 5469 |
% The component consists of a single (possibly compound) character |
| 5470 |
% without a period. Again, copy it and add |
| 5471 |
% \verb+~+. (In our example, this is the component |
| 5472 |
% ``\verb+M+''.) |
| 5473 |
% |
| 5474 |
% \item |
| 5475 |
% The component is the token \verb+\ini@hyphen+. Copy it. |
| 5476 |
% |
| 5477 |
% \item |
| 5478 |
% The component consts of two or more (possibly compound) |
| 5479 |
% characters without a period (e.g., ``\verb+P{\^\i }erre+''). |
| 5480 |
% Copy the first character and add the tokens \verb+.~+. |
| 5481 |
% \end{enumerate} |
| 5482 |
% |
| 5483 |
% \item |
| 5484 |
% The token list generated above will end with an unwanted |~|. |
| 5485 |
% Delete it. |
| 5486 |
% |
| 5487 |
% \end{enumerate} |
| 5488 |
% |
| 5489 |
% The end result is |
| 5490 |
% \begin{verbatim} |
| 5491 |
% {\'E}.~\ini@hyphen P.~J.~K.~M |
| 5492 |
%\end{verbatim} |
| 5493 |
% which, when typeset, does indeed produce |
| 5494 |
% {\makeatletter''{\'E}.~\ini@hyphen P.~J.~K.~M''}.\footnote{Tying |
| 5495 |
% all the characters together is potentially undesirable when, as |
| 5496 |
% in the example, there are a large number of pieces in the given |
| 5497 |
% name.} |
| 5498 |
% |
| 5499 |
% \subsubsection{The implementation} |
| 5500 |
% |
| 5501 |
% \begin{macro}{\extract@initials} |
| 5502 |
% This is pretty straightforward. |
| 5503 |
% \begin{macrocode} |
| 5504 |
\def\extract@initials#1{% |
| 5505 |
\begingroup |
| 5506 |
\auto@protect\ini@hyphen |
| 5507 |
\auto@protect\nobreakspace |
| 5508 |
\let~\relax |
| 5509 |
\@apply\auto@protect\amsrefs@textsymbols |
| 5510 |
\@apply\auto@protect\amsrefs@textaccents |
| 5511 |
\normalize@edef\@tempa{#1}% |
| 5512 |
\ifx\@tempa\@empty |
| 5513 |
\else |
| 5514 |
% \end{macrocode} |
| 5515 |
% It would be nice if \cs{process@hyphens} and \cs{process@dots} |
| 5516 |
% commuted, and they almost do. However, suppose you have the |
| 5517 |
% (admittedly contrived) name |Yu.-{Yu}|, which should be turned |
| 5518 |
% into ``Yu.-Yu''. If \cs{process@dots} is applied first, the |
| 5519 |
% braces around the second ``Yu'' get removed, so the output is |
| 5520 |
% ``Yu.-Y.''. (Even worse would be |P.-\'E|, which would produce |
| 5521 |
% ``P.-\'.'') |
| 5522 |
% \begin{macrocode} |
| 5523 |
\process@hyphens\@tempa |
| 5524 |
\process@dots\@tempa |
| 5525 |
\process@names\@tempa |
| 5526 |
\@chomp\@tempa{~}% |
| 5527 |
\fi |
| 5528 |
\edef\@tempa{\def\@nx\bib'initials{\@tempa}}% |
| 5529 |
\@xp\endgroup |
| 5530 |
\@tempa |
| 5531 |
} |
| 5532 |
% \end{macrocode} |
| 5533 |
% \end{macro} |
| 5534 |
% |
| 5535 |
% \begin{macro}{\ini@hyphen} |
| 5536 |
% The \cs{unskip} removes the space at the end of a potential (and |
| 5537 |
% probable) preceding |~|, but leaves the \cs{nobreak} penalty. |
| 5538 |
% \begin{macrocode} |
| 5539 |
\def\ini@hyphen{\unskip-\nobreak} |
| 5540 |
% \end{macrocode} |
| 5541 |
% \end{macro} |
| 5542 |
% |
| 5543 |
% \begin{macro}{\process@hyphens} |
| 5544 |
% This follows the same general pattern as \cs{get@namepart}, but |
| 5545 |
% with an extra layer of grouping to avoid unwanted side-effects. |
| 5546 |
% Otherwise, it uses the same parsing techniques. |
| 5547 |
% |
| 5548 |
% One difference is that there is no explicit continuation: |
| 5549 |
% instead, we iterate by repeatedly calling |
| 5550 |
% \cs{process@one@hyphen@d} until we run into the \cs{@nil} |
| 5551 |
% marker. |
| 5552 |
% \begin{macrocode} |
| 5553 |
\def\process@hyphens#1{% |
| 5554 |
\begingroup |
| 5555 |
\toks@\@emptytoks |
| 5556 |
\@xp\process@one@hyphen #1-\@nil |
| 5557 |
\edef\@tempa{\the\toks@}% |
| 5558 |
% \end{macrocode} |
| 5559 |
% Because of the |-| we have to stick in as a delimiter above, |
| 5560 |
% \cs{process@one@hyphen} will always generate unwanted code at the |
| 5561 |
% end of the name. We now delete it. (This also has the necessary |
| 5562 |
% side-effect of expanding the \cs{space} macros into space |
| 5563 |
% characters.) |
| 5564 |
% \begin{macrocode} |
| 5565 |
\@chomp\@tempa{ \ini@hyphen\space}% |
| 5566 |
\edef\@tempa{\def\@nx#1{\@tempa}}% |
| 5567 |
\@xp\endgroup |
| 5568 |
\@tempa |
| 5569 |
} |
| 5570 |
% \end{macrocode} |
| 5571 |
% \end{macro} |
| 5572 |
% |
| 5573 |
% \begin{macro}{\process@one@hyphen} |
| 5574 |
% Cf.\ \cs{get@namepart@a}. |
| 5575 |
% \begin{macrocode} |
| 5576 |
\def\process@one@hyphen{% |
| 5577 |
\futurelet\@let@token |
| 5578 |
\process@one@hyphen@a |
| 5579 |
} |
| 5580 |
% \end{macrocode} |
| 5581 |
% \end{macro} |
| 5582 |
% |
| 5583 |
% \begin{macro}{\process@one@hyphen@a} |
| 5584 |
% Cf.\ \cs{get@namepart@b} and \cs{extract@initial@a}. |
| 5585 |
% |
| 5586 |
% The tests for \cs{@nil} and~|-| here are purely to supply better |
| 5587 |
% error recovery. Without them, a hyphen at the end of the given |
| 5588 |
% name (.e.g, |author={Doe, John-}|) would produce a very |
| 5589 |
% mysterious error message. Since it's unlikely the hyphen really |
| 5590 |
% belongs there, we delete it, but we also issue a warning to the |
| 5591 |
% author. (It will still show up as part of the full given name, |
| 5592 |
% though.) |
| 5593 |
% |
| 5594 |
% We borrow \cs{fsa@n} from \pkg{rkeyval} to keep track of the |
| 5595 |
% appropriate next action. |
| 5596 |
% \begin{macrocode} |
| 5597 |
\def\process@one@hyphen@a{% |
| 5598 |
\ifx\@let@token\@nil |
| 5599 |
\let\fsa@n\@gobble |
| 5600 |
\else |
| 5601 |
\ifx\@let@token -% |
| 5602 |
\TrailingHyphenWarning |
| 5603 |
\let\fsa@n\process@one@hyphen@b |
| 5604 |
\else |
| 5605 |
\ifx\@let@token\@sptoken |
| 5606 |
\let\fsa@n\process@one@hyphen@b |
| 5607 |
\else |
| 5608 |
\let\fsa@n\process@one@hyphen@c |
| 5609 |
\fi |
| 5610 |
\fi |
| 5611 |
\fi |
| 5612 |
\fsa@n |
| 5613 |
} |
| 5614 |
% \end{macrocode} |
| 5615 |
% \end{macro} |
| 5616 |
% |
| 5617 |
% \begin{macro}{\process@one@hyphen@b} |
| 5618 |
% Cf.\ \cs{get@namepart@c}. |
| 5619 |
% \begin{macrocode} |
| 5620 |
\def\process@one@hyphen@b{% |
| 5621 |
\after@deleting@token\process@one@hyphen |
| 5622 |
} |
| 5623 |
% \end{macrocode} |
| 5624 |
% \end{macro} |
| 5625 |
% |
| 5626 |
% \begin{macro}{\process@one@hyphen@c} |
| 5627 |
% Cf.\ \cs{get@namepart@f}. |
| 5628 |
% \begin{macrocode} |
| 5629 |
\def\process@one@hyphen@c#1#2-{% |
| 5630 |
\ifx\bgroup\@let@token |
| 5631 |
\add@toks@{{#1}#2 \ini@hyphen\space}% |
| 5632 |
\else |
| 5633 |
\add@toks@{#1#2 \ini@hyphen\space}% |
| 5634 |
\fi |
| 5635 |
\futurelet\@let@token |
| 5636 |
\process@one@hyphen@d |
| 5637 |
} |
| 5638 |
% \end{macrocode} |
| 5639 |
% \end{macro} |
| 5640 |
% |
| 5641 |
% \begin{macro}{\process@one@hyphen@d} |
| 5642 |
% Here we just check for \cs{@nil} and terminate if we detect it. |
| 5643 |
% Otherwise, we start over. |
| 5644 |
% \begin{macrocode} |
| 5645 |
\def\process@one@hyphen@d{% |
| 5646 |
\ifx\@let@token\@nil |
| 5647 |
\@xp\@gobble |
| 5648 |
\else |
| 5649 |
\@xp\process@one@hyphen |
| 5650 |
\fi |
| 5651 |
} |
| 5652 |
% \end{macrocode} |
| 5653 |
% \end{macro} |
| 5654 |
% |
| 5655 |
% \begin{macro}{\TrailingHyphenWarning} |
| 5656 |
% Or translator or contributor or\ldots |
| 5657 |
% \begin{macrocode} |
| 5658 |
\def\TrailingHyphenWarning{% |
| 5659 |
\amsrefs@warning{Trailing hyphen deleted from name}% |
| 5660 |
} |
| 5661 |
% \end{macrocode} |
| 5662 |
% \end{macro} |
| 5663 |
% |
| 5664 |
% \begin{macro}{\process@dots} |
| 5665 |
% This is almost completely parallel to \cs{process@hyphens}. |
| 5666 |
% \begin{macrocode} |
| 5667 |
\def\process@dots#1{% |
| 5668 |
\begingroup |
| 5669 |
\toks@\@emptytoks |
| 5670 |
\@xp\process@one@dot #1.\@nil |
| 5671 |
\edef\@tempa{\the\toks@}% |
| 5672 |
\@chomp\@tempa{. }% |
| 5673 |
% \end{macrocode} |
| 5674 |
% Since it's legitimate for names to end in periods, we might |
| 5675 |
% still have an unwanted space at the end of the name, so we delete |
| 5676 |
% it too. |
| 5677 |
% \begin{macrocode} |
| 5678 |
\@chomp\@tempa{ }% |
| 5679 |
\edef\@tempa{\def\@nx#1{\@tempa}}% |
| 5680 |
\@xp\endgroup |
| 5681 |
\@tempa |
| 5682 |
} |
| 5683 |
% \end{macrocode} |
| 5684 |
% \end{macro} |
| 5685 |
% |
| 5686 |
% \begin{macro}{\process@one@dot} |
| 5687 |
% \begin{macrocode} |
| 5688 |
\def\process@one@dot{% |
| 5689 |
\futurelet\@let@token |
| 5690 |
\process@one@dot@a |
| 5691 |
} |
| 5692 |
% \end{macrocode} |
| 5693 |
% \end{macro} |
| 5694 |
% |
| 5695 |
% \begin{macro}{\process@one@dot@a} |
| 5696 |
% This is a bit different from \cs{process@one@hyphen@a} since we |
| 5697 |
% expect names sometimes to end in a period---or even two |
| 5698 |
% periods---not least because of the |.| we add as a delimiter when |
| 5699 |
% invoking \cs{process@one@dot}. |
| 5700 |
% \begin{macrocode} |
| 5701 |
\def\process@one@dot@a{% |
| 5702 |
\ifx\@let@token .% |
| 5703 |
\def\fsa@n{\after@deleting@token\process@bare@dot}% |
| 5704 |
\else |
| 5705 |
\ifx\@let@token\@sptoken |
| 5706 |
\let\fsa@n\process@one@dot@b |
| 5707 |
\else |
| 5708 |
\let\fsa@n\process@one@dot@c |
| 5709 |
\fi |
| 5710 |
\fi |
| 5711 |
\fsa@n |
| 5712 |
} |
| 5713 |
% \end{macrocode} |
| 5714 |
% \end{macro} |
| 5715 |
% |
| 5716 |
% \begin{macro}{\process@bare@dot} |
| 5717 |
% \begin{macrocode} |
| 5718 |
\def\process@bare@dot{% |
| 5719 |
\add@toks@{. }% |
| 5720 |
\futurelet\@let@token |
| 5721 |
\process@one@dot@d |
| 5722 |
} |
| 5723 |
% \end{macrocode} |
| 5724 |
% \end{macro} |
| 5725 |
% |
| 5726 |
% \begin{macro}{\process@one@dot@b} |
| 5727 |
% \begin{macrocode} |
| 5728 |
\def\process@one@dot@b{% |
| 5729 |
\after@deleting@token\process@one@dot |
| 5730 |
} |
| 5731 |
% \end{macrocode} |
| 5732 |
% \end{macro} |
| 5733 |
% |
| 5734 |
% \begin{macro}{\process@one@dot@c} |
| 5735 |
% \begin{macrocode} |
| 5736 |
\def\process@one@dot@c#1#2.{% |
| 5737 |
\ifx\bgroup\@let@token |
| 5738 |
\add@toks@{{#1}#2. }% |
| 5739 |
\else |
| 5740 |
\add@toks@{#1#2. }% |
| 5741 |
\fi |
| 5742 |
\futurelet\@let@token |
| 5743 |
\process@one@dot@d |
| 5744 |
} |
| 5745 |
% \end{macrocode} |
| 5746 |
% \end{macro} |
| 5747 |
% |
| 5748 |
% \begin{macro}{\process@one@dot@d} |
| 5749 |
% \begin{macrocode} |
| 5750 |
\def\process@one@dot@d{% |
| 5751 |
\ifx\@let@token\@nil |
| 5752 |
\@xp\@gobble |
| 5753 |
\else |
| 5754 |
\@xp\process@one@dot |
| 5755 |
\fi |
| 5756 |
} |
| 5757 |
% \end{macrocode} |
| 5758 |
% \end{macro} |
| 5759 |
% |
| 5760 |
% \begin{macro}{\process@names} |
| 5761 |
% This is very similar to \cs{process@hyphens} and |
| 5762 |
% \cs{process@dots}, but with a couple of twists, as noted below. |
| 5763 |
% \begin{macrocode} |
| 5764 |
\def\process@names#1{% |
| 5765 |
\begingroup |
| 5766 |
\toks@\@emptytoks |
| 5767 |
\@xp\extract@initial #1 \@nil |
| 5768 |
\edef\@tempa{\def\@nx#1{\the\toks@}}% |
| 5769 |
\@xp\endgroup |
| 5770 |
\@tempa |
| 5771 |
} |
| 5772 |
% \end{macrocode} |
| 5773 |
% \end{macro} |
| 5774 |
% |
| 5775 |
% \begin{macro}{\extract@initial} |
| 5776 |
% Scan through the token stream replacing words by their initials |
| 5777 |
% until we hit the terminating~|'|$_{11}$ |
| 5778 |
% \begin{macrocode} |
| 5779 |
\def\extract@initial{% |
| 5780 |
\futurelet\@let@token |
| 5781 |
\extract@initial@a |
| 5782 |
} |
| 5783 |
% \end{macrocode} |
| 5784 |
% \end{macro} |
| 5785 |
% |
| 5786 |
% \begin{macro}{\extract@initial@a} |
| 5787 |
% As with \cs{process@one@hyphen@a}, the test for |'|$_{11}$ here |
| 5788 |
% is purely to provide better recovery, this time in case the given |
| 5789 |
% name has a trailing space (.e.g, |author={Doe, John }|). |
| 5790 |
% But since we're just deleting whitespace, we don't bother issuing |
| 5791 |
% a warning. |
| 5792 |
% \begin{macrocode} |
| 5793 |
\def\extract@initial@a{% |
| 5794 |
\ifx\@let@token\@nil |
| 5795 |
\let\fsa@n\@gobble |
| 5796 |
\else |
| 5797 |
\ifx\@let@token\@sptoken |
| 5798 |
\let\fsa@n\extract@initial@b |
| 5799 |
\else |
| 5800 |
\let\fsa@n\extract@initial@c |
| 5801 |
\fi |
| 5802 |
\fi |
| 5803 |
\fsa@n |
| 5804 |
} |
| 5805 |
% \end{macrocode} |
| 5806 |
% \end{macro} |
| 5807 |
% |
| 5808 |
% \begin{macro}{\extract@initial@b} |
| 5809 |
% \begin{macrocode} |
| 5810 |
\def\extract@initial@b{% |
| 5811 |
\after@deleting@token\extract@initial |
| 5812 |
} |
| 5813 |
% \end{macrocode} |
| 5814 |
% \end{macro} |
| 5815 |
% |
| 5816 |
% \begin{macro}{\extract@initial@c} |
| 5817 |
% Here, instead of just copying the name, we extract its initials |
| 5818 |
% and copy those. |
| 5819 |
% \begin{macrocode} |
| 5820 |
\def\extract@initial@c#1#2 {% |
| 5821 |
\ifx\@let@token\bgroup |
| 5822 |
% \end{macrocode} |
| 5823 |
% Note that we double-brace the first argument to avoid having to |
| 5824 |
% test \cs{@let@token} again inside \cs{@extract@initial}. |
| 5825 |
% \begin{macrocode} |
| 5826 |
\@extract@initial {{#1}}#2\@nil |
| 5827 |
\else |
| 5828 |
\@extract@initial #1#2\@nil |
| 5829 |
\fi |
| 5830 |
\futurelet\@let@token |
| 5831 |
\extract@initial@d |
| 5832 |
} |
| 5833 |
% \end{macrocode} |
| 5834 |
% \end{macro} |
| 5835 |
% |
| 5836 |
% \begin{macro}{\extract@initial@d} |
| 5837 |
% \begin{macrocode} |
| 5838 |
\def\extract@initial@d{% |
| 5839 |
\ifx\@let@token\@nil |
| 5840 |
\@xp\@gobble |
| 5841 |
\else |
| 5842 |
\@xp\extract@initial |
| 5843 |
\fi |
| 5844 |
} |
| 5845 |
% \end{macrocode} |
| 5846 |
% \end{macro} |
| 5847 |
% |
| 5848 |
% \begin{macro}{\@extract@initial} |
| 5849 |
% This handles the four cases mentioned on |
| 5850 |
% page~\pageref{initial_cases}. |
| 5851 |
% \begin{macrocode} |
| 5852 |
\def\@extract@initial#1#2\@nil{% |
| 5853 |
\ifx\ini@hyphen#1% |
| 5854 |
\add@toks@{\ini@hyphen}% |
| 5855 |
\else |
| 5856 |
\in@{.\@nil}{#1#2\@nil}% Look for a period at the end of the name |
| 5857 |
\ifin@ |
| 5858 |
\add@toks@{#1#2~}% |
| 5859 |
\else |
| 5860 |
\count@chars\@tempcnta{#1#2}% |
| 5861 |
\ifnum\@tempcnta > \@ne |
| 5862 |
\add@toks@{#1.~}% |
| 5863 |
\else |
| 5864 |
\add@toks@{#1~}% |
| 5865 |
\fi |
| 5866 |
\fi |
| 5867 |
\fi |
| 5868 |
} |
| 5869 |
% \end{macrocode} |
| 5870 |
% \end{macro} |
| 5871 |
% |
| 5872 |
% \begin{macro}{\count@chars} |
| 5873 |
% This sets its first argument (which is assumed to be a count |
| 5874 |
% register) to the number of characters in the second argument. |
| 5875 |
% Compound characters are counted as a single character. |
| 5876 |
% \begin{macrocode} |
| 5877 |
\def\count@chars#1#2{% |
| 5878 |
\begingroup |
| 5879 |
\@tempcnta\z@ |
| 5880 |
\@count@chars#2\@nil |
| 5881 |
\edef\@tempb{#1=\the\@tempcnta\relax}% |
| 5882 |
\@xp\endgroup |
| 5883 |
\@tempb |
| 5884 |
} |
| 5885 |
% \end{macrocode} |
| 5886 |
% \end{macro} |
| 5887 |
% |
| 5888 |
% \begin{macro}{\@count@chars} |
| 5889 |
% \begin{macrocode} |
| 5890 |
\def\@count@chars#1{% |
| 5891 |
\ifx #1\@nil |
| 5892 |
\else |
| 5893 |
\advance\@tempcnta\@ne |
| 5894 |
\@xp\@count@chars |
| 5895 |
\fi |
| 5896 |
} |
| 5897 |
% \end{macrocode} |
| 5898 |
% \end{macro} |
| 5899 |
% |
| 5900 |
% \subsection{Generating alphabetic labels} |
| 5901 |
% |
| 5902 |
% \subsubsection{The algorithm} |
| 5903 |
% |
| 5904 |
% Like Gaul, an alphabetic label is divided into three parts. |
| 5905 |
% \begin{enumerate} |
| 5906 |
% |
| 5907 |
% \item The author part. In the simplest case, this is formed by |
| 5908 |
% extracting the first character of each word of each last name of |
| 5909 |
% each author. Thus, if there were two authors with last names |
| 5910 |
% ``Vaughan Williams'' and ``Tallis'', the author part would be |
| 5911 |
% ``VWT''. |
| 5912 |
% |
| 5913 |
% If there are more than four authors, only the first three names |
| 5914 |
% are used, and a superscript~``+'' is appended to represent the |
| 5915 |
% elided names. Similarly, if an author name is ``others'', |
| 5916 |
% it is replaced by a superscript~``+'' and any following author |
| 5917 |
% names (of which there shouldn't be any) are ignored. |
| 5918 |
% |
| 5919 |
% Finally, if there is only one author and the author's last name |
| 5920 |
% consists of a single word, the first three characters of that |
| 5921 |
% name are used. |
| 5922 |
% |
| 5923 |
% \item The year part. If the \opt{y2k} option is in force, or if |
| 5924 |
% the year is less than~1901, the entire year is used. Otherwise |
| 5925 |
% the last two digits of the year are used.\footnote{Years with |
| 5926 |
% more than 4 digits are not currently handled correctly. |
| 5927 |
% \emph{Caveat lector}.} |
| 5928 |
% |
| 5929 |
% The combination of author part and year part will be referred to |
| 5930 |
% as the \emph{stem}. |
| 5931 |
% |
| 5932 |
% \item[3.] The suffix. If two or more items have the same stems, |
| 5933 |
% a suffix consisting of a lowercase latin letter will be appended |
| 5934 |
% to each label to make it unique. |
| 5935 |
% |
| 5936 |
% \end{enumerate} |
| 5937 |
% |
| 5938 |
% \label{stem-comparison} |
| 5939 |
% This third part is more subtle than it might first appear. |
| 5940 |
% First, case is ignored when comparing stems, so that, for |
| 5941 |
% example, ``Ahl1999'' and ``AHL1999'' are considered identical. |
| 5942 |
% Second, existing practice (in English, at least), is to ignore |
| 5943 |
% diacritics so that, for example, ``Ahl1999'' and ``\"Ahl1999'' |
| 5944 |
% are considered identical. |
| 5945 |
% |
| 5946 |
% Note that when checking for duplicate stems, we assume that |
| 5947 |
% bibliography items appear sorted by label, which means that all |
| 5948 |
% items with the same stem will be adjacent. This means we can use |
| 5949 |
% the naive algorithm (check to see if the current item has the |
| 5950 |
% same stem as the previous item and, if so, append a suffix) to |
| 5951 |
% detect clashes. This sorting will be done automatically by |
| 5952 |
% \bst{amsxport}, but the document author is responsible for |
| 5953 |
% ensuring the appropriate order if \bst{amsxport} is not used. |
| 5954 |
% This is why it's an error to mix the \opt{alphabetic} and |
| 5955 |
% \opt{citation-order} options. |
| 5956 |
% |
| 5957 |
% \subsubsection{The implementation} |
| 5958 |
% |
| 5959 |
% \begin{macrocode} |
| 5960 |
\let\previous@stem\@empty |
| 5961 |
\let\current@stem\@empty |
| 5962 |
% \end{macrocode} |
| 5963 |
% |
| 5964 |
% \begin{macrocode} |
| 5965 |
\let\previous@year\@empty |
| 5966 |
\let\current@year\@empty |
| 5967 |
% \end{macrocode} |
| 5968 |
% |
| 5969 |
% \begin{macro}{\amsrefs@label@prefix} |
| 5970 |
% \begin{macrocode} |
| 5971 |
\let\amsrefs@label@prefix\@empty |
| 5972 |
% \end{macrocode} |
| 5973 |
% \end{macro} |
| 5974 |
% |
| 5975 |
% \begin{macro}{\thebib} |
| 5976 |
% \begin{macrocode} |
| 5977 |
\def\thebib{\amsrefs@label@prefix\@arabic\c@bib} |
| 5978 |
% \end{macrocode} |
| 5979 |
% \end{macro} |
| 5980 |
% |
| 5981 |
% \begin{macro}{\append@to@stem} |
| 5982 |
% \begin{macrocode} |
| 5983 |
\def\append@to@stem{\global\@concat\current@stem} |
| 5984 |
% \end{macrocode} |
| 5985 |
% \end{macro} |
| 5986 |
% |
| 5987 |
% \begin{macro}{\generate@alphalabel} |
| 5988 |
% \begin{macrocode} |
| 5989 |
\def\generate@alphalabel{% |
| 5990 |
% \end{macrocode} |
| 5991 |
% If the user supplied an explicit \fld{label} field, we use it. |
| 5992 |
% Otherwise, we generate our own. |
| 5993 |
% \begin{macrocode} |
| 5994 |
\ifx\bib'label\@empty |
| 5995 |
\begingroup |
| 5996 |
% \end{macrocode} |
| 5997 |
% We begin by saving the previous stem and initializing the |
| 5998 |
% current stem to the empty string. |
| 5999 |
% \begin{macrocode} |
| 6000 |
\global\let\previous@stem\current@stem |
| 6001 |
\global\let\current@stem\amsrefs@label@prefix |
| 6002 |
% \end{macrocode} |
| 6003 |
% The list of primary contributors is available to us in |
| 6004 |
% \cs{current@primary} in the form |
| 6005 |
% \begin{quote} |
| 6006 |
% \cnm{name}{$\mathrm{Last}_1, \mathrm{First}_1$}% |
| 6007 |
% \cnm{name}{$\mathrm{Last}_2, \mathrm{First}_2$} |
| 6008 |
% \ldots |
| 6009 |
% \cnm{name}{$\mathrm{Last}_n, \mathrm{First}_n$} |
| 6010 |
% \end{quote} |
| 6011 |
% We will be executing this list multiple times with various |
| 6012 |
% definitions of \cs{name}. So the first thing we want to do is |
| 6013 |
% establish a safe environment and normalize the names. |
| 6014 |
% \begin{macrocode} |
| 6015 |
\@apply\auto@protect\amsrefs@textsymbols |
| 6016 |
\@apply\auto@protect\amsrefs@textaccents |
| 6017 |
\auto@protect\name |
| 6018 |
\auto@protect\etaltext |
| 6019 |
\normalize@edef\@tempa\current@primary |
| 6020 |
% \end{macrocode} |
| 6021 |
% Now we count the number of authors in the list and invoke the |
| 6022 |
% appropriate macro to calculate the author part of the |
| 6023 |
% reference label. |
| 6024 |
% \begin{macrocode} |
| 6025 |
\get@numberof\@tempcnta\name\@tempa |
| 6026 |
\calc@author@part |
| 6027 |
% \end{macrocode} |
| 6028 |
% Next append the year part. |
| 6029 |
% \begin{macrocode} |
| 6030 |
\append@label@year |
| 6031 |
% \end{macrocode} |
| 6032 |
% At this point, the \cs{current@stem} is complete and we're ready |
| 6033 |
% to determine what (if any) suffix is needed to disambiguate |
| 6034 |
% it from the previous label. |
| 6035 |
% \begin{macrocode} |
| 6036 |
\calc@alpha@suffix |
| 6037 |
% \end{macrocode} |
| 6038 |
% We have all the pieces now. Arrange to end the current group and |
| 6039 |
% then define \cs{bib@label} in the enclosing group. (This keeps |
| 6040 |
% \cs{bib@label} from being defined outside the group started by |
| 6041 |
% \cs{bib@start}. This isn't strictly necessary, but it provides a |
| 6042 |
% bit of compartmentalization.) |
| 6043 |
% \begin{macrocode} |
| 6044 |
\edef\@tempa{% |
| 6045 |
\def\@nx\bib'label{% |
| 6046 |
\current@stem |
| 6047 |
\alpha@label@suffix |
| 6048 |
}% |
| 6049 |
}% |
| 6050 |
\@xp\endgroup |
| 6051 |
\@tempa |
| 6052 |
\fi |
| 6053 |
} |
| 6054 |
% \end{macrocode} |
| 6055 |
% \end{macro} |
| 6056 |
% |
| 6057 |
% \begin{macro}{\calc@author@part@} |
| 6058 |
% \begin{macrocode} |
| 6059 |
\def\calc@author@part@{% |
| 6060 |
\ifnum \@tempcnta = 1 |
| 6061 |
\@xp\@oneauthorlabel\@xp{\@tempa}% |
| 6062 |
\else |
| 6063 |
\@xp\@multiauthorlabel\@xp{\@tempa}% |
| 6064 |
\fi |
| 6065 |
} |
| 6066 |
% \end{macrocode} |
| 6067 |
% \end{macro} |
| 6068 |
% |
| 6069 |
% \begin{macro}{\calc@author@part@short} |
| 6070 |
% \begin{macrocode} |
| 6071 |
\def\calc@author@part@short{% |
| 6072 |
\@xp\@multiauthorlabel\@xp{\@tempa}% |
| 6073 |
}% |
| 6074 |
% \end{macrocode} |
| 6075 |
% \end{macro} |
| 6076 |
% |
| 6077 |
% \begin{macro}{\@firstone} |
| 6078 |
% This extracts the first character from a properly prepared author |
| 6079 |
% name (i.e., one in which accents are properly wrapped). |
| 6080 |
% \begin{macrocode} |
| 6081 |
\def\@firstone#1{\@car#1\@empty\@nil} |
| 6082 |
% \end{macrocode} |
| 6083 |
% \end{macro} |
| 6084 |
% |
| 6085 |
% \begin{macro}{\@firstthree} |
| 6086 |
% And this extracts the first three characters. |
| 6087 |
% \begin{macrocode} |
| 6088 |
\def\@firstthree#1{\@carcube#1\@empty\@empty\@empty\@nil} |
| 6089 |
% \end{macrocode} |
| 6090 |
% \end{macro} |
| 6091 |
% |
| 6092 |
% \begin{macro}{\@nametoken} |
| 6093 |
% \begin{macrocode} |
| 6094 |
\let\@nametoken\@firstone |
| 6095 |
% \end{macrocode} |
| 6096 |
% \end{macro} |
| 6097 |
% |
| 6098 |
% \begin{macro}{\hyph@to@space} |
| 6099 |
% \begin{macrocode} |
| 6100 |
\def\hyph@to@space#1-{#1 \hyph@to@space} |
| 6101 |
% \end{macrocode} |
| 6102 |
% \end{macro} |
| 6103 |
% |
| 6104 |
% \begin{macro}{\@marknames} |
| 6105 |
% Since we have a~' with funny catcode already, let's use it (being |
| 6106 |
% able to easily put a space after the |'| makes things easier). |
| 6107 |
% \begin{macrocode} |
| 6108 |
\def\@marknames#1{% |
| 6109 |
\@ifnotempty{#1}{\surround@names#1 ' }% |
| 6110 |
} |
| 6111 |
% \end{macrocode} |
| 6112 |
% \end{macro} |
| 6113 |
% |
| 6114 |
% \begin{macro}{\surround@names} |
| 6115 |
% \begin{macrocode} |
| 6116 |
\def\surround@names#1 {% |
| 6117 |
\ifx '#1% |
| 6118 |
\else |
| 6119 |
\@nx\@nametoken{#1}% |
| 6120 |
\@xp\surround@names |
| 6121 |
\fi |
| 6122 |
} |
| 6123 |
% \end{macrocode} |
| 6124 |
% \end{macro} |
| 6125 |
% |
| 6126 |
% \begin{macro}{\extract@surnames} |
| 6127 |
% \begin{macrocode} |
| 6128 |
\def\extract@surnames#1#2{% |
| 6129 |
\get@namepart\@tempb\@nilgobble #2,\@nil |
| 6130 |
\edef\@tempb{\@nx\@marknames{\@xp\hyph@to@space\@tempb\@gobble-}}% |
| 6131 |
\edef#1{\@tempb}% |
| 6132 |
} |
| 6133 |
% \end{macrocode} |
| 6134 |
% \end{macro} |
| 6135 |
% |
| 6136 |
% \begin{macro}{\@oneauthorlabel} |
| 6137 |
% This is the easy case. |
| 6138 |
% \begin{macrocode} |
| 6139 |
\newcommand{\@oneauthorlabel}[1]{% |
| 6140 |
\def\name##1{% |
| 6141 |
\extract@surnames\@tempa{##1}% |
| 6142 |
\get@numberof\@tempcnta\@nametoken\@tempa |
| 6143 |
\ifnum \@tempcnta = 1 |
| 6144 |
\let\@nametoken\@firstthree |
| 6145 |
\fi |
| 6146 |
\append@to@stem{\@tempa}% |
| 6147 |
}% |
| 6148 |
#1% |
| 6149 |
} |
| 6150 |
% \end{macrocode} |
| 6151 |
% \end{macro} |
| 6152 |
% |
| 6153 |
% \begin{macro}{\@threeauthors} |
| 6154 |
% \begin{macrocode} |
| 6155 |
\def\@threeauthors\name#1\name#2\name#3#4\@empty{% |
| 6156 |
\name{#1}\name{#2}\name{#3}% |
| 6157 |
\append@to@stem{\etalchar{+}}% |
| 6158 |
} |
| 6159 |
% \end{macrocode} |
| 6160 |
% \end{macro} |
| 6161 |
% |
| 6162 |
% \begin{macro}{\@multiauthorlabel} |
| 6163 |
% \begin{macrocode} |
| 6164 |
\newcommand{\@multiauthorlabel}[1]{% |
| 6165 |
\def\name##1{% |
| 6166 |
\ifx\etaltext ##1% |
| 6167 |
\def\@tempa{\@nx\etalchar{+}}% |
| 6168 |
\let\name\@gobble |
| 6169 |
\else |
| 6170 |
\extract@surnames\@tempa{##1}% |
| 6171 |
\fi |
| 6172 |
\append@to@stem{\@tempa}% |
| 6173 |
}% |
| 6174 |
\ifnum \@tempcnta > 4 \@xp \@threeauthors \fi |
| 6175 |
#1\@empty |
| 6176 |
} |
| 6177 |
% \end{macrocode} |
| 6178 |
% \end{macro} |
| 6179 |
% |
| 6180 |
% \begin{macro}{\etalchar} |
| 6181 |
% \begin{macrocode} |
| 6182 |
\newcommand{\etalchar}[1]{$^{#1}$} |
| 6183 |
% \end{macrocode} |
| 6184 |
% \end{macro} |
| 6185 |
% |
| 6186 |
% \begin{macro}{\year@short} |
| 6187 |
% For alphanumeric labels, we want to extract the last 2 digits of |
| 6188 |
% the year. Here's a way to do that, assuming a 4-digit year. |
| 6189 |
% \begin{macrocode} |
| 6190 |
\def\year@short#1#2#3#4\@nil{#3#4} |
| 6191 |
% \end{macrocode} |
| 6192 |
% \end{macro} |
| 6193 |
% |
| 6194 |
% \begin{macro}{\append@label@year@} |
| 6195 |
% \begin{macrocode} |
| 6196 |
\def\append@label@year@{% |
| 6197 |
\safe@set\@tempcnta\bib@year |
| 6198 |
\edef\bib@citeyear{\the\@tempcnta}% |
| 6199 |
\append@to@stem{% |
| 6200 |
\ifx\bib@year\@empty |
| 6201 |
\else |
| 6202 |
\@xp\year@short \bib@citeyear \@nil |
| 6203 |
\fi |
| 6204 |
}% |
| 6205 |
} |
| 6206 |
% \end{macrocode} |
| 6207 |
% \end{macro} |
| 6208 |
% |
| 6209 |
% \begin{macrocode} |
| 6210 |
\let\alpha@label@suffix\@empty |
| 6211 |
|
| 6212 |
\newcount\alpha@suffix |
| 6213 |
\alpha@suffix\@ne |
| 6214 |
\let\@suffix@format\@alph |
| 6215 |
% \end{macrocode} |
| 6216 |
% |
| 6217 |
% \begin{macro}{\calc@alpha@suffix} |
| 6218 |
% \begin{macrocode} |
| 6219 |
\def\calc@alpha@suffix{% |
| 6220 |
\@tempswafalse |
| 6221 |
\compare@stems\previous@stem\current@stem |
| 6222 |
\ifsame@stems |
| 6223 |
% \end{macrocode} |
| 6224 |
% Under the \opt{alphabetic} option, \cs{previous@year} and |
| 6225 |
% \cs{current@year} will always be the same (namely, both will be |
| 6226 |
% empty), but including the test allows this code to work with the |
| 6227 |
% \opt{author-year} option as well. |
| 6228 |
% \begin{macrocode} |
| 6229 |
\ifx\previous@year\current@year |
| 6230 |
\@tempswatrue |
| 6231 |
\fi |
| 6232 |
\else |
| 6233 |
\begingroup |
| 6234 |
\let\name\@firstofone |
| 6235 |
\@apply\auto@stringify\amsrefs@textsymbols |
| 6236 |
\@apply\auto@stringify\amsrefs@textaccents |
| 6237 |
\@ifundefined{amsrefs@stem@\current@stem}{% |
| 6238 |
\expandafter\gdef\csname amsrefs@stem@\current@stem\endcsname{}% |
| 6239 |
}{% |
| 6240 |
\DuplicateBibLabelWarning |
| 6241 |
}% |
| 6242 |
\endgroup |
| 6243 |
\fi |
| 6244 |
\if@tempswa |
| 6245 |
\global\advance\alpha@suffix\@ne |
| 6246 |
\edef\alpha@label@suffix{\@suffix@format\alpha@suffix}% |
| 6247 |
\ifnum\alpha@suffix=\tw@ |
| 6248 |
\immediate\write\@auxout{% |
| 6249 |
\string\ModifyBibLabel{\prev@citekey}% |
| 6250 |
}% |
| 6251 |
\fi |
| 6252 |
\else |
| 6253 |
\let\alpha@label@suffix\@empty |
| 6254 |
\global\alpha@suffix\@ne |
| 6255 |
\@xp\ifx \csname b@\current@citekey @suffix\endcsname \relax |
| 6256 |
\else |
| 6257 |
\edef\alpha@label@suffix{\@suffix@format\alpha@suffix}% |
| 6258 |
\fi |
| 6259 |
\fi |
| 6260 |
} |
| 6261 |
% \end{macrocode} |
| 6262 |
% \end{macro} |
| 6263 |
% |
| 6264 |
% \begin{macro}{\ifsame@stems} |
| 6265 |
% \begin{macrocode} |
| 6266 |
\newif\ifsame@stems |
| 6267 |
% \end{macrocode} |
| 6268 |
% \end{macro} |
| 6269 |
% |
| 6270 |
% \begin{macro}{\compare@stems} |
| 6271 |
% \begin{macrocode} |
| 6272 |
\def\compare@stems#1#2{% |
| 6273 |
\begingroup |
| 6274 |
\purge@edef\@tempa{#1}% |
| 6275 |
\purge@edef\@tempb{#2}% |
| 6276 |
\lc@edef\@tempa{\@tempa}% |
| 6277 |
\lc@edef\@tempb{\@tempb}% |
| 6278 |
\ifx\@tempa\@tempb |
| 6279 |
\def\@tempa{\same@stemstrue}% |
| 6280 |
\else |
| 6281 |
\def\@tempa{\same@stemsfalse}% |
| 6282 |
\fi |
| 6283 |
\@xp\endgroup |
| 6284 |
\@tempa |
| 6285 |
} |
| 6286 |
% \end{macrocode} |
| 6287 |
% \end{macro} |
| 6288 |
% |
| 6289 |
% \begin{macro}{\ModifyBibLabel} |
| 6290 |
% \begin{macrocode} |
| 6291 |
\def\ModifyBibLabel#1{% |
| 6292 |
\global\@xp\let\csname b@#1@suffix\endcsname\@empty |
| 6293 |
} |
| 6294 |
% \end{macrocode} |
| 6295 |
% \end{macro} |
| 6296 |
% |
| 6297 |
% \subsection{Generating short alphabetic labels} |
| 6298 |
% |
| 6299 |
% This style for alphabetic labels is somewhat simpler than the |
| 6300 |
% regular alphabetic style. The stem consists only of an author |
| 6301 |
% part without a year part. The author part is formed in the same |
| 6302 |
% way, except that even when there is only a single author with a |
| 6303 |
% one-word last name, only the first letter of the name is used, |
| 6304 |
% not the first three. Finally, the suffix used to disambiguate |
| 6305 |
% identical stems is numeric rather than alphabetic. |
| 6306 |
% |
| 6307 |
% See section~\ref{opt:shortalphabetic} on |
| 6308 |
% page~\pageref{opt:shortalphabetic} for the implementation. |
| 6309 |
% |
| 6310 |
% \subsection{Formatting series} |
| 6311 |
% |
| 6312 |
% The \cn{PrintSeries} command prints a list of objects in series |
| 6313 |
% form. The essential idea is to produce something like \qq{A, B, and |
| 6314 |
% C} when we are given three elements ``A'', ``B'', and ``C'', with |
| 6315 |
% suitable variations in the punctuation and other intervening |
| 6316 |
% material depending on the number of elements. |
| 6317 |
% |
| 6318 |
% More precisely, we can envision \cn{PrintSeries} being |
| 6319 |
% called as |
| 6320 |
% \begin{quote} |
| 6321 |
% |\PrintSeries{|$S$|}{|$i_1$|}{|$i_2$|}{|$i_3$|}{|$E$|}{\do{|$T_1$|}| \dots|\do{|$T_n$|}}| |
| 6322 |
%\end{quote} |
| 6323 |
% where $S$ and~$E$ are material to be interpolated before the |
| 6324 |
% start and after the end of the list, respectively, |
| 6325 |
% $i_1$, \dots, $i_3$ are material to be interpolated between the |
| 6326 |
% elements, and the final argument is a list of indeterminate |
| 6327 |
% length where each element consists of a macro and its |
| 6328 |
% argument. If there are exactly two elements, $i_1$ is inserted |
| 6329 |
% between them; otherwise, $i_2$ is inserted between each pair of |
| 6330 |
% items except for the last pair, where $i_3$ is inserted. Thus, |
| 6331 |
% \begin{center} |
| 6332 |
% \begin{tabular}{ll} |
| 6333 |
% $n$ & output \\ |
| 6334 |
% 1 & $S$ $T_1$ $E$ \\ |
| 6335 |
% 2 & $S$ $T_1$ $i_1$ $T_2$ $E$ \\ |
| 6336 |
% 3 & $S$ $T_1$ $i_2$ $T_2$ $i_3$ $T_3$ $E$ \\ |
| 6337 |
% 4 & $S$ $T_1$ $i_2$ $T_2$ $i_2$ $T_3$ $i_3$ $T_4$ $E$ |
| 6338 |
%^^A \\$>4$ & $S$ $T_1$ $i_2$ $T_2$ $i_2$ $T_3$ \dots $T_{n-1}$ $i_3$ $T_n$ $E$ |
| 6339 |
% \end{tabular} |
| 6340 |
% \end{center} |
| 6341 |
% and so forth. For example, a standard comma-separated list could |
| 6342 |
% be formatted by |
| 6343 |
% \begin{verbatim} |
| 6344 |
% \PrintSeries{}{ and }{, }{, and }{}{...} |
| 6345 |
%\end{verbatim} |
| 6346 |
% |
| 6347 |
% That is the simple case but in practice there are |
| 6348 |
% additional complications. What if user-supplied line breaks have to |
| 6349 |
% be supported at the boundaries between elements? What if in |
| 6350 |
% addition to adding material between elements we also want to apply |
| 6351 |
% some handy function to each element (e.g., \cn{textsc})? Even |
| 6352 |
% worse, what if we want the function to be different depending on |
| 6353 |
% the position of the element in the list? Indeed if this did not |
| 6354 |
% happen to be the case with the current application I would not have |
| 6355 |
% gone to the extra trouble of supporting it. But if it must be so, |
| 6356 |
% then the output that we need from a list |\do{A}\do{B}...| is |
| 6357 |
% \begin{verbatim} |
| 6358 |
% f0{A} |
| 6359 |
% f0{A} p1 i1 f1{B} |
| 6360 |
% f0{A} p2 i2 f2{B} p3 i3 f3{B} |
| 6361 |
%\end{verbatim} |
| 6362 |
% and so on, where |
| 6363 |
% \begin{itemize} |
| 6364 |
% \item $f_n$ is a macro taking one argument, |
| 6365 |
% \item $p_n$ is punctuation\mdash material that must precede a line |
| 6366 |
% break if one occurs at this boundary, |
| 6367 |
% \item $i_n$ other interpolated material, as before. |
| 6368 |
% \end{itemize} |
| 6369 |
% To reduce the number of distinct required objects we decree that |
| 6370 |
% each element will get braces wrapped around it as a matter of |
| 6371 |
% course; then it is possible for $f_1$, $f_2$, $f_3$ to be |
| 6372 |
% assimilated onto the tail end of $i_1$, $i_2$, $i_3$. Since we |
| 6373 |
% also have to specify the macro that delimits the elements |
| 6374 |
% of the list, we end up with the following rather formidable |
| 6375 |
% signature: |
| 6376 |
% \begin{quote}\raggedright |
| 6377 |
% |\PrintSeries{\m} {|$f_0$|}| |
| 6378 |
% |{|$p_1$|}{|$i_1 f_1$|}| |{|$p_2$|}{|$i_2 f_2$|}| |
| 6379 |
% |{|$p_3$|}{|$i_3 f_3$|}| |
| 6380 |
% \hspace*{2 em} |{|$S$|} {\m{|$T_1$|}|$\dots$|\m{|$T_n$|}} {|$E$|}| |
| 6381 |
%\end{quote} |
| 6382 |
% and our comma-separated list example becomes |
| 6383 |
% \begin{verbatim} |
| 6384 |
% \PrintSeries{\do}{} {}{ and } {,}{ } {,}{ and } {}{...}{} |
| 6385 |
%\end{verbatim} |
| 6386 |
% |
| 6387 |
% \begin{macro}{\series@index} |
| 6388 |
% First we define a dedicated count register to be used in tracking |
| 6389 |
% the ordinal number of the item currently being processed. |
| 6390 |
% \begin{macrocode} |
| 6391 |
\newcount\series@index |
| 6392 |
% \end{macrocode} |
| 6393 |
% \end{macro} |
| 6394 |
% |
| 6395 |
% \begin{macro}{\PrintSeries} |
| 6396 |
% \begin{macrocode} |
| 6397 |
\def\PrintSeries#1#2#3#4#5#6#7#8{% |
| 6398 |
\begingroup |
| 6399 |
\def\series@add@a{#2}% |
| 6400 |
\def\series@add@b{\SwapBreak{#3}#4}% |
| 6401 |
\def\series@add@c{\SwapBreak{#5}#6}% |
| 6402 |
\def\series@add@d{\SwapBreak{#7}#8}% |
| 6403 |
\def\series@add@e{\SwapBreak{#7}}% |
| 6404 |
\PrintSeries@a{#1}% |
| 6405 |
} |
| 6406 |
% \end{macrocode} |
| 6407 |
% \end{macro} |
| 6408 |
% |
| 6409 |
% \begin{macro}{\PrinteSeries@a} |
| 6410 |
% For \cs{PrintSeries@a} the first arg is the iterator function |
| 6411 |
% present in the list which is arg 3. Args 2 and 4 are extra material |
| 6412 |
% to be added before and after the list that may require the use of |
| 6413 |
% \cn{Plural} or \cn{SingularPlural}. |
| 6414 |
% \begin{macrocode} |
| 6415 |
\def\PrintSeries@a#1#2#3#4{% |
| 6416 |
\get@numberof\@tempcnta#1{#3}% |
| 6417 |
\chardef\series@total=\@tempcnta |
| 6418 |
\ifnum\series@total=\@ne |
| 6419 |
\let\SingularPlural\@firstoftwo |
| 6420 |
\else |
| 6421 |
\let\SingularPlural\@secondoftwo |
| 6422 |
\fi |
| 6423 |
\series@index=\z@ |
| 6424 |
\let#1\series@add |
| 6425 |
#2#3#4\relax |
| 6426 |
\endgroup |
| 6427 |
} |
| 6428 |
% \end{macrocode} |
| 6429 |
% \end{macro} |
| 6430 |
% |
| 6431 |
% \begin{macro}{\series@add} |
| 6432 |
% This is the inner function called by \cn{PrintSeries} that |
| 6433 |
% carefully distributes all the material stored previously in |
| 6434 |
% \cs{series@add@...} macros. |
| 6435 |
% |
| 6436 |
% Note that the handling of ``et al.''\ cases is somewhat |
| 6437 |
% hardcoded. This seemed preferable to adding yet another argument |
| 6438 |
% (or two!\@) to \cs{PrintSeries}. |
| 6439 |
% \begin{macrocode} |
| 6440 |
\def\series@add#1{% |
| 6441 |
\advance\series@index\@ne |
| 6442 |
\ifx\etaltext#1\relax |
| 6443 |
\ifnum\series@index=\tw@ |
| 6444 |
\def\@tempa{\space\SubEtal}% |
| 6445 |
\else |
| 6446 |
\def\@tempa{\series@add@e\space\SubEtal}% |
| 6447 |
\fi |
| 6448 |
% \end{macrocode} |
| 6449 |
% We assume there are fewer than 20,000 items in the list. |
| 6450 |
% \begin{macrocode} |
| 6451 |
\series@index\@MM |
| 6452 |
\else |
| 6453 |
\ifcase\series@index |
| 6454 |
\or |
| 6455 |
% \end{macrocode} |
| 6456 |
% Material before name 1: |
| 6457 |
% \begin{macrocode} |
| 6458 |
\let\@tempa\series@add@a |
| 6459 |
\or |
| 6460 |
% \end{macrocode} |
| 6461 |
% Material before name 2: |
| 6462 |
% \begin{macrocode} |
| 6463 |
\ifnum\series@total<\thr@@ |
| 6464 |
\let\@tempa\series@add@b |
| 6465 |
\else |
| 6466 |
\let\@tempa\series@add@c |
| 6467 |
\fi |
| 6468 |
\else |
| 6469 |
% \end{macrocode} |
| 6470 |
% Material before names 3, 4, 5,\dots |
| 6471 |
% \begin{macrocode} |
| 6472 |
\ifnum\series@index=\series@total |
| 6473 |
\let\@tempa\series@add@d |
| 6474 |
\else |
| 6475 |
\ifnum\series@index<\series@total |
| 6476 |
\let\@tempa\series@add@c |
| 6477 |
\else |
| 6478 |
\let\@tempa\@gobble |
| 6479 |
\fi |
| 6480 |
\fi |
| 6481 |
\fi |
| 6482 |
\fi |
| 6483 |
\@tempa{#1}% |
| 6484 |
} |
| 6485 |
% \end{macrocode} |
| 6486 |
% \end{macro} |
| 6487 |
% |
| 6488 |
% \begin{macro}{\SwapBreak} |
| 6489 |
% This takes a single argument, which should begin with a |
| 6490 |
% punctuation character, and conditionally appends it to the |
| 6491 |
% current horizontal list after removing any preceding whitespace. |
| 6492 |
% If there was also a penalty at the end of the hlist (presumed to |
| 6493 |
% be the result of a |\linebreak| at the end of a field value), it |
| 6494 |
% moves the penalty to \emph{after} the argument. |
| 6495 |
% |
| 6496 |
% \begin{bug} |
| 6497 |
% \cn{SwapBreak} interferes with \TeX's kerning mechanism. For |
| 6498 |
% example, consider a field value that ends with a~``y'' and that |
| 6499 |
% should have a comma automatically appended. \pkg{amsrefs} |
| 6500 |
% generates the equivalent of |y\SwapBreak{,}|, which results in |
| 6501 |
% ``y\SwapBreak{,}'' (no kern before the comma) rather than~``y,''. |
| 6502 |
% Unfortunately, fixing this would likely require a |
| 6503 |
% disproportionate effort. In cases where the lack of kerning is |
| 6504 |
% unacceptable, a workaround is to add the punctuation mark to the |
| 6505 |
% field value manually. For example, |title={...y,}| would |
| 6506 |
% generate the equivalent of |y,\SwapBreak{,}|, which in turn would |
| 6507 |
% produce ``y,\SwapBreak{,}'' since \cs{SwapBreak} is careful not |
| 6508 |
% to add duplicate punctuation. |
| 6509 |
% \end{bug} |
| 6510 |
% \begin{macrocode} |
| 6511 |
\def\SwapBreak#1{% |
| 6512 |
\relax\ifvmode\leavevmode\fi |
| 6513 |
\@tempcnta\@MM |
| 6514 |
\toks@{#1}% |
| 6515 |
% \end{macrocode} |
| 6516 |
% First, remove any preceding glue. (There usually shouldn't be |
| 6517 |
% any of this.) |
| 6518 |
% \begin{macrocode} |
| 6519 |
\unskip |
| 6520 |
% \end{macrocode} |
| 6521 |
% There might be also be kern, typically an italic correction left |
| 6522 |
% there by a previous \texttt{TextFontCommand} like \ncn{textit}. |
| 6523 |
% But don't remove the special 1\,sp kern used to mark the |
| 6524 |
% beginning of a bibliography entry. |
| 6525 |
% |
| 6526 |
% \begin{bug} |
| 6527 |
% Sometimes we want to keep the italic correction. |
| 6528 |
% \end{bug} |
| 6529 |
% \begin{macrocode} |
| 6530 |
\ifnum \lastkern>\@ne \unkern \fi |
| 6531 |
% \end{macrocode} |
| 6532 |
% And now look for a penalty and stash it in a safe place. |
| 6533 |
% \begin{macrocode} |
| 6534 |
\ifnum\lastpenalty=\z@ |
| 6535 |
\else |
| 6536 |
\@tempcnta\lastpenalty |
| 6537 |
\unpenalty |
| 6538 |
\fi |
| 6539 |
% \end{macrocode} |
| 6540 |
% Now we add the punctuation, \emph{unless} one of the following |
| 6541 |
% conditions is true: |
| 6542 |
% \begin{enumerate} |
| 6543 |
% |
| 6544 |
% \item |
| 6545 |
% The last item on the horizontal list was a kern of~1\,sp, |
| 6546 |
% indicating that we're at the very beginning of a bibliography |
| 6547 |
% item. |
| 6548 |
% |
| 6549 |
% \item |
| 6550 |
% The current space factor is equal to the \cs{sfcode} of the |
| 6551 |
% puncutation mark we are adding, meaning that the mark is already |
| 6552 |
% on the list. |
| 6553 |
% |
| 6554 |
% \item |
| 6555 |
% The current space factor is equal to the special value |
| 6556 |
% |\@nopunctsfcode|, meaning that |\nopunct| was specified. |
| 6557 |
% |
| 6558 |
% \end{enumerate} |
| 6559 |
% This relies on distinct punctuation marks having distinct space |
| 6560 |
% factors, as established by our definition of \cn{frenchspacing}. |
| 6561 |
% \begin{macrocode} |
| 6562 |
\edef\@tempa{% |
| 6563 |
\@nx\deferredquoteslogical |
| 6564 |
\ifnum\lastkern=\@ne |
| 6565 |
\else |
| 6566 |
\ifnum\spacefactor=\sfcode\@xp\@xp\@xp`\@xp\@car\string#1)\@nil |
| 6567 |
\else |
| 6568 |
\ifnum\spacefactor=\@nopunctsfcode |
| 6569 |
\else |
| 6570 |
\the\toks@ |
| 6571 |
\fi |
| 6572 |
\fi |
| 6573 |
\fi |
| 6574 |
\@nx\deferredquotes |
| 6575 |
\ifnum\@tempcnta=\@MM \else \penalty\number\@tempcnta\space \fi |
| 6576 |
\ifnum\lastkern=\@ne \ignorespaces \fi |
| 6577 |
}% |
| 6578 |
\@tempa |
| 6579 |
} |
| 6580 |
% \end{macrocode} |
| 6581 |
% \end{macro} |
| 6582 |
% |
| 6583 |
% \begin{macro}{\Plural} |
| 6584 |
% \begin{macro}{\SingularPlural} |
| 6585 |
% \cn{Plural} takes one argument and prints it if there were two or |
| 6586 |
% more elements in the current list. So, to get \qq{editors} instead |
| 6587 |
% of \qq{editor} after printing a list of editor names, write |
| 6588 |
% \verb'editor\Plural{s}'. |
| 6589 |
% |
| 6590 |
% \cn{SingularPlural} takes two arguments and prints the first if |
| 6591 |
% there was only one element, otherwise prints the second arg. |
| 6592 |
% \begin{macrocode} |
| 6593 |
\newcommand{\SingularPlural}[2]{#1} |
| 6594 |
\newcommand{\Plural}{\SingularPlural{}} |
| 6595 |
% \end{macrocode} |
| 6596 |
% \end{macro} |
| 6597 |
% \end{macro} |
| 6598 |
% |
| 6599 |
% \subsection{Formatting names and series of names}\label{name-style} |
| 6600 |
% |
| 6601 |
% Now that we have a general mechanism for formatting series, we |
| 6602 |
% can easily specialize to the common case of a comma-separated |
| 6603 |
% list of names. First we provide specifications for the three |
| 6604 |
% most common name formats. |
| 6605 |
% |
| 6606 |
% \begin{macro}{\setbib@nameLE} |
| 6607 |
% This sets a name in standard western uninverted order, e.g., |
| 6608 |
% ``John Doe Jr.'' (The ``LE'' stands for little-endian.) |
| 6609 |
% \begin{macrocode} |
| 6610 |
\BibSpec{nameLE}{ |
| 6611 |
+{}{}{given} |
| 6612 |
+{}{\IfEmptyBibField{given}{}{ }}{surname} |
| 6613 |
+{}{ }{jr} |
| 6614 |
} |
| 6615 |
% \end{macrocode} |
| 6616 |
% \end{macro} |
| 6617 |
% |
| 6618 |
% \begin{macro}{\setbib@nameBE} |
| 6619 |
% Big-endian order, as used for example in traditional Chinese, |
| 6620 |
% Japanese, Vietnamese, and Hungarian names: ``Doe John''. |
| 6621 |
% Big-endian formatting can be requested for name by setting the |
| 6622 |
% ``inverted'' property to ``yes.'' |
| 6623 |
% \begin{macrocode} |
| 6624 |
\BibSpec{nameBE}{ |
| 6625 |
+{}{}{surname} |
| 6626 |
+{}{ }{given} |
| 6627 |
% \end{macrocode} |
| 6628 |
% I don't know what should happen if there's a suffix, so I'm going |
| 6629 |
% to just leave it out for now (although I should probably issue a |
| 6630 |
% warning). I suspect that either (a)~it never comes up or (b)~if |
| 6631 |
% it does come up, there's no set standard for how it should be |
| 6632 |
% handled. |
| 6633 |
% \begin{macrocode} |
| 6634 |
% +{}{ }{jr} |
| 6635 |
} |
| 6636 |
% \end{macrocode} |
| 6637 |
% \end{macro} |
| 6638 |
% |
| 6639 |
% \begin{macro}{\setbib@nameinverted} |
| 6640 |
% Inverted western-style names: ``Doe, John, Jr.'' |
| 6641 |
% \begin{macrocode} |
| 6642 |
\BibSpec{nameinverted}{ |
| 6643 |
+{} {} {surname} |
| 6644 |
+{,}{ } {given} |
| 6645 |
+{,}{ } {jr} |
| 6646 |
} |
| 6647 |
% \end{macrocode} |
| 6648 |
% \end{macro} |
| 6649 |
% |
| 6650 |
% Incidentally, it would probably be cleaner if names had their |
| 6651 |
% own namespace like properties do, i.e., something like |
| 6652 |
% \begin{verbatim} |
| 6653 |
% \DefineSimpleKey{name}{given} |
| 6654 |
% \DefineSimpleKey{name}{initials} |
| 6655 |
% \DefineSimpleKey{name}{surname} |
| 6656 |
% \DefineSimpleKey{name}{jr} |
| 6657 |
%\end{verbatim} |
| 6658 |
% followed by |
| 6659 |
% \begin{verbatim} |
| 6660 |
% \NameSpec{nameLE}{...} |
| 6661 |
%\end{verbatim} |
| 6662 |
% or |
| 6663 |
% \begin{verbatim} |
| 6664 |
% \BibSpec[name]{nameLE}{...} |
| 6665 |
%\end{verbatim} |
| 6666 |
% But this seems a little extravagant at this stage, so I've |
| 6667 |
% decided to leave things as-is for now. |
| 6668 |
% |
| 6669 |
% \begin{macro}{\PrintNames} |
| 6670 |
% \cn{PrintNames} is a simplified interface to \cs{PrintSeries} that |
| 6671 |
% takes only the last three arguments: |
| 6672 |
% \begin{quote}\raggedright |
| 6673 |
% |\PrintNames {|$S$|} {|$E$|} {\name{|$T_1$|}|$\dots$|\name{|$T_n$|}}| |
| 6674 |
%\end{quote} |
| 6675 |
% The order of the last two arguments is reversed to make it |
| 6676 |
% moderately easier to use; cf.\ \cn{PrintEditorsA}, etc. |
| 6677 |
% |
| 6678 |
% The first name in a series is treated differently than the other |
| 6679 |
% names in the \opt{author-year} style, so we use a separate |
| 6680 |
% formatting macro for it. |
| 6681 |
% \begin{macrocode} |
| 6682 |
\newcommand{\PrintNames}{% |
| 6683 |
\@ifstar{\PrintNames@a\set@othername}{\PrintNames@a\set@firstname}% |
| 6684 |
} |
| 6685 |
% \end{macrocode} |
| 6686 |
% \end{macro} |
| 6687 |
% |
| 6688 |
% \begin{macro}{\PrintNames@a} |
| 6689 |
% \begin{macrocode} |
| 6690 |
\newcommand{\PrintNames@a}[4]{% |
| 6691 |
\PrintSeries{\name} |
| 6692 |
{#1} |
| 6693 |
{}{ and \set@othername} |
| 6694 |
{,}{ \set@othername} |
| 6695 |
{,}{ and \set@othername} |
| 6696 |
{#2}{#4}{#3}% |
| 6697 |
} |
| 6698 |
% \end{macrocode} |
| 6699 |
% \end{macro} |
| 6700 |
% |
| 6701 |
% \begin{macro}{\set@firstname} |
| 6702 |
% By default, the first name is formatted in little-endian format. |
| 6703 |
% The \opt{author-year} option changes this to inverted order. |
| 6704 |
% \begin{macrocode} |
| 6705 |
\def\set@firstname#1{% |
| 6706 |
\set@name{#1}\setbib@nameLE |
| 6707 |
} |
| 6708 |
% \end{macrocode} |
| 6709 |
% \end{macro} |
| 6710 |
% |
| 6711 |
% \begin{macro}{\set@othername} |
| 6712 |
% The rest of the names are set in little-endian format by |
| 6713 |
% default. |
| 6714 |
% \begin{macrocode} |
| 6715 |
\def\set@othername#1{% |
| 6716 |
\set@name{#1}\setbib@nameLE |
| 6717 |
} |
| 6718 |
% \end{macrocode} |
| 6719 |
% \end{macro} |
| 6720 |
% |
| 6721 |
% \begin{macro}{\set@name} |
| 6722 |
% Parse the name into its components and then pass control to |
| 6723 |
% \cs{set@name@a}, which will decide what format to use for the |
| 6724 |
% name. |
| 6725 |
% \begin{macrocode} |
| 6726 |
\def\set@name#1{% |
| 6727 |
\name@split#1,,,\@nil |
| 6728 |
\set@name@a |
| 6729 |
} |
| 6730 |
% \end{macrocode} |
| 6731 |
% \end{macro} |
| 6732 |
% |
| 6733 |
% \begin{macro}{\set@namea} |
| 6734 |
% Use the requested format unless the |order| property has been set |
| 6735 |
% to ``inverted.'' |
| 6736 |
% \begin{macrocode} |
| 6737 |
\def\set@name@a#1{% |
| 6738 |
\begingroup |
| 6739 |
\get@current@properties |
| 6740 |
\select@auxlanguage |
| 6741 |
\def\@tempa{yes}% |
| 6742 |
\ifx\@tempa\prop'inverted |
| 6743 |
\setbib@nameBE |
| 6744 |
\else |
| 6745 |
#1% |
| 6746 |
\fi |
| 6747 |
\endgroup |
| 6748 |
} |
| 6749 |
% \end{macrocode} |
| 6750 |
% \end{macro} |
| 6751 |
% |
| 6752 |
% \begin{macro}{\PrintPrimary} |
| 6753 |
% \begin{macrocode} |
| 6754 |
\def\PrintPrimary{% |
| 6755 |
\ifx\current@primary\@empty |
| 6756 |
\EmptyPrimaryWarning |
| 6757 |
\else |
| 6758 |
\print@primary\current@primary |
| 6759 |
\fi |
| 6760 |
} |
| 6761 |
% \end{macrocode} |
| 6762 |
% \end{macro} |
| 6763 |
% |
| 6764 |
% \begin{macro}{\EmptyPrimaryWarning} |
| 6765 |
% \begin{macrocode} |
| 6766 |
\def\EmptyPrimaryWarning{% |
| 6767 |
\amsrefs@warning{No authors, editors or translators}% |
| 6768 |
} |
| 6769 |
% \end{macrocode} |
| 6770 |
% \end{macro} |
| 6771 |
% |
| 6772 |
% \begin{macro}{\PrintAuthors} |
| 6773 |
% The comparison of \cs{previous@primary} and \cs{current@primary} |
| 6774 |
% doesn't look at auxiliary properties (see also \cs{PrintEditorsA} |
| 6775 |
% and \cs{PrintTranslatorsA}). This is probably ok. |
| 6776 |
% \begin{macrocode} |
| 6777 |
\newcommand{\PrintAuthors}[1]{% |
| 6778 |
\ifx\previous@primary\current@primary |
| 6779 |
\sameauthors\@empty |
| 6780 |
\else |
| 6781 |
\def\current@bibfield{\bib'author}% |
| 6782 |
\PrintNames{}{}{#1}% |
| 6783 |
\fi |
| 6784 |
} |
| 6785 |
% \end{macrocode} |
| 6786 |
% \end{macro} |
| 6787 |
% |
| 6788 |
% \begin{macro}{\sameauthors} |
| 6789 |
% \begin{macrocode} |
| 6790 |
\newcommand{\sameauthors}[1]{\bysame#1} |
| 6791 |
% \end{macrocode} |
| 6792 |
% \end{macro} |
| 6793 |
% |
| 6794 |
% \begin{macro}{\bysame} |
| 6795 |
% \begin{macrocode} |
| 6796 |
\def\bysame{% |
| 6797 |
\leavevmode\hbox to3em{\hrulefill}\thinspace |
| 6798 |
\kern\z@ |
| 6799 |
} |
| 6800 |
% \end{macrocode} |
| 6801 |
% \end{macro} |
| 6802 |
% |
| 6803 |
% \begin{macro}{\PrintNameList} |
| 6804 |
% This just prints the names without any additional information. |
| 6805 |
% \begin{macrocode} |
| 6806 |
\newcommand{\PrintNameList}{\PrintNames{}{}} |
| 6807 |
% \end{macrocode} |
| 6808 |
% \end{macro} |
| 6809 |
% |
| 6810 |
% \begin{macro}{\PrintEditorsC} |
| 6811 |
% \begin{macrocode} |
| 6812 |
\newcommand{\PrintEditorsC}[1]{% |
| 6813 |
\PrintNames{Edited by }{}{#1}% |
| 6814 |
} |
| 6815 |
% \end{macrocode} |
| 6816 |
% \end{macro} |
| 6817 |
% |
| 6818 |
% \begin{macro}{\PrintEditorsA} |
| 6819 |
% When we consider editor names we have to think about some further |
| 6820 |
% complications. First, for the case of a book where editor names are |
| 6821 |
% listed in place of author names, just copy the same style with a |
| 6822 |
% bit of added text at the end. |
| 6823 |
% \begin{macrocode} |
| 6824 |
\newcommand{\PrintEditorsA}[1]{% |
| 6825 |
\ifx\previous@primary\current@primary |
| 6826 |
\sameauthors{(ed\Plural{s}.)}% |
| 6827 |
\else |
| 6828 |
\def\current@bibfield{\bib'editor}% |
| 6829 |
\PrintNames{}{ (ed\Plural{s}.)}{#1}% |
| 6830 |
\fi |
| 6831 |
\erase@field\bib'editor |
| 6832 |
} |
| 6833 |
% \end{macrocode} |
| 6834 |
% \end{macro} |
| 6835 |
% |
| 6836 |
% \begin{macro}{\PrintEditorsB} |
| 6837 |
% \begin{macrocode} |
| 6838 |
\newcommand{\PrintEditorsB}{% |
| 6839 |
\PrintNames*{(}{\SwapBreak{,}~ed\Plural{s}.)}% |
| 6840 |
} |
| 6841 |
% \end{macrocode} |
| 6842 |
% \end{macro} |
| 6843 |
% |
| 6844 |
% \begin{macro}{\PrintContributions} |
| 6845 |
% \begin{macrocode} |
| 6846 |
\newcommand{\PrintContributions}[1]{% |
| 6847 |
\PrintSeries |
| 6848 |
{\fld@elt} |
| 6849 |
{\print@contribution} |
| 6850 |
{}{ and \print@contribution} |
| 6851 |
{,}{ \print@contribution} |
| 6852 |
{,}{ and \print@contribution}{}{#1}{}% |
| 6853 |
} |
| 6854 |
% \end{macrocode} |
| 6855 |
% \end{macro} |
| 6856 |
% |
| 6857 |
% \begin{macro}{\print@contribution} |
| 6858 |
% \begin{macrocode} |
| 6859 |
\newcommand{\print@contribution}[1]{% |
| 6860 |
\in@={#1}% |
| 6861 |
\ifin@ |
| 6862 |
\ifnum\series@index=\@ne with \fi |
| 6863 |
\RestrictedSetKeys{}{bib}{% |
| 6864 |
\bib@print@inner\setbib@contribution{\the\rsk@toks}% |
| 6865 |
}{#1}% |
| 6866 |
\else |
| 6867 |
#1% |
| 6868 |
\fi |
| 6869 |
} |
| 6870 |
% \end{macrocode} |
| 6871 |
% \end{macro} |
| 6872 |
% |
| 6873 |
% \begin{macro}{\resolve@inner} |
| 6874 |
% \begin{macrocode} |
| 6875 |
\def\resolve@inner#1#2{% |
| 6876 |
\in@={#2}% |
| 6877 |
\ifin@ |
| 6878 |
\RestrictedSetKeys{}{bib}{#1{\the\rsk@toks}}{#2}% |
| 6879 |
\else |
| 6880 |
\@ifundefined{bi@#2}{% |
| 6881 |
\XRefWarning{#2}% |
| 6882 |
}{% |
| 6883 |
#1{\csname bi@#2\endcsname}% |
| 6884 |
}% |
| 6885 |
\fi |
| 6886 |
} |
| 6887 |
% \end{macrocode} |
| 6888 |
% \end{macro} |
| 6889 |
% |
| 6890 |
% \begin{macro}{\PrintConference} |
| 6891 |
% \begin{macrocode} |
| 6892 |
\def\PrintConference{% |
| 6893 |
\resolve@inner{\bib@print@inner\setbib@conference} |
| 6894 |
} |
| 6895 |
% \end{macrocode} |
| 6896 |
% \end{macro} |
| 6897 |
% |
| 6898 |
% \begin{macro}{\PrintConferenceDetails} |
| 6899 |
% \begin{macrocode} |
| 6900 |
\def\PrintConferenceDetails#1{% |
| 6901 |
\ifx\@empty\bib'address |
| 6902 |
\ifx\@empty\bib'date |
| 6903 |
\else |
| 6904 |
\PrintConferenceDetails@ |
| 6905 |
\fi |
| 6906 |
\else |
| 6907 |
\PrintConferenceDetails@ |
| 6908 |
\fi |
| 6909 |
} |
| 6910 |
% \end{macrocode} |
| 6911 |
% \end{macro} |
| 6912 |
% |
| 6913 |
% \begin{macro}{\PrintConferenceDetails@} |
| 6914 |
% \begin{macrocode} |
| 6915 |
\def\PrintConferenceDetails@{% |
| 6916 |
\ifnum\lastkern=\@ne\else\space\fi(\kern 1sp |
| 6917 |
\ifx\@empty\bib'address |
| 6918 |
\else |
| 6919 |
\bib'address |
| 6920 |
\fi |
| 6921 |
\ifx\@empty\bib'date |
| 6922 |
\else |
| 6923 |
\SwapBreak{,}\space |
| 6924 |
\print@date |
| 6925 |
\fi |
| 6926 |
)%\spacefactor\sfcode`\,% |
| 6927 |
} |
| 6928 |
% \end{macrocode} |
| 6929 |
% \end{macro} |
| 6930 |
% |
| 6931 |
% \begin{macro}{\PrintBook} |
| 6932 |
% \begin{macrocode} |
| 6933 |
\def\PrintBook{% |
| 6934 |
\resolve@inner{\bib@print@inner\setbib@innerbook} |
| 6935 |
} |
| 6936 |
% \end{macrocode} |
| 6937 |
% \end{macro} |
| 6938 |
% |
| 6939 |
% \begin{macro}{\PrintReprint} |
| 6940 |
% \begin{macrocode} |
| 6941 |
\def\PrintReprint{% |
| 6942 |
\resolve@inner{\bib@reprint} |
| 6943 |
} |
| 6944 |
% \end{macrocode} |
| 6945 |
% \end{macro} |
| 6946 |
% |
| 6947 |
% \begin{macro}{\bib@reprint} |
| 6948 |
% \begin{macrocode} |
| 6949 |
\def\bib@reprint#1{% |
| 6950 |
\begingroup |
| 6951 |
#1\relax % execute definitions locally |
| 6952 |
\bib@resolve@xrefs |
| 6953 |
\bib@field@patches |
| 6954 |
\bib'setup |
| 6955 |
\IfEmptyBibField{copula}{reprinted in}{\bib'copula} \nopunct |
| 6956 |
\let\bib'language\@empty |
| 6957 |
\setbib@book |
| 6958 |
\endgroup |
| 6959 |
} |
| 6960 |
% \end{macrocode} |
| 6961 |
% \end{macro} |
| 6962 |
% |
| 6963 |
% \begin{macro}{\PrintTranslation} |
| 6964 |
% \begin{macrocode} |
| 6965 |
\def\PrintTranslation{% |
| 6966 |
\resolve@inner{\bib@translation} |
| 6967 |
} |
| 6968 |
% \end{macrocode} |
| 6969 |
% \end{macro} |
| 6970 |
% |
| 6971 |
% \begin{macro}{\bib@translation} |
| 6972 |
% \begin{macrocode} |
| 6973 |
\def\bib@translation#1{% |
| 6974 |
\begingroup |
| 6975 |
#1\relax % execute definitions locally |
| 6976 |
\bib@resolve@xrefs |
| 6977 |
\bib@field@patches |
| 6978 |
\bib'setup |
| 6979 |
\let\PrintPrimary\@empty |
| 6980 |
\bib@append{;}{ % keep this space! |
| 6981 |
\IfEmptyBibField{language}{English}{\bib'language} transl.% |
| 6982 |
\IfEmptyBibField{pages}{ in \kern\@ne sp}{, }% |
| 6983 |
}\bib'transition |
| 6984 |
\let\bib'language\@empty |
| 6985 |
\setbib@@ |
| 6986 |
\endgroup |
| 6987 |
} |
| 6988 |
% \end{macrocode} |
| 6989 |
% \end{macro} |
| 6990 |
% |
| 6991 |
% \begin{macro}{\PrintTranslatorsC} |
| 6992 |
% \begin{macrocode} |
| 6993 |
\newcommand{\PrintTranslatorsC}[1]{% |
| 6994 |
\PrintNames{translated by }{}{#1}% |
| 6995 |
} |
| 6996 |
% \end{macrocode} |
| 6997 |
% \end{macro} |
| 6998 |
% |
| 6999 |
% \begin{macro}{\PrintTranslatorsA} |
| 7000 |
% \begin{macrocode} |
| 7001 |
\newcommand{\PrintTranslatorsA}[1]{% |
| 7002 |
\ifx\previous@primary\current@primary |
| 7003 |
\sameauthors{(trans.)}% |
| 7004 |
\else |
| 7005 |
\def\current@bibfield{\bib'translator}% |
| 7006 |
\PrintNames{}{ (trans.)}{#1}% |
| 7007 |
\fi |
| 7008 |
\erase@field\bib'translator |
| 7009 |
} |
| 7010 |
% \end{macrocode} |
| 7011 |
% \end{macro} |
| 7012 |
% |
| 7013 |
% \begin{macro}{\PrintTranslatorsB} |
| 7014 |
% \begin{macrocode} |
| 7015 |
\newcommand{\PrintTranslatorsB}[1]{ |
| 7016 |
\PrintNames*{(}{\SwapBreak{,}~tran\Plural{s}.)}% |
| 7017 |
} |
| 7018 |
% \end{macrocode} |
| 7019 |
% \end{macro} |
| 7020 |
% |
| 7021 |
% Some special handling for ``et alii'' or ``and others''. |
| 7022 |
% \begin{macrocode} |
| 7023 |
\DefineName{alii}{\etaltext} |
| 7024 |
\DefineName{others}{\etaltext} |
| 7025 |
% \end{macrocode} |
| 7026 |
% |
| 7027 |
% \begin{macro}{\etaltext} |
| 7028 |
% \begin{macro}{\SubEtal} |
| 7029 |
% The Chicago Manual of Style suggests that it is slightly better not |
| 7030 |
% to italicize `et al' and some other extremely common abbreviations |
| 7031 |
% inherited from Latin. (Compare `etc'.) |
| 7032 |
% \begin{macrocode} |
| 7033 |
\newcommand{\etaltext}{et al.} |
| 7034 |
\newcommand{\SubEtal}[1]{\etaltext} |
| 7035 |
% \end{macrocode} |
| 7036 |
% \end{macro} |
| 7037 |
% \end{macro} |
| 7038 |
% |
| 7039 |
% \subsection{The \fld{partial} field} |
| 7040 |
% |
| 7041 |
% \begin{macro}{\print@partial} |
| 7042 |
% \begin{macrocode} |
| 7043 |
\newcommand{\print@partial}{% |
| 7044 |
\resolve@inner{\bib@print@inner\setbib@partial} |
| 7045 |
} |
| 7046 |
% \end{macrocode} |
| 7047 |
% \end{macro} |
| 7048 |
% |
| 7049 |
% \subsection{Special formatting for other fields} |
| 7050 |
% |
| 7051 |
% \begin{macro}{\parenthesize} |
| 7052 |
% The \cn{parenthesize} function adds parentheses around its |
| 7053 |
% argument, calling \cn{upn} to optionally prevent italic |
| 7054 |
% parentheses from being used. |
| 7055 |
% \begin{macrocode} |
| 7056 |
\newcommand{\parenthesize}[1]{% |
| 7057 |
\leavevmode\push@bracket)\upn{(}#1\pop@bracket |
| 7058 |
} |
| 7059 |
% \end{macrocode} |
| 7060 |
% \end{macro} |
| 7061 |
% |
| 7062 |
% \begin{macro}{\upn} |
| 7063 |
% By default, \cn{upn} is a no-op, meaning that this refinement |
| 7064 |
% lies dormant unless the \pkg{upref} package or other activation |
| 7065 |
% is done. (Probably better done via special fonts, anyway.) |
| 7066 |
% \begin{macrocode} |
| 7067 |
\providecommand{\upn}[1]{#1} |
| 7068 |
% \end{macrocode} |
| 7069 |
% \end{macro} |
| 7070 |
% |
| 7071 |
% \begin{macro}{\push@bracket} |
| 7072 |
% \begin{macro}{\pop@bracket} |
| 7073 |
% \begin{macrocode} |
| 7074 |
\let\bracket@stack\@empty |
| 7075 |
|
| 7076 |
\def\push@bracket#1{% |
| 7077 |
\xdef\bracket@stack{#1\bracket@stack}% |
| 7078 |
} |
| 7079 |
|
| 7080 |
\def\pop@bracket{% |
| 7081 |
\iffalse{\fi |
| 7082 |
\@xp\pop@bracket@a\bracket@stack \@empty}% |
| 7083 |
} |
| 7084 |
|
| 7085 |
\def\pop@bracket@a#1{% |
| 7086 |
\leavevmode\/\upn{#1}% |
| 7087 |
\xdef\bracket@stack{\iffalse}\fi |
| 7088 |
} |
| 7089 |
% \end{macrocode} |
| 7090 |
% \end{macro} |
| 7091 |
% \end{macro} |
| 7092 |
% |
| 7093 |
% \begin{macro}{\bibquotes} |
| 7094 |
% \begin{macrocode} |
| 7095 |
\newcommand{\bibquotes}[1]{% |
| 7096 |
\textquotedblleft#1% |
| 7097 |
\gdef\deferredquotes{% |
| 7098 |
\global\let\deferredquotes\@empty |
| 7099 |
\textquotedblright |
| 7100 |
}% |
| 7101 |
} |
| 7102 |
% \end{macrocode} |
| 7103 |
% \end{macro} |
| 7104 |
% |
| 7105 |
% \begin{macro}{\mdash} |
| 7106 |
% \begin{macro}{\ndash} |
| 7107 |
% Cf.\@ \pkg{textcmds}, where there's also a penalty added. |
| 7108 |
% \begin{macrocode} |
| 7109 |
\providecommand{\mdash}{\textemdash} |
| 7110 |
\providecommand{\ndash}{\textendash} |
| 7111 |
% \end{macrocode} |
| 7112 |
% \end{macro} |
| 7113 |
% \end{macro} |
| 7114 |
% |
| 7115 |
% \begin{macro}{\strip@MRprefix} |
| 7116 |
% \begin{macrocode} |
| 7117 |
\def\strip@MRprefix#1#2#3#4\@nil{% |
| 7118 |
\def\@tempa{#1#2#3#4}% |
| 7119 |
\if#1M% |
| 7120 |
\if#2R% |
| 7121 |
\def\@tempa{#3#4}% |
| 7122 |
\fi |
| 7123 |
\fi |
| 7124 |
} |
| 7125 |
% \end{macrocode} |
| 7126 |
% \end{macro} |
| 7127 |
% |
| 7128 |
% \begin{macro}{\MR} |
| 7129 |
% \begin{macrocode} |
| 7130 |
\def\MR#1{% |
| 7131 |
\relax\ifhmode\unskip\spacefactor3000 \space\fi |
| 7132 |
\begingroup |
| 7133 |
\strip@MRprefix#1\@nil |
| 7134 |
\edef\@tempa{MR\@nx\MRhref{\@tempa}{\@tempa}}% |
| 7135 |
\@xp\endgroup |
| 7136 |
\@tempa |
| 7137 |
} |
| 7138 |
% \end{macrocode} |
| 7139 |
% \end{macro} |
| 7140 |
% |
| 7141 |
% \begin{macro}{\MRhref} |
| 7142 |
% For older versions of some AMS document classes, this patch is |
| 7143 |
% needed. |
| 7144 |
% \begin{macrocode} |
| 7145 |
\providecommand{\MRhref}[2]{#1} |
| 7146 |
% \end{macrocode} |
| 7147 |
% \end{macro} |
| 7148 |
% |
| 7149 |
% \begin{macro}{\PrintReviews} |
| 7150 |
% Reviews are handled as a list to support the theoretical |
| 7151 |
% possibility of multiple reviews. |
| 7152 |
% \begin{macrocode} |
| 7153 |
\newcommand{\PrintReviews}[1]{% |
| 7154 |
\PrintSeries{\fld@elt}{}{,}{ }{,}{ }{,}{ }{}{#1}{}% |
| 7155 |
} |
| 7156 |
% \end{macrocode} |
| 7157 |
% \end{macro} |
| 7158 |
% |
| 7159 |
% \begin{macro}{\PrintPartials} |
| 7160 |
% \begin{macrocode} |
| 7161 |
\newcommand{\PrintPartials}[1]{% |
| 7162 |
\PrintSeries |
| 7163 |
{\fld@elt} |
| 7164 |
{\print@partial} |
| 7165 |
{;}{ \print@partial} |
| 7166 |
{;}{ \print@partial} |
| 7167 |
{;}{ \print@partial}{}{#1}{}% |
| 7168 |
} |
| 7169 |
% \end{macrocode} |
| 7170 |
% \end{macro} |
| 7171 |
% |
| 7172 |
% \begin{macro}{\PrintISBNs} |
| 7173 |
% And similarly for ISBNs. There seem to be a few different |
| 7174 |
% situations where one book might have two different ISBN numbers. |
| 7175 |
% Here are the ones I know of so far [mjd,2002-02-18]: separate ISBN |
| 7176 |
% numbers for hardback and paperback; separate ISBN numbers for U.S. |
| 7177 |
% edition and European edition. |
| 7178 |
% \begin{macrocode} |
| 7179 |
\newcommand{\PrintISBNs}[1]{% |
| 7180 |
\PrintSeries{\fld@elt}{}{,}{ }{,}{ }{,}{ }{ISBN }{#1}{}% |
| 7181 |
} |
| 7182 |
% \end{macrocode} |
| 7183 |
% \end{macro} |
| 7184 |
% |
| 7185 |
% \begin{macro}{\voltext} |
| 7186 |
% \begin{macrocode} |
| 7187 |
\newcommand{\voltext}{\IfEmptyBibField{series}{Vol.~}{vol.~}} |
| 7188 |
% \end{macrocode} |
| 7189 |
% \end{macro} |
| 7190 |
% |
| 7191 |
% \begin{macro}{\issuetext} |
| 7192 |
% \begin{macrocode} |
| 7193 |
\newcommand{\issuetext}{no.~} |
| 7194 |
% \end{macrocode} |
| 7195 |
% \end{macro} |
| 7196 |
% |
| 7197 |
% \begin{macro}{\DashPages} |
| 7198 |
% Scan the contents of a page value to see if it is a single page. |
| 7199 |
% Presence of \cn{ndash} or hyphen is taken to mean no. Probably |
| 7200 |
% should test also for spaces and commas. [mjd,2000/01/24] |
| 7201 |
% \begin{macrocode} |
| 7202 |
\newcommand{\DashPages}[1]{% |
| 7203 |
p\pp@scan@a#1@\ndash p@\ndash{\pp@scan#1@-p@-{}\@nil}\@nil.~#1% |
| 7204 |
} |
| 7205 |
|
| 7206 |
\def\pp@scan#1-#2@-#3#4\@nil{#3} |
| 7207 |
|
| 7208 |
\def\pp@scan@a#1\ndash#2@\ndash#3#4\@nil{#3} |
| 7209 |
% \end{macrocode} |
| 7210 |
% \end{macro} |
| 7211 |
% |
| 7212 |
% \begin{macro}{\eprintpages} |
| 7213 |
% If we have eprint info and pages info and no journal name, the |
| 7214 |
% pages information is presumably the number of pages in the eprint. |
| 7215 |
% \begin{macrocode} |
| 7216 |
\newcommand{\eprintpages}[1]{% |
| 7217 |
#1\IfEmptyBibField{eprint}{}{\IfEmptyBibField{journal}{ pp.}{}}% |
| 7218 |
} |
| 7219 |
% \end{macrocode} |
| 7220 |
% \end{macro} |
| 7221 |
% |
| 7222 |
% \begin{macro}{\PrintThesisType} |
| 7223 |
% \begin{macrocode} |
| 7224 |
\def\PrintThesisType#1{% |
| 7225 |
\thesis@type#1?\@nil{#1}% |
| 7226 |
} |
| 7227 |
|
| 7228 |
\def\thesis@type#1#2\@nil#3{% |
| 7229 |
\ifx p#1% |
| 7230 |
Ph.D. Thesis% |
| 7231 |
\else |
| 7232 |
\ifx m#1% |
| 7233 |
Master's Thesis% |
| 7234 |
\else |
| 7235 |
#3% |
| 7236 |
\fi |
| 7237 |
\fi |
| 7238 |
} |
| 7239 |
% \end{macrocode} |
| 7240 |
% \end{macro} |
| 7241 |
% |
| 7242 |
% \begin{macro}{\PrintDOI} |
| 7243 |
% Perhaps need to add allowbreak penalties at the parentheses in a DOI. |
| 7244 |
% Also what about prohibiting a break after the leading S? |
| 7245 |
% \begin{macrocode} |
| 7246 |
\newcommand{\PrintDOI}[1]{% |
| 7247 |
DOI #1% |
| 7248 |
} |
| 7249 |
% \end{macrocode} |
| 7250 |
% \end{macro} |
| 7251 |
% |
| 7252 |
% \begin{macro}{\PrintDatePV} |
| 7253 |
% Print date in different forms depending on DOI and volume |
| 7254 |
% information. |
| 7255 |
% \begin{macrocode} |
| 7256 |
\newcommand{\PrintDatePV}[1]{% |
| 7257 |
\IfEmptyBibField{doi}{% |
| 7258 |
\let\@tempa\PrintDate |
| 7259 |
}{% |
| 7260 |
\IfEmptyBibField{volume}{% |
| 7261 |
\let\@tempa\PrintDatePosted |
| 7262 |
}{% |
| 7263 |
\let\@tempa\PrintDate |
| 7264 |
}% |
| 7265 |
}% |
| 7266 |
\@tempa{#1}% |
| 7267 |
} |
| 7268 |
% \end{macrocode} |
| 7269 |
% \end{macro} |
| 7270 |
% |
| 7271 |
% \begin{macro}{\PrintDate} |
| 7272 |
% The intent is to handle variations such as \texttt{1987}, |
| 7273 |
% \texttt{August 1987}, \texttt{1987-08}, and |
| 7274 |
% \texttt{1987-08-14}. If the month is present, print August or |
| 7275 |
% Aug. or 08 or nothing, at the behest of the bib style. |
| 7276 |
% |
| 7277 |
% We've taken some special care to parse out the date info ahead of |
| 7278 |
% time, so this function just discards arg 1 and uses the |
| 7279 |
% already-parsed value. |
| 7280 |
% \begin{macrocode} |
| 7281 |
\newcommand{\PrintDate}[1]{(\print@date)} |
| 7282 |
% \end{macrocode} |
| 7283 |
% \end{macro} |
| 7284 |
% |
| 7285 |
% \begin{macro}{\PrintDateB} |
| 7286 |
% The same, but without the parentheses. |
| 7287 |
% \begin{macrocode} |
| 7288 |
\newcommand{\PrintDateB}[1]{\print@date} |
| 7289 |
% \end{macrocode} |
| 7290 |
% \end{macro} |
| 7291 |
% |
| 7292 |
% \begin{macro}{\PrintDateField} |
| 7293 |
% \begin{macrocode} |
| 7294 |
\newcommand{\PrintDateField}[1]{% |
| 7295 |
\@ifempty{#1}{}{% |
| 7296 |
\begingroup |
| 7297 |
\bib@parsedate{#1}% |
| 7298 |
\print@full@date |
| 7299 |
\endgroup |
| 7300 |
}% |
| 7301 |
} |
| 7302 |
% \end{macrocode} |
| 7303 |
% \end{macro} |
| 7304 |
% |
| 7305 |
% \begin{macro}{\print@full@date} |
| 7306 |
% \begin{macrocode} |
| 7307 |
\def\print@full@date{% |
| 7308 |
\ifx\bib@month\@empty |
| 7309 |
\else |
| 7310 |
\print@month@day |
| 7311 |
\fi |
| 7312 |
\bib@year |
| 7313 |
} |
| 7314 |
% \end{macrocode} |
| 7315 |
% \end{macro} |
| 7316 |
% |
| 7317 |
% \begin{macro}{\print@date} |
| 7318 |
% \begin{macrocode} |
| 7319 |
\let\print@date\print@full@date |
| 7320 |
% \end{macrocode} |
| 7321 |
% \end{macro} |
| 7322 |
% |
| 7323 |
% \begin{macro}{\print@month@day} |
| 7324 |
% \begin{macrocode} |
| 7325 |
\def\print@month@day{% |
| 7326 |
\bib@monthname |
| 7327 |
\ifx\@empty\bib@day \else \nobreakspace\number 0\bib@day,\fi |
| 7328 |
\space |
| 7329 |
} |
| 7330 |
% \end{macrocode} |
| 7331 |
% \end{macro} |
| 7332 |
% |
| 7333 |
% \begin{macro}{\bib@monthname} |
| 7334 |
% With the Babel package, month names for a given language are |
| 7335 |
% typically available in a macro \cs{month@}\emph{language}: |
| 7336 |
% \begin{verbatim} |
| 7337 |
% \def\month@german{\ifcase\month\or |
| 7338 |
% Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or |
| 7339 |
% Juli\or August\or September\or Oktober\or November\or Dezember\fi} |
| 7340 |
%\end{verbatim} |
| 7341 |
% However this is not true for English. |
| 7342 |
% \begin{macrocode} |
| 7343 |
\newcommand{\bib@monthname}{% |
| 7344 |
\ifcase 0\bib@month |
| 7345 |
\or January\or February\or March\or April\or May\or June\or |
| 7346 |
July\or August\or September\or October\or November\or December\or |
| 7347 |
Winter\or Spring\or Summer\or Fall\else Unknown Month% |
| 7348 |
\fi |
| 7349 |
} |
| 7350 |
% \end{macrocode} |
| 7351 |
% \end{macro} |
| 7352 |
% |
| 7353 |
% \begin{macro}{\PrintYear} |
| 7354 |
% You can use \cn{PrintYear} if you want to suppress month/day even |
| 7355 |
% when supplied in the data. |
| 7356 |
% \begin{macrocode} |
| 7357 |
\newcommand{\PrintYear}[1]{\bib@year} |
| 7358 |
% \end{macrocode} |
| 7359 |
% \end{macro} |
| 7360 |
% |
| 7361 |
% \begin{macro}{\PrintDatePosted} |
| 7362 |
% This one is special for AMS use. |
| 7363 |
% \begin{macrocode} |
| 7364 |
\newcommand{\PrintDatePosted}[1]{\unskip, posted on \print@date} |
| 7365 |
% \end{macrocode} |
| 7366 |
% \end{macro} |
| 7367 |
% |
| 7368 |
% \begin{macro}{\PrintEdition} |
| 7369 |
% \begin{macrocode} |
| 7370 |
\newcommand{\PrintEdition}[1]{% |
| 7371 |
\afterassignment\print@edition |
| 7372 |
\count@ 0#1\relax\@nil |
| 7373 |
} |
| 7374 |
% \end{macrocode} |
| 7375 |
% \end{macro} |
| 7376 |
% |
| 7377 |
% \begin{macro}{\print@edition} |
| 7378 |
% If the number assignment swept up all the contents, produce a |
| 7379 |
% cardinal number from \cs{count@}. |
| 7380 |
% \begin{macrocode} |
| 7381 |
\def\print@edition#1#2\@nil{% |
| 7382 |
\ifx\relax#1\relax |
| 7383 |
\ifnum\count@>\z@ |
| 7384 |
\CardinalNumeric\count@ |
| 7385 |
\else |
| 7386 |
??th% |
| 7387 |
\fi |
| 7388 |
\ \editiontext |
| 7389 |
\else |
| 7390 |
\ifnum \count@>\z@ \number\count@ \fi |
| 7391 |
#1#2\relax |
| 7392 |
\fi |
| 7393 |
} |
| 7394 |
% \end{macrocode} |
| 7395 |
% \end{macro} |
| 7396 |
% |
| 7397 |
% \begin{macro}{\editiontext} |
| 7398 |
% \begin{macrocode} |
| 7399 |
\newcommand{\editiontext}{ed.} |
| 7400 |
% \end{macrocode} |
| 7401 |
% \end{macro} |
| 7402 |
% |
| 7403 |
% \begin{macro}{\CardinalNumber} |
| 7404 |
% \begin{macrocode} |
| 7405 |
\newcommand{\CardinalNumeric}[1]{% |
| 7406 |
\number#1\relax |
| 7407 |
\if |
| 7408 |
\ifnum#1<14 |
| 7409 |
\ifnum#1>\thr@@ T\else F\fi |
| 7410 |
\else |
| 7411 |
F% |
| 7412 |
\fi |
| 7413 |
T% |
| 7414 |
th% |
| 7415 |
\else |
| 7416 |
\@xp\keep@last@digit\@xp#1\number#1\relax |
| 7417 |
\ifcase#1th\or st\or nd\or rd\else th\fi |
| 7418 |
\fi |
| 7419 |
} |
| 7420 |
% \end{macrocode} |
| 7421 |
% \end{macro} |
| 7422 |
% |
| 7423 |
% \begin{macro}{\keep@last@digit} |
| 7424 |
% \begin{macrocode} |
| 7425 |
\def\keep@last@digit#1#2{% |
| 7426 |
\ifx\relax#2% |
| 7427 |
\@xp\@gobbletwo |
| 7428 |
\else |
| 7429 |
#1=#2\relax |
| 7430 |
\fi |
| 7431 |
\keep@last@digit#1% |
| 7432 |
} |
| 7433 |
% \end{macrocode} |
| 7434 |
% \end{macro} |
| 7435 |
% |
| 7436 |
% \begin{macro}{\SentenceSpace} |
| 7437 |
% Note how careful we are here to preserve \cn{frenchspacing}. |
| 7438 |
% \begin{macrocode} |
| 7439 |
\newcommand{\SentenceSpace}{\relax\ifhmode\spacefactor`\. \fi} |
| 7440 |
% \end{macrocode} |
| 7441 |
% \end{macro} |
| 7442 |
% |
| 7443 |
% \begin{macro}{\eprint} |
| 7444 |
% For now, this does nothing. Could do a url/hyperlink or something. |
| 7445 |
% \begin{macrocode} |
| 7446 |
\newcommand{\eprint}[1]{\url{#1}} |
| 7447 |
% \end{macrocode} |
| 7448 |
% \end{macro} |
| 7449 |
% The \url{www.arXiv.org} recommendations for citing their eprints are |
| 7450 |
% found at \url{http://xxx.lanl.gov/help/faq/references}, including |
| 7451 |
% these examples: |
| 7452 |
% \begin{verbatim} |
| 7453 |
% arXiv:hep-th/9910001 |
| 7454 |
% arXiv:math.AT/9910001 |
| 7455 |
% arXiv:physics.acc-ph/9911027 |
| 7456 |
%\end{verbatim} |
| 7457 |
% |
| 7458 |
% \subsection{\BibTeX\ support} |
| 7459 |
% |
| 7460 |
% \begin{macro}{\bibliographystyle} |
| 7461 |
% Disable \cn{bibliographystyle} since we're going to handle that |
| 7462 |
% behind the scenes. |
| 7463 |
% \begin{macrocode} |
| 7464 |
\let\bibliographystyle\@gobble |
| 7465 |
% \end{macrocode} |
| 7466 |
% \end{macro} |
| 7467 |
% |
| 7468 |
% \begin{macro}{\bibtex@style} |
| 7469 |
% \begin{macrocode} |
| 7470 |
\def\bibtex@style{amsrn} |
| 7471 |
% \end{macrocode} |
| 7472 |
% \end{macro} |
| 7473 |
% |
| 7474 |
% \begin{macrocode} |
| 7475 |
\AtBeginDocument{ |
| 7476 |
\if@filesw |
| 7477 |
\immediate\write\@auxout{\string\bibstyle{\bibtex@style}}% |
| 7478 |
\fi |
| 7479 |
} |
| 7480 |
% \end{macrocode} |
| 7481 |
% |
| 7482 |
% \subsection{Implementing package options} |
| 7483 |
% |
| 7484 |
% \subsubsection{The \opt{alphabetic} option} |
| 7485 |
% |
| 7486 |
% \begin{macrocode} |
| 7487 |
\IfOption{alphabetic}{% |
| 7488 |
\def\bibtex@style{amsra}% |
| 7489 |
\let\process@citelist\process@citelist@unsorted |
| 7490 |
\amsrefs@option@alphabetic |
| 7491 |
}{} |
| 7492 |
% \end{macrocode} |
| 7493 |
% |
| 7494 |
% \subsubsection{The \opt{shortalphabetic} option} |
| 7495 |
% \label{opt:shortalphabetic} |
| 7496 |
% |
| 7497 |
% \begin{macrocode} |
| 7498 |
\IfOption{shortalphabetic}{% |
| 7499 |
\def\bibtex@style{amsrs}% |
| 7500 |
\let\process@citelist\process@citelist@unsorted |
| 7501 |
\amsrefs@option@shortalphabetic |
| 7502 |
}{} |
| 7503 |
% \end{macrocode} |
| 7504 |
% |
| 7505 |
% \subsubsection{The \opt{backrefs} option} |
| 7506 |
% Rather than checking for the \opt{backrefs} option \emph{per se}, |
| 7507 |
% we check to see if the \pkg{backref} package is loaded. This |
| 7508 |
% accomodates authors who load the \pkg{backref} package explicitly |
| 7509 |
% but do not pass the \opt{backrefs} option to \pkg{amsrefs}. |
| 7510 |
% \begin{macrocode} |
| 7511 |
\AtBeginDocument{% |
| 7512 |
\@ifpackageloaded{backref}{% |
| 7513 |
\let\PrintBackRefs\print@backrefs |
| 7514 |
\let\BackCite\back@cite |
| 7515 |
% \end{macrocode} |
| 7516 |
% The \pkg{backref} package uses \cn{@starttoc} inside |
| 7517 |
% \cn{thebibliography} to open and read the \fn{.brf} file. We |
| 7518 |
% could do something similar with \cn{biblist}, but it seems |
| 7519 |
% cleaner to use \cn{AtBeginDocument}. Unfortunately, \cls{amsart} |
| 7520 |
% redefines \cn{@starttoc} in a way that interacts badly with this |
| 7521 |
% use. So, we inline the relevant parts of \cn{@starttoc} here. |
| 7522 |
% (The group and \cn{makeatletter} are unnecessary at present, but |
| 7523 |
% I'll leave them in as future-proofing.) |
| 7524 |
% \begin{macrocode} |
| 7525 |
\begingroup |
| 7526 |
\makeatletter |
| 7527 |
\@input{\jobname.brf}% |
| 7528 |
\if@filesw |
| 7529 |
\newwrite\tf@brf |
| 7530 |
\immediate\openout\tf@brf \jobname.brf\relax |
| 7531 |
\fi |
| 7532 |
\endgroup |
| 7533 |
}{}% |
| 7534 |
} |
| 7535 |
% \end{macrocode} |
| 7536 |
% |
| 7537 |
% \subsubsection{The \opt{citation-order} option} |
| 7538 |
% |
| 7539 |
% \begin{macrocode} |
| 7540 |
\IfOption{citation-order}{% |
| 7541 |
\IfOption{alphabetic}{% |
| 7542 |
\amsrefs@warning@nl{% |
| 7543 |
The citation-order and alphabetic options are |
| 7544 |
incompatible% |
| 7545 |
}% |
| 7546 |
}{ |
| 7547 |
\def\bibtex@style{amsru}% |
| 7548 |
} |
| 7549 |
}{} |
| 7550 |
% \end{macrocode} |
| 7551 |
% |
| 7552 |
% \subsubsection{The \opt{initials} option} |
| 7553 |
% |
| 7554 |
% \begin{macrocode} |
| 7555 |
\IfOption{initials}{% TRUE: |
| 7556 |
\BibSpec{nameLE}{ |
| 7557 |
+{}{}{initials} |
| 7558 |
+{}{\IfEmptyBibField{initials}{}{ }}{surname} |
| 7559 |
+{}{ }{jr} |
| 7560 |
} |
| 7561 |
|
| 7562 |
\BibSpec{nameBE}{ |
| 7563 |
+{}{}{surname} |
| 7564 |
+{}{ }{initials} |
| 7565 |
% +{}{ }{jr} |
| 7566 |
} |
| 7567 |
|
| 7568 |
\BibSpec{nameinverted}{ |
| 7569 |
+{} {} {surname} |
| 7570 |
+{,}{ } {initials} |
| 7571 |
+{,}{ } {jr} |
| 7572 |
} |
| 7573 |
}{% initials? FALSE: |
| 7574 |
% \let\extract@initials\@gobble |
| 7575 |
} % end conditional code for initials option |
| 7576 |
% \end{macrocode} |
| 7577 |
% |
| 7578 |
% \subsubsection{The \opt{logical-quotes} option} |
| 7579 |
% |
| 7580 |
% \begin{macro}{\deferredquotes} |
| 7581 |
% \begin{macrocode} |
| 7582 |
\let\deferredquotes\@empty |
| 7583 |
% \end{macrocode} |
| 7584 |
% \end{macro} |
| 7585 |
% |
| 7586 |
% \begin{macro}{\deferredquoteslogical} |
| 7587 |
% \begin{macrocode} |
| 7588 |
\IfOption{logical-quotes}{% |
| 7589 |
\def\deferredquoteslogical{\deferredquotes}% |
| 7590 |
}{% |
| 7591 |
\let\deferredquoteslogical\relax |
| 7592 |
} |
| 7593 |
% \end{macrocode} |
| 7594 |
% \end{macro} |
| 7595 |
% |
| 7596 |
% \subsubsection{The \opt{non-compressed-cites} option} |
| 7597 |
% |
| 7598 |
% \begin{macrocode} |
| 7599 |
\IfOption{non-compressed-cites}{% |
| 7600 |
\let\cite@compress\cite@print |
| 7601 |
}{} |
| 7602 |
% \end{macrocode} |
| 7603 |
% |
| 7604 |
% \subsubsection{The \opt{non-sorted-cites} option} |
| 7605 |
% |
| 7606 |
% \begin{macrocode} |
| 7607 |
\IfOption{non-sorted-cites}{% |
| 7608 |
\let\process@citelist\process@citelist@unsorted |
| 7609 |
}{} |
| 7610 |
% \end{macrocode} |
| 7611 |
% |
| 7612 |
% \subsubsection{The \opt{short-journals} option} |
| 7613 |
% |
| 7614 |
% \begin{macrocode} |
| 7615 |
\IfOption{short-journals}{% |
| 7616 |
\renewcommand{\DefineJournal}[4]{% |
| 7617 |
\bib*{#1}{periodical}{ |
| 7618 |
issn={#2}, |
| 7619 |
journal={#3}, |
| 7620 |
}% |
| 7621 |
} |
| 7622 |
}{} |
| 7623 |
% \end{macrocode} |
| 7624 |
% |
| 7625 |
% \subsubsection{The \opt{short-publishers} option} |
| 7626 |
% |
| 7627 |
% \begin{macrocode} |
| 7628 |
\IfOption{short-publishers}{% |
| 7629 |
\renewcommand{\DefinePublisher}[4]{% |
| 7630 |
\bib*{#1}{publisher}{% |
| 7631 |
publisher={#2},% |
| 7632 |
% \end{macrocode} |
| 7633 |
% Maybe \opt{short-publishers} should suppress the \fld{address}? Or |
| 7634 |
% is that a separate option? I sense a combinatorial explosion |
| 7635 |
% coming on.\ldots |
| 7636 |
% \begin{macrocode} |
| 7637 |
address={#4}, |
| 7638 |
}% |
| 7639 |
}% |
| 7640 |
}{} |
| 7641 |
% \end{macrocode} |
| 7642 |
% |
| 7643 |
% \subsubsection{The \opt{short-months} option} |
| 7644 |
% |
| 7645 |
% \begin{macrocode} |
| 7646 |
\IfOption{short-months}{% |
| 7647 |
\renewcommand{\bib@monthname}{% |
| 7648 |
\ifcase 0\bib@month |
| 7649 |
\or Jan.\or Feb.\or Mar.\or Apr.\or May\or June\or |
| 7650 |
July\or Aug.\or Sep.\or Oct.\or Nov.\or Dec.\or |
| 7651 |
Winter\or Spring\or Summer\or Fall\else Unknown Month% |
| 7652 |
\fi |
| 7653 |
}% |
| 7654 |
}{} |
| 7655 |
% \end{macrocode} |
| 7656 |
% |
| 7657 |
% \subsubsection{The \opt{y2k} option} |
| 7658 |
% |
| 7659 |
% \begin{macrocode} |
| 7660 |
\IfOption{y2k}{% |
| 7661 |
\IfOption{alphabetic}{% |
| 7662 |
\def\year@short#1\@nil{#1}% |
| 7663 |
\def\bibtex@style{amsry}% |
| 7664 |
}{% |
| 7665 |
\amsrefs@warning@nl{% |
| 7666 |
The y2k option can only be used with the^^J% |
| 7667 |
alphabetic option% |
| 7668 |
}% |
| 7669 |
} |
| 7670 |
}{} |
| 7671 |
% \end{macrocode} |
| 7672 |
% |
| 7673 |
% \subsubsection{The \opt{bibtex-style} option} |
| 7674 |
% |
| 7675 |
% \begin{macrocode} |
| 7676 |
\IfOption{bibtex-style}{% |
| 7677 |
\RequirePackage{amsbst} |
| 7678 |
}{} |
| 7679 |
% \end{macrocode} |
| 7680 |
% |
| 7681 |
% \subsubsection{The \opt{msc-links} option} |
| 7682 |
% |
| 7683 |
% \begin{macrocode} |
| 7684 |
\IfOption{msc-links}{% |
| 7685 |
% \end{macrocode} |
| 7686 |
% Unless you're using pdf\TeX, links cannot be broken across |
| 7687 |
% lines, which causes problems for long-form MR numbers such as |
| 7688 |
% ``MR2149145 (2006d:01012)''. To mitigate the problem, we |
| 7689 |
% manually break such numbers into two separate links. |
| 7690 |
% \begin{macrocode} |
| 7691 |
\@ifundefined{href}{}{% |
| 7692 |
\def\parse@MR#1 (#2)#3\@nil{% |
| 7693 |
\def\MR@url{http://www.ams.org/mathscinet-getitem?mr=#1}% |
| 7694 |
\def\@tempd{#1}% |
| 7695 |
\def\@tempe{#2}% |
| 7696 |
}% |
| 7697 |
\def\MRhref#1#2{% |
| 7698 |
\begingroup |
| 7699 |
\parse@MR#1 ()\@empty\@nil% |
| 7700 |
\href{\MR@url}{\@tempd\vphantom{()}}% |
| 7701 |
\ifx\@tempe\@empty |
| 7702 |
\else |
| 7703 |
\ \href{\MR@url}{(\@tempe)}% |
| 7704 |
\fi |
| 7705 |
\endgroup |
| 7706 |
}% |
| 7707 |
}{} |
| 7708 |
}{} |
| 7709 |
% \end{macrocode} |
| 7710 |
% |
| 7711 |
% \subsubsection{The \opt{author-year} option} |
| 7712 |
% |
| 7713 |
% Here ends the \pkg{amsrefs} package, unless the \opt{author-year} |
| 7714 |
% option is in effect; then we want to use some different |
| 7715 |
% bibspecs. |
| 7716 |
% \begin{macrocode} |
| 7717 |
\IfOption{author-year}{}{\PopCatcodes \endinput} |
| 7718 |
% \end{macrocode} |
| 7719 |
% |
| 7720 |
% \begin{macro}{\@biblistsetup} |
| 7721 |
% \begin{macrocode} |
| 7722 |
\renewcommand{\@biblistsetup}[1]{% |
| 7723 |
\RestrictedSetKeys{}{biblist}{\the\rsk@toks}{#1}% |
| 7724 |
\rkvIfEmpty{biblist}{prefix}{}{% |
| 7725 |
\amsrefs@warning{% |
| 7726 |
The `prefix' biblist option cannot be used\MessageBreak |
| 7727 |
with the author-year option.% |
| 7728 |
}% |
| 7729 |
}% |
| 7730 |
\rkvIfEmpty{biblist}{labels}{}{% |
| 7731 |
\amsrefs@warning{% |
| 7732 |
The `labels' biblist option cannot be used\MessageBreak |
| 7733 |
with the author-year option.% |
| 7734 |
}% |
| 7735 |
}% |
| 7736 |
} |
| 7737 |
% \end{macrocode} |
| 7738 |
% \end{macro} |
| 7739 |
% |
| 7740 |
% \begin{macro}{\generate@label} |
| 7741 |
% \begin{macrocode} |
| 7742 |
\def\generate@label{% |
| 7743 |
% \end{macrocode} |
| 7744 |
% If the user supplied an explicit \fld{label} field, we use it. |
| 7745 |
% Otherwise, we generate our own. |
| 7746 |
% \begin{macrocode} |
| 7747 |
\ifx\bib'label\@empty |
| 7748 |
\begingroup |
| 7749 |
% \end{macrocode} |
| 7750 |
% We begin by saving the previous stem and initializing the |
| 7751 |
% current stem to the empty string. |
| 7752 |
% \begin{macrocode} |
| 7753 |
\global\let\previous@stem\current@stem |
| 7754 |
\global\let\current@stem\@empty |
| 7755 |
\global\let\previous@year\current@year |
| 7756 |
\global\let\current@year\bib@year |
| 7757 |
% \end{macrocode} |
| 7758 |
% The list of primary contributors is available to us in |
| 7759 |
% \cs{current@primary} in the form |
| 7760 |
% \begin{quote} |
| 7761 |
% \cnm{name}{$\mathrm{Last}_1, \mathrm{First}_1$}% |
| 7762 |
% \cnm{name}{$\mathrm{Last}_2, \mathrm{First}_2$} |
| 7763 |
% \ldots |
| 7764 |
% \cnm{name}{$\mathrm{Last}_n, \mathrm{First}_n$} |
| 7765 |
% \end{quote} |
| 7766 |
% We will be executing this list multiple times with various |
| 7767 |
% definitions of \cs{name}. So the first thing we want to do is |
| 7768 |
% establish a safe environment and normalize the names. |
| 7769 |
% \begin{macrocode} |
| 7770 |
\@apply\auto@protect\amsrefs@textsymbols |
| 7771 |
\@apply\auto@protect\amsrefs@textaccents |
| 7772 |
\def\name##1{\@nx\name{\lnscan@a##1,\@nil}}% |
| 7773 |
\auto@protect\etaltext |
| 7774 |
\normalize@edef\current@stem{\current@primary}% |
| 7775 |
\xdef\current@stem{\current@stem}% |
| 7776 |
% \end{macrocode} |
| 7777 |
% At this point, the \cs{current@stem} is complete and we're ready |
| 7778 |
% to determine what (if any) suffix is needed to disambiguate |
| 7779 |
% it from the previous label. |
| 7780 |
% \begin{macrocode} |
| 7781 |
\calc@alpha@suffix |
| 7782 |
% \end{macrocode} |
| 7783 |
% We have all the pieces now. Arrange to end the current group and |
| 7784 |
% then define \cs{bib@label} in the enclosing group. (This keeps |
| 7785 |
% \cs{bib@label} from being defined outside the group started by |
| 7786 |
% \cs{bib@start}. This isn't strictly necessary, but it provides a |
| 7787 |
% bit of compartmentalization.) |
| 7788 |
% \begin{macrocode} |
| 7789 |
\edef\@tempa{% |
| 7790 |
\def\@nx\cite@label{\current@stem}% |
| 7791 |
\def\@nx\bib@label@year{% |
| 7792 |
\current@year |
| 7793 |
\alpha@label@suffix |
| 7794 |
}% |
| 7795 |
} |
| 7796 |
\@xp\endgroup |
| 7797 |
\@tempa |
| 7798 |
\fi |
| 7799 |
} |
| 7800 |
% \end{macrocode} |
| 7801 |
% \end{macro} |
| 7802 |
% |
| 7803 |
% \begin{macro}{\lnscan@a} |
| 7804 |
% \begin{macrocode} |
| 7805 |
\def\lnscan@a#1,#2\@nil{#1} |
| 7806 |
% \end{macrocode} |
| 7807 |
% \end{macro} |
| 7808 |
% |
| 7809 |
% \begin{macro}{\citesel@author} |
| 7810 |
% \begin{macrocode} |
| 7811 |
\def\citesel@author#1#2#3#4#5{\PrintCiteNames{#3}} |
| 7812 |
% \end{macrocode} |
| 7813 |
% \end{macro} |
| 7814 |
% |
| 7815 |
% \begin{macro}{\citesel@authoryear} |
| 7816 |
% \begin{macrocode} |
| 7817 |
\def\citesel@authoryear#1#2#3#4#5{\PrintCNY{#3}{#4}} |
| 7818 |
% \end{macrocode} |
| 7819 |
% \end{macro} |
| 7820 |
% |
| 7821 |
% \begin{macro}{\citesel@object} |
| 7822 |
% \begin{macrocode} |
| 7823 |
\def\citesel@object#1#2#3#4#5{\PrintCiteNames{#3} \citeleft#4} |
| 7824 |
% \end{macrocode} |
| 7825 |
% \end{macro} |
| 7826 |
% |
| 7827 |
% \begin{macro}{\citesel} |
| 7828 |
% \begin{macrocode} |
| 7829 |
\let\citesel\citesel@authoryear |
| 7830 |
% \end{macrocode} |
| 7831 |
% \end{macro} |
| 7832 |
% |
| 7833 |
% \begin{macro}{\citeleft} |
| 7834 |
% \begin{macrocode} |
| 7835 |
\def\citeleft{(}% |
| 7836 |
% \end{macrocode} |
| 7837 |
% \end{macro} |
| 7838 |
% |
| 7839 |
% \begin{macro}{\citeright} |
| 7840 |
% \begin{macrocode} |
| 7841 |
\def\citeright{)}% |
| 7842 |
% \end{macrocode} |
| 7843 |
% \end{macro} |
| 7844 |
% |
| 7845 |
% \begin{macro}{\@citeleft} |
| 7846 |
% \begin{macrocode} |
| 7847 |
\def\@citeleft{\ifx\citesel\citesel@object\else\citeleft\fi}% |
| 7848 |
% \end{macrocode} |
| 7849 |
% \end{macro} |
| 7850 |
% |
| 7851 |
% \begin{macro}{\citepunct} |
| 7852 |
% \begin{macrocode} |
| 7853 |
\def\citepunct{; } |
| 7854 |
% \end{macrocode} |
| 7855 |
% \end{macro} |
| 7856 |
% |
| 7857 |
% \begin{macro}{\BibLabel} |
| 7858 |
% \begin{macrocode} |
| 7859 |
\def\BibLabel{% |
| 7860 |
\Hy@raisedlink{\hyper@anchorstart{cite.\CurrentBib}\relax\hyper@anchorend}% |
| 7861 |
} |
| 7862 |
% \end{macrocode} |
| 7863 |
% \end{macro} |
| 7864 |
% |
| 7865 |
% \begin{macro}{\process@citelist} |
| 7866 |
% \begin{macrocode} |
| 7867 |
\let\process@citelist\process@citelist@unsorted |
| 7868 |
% \end{macrocode} |
| 7869 |
% \end{macro} |
| 7870 |
% |
| 7871 |
% \begin{macro}{\ycite} |
| 7872 |
% \begin{macrocode} |
| 7873 |
\DeclareRobustCommand{\ycite}[1]{% |
| 7874 |
\star@{\cite@a\citesel@year{#1}}{}% |
| 7875 |
} |
| 7876 |
% \end{macrocode} |
| 7877 |
% \end{macro} |
| 7878 |
% |
| 7879 |
% \begin{macro}{\ycites} |
| 7880 |
% \begin{macrocode} |
| 7881 |
\DeclareRobustCommand{\ycites}[1]{% |
| 7882 |
\begingroup |
| 7883 |
\def\citepunct{, }% |
| 7884 |
\let\citesel\citesel@year |
| 7885 |
\cites{#1}% |
| 7886 |
\endgroup |
| 7887 |
} |
| 7888 |
% \end{macrocode} |
| 7889 |
% \end{macro} |
| 7890 |
% |
| 7891 |
% \begin{macro}{\citeyear} |
| 7892 |
% \begin{macrocode} |
| 7893 |
\DeclareRobustCommand{\citeyear}[1]{% |
| 7894 |
\begingroup |
| 7895 |
\let\citeleft\@empty |
| 7896 |
\let\citeright\@empty |
| 7897 |
\star@{\cite@a\citesel@year{#1}}{}% |
| 7898 |
\endgroup |
| 7899 |
} |
| 7900 |
% \end{macrocode} |
| 7901 |
% \end{macro} |
| 7902 |
% |
| 7903 |
% \begin{macro}{\ocite} |
| 7904 |
% \begin{macrocode} |
| 7905 |
\DeclareRobustCommand{\ocite}[1]{% |
| 7906 |
\star@{\cite@a\citesel@object{#1}}{}% |
| 7907 |
} |
| 7908 |
% \end{macrocode} |
| 7909 |
% \end{macro} |
| 7910 |
% |
| 7911 |
% \begin{macro}{\ocites} |
| 7912 |
% \begin{macrocode} |
| 7913 |
\DeclareRobustCommand{\ocites}[1]{% |
| 7914 |
\begingroup |
| 7915 |
\let\@citelist\@ocitelist |
| 7916 |
\cites{#1}% |
| 7917 |
\endgroup |
| 7918 |
} |
| 7919 |
% \end{macrocode} |
| 7920 |
% \end{macro} |
| 7921 |
% |
| 7922 |
% \begin{macro}{\ocitelist} |
| 7923 |
% \begin{macrocode} |
| 7924 |
\def\@ocitelist#1{% |
| 7925 |
\PrintSeries{\InnerCite}% |
| 7926 |
{\ocite}% |
| 7927 |
{}{ and \ocite}% |
| 7928 |
% \end{macrocode} |
| 7929 |
% For three or more names: print `et al' instead of the last name. |
| 7930 |
% Have to putz around with the space factor a bit or the comma |
| 7931 |
% between name and year will not be applied. |
| 7932 |
% \begin{macrocode} |
| 7933 |
{,}{ \ocite}% |
| 7934 |
{,}{ and \ocite}% |
| 7935 |
{}% |
| 7936 |
{#1}% |
| 7937 |
{}% |
| 7938 |
} |
| 7939 |
% \end{macrocode} |
| 7940 |
% \end{macro} |
| 7941 |
% |
| 7942 |
% \begin{macro}{\citeauthor} |
| 7943 |
% \begin{macrocode} |
| 7944 |
\DeclareRobustCommand{\citeauthor}[1]{% |
| 7945 |
\star@{\cite@a\citesel@author{#1}}{}% |
| 7946 |
} |
| 7947 |
% \end{macrocode} |
| 7948 |
% \end{macro} |
| 7949 |
% |
| 7950 |
% \begin{macro}{\citeauthory} |
| 7951 |
% \begin{macrocode} |
| 7952 |
\DeclareRobustCommand{\citeauthory}[1]{% |
| 7953 |
\citeauthor{#1} \ycite{#1}% |
| 7954 |
} |
| 7955 |
% \end{macrocode} |
| 7956 |
% \end{macro} |
| 7957 |
% |
| 7958 |
% \begin{macro}{\fullcite} |
| 7959 |
% \begin{macrocode} |
| 7960 |
\DeclareRobustCommand{\fullcite}[1]{% |
| 7961 |
\begingroup |
| 7962 |
\let\print@citenames\CiteNamesFull |
| 7963 |
\star@{\cite@a\citesel@authoryear{#1}}{}% |
| 7964 |
\endgroup |
| 7965 |
} |
| 7966 |
% \end{macrocode} |
| 7967 |
% \end{macro} |
| 7968 |
% |
| 7969 |
% \begin{macro}{\fullocite} |
| 7970 |
% \begin{macrocode} |
| 7971 |
\DeclareRobustCommand{\fullocite}[1]{% |
| 7972 |
\begingroup |
| 7973 |
\let\print@citenames\CiteNamesFull |
| 7974 |
\star@{\cite@a\citesel@object{#1}}{}% |
| 7975 |
\endgroup |
| 7976 |
} |
| 7977 |
% \end{macrocode} |
| 7978 |
% \end{macro} |
| 7979 |
% |
| 7980 |
% Invert the first author's name. |
| 7981 |
% \begin{macrocode} |
| 7982 |
\def\set@firstname#1{% |
| 7983 |
\set@name{#1}\setbib@nameinverted |
| 7984 |
} |
| 7985 |
% \end{macrocode} |
| 7986 |
% |
| 7987 |
% \begin{macro}{\PrintCNY} |
| 7988 |
% \begin{macrocode} |
| 7989 |
\def\PrintCNY#1#2{% |
| 7990 |
\PrintCiteNames{#1}% |
| 7991 |
\@ifnotempty{#2}{\@addpunct{,} #2}% |
| 7992 |
} |
| 7993 |
% \end{macrocode} |
| 7994 |
% \end{macro} |
| 7995 |
% |
| 7996 |
% \begin{macro}{\PrintCiteNames} |
| 7997 |
% \begin{macrocode} |
| 7998 |
\def\PrintCiteNames#1{% |
| 7999 |
\leavevmode |
| 8000 |
\def\@tempa{#1}% |
| 8001 |
\ifx\@tempa\prev@names |
| 8002 |
\else |
| 8003 |
\gdef\prev@names{#1}% |
| 8004 |
\@xp\ifx\@car#1.\@nil\CitePrintUndefined |
| 8005 |
#1\relax |
| 8006 |
\else |
| 8007 |
\print@citenames{#1}% |
| 8008 |
\fi |
| 8009 |
\fi |
| 8010 |
} |
| 8011 |
% \end{macrocode} |
| 8012 |
% \end{macro} |
| 8013 |
% |
| 8014 |
% \begin{macro}{\CiteNames} |
| 8015 |
% \begin{macrocode} |
| 8016 |
\newcommand{\CiteNames}[1]{% |
| 8017 |
\PrintSeries{\name}% |
| 8018 |
{}% |
| 8019 |
{}{ and }% |
| 8020 |
% \end{macrocode} |
| 8021 |
% For three or more names: print `et al' instead of the last name. |
| 8022 |
% Have to putz around with the space factor a bit or the comma |
| 8023 |
% between name and year will not be applied. |
| 8024 |
% \begin{macrocode} |
| 8025 |
{}{\@gobble}% |
| 8026 |
{}{ \etaltext\@\@gobble}% |
| 8027 |
{}% |
| 8028 |
{#1}% |
| 8029 |
{}% |
| 8030 |
} |
| 8031 |
% \end{macrocode} |
| 8032 |
% \end{macro} |
| 8033 |
% |
| 8034 |
% \begin{macro}{\print@citenames} |
| 8035 |
% \begin{macrocode} |
| 8036 |
\let\print@citenames\CiteNames |
| 8037 |
% \end{macrocode} |
| 8038 |
% \end{macro} |
| 8039 |
% |
| 8040 |
% \begin{macro}{\CiteNamesFull} |
| 8041 |
% \begin{macrocode} |
| 8042 |
\newcommand{\CiteNamesFull}[1]{% |
| 8043 |
\PrintSeries{\name}% |
| 8044 |
{}% |
| 8045 |
{}{ and }% |
| 8046 |
% \end{macrocode} |
| 8047 |
% For three or more names: print `et al' instead of the last name. |
| 8048 |
% Have to putz around with the space factor a bit or the comma |
| 8049 |
% between name and year will not be applied. |
| 8050 |
% \begin{macrocode} |
| 8051 |
{,}{ }% |
| 8052 |
{,}{ and }% |
| 8053 |
{}% |
| 8054 |
{#1}% |
| 8055 |
{}% |
| 8056 |
} |
| 8057 |
% \end{macrocode} |
| 8058 |
% \end{macro} |
| 8059 |
% |
| 8060 |
% \begin{macro}{\PrintDate} |
| 8061 |
% No parentheses around the year. |
| 8062 |
% \begin{macrocode} |
| 8063 |
\renewcommand{\PrintDate}[1]{\bib@label@year} |
| 8064 |
% \end{macrocode} |
| 8065 |
% \end{macro} |
| 8066 |
% |
| 8067 |
% \begin{macro}{\print@date} |
| 8068 |
% Only print the year, not the month or day. |
| 8069 |
% \begin{macrocode} |
| 8070 |
\def\print@date{% |
| 8071 |
\IfEmptyBibField{date}{% |
| 8072 |
\IfEmptyBibField{year}{\BibField{status}}{\bib@year}% |
| 8073 |
}{% |
| 8074 |
\bib@year |
| 8075 |
}% |
| 8076 |
} |
| 8077 |
% \end{macrocode} |
| 8078 |
% \end{macro} |
| 8079 |
% |
| 8080 |
% \begin{macrocode} |
| 8081 |
\BibSpec{article}{% |
| 8082 |
+{} {\PrintAuthors} {author} |
| 8083 |
+{.} { \PrintDate} {date} |
| 8084 |
+{.} { \textit} {title} |
| 8085 |
+{.} { } {part} |
| 8086 |
+{:} { \textit} {subtitle} |
| 8087 |
+{,} { \PrintContributions} {contribution} |
| 8088 |
+{.} { \PrintPartials} {partial} |
| 8089 |
+{,} { } {journal} |
| 8090 |
+{} { \textbf} {volume} |
| 8091 |
+{,} { \issuetext} {number} |
| 8092 |
+{,} { \eprintpages} {pages} |
| 8093 |
+{,} { } {status} |
| 8094 |
+{,} { \PrintDOI} {doi} |
| 8095 |
+{,} { available at \eprint} {eprint} |
| 8096 |
+{} { \parenthesize} {language} |
| 8097 |
+{} { \PrintTranslation} {translation} |
| 8098 |
+{;} { \PrintReprint} {reprint} |
| 8099 |
+{.} { } {note} |
| 8100 |
+{.} {} {transition} |
| 8101 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 8102 |
} |
| 8103 |
|
| 8104 |
\BibSpec{book}{% |
| 8105 |
+{} {\PrintPrimary} {transition} |
| 8106 |
+{.} { \PrintDate} {date} |
| 8107 |
+{.} { \textit} {title} |
| 8108 |
+{.} { } {part} |
| 8109 |
+{:} { \textit} {subtitle} |
| 8110 |
+{,} { \PrintEdition} {edition} |
| 8111 |
+{} { \PrintEditorsB} {editor} |
| 8112 |
+{,} { \PrintTranslatorsC} {translator} |
| 8113 |
+{,} { \PrintContributions} {contribution} |
| 8114 |
+{,} { } {series} |
| 8115 |
+{,} { \voltext} {volume} |
| 8116 |
+{,} { } {publisher} |
| 8117 |
+{,} { } {organization} |
| 8118 |
+{,} { } {address} |
| 8119 |
+{,} { } {status} |
| 8120 |
+{} { \parenthesize} {language} |
| 8121 |
+{} { \PrintTranslation} {translation} |
| 8122 |
+{;} { \PrintReprint} {reprint} |
| 8123 |
+{.} { } {note} |
| 8124 |
+{.} {} {transition} |
| 8125 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 8126 |
} |
| 8127 |
|
| 8128 |
\BibSpec{collection.article}{% |
| 8129 |
+{} {\PrintAuthors} {author} |
| 8130 |
+{.} { \PrintDate} {date} |
| 8131 |
+{.} { \textit} {title} |
| 8132 |
+{.} { } {part} |
| 8133 |
+{:} { \textit} {subtitle} |
| 8134 |
+{,} { \PrintContributions} {contribution} |
| 8135 |
+{,} { \PrintConference} {conference} |
| 8136 |
+{} {\PrintBook} {book} |
| 8137 |
+{,} { } {booktitle} |
| 8138 |
+{,} { pp.~} {pages} |
| 8139 |
+{,} { } {status} |
| 8140 |
+{,} { \PrintDOI} {doi} |
| 8141 |
+{,} { available at \eprint} {eprint} |
| 8142 |
+{} { \parenthesize} {language} |
| 8143 |
+{} { \PrintTranslation} {translation} |
| 8144 |
+{;} { \PrintReprint} {reprint} |
| 8145 |
+{.} { } {note} |
| 8146 |
+{.} {} {transition} |
| 8147 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 8148 |
} |
| 8149 |
|
| 8150 |
\BibSpec{report}{% |
| 8151 |
+{} {\PrintPrimary} {transition} |
| 8152 |
+{.} { \PrintDate} {date} |
| 8153 |
+{.} { \textit} {title} |
| 8154 |
+{.} { } {part} |
| 8155 |
+{:} { \textit} {subtitle} |
| 8156 |
+{,} { \PrintEdition} {edition} |
| 8157 |
+{,} { \PrintContributions} {contribution} |
| 8158 |
+{,} { Technical Report } {number} |
| 8159 |
+{,} { } {series} |
| 8160 |
+{,} { } {organization} |
| 8161 |
+{,} { } {address} |
| 8162 |
+{,} { \eprint} {eprint} |
| 8163 |
+{,} { } {status} |
| 8164 |
+{} { \parenthesize} {language} |
| 8165 |
+{} { \PrintTranslation} {translation} |
| 8166 |
+{;} { \PrintReprint} {reprint} |
| 8167 |
+{.} { } {note} |
| 8168 |
+{.} {} {transition} |
| 8169 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 8170 |
} |
| 8171 |
|
| 8172 |
\BibSpec{thesis}{% |
| 8173 |
+{} {\PrintAuthors} {author} |
| 8174 |
+{.} { \PrintDate} {date} |
| 8175 |
+{.} { \textit} {title} |
| 8176 |
+{:} { \textit} {subtitle} |
| 8177 |
+{,} { \PrintThesisType} {type} |
| 8178 |
+{,} { } {organization} |
| 8179 |
+{,} { } {address} |
| 8180 |
+{,} { \eprint} {eprint} |
| 8181 |
+{,} { } {status} |
| 8182 |
+{} { \parenthesize} {language} |
| 8183 |
+{} { \PrintTranslation} {translation} |
| 8184 |
+{;} { \PrintReprint} {reprint} |
| 8185 |
+{.} { } {note} |
| 8186 |
+{.} {} {transition} |
| 8187 |
+{} {\SentenceSpace \PrintReviews} {review} |
| 8188 |
} |
| 8189 |
|
| 8190 |
\BibSpec{webpage}{% |
| 8191 |
+{} {\PrintAuthors} {author} |
| 8192 |
+{.} { \PrintDate} {date} |
| 8193 |
+{.} { \emph} {title} |
| 8194 |
+{:} { \emph} {subtitle} |
| 8195 |
+{,} { \url} {url} |
| 8196 |
+{.} { Accessed \PrintDateField} {accessdate} |
| 8197 |
+{.} { } {note} |
| 8198 |
+{.} {} {transition} |
| 8199 |
} |
| 8200 |
% \end{macrocode} |
| 8201 |
% |
| 8202 |
% \begin{macrocode} |
| 8203 |
\PopCatcodes |
| 8204 |
%</pkg> |
| 8205 |
% \end{macrocode} |
| 8206 |
% |
| 8207 |
% \subsection{The \pkg{amsbst} package} |
| 8208 |
% |
| 8209 |
% \begin{macrocode} |
| 8210 |
%<*bst> |
| 8211 |
% \end{macrocode} |
| 8212 |
% |
| 8213 |
% \begin{macrocode} |
| 8214 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 8215 |
\ProvidesPackage{amsbst}[2013/03/07 v2.14] |
| 8216 |
%\RequirePackage{amsrefs}[2004/03/29] |
| 8217 |
% \end{macrocode} |
| 8218 |
% |
| 8219 |
% \begin{macrocode} |
| 8220 |
\BibSpec{article}{% |
| 8221 |
+{} {\PrintAuthors} {author} |
| 8222 |
+{.} { } {title} |
| 8223 |
+{.} { } {part} |
| 8224 |
+{:} { } {subtitle} |
| 8225 |
+{.} { \PrintContributions} {contribution} |
| 8226 |
+{.} { \PrintPartials} {partial} |
| 8227 |
+{.} { \emph} {journal} |
| 8228 |
+{} { } {volume} |
| 8229 |
+{} { \parenthesize} {number} |
| 8230 |
+{:} {} {pages} |
| 8231 |
+{,} { \PrintDateB} {date} |
| 8232 |
+{,} { } {status} |
| 8233 |
+{.} { \PrintTranslation} {translation} |
| 8234 |
+{.} { Reprinted in \PrintReprint} {reprint} |
| 8235 |
+{.} { } {note} |
| 8236 |
+{.} {} {transition} |
| 8237 |
} |
| 8238 |
|
| 8239 |
\BibSpec{partial}{% |
| 8240 |
+{} {} {part} |
| 8241 |
+{:} { } {subtitle} |
| 8242 |
+{.} { \PrintContributions} {contribution} |
| 8243 |
+{.} { \emph} {journal} |
| 8244 |
+{} { } {volume} |
| 8245 |
+{} { \parenthesize} {number} |
| 8246 |
+{:} {} {pages} |
| 8247 |
+{,} { \PrintDateB} {date} |
| 8248 |
} |
| 8249 |
|
| 8250 |
\BibSpec{book}{% |
| 8251 |
+{} {\PrintPrimary} {transition} |
| 8252 |
+{.} { \emph} {title} |
| 8253 |
+{.} { } {part} |
| 8254 |
+{:} { \emph} {subtitle} |
| 8255 |
+{.} { } {series} |
| 8256 |
+{,} { \voltext} {volume} |
| 8257 |
+{.} { Edited by \PrintNameList} {editor} |
| 8258 |
+{.} { Translated by \PrintNameList}{translator} |
| 8259 |
+{.} { \PrintContributions} {contribution} |
| 8260 |
+{.} { } {publisher} |
| 8261 |
+{.} { } {organization} |
| 8262 |
+{,} { } {address} |
| 8263 |
+{,} { \PrintEdition} {edition} |
| 8264 |
+{,} { \PrintDateB} {date} |
| 8265 |
+{.} { } {note} |
| 8266 |
+{.} {} {transition} |
| 8267 |
+{.} { \PrintTranslation} {translation} |
| 8268 |
+{.} { Reprinted in \PrintReprint} {reprint} |
| 8269 |
+{.} {} {transition} |
| 8270 |
} |
| 8271 |
|
| 8272 |
\BibSpec{collection.article}{% |
| 8273 |
+{} {\PrintAuthors} {author} |
| 8274 |
+{.} { } {title} |
| 8275 |
+{.} { } {part} |
| 8276 |
+{:} { } {subtitle} |
| 8277 |
+{.} { \PrintContributions} {contribution} |
| 8278 |
+{.} { \PrintConference} {conference} |
| 8279 |
+{.} { \PrintBook} {book} |
| 8280 |
+{.} { In } {booktitle} |
| 8281 |
+{,} { pages~} {pages} |
| 8282 |
+{.} { \PrintDateB} {date} |
| 8283 |
+{.} { \PrintTranslation} {translation} |
| 8284 |
+{.} { Reprinted in \PrintReprint} {reprint} |
| 8285 |
+{.} { } {note} |
| 8286 |
+{.} {} {transition} |
| 8287 |
} |
| 8288 |
|
| 8289 |
\BibSpec{conference}{% |
| 8290 |
+{} {} {title} |
| 8291 |
+{} {\PrintConferenceDetails} {transition} |
| 8292 |
} |
| 8293 |
|
| 8294 |
\BibSpec{innerbook}{% |
| 8295 |
+{.} { \emph} {title} |
| 8296 |
+{.} { } {part} |
| 8297 |
+{:} { \emph} {subtitle} |
| 8298 |
+{.} { } {series} |
| 8299 |
+{,} { \voltext} {volume} |
| 8300 |
+{.} { Edited by \PrintNameList} {editor} |
| 8301 |
+{.} { Translated by \PrintNameList}{translator} |
| 8302 |
+{.} { \PrintContributions} {contribution} |
| 8303 |
+{.} { } {publisher} |
| 8304 |
+{.} { } {organization} |
| 8305 |
+{,} { } {address} |
| 8306 |
+{,} { \PrintEdition} {edition} |
| 8307 |
+{,} { \PrintDateB} {date} |
| 8308 |
+{.} { } {note} |
| 8309 |
+{.} {} {transition} |
| 8310 |
} |
| 8311 |
|
| 8312 |
\BibSpec{report}{% |
| 8313 |
+{} {\PrintPrimary} {transition} |
| 8314 |
+{.} { \emph} {title} |
| 8315 |
+{.} { } {part} |
| 8316 |
+{:} { \emph} {subtitle} |
| 8317 |
+{.} { \PrintContributions} {contribution} |
| 8318 |
+{.} { Technical Report } {number} |
| 8319 |
+{,} { } {series} |
| 8320 |
+{.} { } {organization} |
| 8321 |
+{,} { } {address} |
| 8322 |
+{,} { \PrintDateB} {date} |
| 8323 |
+{.} { \PrintTranslation} {translation} |
| 8324 |
+{.} { Reprinted in \PrintReprint} {reprint} |
| 8325 |
+{.} { } {note} |
| 8326 |
+{.} {} {transition} |
| 8327 |
} |
| 8328 |
|
| 8329 |
\BibSpec{thesis}{% |
| 8330 |
+{} {\PrintAuthors} {author} |
| 8331 |
+{,} { \emph} {title} |
| 8332 |
+{:} { \emph} {subtitle} |
| 8333 |
+{.} { \PrintThesisType} {type} |
| 8334 |
+{.} { } {organization} |
| 8335 |
+{,} { } {address} |
| 8336 |
+{,} { \PrintDateB} {date} |
| 8337 |
+{.} { \PrintTranslation} {translation} |
| 8338 |
+{.} { Reprinted in \PrintReprint} {reprint} |
| 8339 |
+{.} { } {note} |
| 8340 |
+{.} {} {transition} |
| 8341 |
} |
| 8342 |
|
| 8343 |
\BibSpec{webpage}{% |
| 8344 |
+{} {\PrintAuthors} {author} |
| 8345 |
+{.} { } {title} |
| 8346 |
+{:} { } {subtitle} |
| 8347 |
+{.} { \PrintDateB} {date} |
| 8348 |
+{.} { \url} {url} |
| 8349 |
+{.} { Accessed \PrintDateField} {accessdate} |
| 8350 |
+{.} { } {note} |
| 8351 |
+{.} {} {transition} |
| 8352 |
} |
| 8353 |
% \end{macrocode} |
| 8354 |
% |
| 8355 |
% \begin{macro}{\PrintEditorsA} |
| 8356 |
% When we consider editor names we have to think about some further |
| 8357 |
% complications. First, for the case of a book where editor names are |
| 8358 |
% listed in place of author names, just copy the same style with a |
| 8359 |
% bit of added text at the end. |
| 8360 |
% \begin{macrocode} |
| 8361 |
\renewcommand{\PrintEditorsA}[1]{% |
| 8362 |
\def\current@bibfield{\bib'editor}% |
| 8363 |
\PrintNames{}{, editor\Plural{s}}{#1}% |
| 8364 |
\erase@field\bib'editor |
| 8365 |
} |
| 8366 |
% \end{macrocode} |
| 8367 |
% \end{macro} |
| 8368 |
% |
| 8369 |
% \begin{macro}{\PrintTranslatorsA} |
| 8370 |
% \begin{macrocode} |
| 8371 |
\renewcommand{\PrintTranslatorsA}[1]{% |
| 8372 |
\def\current@bibfield{\bib'translator}% |
| 8373 |
\PrintNames{}{, translator\Plural{s}}{#1}% |
| 8374 |
\erase@field\bib'translator |
| 8375 |
} |
| 8376 |
% \end{macrocode} |
| 8377 |
% \end{macro} |
| 8378 |
% |
| 8379 |
% \begin{macrocode} |
| 8380 |
%</bst> |
| 8381 |
% \end{macrocode} |
| 8382 |
% |
| 8383 |
% The usual \cs{endinput} to ensure that random garbage at the end of |
| 8384 |
% the file doesn't get copied by \fn{docstrip}. |
| 8385 |
% \begin{macrocode} |
| 8386 |
\endinput |
| 8387 |
% \end{macrocode} |
| 8388 |
% |
| 8389 |
% \Finale |