Debian Codegraph @

texmf-dist/source/latex/chembst/chembst.dtx

raw
1 % \iffalse
2 %
3 %% File: chembst.dtx Copyright (C) 2008 Stephan Schenk
4 %% $Id: chembst.dtx,v 1.12 2008/09/17 19:07:16 schenk Exp $
5 %%
6 %% Stephan Schenk ([email protected])
7 %%
8 %% This program may be distributed and/or modified under the
9 %% conditions of the LaTeX Project Public License, either version 1.3
10 %% of this license or (at your option) any later version.
11 %% The latest version of this license is in
12 %% http://www.latex-project.org/lppl.txt
13 %%
14 %% *****
15 %%
16 % This package consists of the files chembst.dtx and chembst.ins
17 %
18 % To typeset this documentation use
19 %
20 % pdflatex chembst.dtx
21 % makeindex -s gind.ist chembst.idx
22 % makeindex -s gglo.ist -o chembst.gls chembst.glo
23 % pdflatex chembst.dtx
24 %
25 %
26 % The following journals can be selected:
27 % - ChemCommun
28 % - ChemEurJ
29 % - InorgChem
30 % - JAmChemSoc
31 %
32 % The following additional selection rules exist:
33 % - cv
34 % Create a style file for a curriculum vitae.
35 % - namesone
36 % Truncate list of names to one and append et al.
37 % Works only if more names than specified by *name options are present.
38 % - tennames
39 % If a list contains more than ten names it is truncated.
40 % See names* options
41 % - fifteennames
42 % Same as tennames but with 16 names.
43 %
44 %
45 %
46 %<*driver>
47 \ProvidesFile{chembst.dtx}
48 [2008/09/17 0.2.5 BibTeX style files for chemistry journals]
49 \documentclass{ltxdoc}
50 \GetFileInfo{chembst.dtx}
51 \CodelineIndex
52 \RecordChanges
53 %\OnlyDescription
54 \begin{document}
55 \DocInput{\filename}
56 \end{document}
57 %</driver>
58 % \fi
59 %
60 % \CheckSum{175}
61 %
62 % \CharacterTable
63 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
64 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
65 % Digits \0\1\2\3\4\5\6\7\8\9
66 % Exclamation \! Double quote \" Hash (number) \#
67 % Dollar \$ Percent \% Ampersand \&
68 % Acute accent \' Left paren \( Right paren \)
69 % Asterisk \* Plus \+ Comma \,
70 % Minus \- Point \. Solidus \/
71 % Colon \: Semicolon \; Less than \<
72 % Equals \= Greater than \> Question mark \?
73 % Commercial at \@ Left bracket \[ Backslash \\
74 % Right bracket \] Circumflex \^ Underscore \_
75 % Grave accent \` Left brace \{ Vertical bar \|
76 % Right brace \} Tilde \~}
77 %
78 % ^^A Cheat on doc.sty since this BibTeX commands do not start with '\'
79 % \renewcommand*{\bslash}{}
80 % ^^A Suppress index entries for \DescribeMacro{}
81 % \makeatletter\let\SpecialUsageIndex=\@gobble\makeatother
82 %
83 % ^^A For some reason I don't understand right now the counter has to be
84 % ^^A set to 0. doc.dtx states that this is the default anyway.
85 % \setcounter{StandardModuleDepth}{0}
86 %
87 % \changes{0.2.5}{2008/09/17}{Minor documentation updates}
88 % \changes{0.2.4}{2008/03/18}{Removed number of pages from papers with EID in
89 % all styles except 'cv'.}
90 % \changes{0.2.3}{2008/01/17}{Fixed some minor issues with ACS styles.}
91 % \changes{0.2.2}{2007/09/13}{JAmChemSoc now requires truncation of author list
92 % after more than 15 names only.}
93 % \changes{0.2.2}{2007/09/13}{Added InorgChem.bst}
94 % \changes{0.2.0}{2006/07/27}{Renamed european.bst to ChemEurJ.bst}
95 % \changes{0.2.0}{2006/07/27}{Renamed american.bst to JAmChemSoc.bst}
96 % \changes{0.2.0}{2006/07/27}{Added support for Chem. Commun.}
97 % \changes{0.1.2}{2006/05/03}{Added support for a curriculum vitae}
98 % \changes{0.1.2}{2006/05/03}{Removed unused function add.blank}
99 % \changes{0.1.0}{2006/02/23}{Initial revision}
100 % \title{\BibTeX\ Style Files for Chemistry Journals\thanks{This file
101 % describes version \fileversion\ and has been last revised \filedate.}}
102 % \author{Stephan Schenk\\mail (at) schenk-stephan.de}
103 % \maketitle
104 %
105 % \setcounter{tocdepth}{2}
106 % \tableofcontents
107 %
108 % \section{Introduction}
109 %
110 % This collection of bibtex style files started with a version intended for
111 % \emph{Chem.\ Eur.~J.} The base version of it was created using the
112 % marvelous |makebst| program by Patrick W.~Daly. Soon afterwards, a version for
113 % \emph{J.~Am.\ Chem.\ Soc.}\ was available, too. With changes to both files
114 % becoming more and more complex, everything was merged into a single
115 % |chembst.dtx| file to avoid maintaining several versions of the code. Using
116 % the |docstrip| utility, the different style files can now easily be generated
117 % by running |latex chembst.ins|.
118 % Currently, the following journals are supported:
119 % \begin{itemize}
120 % \item \emph{Chem.\ Commun.}\ (|ChemCommun.bst|)
121 % \item \emph{Inorg.\ Chem.}\ (|InorgChem.bst|), which can be used for
122 % most of the journals published by the American Chemical Society
123 % \item \emph{J.~Am.\ Chem.\ Soc.}\ (|JAmChemSoc.bst|)
124 % \item \emph{Chem.\ Eur.~J.}\ (|ChemEurJ.bst|), which can be used for most of
125 % the journals published by Wiley
126 % \end{itemize}
127 % Additionally, the following styles are also supported:
128 % \begin{itemize}
129 % \item \emph{Curriculum vitae} (|cv.bst|), a style similar to \emph{Chem.\
130 % Eur.~J.} that includes the title of an article
131 % \end{itemize}
132 %
133 %
134 %
135 % \section{Some notes}
136 %
137 % \subsection{crossref entries}
138 % \label{o::crossref}
139 %
140 % The crossref feature is described in detail in the |btxdoc.dvi| \BibTeX\
141 % documentation. Using crossref is a way to inherit information from a parent
142 % entry. As an example consider a database containing a @book entry for citing
143 % the whole book and a @inbook entry for citing some pages from that book.
144 % Naturally, the only difference between both entries is that @inbook contains
145 % a |pages| field. All the other information is stored redundantly.
146 %
147 % Using the crossref feature the @inbook entry can be as simple as
148 % \begin{verbatim}
149 % @inbook{inbook_key,
150 % crossref = {book_key},
151 % pages = {1-5},
152 % }
153 % \end{verbatim}
154 % All the other fields (author, publisher, year etc.) are inherited from the
155 % parent entry with the key |book_key|.
156 %
157 % If you do not cite the whole book in your document, i.\,e.\ the document does
158 % not contain |\cite{book_key}|, the following will happen. If |book_key| is
159 % not cross-referenced more than once\footnote{%
160 % You can change that number by passing the argument |-min-crossrefs=number|
161 % to bibtex.}
162 % everything will look perfectly like a ``normal'' @inbook entry. However, if
163 % |book_key| is cross-referenced more than once, the entry corresponding to the
164 % whole book will be added automatically to the bibliography and the @inbook
165 % entry will be formatted as A. Author in |\cite{book_key}|,
166 % pages 1-5.\footnote{%
167 % In fact \cs{bibliographycite} is used. See section~\ref{o::customization}
168 % for details.}
169 % If your document does contain |\cite{book_key}| you will always get the
170 % crossref format.
171 %
172 % This applies to entries of type @inbook, @incollection and @inproceedings.
173 %
174 %
175 %
176 % \subsection{JAmChemSoc.bst}
177 %
178 % The Journal of the American Chemical Society (ACS) now requires
179 % that for citations with more than 10 authors the list of authors is
180 % abbreviated by giving only the first author followed by \emph{et al.} The
181 % style file |JAmChemSoc.bst| automatically takes care of that. However, ACS
182 % also
183 % requires that for those citations the full list of authors should be given as
184 % Supporting Information. The style |JAmChemSoc_all.bst| can be used for this
185 % purpose, since it does not abbreviate the list of authors.
186 %
187 %
188 %
189 % \subsection{Customization}
190 % \label{o::customization}
191 %
192 % Defaults for several commands used in the |thebibliography| environment are
193 % defined at the beginning of the |.bbl| file. To override the default settings
194 % define the command before using the \mbox{\cs{bibliography}} command.
195 %
196 %
197 % \DescribeMacro{\url}
198 % The \cs{url} command is used to display urls. By default this only selects a
199 % typewriter font. However, it is strongly recommened, that you use the package
200 % |url.sty| which defines \cs{url} in a more sophisticated way. Due to some
201 % problems with multiline urls (spurious '\%' in formatted url) you should use
202 % some reasonable new version (3.2 works fine) of |url.sty|.
203 %
204 %
205 % \DescribeMacro{\urlprefix}
206 % Every \cs{url} is prefixed by \cs{urlprefix}. By default \cs{urlprefix} does
207 % nothing. This command is useful if you have to prepend every url with some
208 % text. For \emph{Angew.\ Chem.}, i.\,e., every url must be preceded by ``to be
209 % found under''. This can easily be achieved by giving
210 % \begin{verbatim}
211 % \newcommand{\urlprefix}{to be found under }
212 % \end{verbatim}
213 %
214 %
215 % \DescribeMacro{\foreignlanguage}
216 % This command is used to temporary switch the language for the title of books
217 % etc. By default this does nothing but if you load |babel.sty| then the
218 % language will be changed.
219 %
220 %
221 % \DescribeMacro{\bibliographycite}
222 % This command is used for formatting crossref entries. It defaults to
223 % \cs{cite}. However, if you use |overcite.sty| you may not want superscripted
224 % citations in your bibliography. Then you can define \cs{bibliographycite} the
225 % following way
226 % \begin{verbatim}
227 % \newcommand{\bibliographycite}[1]{[\citen{#1}]}}
228 % \end{verbatim}
229 %
230 %
231 % \DescribeMacro{\bbl*}
232 % Inside the |.bbl| file no text is hard coded and instead the appropriate
233 % \cs{bbl*} command is used. The text ``erratum'', i.\,e., is produced by
234 % \cs{bblerratum}. Thus one can easily change all the words in the bibliography
235 % by defining the appropriate commands.
236 % \begin{verbatim}
237 % \newcommand{\bblerratum}{\emph{errat.}}
238 % \end{verbatim}
239 % for instance will give ``\emph{errat.}''. By redefining all necessary commands
240 % you can also change the language to some other language than the default
241 % english.
242 %
243 %
244 %
245 % \section{Description of important entry types}
246 %
247 % The entry types discussed in this section are those which are most commonly
248 % used in writing articles in chemistry. The types listed here refer to entries
249 % in the database (i.\,e.\ |*.bib|).
250 %
251 %
252 %
253 % \subsection{@article}
254 %
255 % This entry type is designed for an article in a journal.
256 % The entry type has been augmented with several additional fields. Other style
257 % files will simply ignore these fields. The following fields are recognized:
258 %
259 % \begin{description}
260 % \item[author] The names of all authors
261 % \item[journal] The name of the journal the article was published in
262 % \item[year] The year the article has been published
263 % \item[volume] The volume this article has been published in
264 % \item[pages] The page numbers of the article
265 % \item[eid] The electronic identifier of an article. Some journals, i.\,e.\
266 % \emph{J.~Chem.\ Phys.} no longer have page numbers associated to an
267 % article but only use the EID. If an EID is present |pages| will be
268 % ignored.
269 % \item[numpages] The number of pages of an article. This will only be used
270 % together with an EID.
271 % \item[germanpages] When citing articles from \emph{Angew.\ Chem.} one
272 % should always give both the german and the english version. If this
273 % field is present the style file assumes that this is a citation of
274 % \emph{Angew.\ Chem.\ Int.\ Ed.} and automatically appends the correct
275 % citation for \emph{Angew.\ Chem.} The year is always the same for
276 % both versions and the german volume is easily calculated by adding 73
277 % to the english volume. The page range of the german version is taken
278 % from the |germanpages| field.
279 % \item[erratumyear, erratumvolume, erratumpages, erratumeid,
280 % erratumnumpages] If any of these fields is non-empty the information
281 % will be used to append a correctly formatted citation of the erratum
282 % to the regular citation.
283 % \item[note] A free format text that will be appended at the very end of a
284 % citation.
285 % \end{description}
286 %
287 %
288 %
289 % \subsection{@book}
290 %
291 % This entry type is designed for citing a whole book. If you want to cite only
292 % some chapters or pages of a book use @inbook or @incollection (see below).
293 % The following fields are recognized:
294 %
295 % \begin{description}
296 % \item[author, editor] The names of all authors or editors. You can only use
297 % one of author or editor, but not both.
298 % \item[title] The title of the book
299 % \item[language] The language of the title
300 % \item[edition] The edition of the book
301 % \item[volume] The volume of the book
302 % \item[series] The series the book is part of
303 % \item[publisher] The publisher of the book
304 % \item[address] The publisher's address
305 % \item[year] The year the book was published in
306 % \item[note] A free format text that will be appended at the very end of the
307 % citation.
308 % \end{description}
309 %
310 %
311 %
312 % \subsection{@inbook}
313 %
314 % This entry type is designed for citing chapters or pages of a book. The final
315 % format of the citation is the same as for @book except that the cited
316 % chapter(s) and/or pages are appended. For the crossref feature see
317 % section~\ref{o::crossref}. The same fields as for @book plus
318 % the following are recognized:
319 %
320 % \begin{description}
321 % \item[chapter] The cited chapters
322 % \item[pages] The cited pages
323 % \end{description}
324 %
325 %
326 %
327 % \subsection{@incollection}
328 %
329 % This entry is also designed for citing chapters or pages of a book and thus
330 % very similar to @inbook. However, there is one difference: the present entry
331 % is designed for chapter(s) written by some authors in a book edited by
332 % others. The final citation looks similar to A. Author, in book title, edited
333 % by E. Editor. The crossref feature is discussed in section~\ref{o::crossref}.
334 % The same fields as for @inbook (except |title|) plus the following are
335 % recognized.
336 %
337 % \begin{description}
338 % \item[booktitle] The name of the book
339 % \end{description}
340 %
341 %
342 %
343 % \subsection{@masterthesis and @phdthesis}
344 %
345 % These entries are designed for citing a master's thesis or a PhD thesis. Both
346 % entries are very similar. The only difference is the thesis' name. The
347 % following fields are recognized:
348 %
349 % \begin{description}
350 % \item[author] The author of the thesis
351 % \item[school] The school or university where this thesis work was carried
352 % out.
353 % \item[address] The school's address
354 % \item[year] The year the thesis was finished in.
355 % \item[note] A free format text that will be appended at the very end of the
356 % citation.
357 % \item[url] An url where the thesis can be found.
358 % \end{description}
359 %
360 %
361 %
362 % \subsection{@program}
363 %
364 % This entry is designed for citing a program. This is a new entry type which
365 % is not contained in the standard \BibTeX\ styles. It allows greater
366 % flexibility compared to the @misc entry. The following fields are recognized:
367 %
368 % \begin{description}
369 % \item[author] The program's authors
370 % \item[title] The program name
371 % \item[description] A short description of the program
372 % \item[version] The version/release of the program
373 % \item[year] The year the program was published in.
374 % \item[publisher] The publisher of the program
375 % \item[address] The publisher's address
376 % \item[note] A free format text that will be appended at the very end of the
377 % citation.
378 % \item[url] An url where the program can be found.
379 % \end{description}
380 %
381 %
382 % \subsection{@misc}
383 %
384 % This entry is designed for everything that does not fit into one of the other
385 % entry categories. This is for instance useful to cite websites. The following
386 % fields are recognized:
387 %
388 % \begin{description}
389 % \item[author] The author of the cited work
390 % \item[title] The title of the cited work
391 % \item[howpublished] A free format text describing how this work has been
392 % published. This is usually empty.
393 % \item[year] The year the cited work was published in.
394 % \item[note] A free format text that will be appended at the very end of the
395 % citation.
396 % \item[url] An url where the cited work can be found.
397 % \end{description}
398 %
399 %
400 %
401 % \subsection{@unpublished}
402 %
403 % This entry is designed for unpublished results. The following fields are
404 % recognized:
405 %
406 % \begin{description}
407 % \item[author] The author(s) of the unpublished work
408 % \item[title] The title of the unpublished work
409 % \item[year] The year the unpublished work was carried out.
410 % \item[note] A free format text explaining what kind of unpublished work
411 % this is (i.\,e.\ ``unpublished results'').
412 % \item[url] An url where this work can be found.
413 % \end{description}
414 %
415 %
416 % \StopEventually{}
417 %
418 %
419 %
420 % \section{The implementation}
421 %
422 % Write the journal this style file is intended for to the file header.
423 % \begin{macrocode}
424 %% This file is intended for use with:
425 %<ChemCommun>%% Chem. Commun.
426 %<ChemEurJ>%% Chem.-Eur. J.
427 %<InorgChem>%% Inorg. Chem.
428 %<JAmChemSoc>%% J. Am. Chem. Soc.
429 %<cv>%% a curriculum vitae
430 %%
431 % \end{macrocode}
432 %
433 %
434 %
435 % \subsection{Setup}
436 %
437 % \begin{macro}{ENTRY}
438 % Define all the fields an entry can contain.
439 % \begin{macrocode}
440 ENTRY
441 {
442 address
443 author
444 booktitle
445 chapter
446 collaboration
447 description
448 edition
449 editor
450 eid
451 erratumeid
452 erratumgermanpages
453 erratumnumpages
454 erratumpages
455 erratumvolume
456 erratumyear
457 germanpages
458 howpublished
459 institution
460 journal
461 key
462 language
463 month
464 note
465 number
466 numpages
467 organization
468 pages
469 publisher
470 school
471 series
472 title
473 type
474 url
475 version
476 volume
477 year
478 }
479 {}
480 { label }
481 % \end{macrocode}
482 % \end{macro}
483 %
484 % \begin{macro}{INTEGERS}
485 % \changes{0.1.2}{2006/05/03}{Removed unused variables, added new.sentence}
486 % Define all integer variables.
487 % \begin{macrocode}
488 INTEGERS {
489 before.all
490 i
491 j
492 longest.label.width
493 mid.sentence
494 multiresult
495 nameptr
496 namesleft
497 new.sentence
498 number.label
499 numnames
500 o
501 output.state
502 }
503 % \end{macrocode}
504 % \end{macro}
505 %
506 % \begin{macro}{STRINGS}
507 % Define all string variables.
508 % \begin{macrocode}
509 STRINGS {
510 bibinfo
511 delimiter
512 longest.label
513 s
514 t
515 }
516 % \end{macrocode}
517 % \end{macro}
518 %
519 % \begin{macro}{bbl.*}
520 % Define all the functions for the \LaTeX\ code which returns the words used.
521 % \begin{macrocode}
522 FUNCTION {bbl.and} { "\bbland{}" }
523 FUNCTION {bbl.chap} { "\bblchap{}" }
524 FUNCTION {bbl.chapter} { "\bblchapter{}" }
525 FUNCTION {bbl.edition} { "\bbledn{}" }
526 FUNCTION {bbl.editor} { "\bbled{}" }
527 FUNCTION {bbl.editors} { "\bbleds{}" }
528 FUNCTION {bbl.eidp} { "\bbleidp{}" }
529 FUNCTION {bbl.eidpp} { "\bbleidpp{}" }
530 FUNCTION {bbl.erratum} { "\bblerratum{}" }
531 FUNCTION {bbl.etal} { "\bbletal{}" }
532 FUNCTION {bbl.fifth} { "\bblfiftho{}" }
533 FUNCTION {bbl.first} { "\bblfirsto{}" }
534 FUNCTION {bbl.fourth} { "\bblfourtho{}" }
535 FUNCTION {bbl.in} { "\bblin{}" }
536 FUNCTION {bbl.mthesis} { "\bblmthesis{}" }
537 FUNCTION {bbl.nd} { "\bblnd{}" }
538 FUNCTION {bbl.nr} { "\bblno{}" }
539 FUNCTION {bbl.number} { "\bblno{}" }
540 FUNCTION {bbl.of} { "\bblof{}" }
541 FUNCTION {bbl.page}{ "\bblp{}" }
542 FUNCTION {bbl.pages} { "\bblpp{}" }
543 FUNCTION {bbl.phdthesis} { "\bblphdthesis{}" }
544 FUNCTION {bbl.rd} { "\bblrd{}" }
545 FUNCTION {bbl.second} { "\bblsecondo{}" }
546 FUNCTION {bbl.st} { "\bblst{}" }
547 FUNCTION {bbl.techrep} { "\bbltechrep{}" }
548 FUNCTION {bbl.th} { "\bblth{}" }
549 FUNCTION {bbl.third} { "\bblthirdo{}" }
550 FUNCTION {bbl.volume} { "\bblvol{}" }
551 MACRO {jan} {"\bbljan{}"}
552 MACRO {feb} {"\bblfeb{}"}
553 MACRO {mar} {"\bblmar{}"}
554 MACRO {apr} {"\bblapr{}"}
555 MACRO {may} {"\bblmay{}"}
556 MACRO {jun} {"\bbljun{}"}
557 MACRO {jul} {"\bbljul{}"}
558 MACRO {aug} {"\bblaug{}"}
559 MACRO {sep} {"\bblsep{}"}
560 MACRO {oct} {"\bbloct{}"}
561 MACRO {nov} {"\bblnov{}"}
562 MACRO {dec} {"\bbldec{}"}
563 % \end{macrocode}
564 % \end{macro}
565 %
566 % \begin{macro}{delimiter.*}
567 % Define some delimiters used to separate different parts of a citation.
568 % \begin{macrocode}
569 FUNCTION {delimiter.blank} { " " }
570 FUNCTION {delimiter.colon} { ": " }
571 FUNCTION {delimiter.comma} { ", " }
572 FUNCTION {delimiter.semicolon} { "; " }
573 FUNCTION {delimiter.default}
574 {
575 %<ChemCommun|ChemEurJ|cv> delimiter.comma
576 %<JAmChemSoc|InorgChem> delimiter.semicolon
577 }
578 % \end{macrocode}
579 % \end{macro}
580 %
581 %
582 %
583 % \subsection{Output related functions}
584 %
585 % \begin{macro}{output.bibitem}
586 % Write \cs{bibitem} and setup new citation.
587 % \begin{macrocode}
588 FUNCTION {output.bibitem}
589 {
590 newline$
591 "\bibitem{" write$
592 cite$ write$
593 "}" write$
594 newline$
595 ""
596 before.all 'output.state :=
597 }
598 % \end{macrocode}
599 % \end{macro}
600 %
601 % \begin{macro}{output.internal}
602 % \changes{0.1.2}{2006/05/3}{Removed dead code (variable never got specific
603 % value)}
604 % This function is finally called by all the other output functions. It first
605 % pops the delimiter from the stack. If the (now)
606 % top string is non-empty the function appends the delimiter to
607 % the (top-1) string and writes it. The old top string is pushed back on the
608 % stack at the very end thus leaving it untouched.
609 % \begin{macrocode}
610 FUNCTION {output.internal}
611 {
612 'delimiter :=
613 % \end{macrocode}
614 % write only if top string is non-empty
615 % \begin{macrocode}
616 duplicate$ empty$
617 'pop$
618 {
619 % \end{macrocode}
620 % backup top string
621 % \begin{macrocode}
622 's :=
623 output.state mid.sentence =
624 {
625 delimiter *
626 write$
627 }
628 {
629 output.state before.all =
630 'write$
631 { add.period$ " " * write$ }
632 if$
633 mid.sentence 'output.state :=
634 }
635 if$
636 s
637 }
638 if$
639 }
640 % \end{macrocode}
641 % \end{macro}
642 %
643 % \begin{macro}{output.check.internal}
644 % The function first pops the delimiter from the stack. If the (now) top string
645 % is empty it issues a warning, otherwise it calls |output.internal| for
646 % writing.
647 % \begin{macrocode}
648 FUNCTION {output.check.internal}
649 {
650 'delimiter :=
651 't :=
652 duplicate$ empty$
653 { pop$ "empty " t * " in " * cite$ * warning$ }
654 { delimiter output.internal }
655 if$
656 }
657 % \end{macrocode}
658 % \end{macro}
659 %
660 % \begin{macro}{output}
661 % \begin{macro}{output.blank}
662 % \begin{macro}{output.comma}
663 % \begin{macro}{output.semicolon}
664 % These functions just push the appropriate delimiter on the stack and then
665 % call |output.internal|.
666 % \begin{macrocode}
667 FUNCTION {output} { delimiter.default output.internal }
668 FUNCTION {output.blank} { delimiter.blank output.internal }
669 FUNCTION {output.comma} { delimiter.comma output.internal }
670 FUNCTION {output.semicolon} { delimiter.semicolon output.internal }
671 % \end{macrocode}
672 % \end{macro}
673 % \end{macro}
674 % \end{macro}
675 % \end{macro}
676 %
677 % \begin{macro}{output.check}
678 % \begin{macro}{output.check.blank}
679 % \begin{macro}{output.check.comma}
680 % \begin{macro}{output.check.semicolon}
681 % These functions just push the appropriate delimiter and then call
682 % |output.check.internal|.
683 % \begin{macrocode}
684 FUNCTION {output.check} { delimiter.default output.check.internal }
685 FUNCTION {output.check.blank} { delimiter.blank output.check.internal }
686 FUNCTION {output.check.comma} { delimiter.comma output.check.internal }
687 FUNCTION {output.check.semicolon} { delimiter.semicolon output.check.internal }
688 % \end{macrocode}
689 % \end{macro}
690 % \end{macro}
691 % \end{macro}
692 % \end{macro}
693 %
694 %
695 %
696 % \subsection{Operators}
697 %
698 % \begin{macro}{not}
699 % Define a logical |not|.
700 % \begin{macrocode}
701 FUNCTION {not}
702 {
703 { #0 }
704 { #1 }
705 if$
706 }
707 % \end{macrocode}
708 % \end{macro}
709 %
710 % \begin{macro}{and}
711 % Define a logical |and|.
712 % \begin{macrocode}
713 FUNCTION {and}
714 {
715 'skip$
716 { pop$ #0 }
717 if$
718 }
719 % \end{macrocode}
720 % \end{macro}
721 %
722 % \begin{macro}{or}
723 % Define a logical |or|.
724 % \begin{macrocode}
725 FUNCTION {or}
726 {
727 { pop$ #1 }
728 'skip$
729 if$
730 }
731 % \end{macrocode}
732 % \end{macro}
733 %
734 % \begin{macro}{multiply}
735 % Define a function for multiplying two integers.
736 % \begin{macrocode}
737 FUNCTION {multiply}
738 {
739 % \end{macrocode}
740 % |i| is the multiplicator and will be used as a counter
741 % \begin{macrocode}
742 'i :=
743 % \end{macrocode}
744 % |j| is the value to multiplicate by i, thus will be added i times
745 % to itself
746 % \begin{macrocode}
747 'j :=
748 #0
749 j #0 =
750 % \end{macrocode}
751 % if |j==0|, nothing has to be done since the product will always be 0;
752 % |i==0| will be handled gracefully by while loop below
753 % \begin{macrocode}
754 'skip$
755 {
756 % \end{macrocode}
757 % now add |j| |i| times to the 0 on the stack
758 % \begin{macrocode}
759 { i }
760 {
761 j +
762 i #1 - 'i :=
763 }
764 while$
765 }
766 if$
767 }
768 % \end{macrocode}
769 % \end{macro}
770 %
771 %
772 %
773 % \subsection{Small helper functions}
774 %
775 % \begin{macro}{bibinfo.check}
776 % This function checks whether the top value is a missing field. If so it
777 % replaces the top value by an empty string, otherwise the top value is left
778 % unchanged.
779 % \begin{macrocode}
780 FUNCTION {bibinfo.check}
781 {
782 duplicate$ missing$
783 { pop$ "" }
784 'skip$
785 if$
786 }
787 % \end{macrocode}
788 % \end{macro}
789 %
790 % \begin{macro}{bibinfo.warn}
791 % This functions first checks whether a field is empty. If so it issues a
792 % warning. The topmost value is a description of the current field. If the
793 % field is missing, |bibinfo.warn| pushes an empty string, otherwise the value
794 % is left unchanged. The behaviour is very similar to |bibinfo.check|.
795 % \begin{macrocode}
796 FUNCTION {bibinfo.warn}
797 {
798 swap$
799 duplicate$ missing$
800 {
801 swap$ "missing " swap$ * " in " * cite$ * warning$ pop$
802 ""
803 }
804 { duplicate$ empty$
805 {
806 swap$ "empty " swap$ * " in " * cite$ * warning$
807 }
808 { swap$
809 pop$
810 }
811 if$
812 }
813 if$
814 }
815 % \end{macrocode}
816 % \end{macro}
817 %
818 % \begin{macro}{bolden}
819 % This function returns the \LaTeX\ code for boldening the top string.
820 % \begin{macrocode}
821 FUNCTION {bolden}
822 {
823 duplicate$ empty$
824 { pop$ "" }
825 { "\textbf{" swap$ * "}" * }
826 if$
827 }
828 % \end{macrocode}
829 % \end{macro}
830 %
831 % \begin{macro}{capitalize}
832 % This function capitalizes the first letter of a word.
833 % \begin{macrocode}
834 FUNCTION {capitalize}
835 {
836 "\capitalize" swap$ *
837 }
838 % \end{macrocode}
839 % \end{macro}
840 %
841 % \begin{macro}{cat.internal}
842 % This function catenates two strings using the delimiter on top of the stack.
843 % The second string is at (top-1) position, the first at (top-2). If any of
844 % both strings is empty the function just returns the other string without any
845 % delimiter.
846 % \begin{macrocode}
847 FUNCTION {cat.internal}
848 {
849 'delimiter :=
850 duplicate$ empty$
851 'pop$
852 {
853 swap$
854 duplicate$ empty$
855 'skip$
856 { delimiter * }
857 if$
858 swap$
859 *
860 }
861 if$
862 }
863 % \end{macrocode}
864 % \end{macro}
865 %
866 % \begin{macro}{cat.blank}
867 % \begin{macro}{cat.colon}
868 % \begin{macro}{cat.comma}
869 % \begin{macro}{cat.default}
870 % \begin{macro}{cat.semicolon}
871 % These functions just push the appropriate delimiter and call |cat.internal|.
872 % \begin{macrocode}
873 FUNCTION {cat.blank} { delimiter.blank cat.internal }
874 FUNCTION {cat.colon} { delimiter.colon cat.internal }
875 FUNCTION {cat.comma} { delimiter.comma cat.internal }
876 FUNCTION {cat.default} { delimiter.default cat.internal }
877 FUNCTION {cat.semicolon} { delimiter.semicolon cat.internal }
878 % \end{macrocode}
879 % \end{macro}
880 % \end{macro}
881 % \end{macro}
882 % \end{macro}
883 % \end{macro}
884 %
885 % \begin{macro}{eng.ord}
886 % This function formats an english ordinal by appending the appropriate string.
887 % \begin{macrocode}
888 FUNCTION {eng.ord}
889 {
890 duplicate$ "1" swap$ *
891 #-2 #1 substring$ "1" =
892 { bbl.th * }
893 { duplicate$ #-1 #1 substring$
894 duplicate$ "1" =
895 { pop$ bbl.st * }
896 { duplicate$ "2" =
897 { pop$ bbl.nd * }
898 { "3" =
899 { bbl.rd * }
900 { bbl.th * }
901 if$
902 }
903 if$
904 }
905 if$
906 }
907 if$
908 }
909 % \end{macrocode}
910 % \end{macro}
911 %
912 % \begin{macro}{is.num}
913 % This function checks whether the top character is a number.
914 % \begin{macrocode}
915 FUNCTION {is.num}
916 {
917 chr.to.int$
918 duplicate$ "0" chr.to.int$ < not
919 swap$ "9" chr.to.int$ > not and
920 }
921 % \end{macrocode}
922 % \end{macro}
923 %
924 % \begin{macro}{extract.num}
925 % This function extracts a number (as string) from the top string.
926 % \begin{macrocode}
927 FUNCTION {extract.num}
928 {
929 duplicate$ 't :=
930 "" 's :=
931 { t empty$ not }
932 {
933 t #1 #1 substring$
934 t #2 global.max$ substring$ 't :=
935 duplicate$ is.num
936 { s swap$ * 's := }
937 { pop$ "" 't := }
938 if$
939 }
940 while$
941 s empty$
942 'skip$
943 { pop$ s }
944 if$
945 }
946 % \end{macrocode}
947 % \end{macro}
948 %
949 % \begin{macro}{convert.edition}
950 % This functions converts the |edition| field into the appropriate ordinal.
951 % \begin{macrocode}
952 FUNCTION {convert.edition}
953 {
954 extract.num "l" change.case$ 's :=
955 s "first" = s "1" = or
956 { bbl.first 't := }
957 { s "second" = s "2" = or
958 { bbl.second 't := }
959 { s "third" = s "3" = or
960 { bbl.third 't := }
961 { s "fourth" = s "4" = or
962 { bbl.fourth 't := }
963 { s "fifth" = s "5" = or
964 { bbl.fifth 't := }
965 { s #1 #1 substring$ is.num
966 { s eng.ord 't := }
967 { edition 't := }
968 if$
969 }
970 if$
971 }
972 if$
973 }
974 if$
975 }
976 if$
977 }
978 if$
979 t
980 }
981 % \end{macrocode}
982 % \end{macro}
983 %
984 % \begin{macro}{either.or.check}
985 % This function checks whether mutually exclusive fields are present at the
986 % same time.
987 % \begin{macrocode}
988 FUNCTION {either.or.check}
989 {
990 empty$
991 'pop$
992 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
993 if$
994 }
995 % \end{macrocode}
996 % \end{macro}
997 %
998 % \begin{macro}{emphasize}
999 % This function returns the \LaTeX\ code for emphasizing the top string.
1000 % \begin{macrocode}
1001 FUNCTION {emphasize}
1002 {
1003 duplicate$ empty$
1004 { pop$ "" }
1005 { "\emph{" swap$ * "}" * }
1006 if$
1007 }
1008 % \end{macrocode}
1009 % \end{macro}
1010 %
1011 % \begin{macro}{fin.entry}
1012 % This function finalizes a citation. It appends a dot and writes the last
1013 % text chunk.
1014 % \begin{macrocode}
1015 FUNCTION {fin.entry}
1016 {
1017 add.period$
1018 write$ newline$
1019 }
1020 % \end{macrocode}
1021 % \end{macro}
1022 %
1023 % \begin{macro}{format.names}
1024 % \changes{0.2.2}{2007/09/13}{Added fifteennames option}
1025 % This function formats a list of names.
1026 % \begin{macrocode}
1027 FUNCTION {format.names}
1028 {
1029 % bibinfo is the description of the names, i.e. author, editor
1030 'bibinfo :=
1031 duplicate$ empty$
1032 'skip$
1033 {
1034 % \end{macrocode}
1035 % |s| is the full list of names
1036 % \begin{macrocode}
1037 's :=
1038 % \end{macrocode}
1039 % |t| is the formatted name
1040 % \begin{macrocode}
1041 "" 't :=
1042 % \end{macrocode}
1043 % |nameptr| is the index of the current name\\
1044 % |numnames| is the total number of names\\
1045 % |namesleft| is the number of names yet to format
1046 % \begin{macrocode}
1047 #1 'nameptr :=
1048 s num.names$ 'numnames :=
1049 numnames 'namesleft :=
1050 { namesleft #0 > }
1051 {
1052 s nameptr
1053 %<ChemCommun|ChemEurJ|cv> "{f.~}{vv~}{ll}{, jj}"
1054 %<JAmChemSoc|InorgChem> "{vv~}{ll}{, f.}{, jj}"
1055 format.name$
1056 bibinfo.check
1057 't :=
1058 nameptr #1 >
1059 {
1060 % \end{macrocode}
1061 % The following code chunk checks whether the list of names should be
1062 % abbreviated by et al.
1063 % \begin{macrocode}
1064 numnames #0
1065 %<tennames> #10 +
1066 %<fifteennames> #15 +
1067 >
1068 % \end{macrocode}
1069 % If no appropriate |docstrip| option is given, the next expression will
1070 % always be false (|nameptr| is always $>1$, see above). Thus the check is
1071 % effectively disabled.
1072 % \begin{macrocode}
1073 nameptr #0
1074 %<namesone> #2 +
1075 =
1076 and
1077 {
1078 % \end{macrocode}
1079 % list of names should be truncated, set formatted name to ``others''
1080 % \begin{macrocode}
1081 "others" 't :=
1082 #1 'namesleft :=
1083 }
1084 'skip$
1085 if$
1086 delimiter.default *
1087 namesleft #1 >
1088 { t * }
1089 {
1090 % \end{macrocode}
1091 % check whether current name is ``others'', if so set formatted name
1092 % to ``others''
1093 % \begin{macrocode}
1094 s nameptr "{ll}" format.name$
1095 duplicate$ "others" =
1096 { 't := }
1097 { pop$ }
1098 if$
1099 % \end{macrocode}
1100 % check whether formatted name is ``others'', if so print et al.
1101 % \begin{macrocode}
1102 t "others" =
1103 { bbl.etal * }
1104 { t * }
1105 if$
1106 }
1107 if$
1108 }
1109 % \end{macrocode}
1110 % this is the first name
1111 % \begin{macrocode}
1112 't
1113 if$
1114 nameptr #1 + 'nameptr :=
1115 namesleft #1 - 'namesleft :=
1116 }
1117 while$
1118 }
1119 if$
1120 }
1121 % \end{macrocode}
1122 % \end{macro}
1123 %
1124 % \begin{macro}{get.bbl.editor}
1125 % Return ``editors'' if |editor| contains more than one name, ``editor''
1126 % otherwise.
1127 % \begin{macrocode}
1128 FUNCTION {get.bbl.editor}
1129 {
1130 editor num.names$ #1 >
1131 'bbl.editors
1132 'bbl.editor
1133 if$
1134 }
1135 % \end{macrocode}
1136 % \end{macro}
1137 %
1138 % \begin{macro}{get.bbl.erratum}
1139 % Return the formatted string for ``erratum''.
1140 % \begin{macrocode}
1141 FUNCTION {get.bbl.erratum}
1142 {
1143 bbl.erratum
1144 ":" *
1145 }
1146 % \end{macrocode}
1147 % \end{macro}
1148 %
1149 % \begin{macro}{multi.page.check}
1150 % Check whether the top string is only a single page or a range of pages.
1151 % \begin{macrocode}
1152 FUNCTION {multi.page.check}
1153 {
1154 't :=
1155 #0 'multiresult :=
1156 {
1157 multiresult not
1158 t empty$ not and
1159 }
1160 { t #1 #1 substring$
1161 duplicate$ "-" =
1162 swap$ duplicate$ "," =
1163 swap$ "+" =
1164 or or
1165 { #1 'multiresult := }
1166 { t #2 global.max$ substring$ 't := }
1167 if$
1168 }
1169 while$
1170 multiresult
1171 }
1172 % \end{macrocode}
1173 % \end{macro}
1174 %
1175 % \begin{macro}{get.bbl.page}
1176 % Return a formatted prefix for pages.
1177 % \begin{macrocode}
1178 FUNCTION {get.bbl.page}
1179 {
1180 duplicate$ multi.page.check
1181 { bbl.pages }
1182 { bbl.page }
1183 if$
1184 %<ChemCommun|ChemEurJ|cv> "." *
1185 }
1186 % \end{macrocode}
1187 % \end{macro}
1188 %
1189 % \begin{macro}{n.dashify}
1190 % Replace a single ``|-|'' in a range of pages by ``|--|''.
1191 % \begin{macrocode}
1192 FUNCTION {n.dashify}
1193 {
1194 't :=
1195 ""
1196 { t empty$ not }
1197 {
1198 t #1 #1 substring$ "-" =
1199 {
1200 t #1 #2 substring$ "--" = not
1201 {
1202 "--" *
1203 t #2 global.max$ substring$ 't :=
1204 }
1205 {
1206 % \end{macrocode}
1207 % there is more than one '|-|', therefore append all of them to the string
1208 % on the stack
1209 % \begin{macrocode}
1210 { t #1 #1 substring$ "-" = }
1211 {
1212 "-" *
1213 t #2 global.max$ substring$ 't :=
1214 }
1215 while$
1216 }
1217 if$
1218 }
1219 {
1220 % \end{macrocode}
1221 % the current char is not '|-|', therefore just append it
1222 % \begin{macrocode}
1223 t #1 #1 substring$ *
1224 t #2 global.max$ substring$ 't :=
1225 }
1226 if$
1227 }
1228 while$
1229 }
1230 % \end{macrocode}
1231 % \end{macro}
1232 %
1233 % \begin{macro}{select.language}
1234 % \changes{0.1.3}{2006/07/27}{leave empty string on stack (replace pop\$ by
1235 % skip\$)}
1236 % Return \LaTeX\ code for changing the language for the string
1237 % on top of the stack.
1238 % \begin{macrocode}
1239 FUNCTION {select.language}
1240 {
1241 duplicate$ empty$
1242 'skip$
1243 {
1244 language empty$
1245 'skip$
1246 { "\foreignlanguage{" language * "}{" * swap$ * "}" * }
1247 if$
1248 }
1249 if$
1250 }
1251 % \end{macrocode}
1252 % \end{macro}
1253 %
1254 % \begin{macro}{space.word}
1255 % This function puts spaces around a word.
1256 % \begin{macrocode}
1257 FUNCTION {space.word}
1258 {
1259 " " swap$ * " " *
1260 }
1261 % \end{macrocode}
1262 % \end{macro}
1263 %
1264 % \begin{macro}{str.to.int.warn}
1265 % Print a warning if top string is not a representation of a valid integer
1266 % (used by |str.to.int|).
1267 % \begin{macrocode}
1268 FUNCTION {str.to.int.warn}
1269 {
1270 "str.to.int: '" swap$ * "' is not a valid integer" * warning$
1271 }
1272 % \end{macrocode}
1273 % \end{macro}
1274 %
1275 % \begin{macro}{str.to.int}
1276 % This function converts a string into an integer. A warning is issued if the
1277 % string is not a valid representation of an integer.
1278 % \begin{macrocode}
1279 FUNCTION {str.to.int}
1280 {
1281 duplicate$ empty$
1282 {
1283 str.to.int.warn
1284 #0
1285 }
1286 {
1287 % \end{macrocode}
1288 % assign the original string to |t| for parsing |t| from the end
1289 % \begin{macrocode}
1290 duplicate$ 't :=
1291 % \end{macrocode}
1292 % check for sign
1293 % \begin{macrocode}
1294 t #1 #1 substring$ "-" =
1295 {
1296 % \end{macrocode}
1297 % be sure that ``|-|'' is followed by at least one more character
1298 % \begin{macrocode}
1299 t #2 global.max$ substring$ 't :=
1300 t empty$
1301 {
1302 duplicate$ str.to.int.warn
1303 #0
1304 }
1305 { #-1 }
1306 if$
1307 }
1308 { #1 }
1309 if$
1310 % \end{macrocode}
1311 % the top stack position contains now $-1$ or $1$ depending on sign\\
1312 % |o| stores the offset for position inside the number
1313 % \begin{macrocode}
1314 #1 'o :=
1315 % \end{macrocode}
1316 % push starting value on stack
1317 % \begin{macrocode}
1318 #0
1319 { t empty$ not}
1320 {
1321 % \end{macrocode}
1322 % get last character
1323 % \begin{macrocode}
1324 t #-1 #1 substring$
1325 duplicate$ is.num
1326 {
1327 % \end{macrocode}
1328 % character is in range [0--9], now multiply by offset and add to value already
1329 % on stack
1330 % \begin{macrocode}
1331 chr.to.int$ #48 -
1332 o multiply
1333 +
1334 % \end{macrocode}
1335 % remove last character from string, increment offset |o|
1336 % \begin{macrocode}
1337 t #-2 global.max$ substring$ 't :=
1338 o #10 multiply 'o :=
1339 }
1340 {
1341 % \end{macrocode}
1342 % the last character was not a digit, therefore
1343 % pop last character and sum
1344 % \begin{macrocode}
1345 pop$ pop$
1346 % \end{macrocode}
1347 % swap sign and original string, duplicate string, print warning
1348 % \begin{macrocode}
1349 swap$ duplicate$ str.to.int.warn
1350 % \end{macrocode}
1351 % swap original string and sign, push 0
1352 % \begin{macrocode}
1353 swap$ #0
1354 % \end{macrocode}
1355 % break |while| loop
1356 % \begin{macrocode}
1357 "" 't :=
1358 }
1359 if$
1360 }
1361 while$
1362 % \end{macrocode}
1363 % stack holds value and sign, multiply combines them
1364 % \begin{macrocode}
1365 multiply
1366 % \end{macrocode}
1367 % pop copy of original string
1368 % \begin{macrocode}
1369 swap$ pop$
1370 }
1371 if$
1372 }
1373 % \end{macrocode}
1374 % \end{macro}
1375 %
1376 % \begin{macro}{tie.or.space.prefix}
1377 % This function prepends a string with either a space or a ``|~|'' depending on
1378 % the length of the string.
1379 % \begin{macrocode}
1380 FUNCTION {tie.or.space.prefix}
1381 {
1382 duplicate$ text.length$ #3 <
1383 { "~" }
1384 { " " }
1385 if$
1386 swap$
1387 }
1388 % \end{macrocode}
1389 % \end{macro}
1390 %
1391 % \begin{macro}{word.in}
1392 % This function returns the word ``in'' followed by a space.
1393 % \begin{macrocode}
1394 FUNCTION {word.in}
1395 {
1396 bbl.in delimiter.blank *
1397 }
1398 % \end{macrocode}
1399 % \end{macro}
1400 %
1401 %
1402 %
1403 % \subsection{Field formatting functions}
1404 %
1405 % \begin{macro}{format.year.internal}
1406 % This function applies all necessary formatting for a year on the stack.
1407 % \begin{macrocode}
1408 FUNCTION {format.year.internal}
1409 {
1410 %<ChemEurJ|cv> bolden
1411 }
1412 % \end{macrocode}
1413 % \end{macro}
1414 %
1415 % \begin{macro}{format.volume.internal}
1416 % This function applies all necessary formating for a volume on the stack.
1417 % \begin{macrocode}
1418 FUNCTION {format.volume.internal}
1419 {
1420 duplicate$ empty$
1421 'skip$
1422 {
1423 bbl.volume
1424 swap$
1425 tie.or.space.prefix
1426 % \end{macrocode}
1427 % stack (top-down): volume, tie/space, bbl.volume
1428 % \begin{macrocode}
1429 * *
1430 }
1431 if$
1432 }
1433 % \end{macrocode}
1434 % \end{macro}
1435 %
1436 % \begin{macro}{format.authors}
1437 % This function formats the list of authors. If a |collaboration| field is
1438 % present its contents is printed and the list of authors is appended in
1439 % parentheses.
1440 % \begin{macrocode}
1441 FUNCTION {format.authors}
1442 {
1443 author "author" format.names
1444 duplicate$ empty$
1445 'skip$
1446 {
1447 collaboration bibinfo.check
1448 duplicate$ empty$
1449 'skip$
1450 { " (" * swap$ * ")" * }
1451 if$
1452 *
1453 }
1454 if$
1455 }
1456 % \end{macrocode}
1457 % \end{macro}
1458 %
1459 % \begin{macro}{format.booktitle}
1460 % This function formats the title of a book and switches to an optional foreign
1461 % language for this title.
1462 % \begin{macrocode}
1463 FUNCTION {format.booktitle}
1464 {
1465 booktitle bibinfo.check
1466 emphasize
1467 select.language
1468 }
1469 % \end{macrocode}
1470 % \end{macro}
1471 %
1472 % \begin{macro}{format.chapter}
1473 % \changes{0.1.1}{2006/02/28}{added capitalize to bbl.chapter for JACS}
1474 % This function formats a chapter. If a |type| field is present its contents is
1475 % used as a prefix. If it is absent then the default (return value
1476 % of |bbl.chapter|) will be % used.
1477 % \begin{macrocode}
1478 FUNCTION {format.chapter}
1479 {
1480 chapter bibinfo.check
1481 duplicate$ empty$
1482 'skip$
1483 {
1484 type bibinfo.check
1485 duplicate$ empty$
1486 { pop$ bbl.chapter }
1487 { "l" change.case$ }
1488 if$
1489 %<JAmChemSoc|InorgChem> capitalize
1490 swap$
1491 % \end{macrocode}
1492 % stack (top-down): chapter, type/bbl.chapter
1493 % \begin{macrocode}
1494 tie.or.space.prefix
1495 * *
1496 }
1497 if$
1498 }
1499 % \end{macrocode}
1500 % \end{macro}
1501 %
1502 % \begin{macro}{format.date}
1503 % This function formats the date of a citation. All currently supported styles
1504 % only use the year. It is pushed onto the stack and |format.year.internal| is
1505 % called to format it.
1506 % \begin{macrocode}
1507 FUNCTION {format.date}
1508 {
1509 year bibinfo.check
1510 format.year.internal
1511 }
1512 % \end{macrocode}
1513 % \end{macro}
1514 %
1515 % \begin{macro}{format.edition}
1516 % This function formats the edition. It is converted into the appropriate
1517 % english ordinal and the return value of |bbl.edition| will be appended.
1518 % \begin{macrocode}
1519 FUNCTION {format.edition}
1520 {
1521 edition bibinfo.check
1522 duplicate$ empty$
1523 'skip$
1524 {
1525 convert.edition
1526 output.state mid.sentence =
1527 { "l" }
1528 { "t" }
1529 if$ change.case$
1530 " " * bbl.edition *
1531 %<ChemCommun|ChemEurJ|cv> emphasize
1532 }
1533 if$
1534 }
1535 % \end{macrocode}
1536 % \end{macro}
1537 %
1538 % \begin{macro}{format.editors}
1539 % \changes{0.2.3}{2008/01/17}{ACS does not print 'Eds.' if there are no
1540 % authors.}
1541 % This function formats the list of editors.
1542 % \begin{macrocode}
1543 FUNCTION {format.editors}
1544 {
1545 editor "editor" format.names
1546 duplicate$ empty$
1547 'skip$
1548 {
1549 %<JAmChemSoc|InorgChem> author empty$
1550 %<JAmChemSoc|InorgChem> 'skip$
1551 %<JAmChemSoc|InorgChem> {
1552 %<JAmChemSoc|InorgChem> "," *
1553 " " *
1554 get.bbl.editor
1555 capitalize
1556 %<ChemCommun|ChemEurJ|cv> "(" swap$ * ")" *
1557 *
1558 %<JAmChemSoc|InorgChem> }
1559 %<JAmChemSoc|InorgChem> if$
1560 }
1561 if$
1562 }
1563 % \end{macrocode}
1564 % \end{macro}
1565 %
1566 % \begin{macro}{format.in.booktitle}
1567 % This function formats a booktitle an prepends it with ``in''.
1568 % \begin{macrocode}
1569 FUNCTION {format.in.booktitle}
1570 {
1571 format.booktitle
1572 duplicate$ empty$
1573 'skip$
1574 {
1575 word.in
1576 %<JAmChemSoc|InorgChem> capitalize
1577 swap$ *
1578 }
1579 if$
1580 }
1581 % \end{macrocode}
1582 % \end{macro}
1583 %
1584 % \begin{macro}{format.note}
1585 % This function formats the |note| field of a citation. Since this is a free
1586 % format field is content is used unchanged.
1587 % \begin{macrocode}
1588 FUNCTION {format.note}
1589 {
1590 note bibinfo.check
1591 }
1592 % \end{macrocode}
1593 % \end{macro}
1594 %
1595 % \begin{macro}{format.number.series}
1596 % This function formats number and series if the |volume| field is empty.
1597 % \begin{macrocode}
1598 FUNCTION {format.number.series}
1599 {
1600 volume bibinfo.check
1601 duplicate$ empty$
1602 {
1603 number empty$
1604 { series bibinfo.check }
1605 {
1606 series empty$
1607 { number bibinfo.check }
1608 {
1609 output.state mid.sentence =
1610 { bbl.number }
1611 { bbl.number capitalize }
1612 if$
1613 number bibinfo.check tie.or.space.prefix * *
1614 word.in *
1615 series bibinfo.check *
1616 }
1617 if$
1618 }
1619 if$
1620 }
1621 'skip$
1622 if$
1623 }
1624 % \end{macrocode}
1625 % \end{macro}
1626 %
1627 % \begin{macro}{format.org.or.pub}
1628 % This function formats an organization or publisher (on the stack) and its
1629 % address.
1630 % \begin{macrocode}
1631 FUNCTION {format.org.or.pub}
1632 {
1633 't :=
1634 address empty$ t empty$ and
1635 { "" }
1636 {
1637 t
1638 address bibinfo.check
1639 duplicate$ empty$
1640 'pop$
1641 {
1642 %<ChemCommun|ChemEurJ|cv> cat.comma
1643 %<JAmChemSoc|InorgChem> cat.colon
1644 }
1645 if$
1646 }
1647 if$
1648 }
1649 % \end{macrocode}
1650 % \end{macro}
1651 %
1652 % \begin{macro}{format.organization.address}
1653 % This function formats an organization and its address. It pushes
1654 % the organization onto the stack and calls |format.org.or.pub|.
1655 % \begin{macrocode}
1656 FUNCTION {format.organization.address}
1657 {
1658 organization bibinfo.check
1659 format.org.or.pub
1660 }
1661 % \end{macrocode}
1662 % \end{macro}
1663 %
1664 % \begin{macro}{format.pages}
1665 % This function formats a list of pages. The list is prepended with
1666 % |bbl.page(s)|.
1667 % \begin{macrocode}
1668 FUNCTION {format.pages}
1669 {
1670 pages bibinfo.check
1671 duplicate$ empty$
1672 'skip$
1673 {
1674 n.dashify
1675 get.bbl.page
1676 % \end{macrocode}
1677 % stack top-down: pages prefix, pages
1678 % \begin{macrocode}
1679 swap$
1680 tie.or.space.prefix *
1681 *
1682 }
1683 if$
1684 }
1685 % \end{macrocode}
1686 % \end{macro}
1687 %
1688 % \begin{macro}{format.publisher.address}
1689 % This function formats a publisher and its address. It pushes
1690 % the publisher onto the stack and calls |format.org.or.pub|.
1691 % \begin{macrocode}
1692 FUNCTION {format.publisher.address}
1693 {
1694 publisher "publisher" bibinfo.warn
1695 format.org.or.pub
1696 }
1697 % \end{macrocode}
1698 % \end{macro}
1699 %
1700 % \begin{macro}{format.thesis.type}
1701 % This function formats the type of a thesis.
1702 % \begin{macrocode}
1703 FUNCTION {format.thesis.type}
1704 {
1705 type
1706 duplicate$ empty$
1707 'pop$
1708 {
1709 swap$ pop$
1710 "t" change.case$ bibinfo.check
1711 }
1712 if$
1713 }
1714 % \end{macrocode}
1715 % \end{macro}
1716 %
1717 % \begin{macro}{format.title}
1718 % This function formats a title. It also switches the language temporarily.
1719 % \begin{macrocode}
1720 FUNCTION {format.title}
1721 {
1722 title bibinfo.check
1723 duplicate$ empty$
1724 'skip$
1725 {
1726 emphasize
1727 select.language
1728 }
1729 if$
1730 }
1731 % \end{macrocode}
1732 % \end{macro}
1733 %
1734 % \begin{macro}{format.tr.number}
1735 % This function formats the number of a technical report.
1736 % \begin{macrocode}
1737 FUNCTION {format.tr.number}
1738 {
1739 number bibinfo.check
1740 type
1741 duplicate$ empty$
1742 { pop$ bbl.techrep }
1743 'skip$
1744 if$
1745 bibinfo.check
1746 swap$
1747 duplicate$ empty$
1748 { pop$ "t" change.case$ }
1749 { tie.or.space.prefix * * }
1750 if$
1751 }
1752 % \end{macrocode}
1753 % \end{macro}
1754 %
1755 % \begin{macro}{format.url}
1756 % \changes{0.2.3}{2008/01/17}{Put URL into a new sentence.}
1757 % This function formats an url. Each url is prefixed with \cs{urlprefix}. See
1758 % section \ref{o::customization} for more information.
1759 % \begin{macrocode}
1760 FUNCTION {format.url}
1761 {
1762 url bibinfo.check
1763 duplicate$ empty$
1764 'skip$
1765 {
1766 "\urlprefix\url{" swap$ * "}" *
1767 new.sentence 'output.state :=
1768 }
1769 if$
1770 }
1771 % \end{macrocode}
1772 % \end{macro}
1773 %
1774 % \begin{macro}{format.volume}
1775 % This function formats the |volume| field. It merely pushes the field's value
1776 % onto the stack and calls |format.volume.internal| to format it.
1777 % \begin{macrocode}
1778 FUNCTION {format.volume}
1779 {
1780 volume bibinfo.check
1781 format.volume.internal
1782 }
1783 % \end{macrocode}
1784 % \end{macro}
1785 %
1786 % \begin{macro}{format.volume.and.series}
1787 % This function will format the |volume| and |series|, but only if \emph{both}
1788 % of them are not empty. Otherwise and empty string is returned.
1789 % \begin{macrocode}
1790 FUNCTION {format.volume.and.series}
1791 {
1792 volume empty$ series empty$ or
1793 { "" }
1794 {
1795 volume format.volume.internal
1796 % \end{macrocode}
1797 % prepend "of"
1798 % \begin{macrocode}
1799 swap$ bbl.of space.word * swap$
1800 emphasize
1801 *
1802 "volume and number" number either.or.check
1803 }
1804 if$
1805 }
1806 % \end{macrocode}
1807 % \end{macro}
1808 %
1809 % \begin{macro}{format.volume.noseries}
1810 % This function formats the volume. If the |series| field is non-empty an empty
1811 % string is returned.
1812 % \begin{macrocode}
1813 FUNCTION {format.volume.noseries}
1814 {
1815 series empty$
1816 {
1817 volume bibinfo.check
1818 format.volume.internal
1819 %<ChemCommun|ChemEurJ|cv> emphasize
1820 }
1821 { "" }
1822 if$
1823 }
1824 % \end{macrocode}
1825 % \end{macro}
1826 %
1827 %
1828 %
1829 % \subsection{Functions related to cross-referenced entries}
1830 %
1831 % \begin{macro}{bibliography.cite}
1832 % This function returns the string for citing the document the |crossref|
1833 % field points to.
1834 % \begin{macrocode}
1835 FUNCTION {bibliography.cite}
1836 {
1837 "\bibliographycite{" swap$ * "}" *
1838 }
1839 % \end{macrocode}
1840 % \end{macro}
1841 %
1842 % \begin{macro}{format.crossref}
1843 % This function formats the cross-reference.
1844 % \begin{macrocode}
1845 FUNCTION {format.crossref}
1846 {
1847 bbl.in " " *
1848 %<JAmChemSoc|InorgChem> capitalize
1849 crossref bibliography.cite *
1850 }
1851 % \end{macrocode}
1852 % \end{macro}
1853 %
1854 %
1855 %
1856 % \subsection{@article related funtions}
1857 %
1858 % \begin{macro}{format.article.cat.journal.year}
1859 % \changes{0.2.0}{2006/07/27}{NEW}
1860 % This function catenates the journal name and the year. It is used when
1861 % formatting an erratum and/or articles in \emph{Angew.~Chem.}
1862 % \begin{macrocode}
1863 FUNCTION {format.article.cat.journal.year}
1864 {
1865 %<ChemCommun> cat.comma
1866 %<ChemEurJ|cv|JAmChemSoc|InorgChem> cat.blank
1867 }
1868 % \end{macrocode}
1869 % \end{macro}
1870 %
1871 % \begin{macro}{format.article.year.internal}
1872 % This function provides all formatting required for an article which is not
1873 % already done in |format.date.internal|.
1874 % \begin{macrocode}
1875 FUNCTION {format.article.year.internal}
1876 {
1877 %<JAmChemSoc|InorgChem> bolden
1878 }
1879 % \end{macrocode}
1880 % \end{macro}
1881 %
1882 % \begin{macro}{format.article.volume.internal}
1883 % This function applies all necessary formatting to the volume an article is
1884 % published in.
1885 % \begin{macrocode}
1886 FUNCTION {format.article.volume.internal}
1887 {
1888 %<ChemCommun> bolden
1889 %<ChemEurJ|cv|JAmChemSoc|InorgChem> emphasize
1890 }
1891 % \end{macrocode}
1892 % \end{macro}
1893 %
1894 % \begin{macro}{format.article.germanpages.volume.internal}
1895 % This function is used while formatting citations of \emph{Angew.\ Chem.\
1896 % Int.\ Ed.} It calculates the volume of the german edition from the volume of
1897 % the english one (on the stack).
1898 % \begin{macrocode}
1899 FUNCTION {format.article.germanpages.volume.internal}
1900 {
1901 duplicate$ empty$
1902 'skip$
1903 {
1904 str.to.int
1905 duplicate$ #1 <
1906 {
1907 pop$
1908 "volume in " cite$ * " is not a positive integer value" * warning$
1909 ""
1910 }
1911 {
1912 % \end{macrocode}
1913 % vol.~1 of the english edition corresponds to vol.~74 of the german one
1914 % \begin{macrocode}
1915 #73 +
1916 int.to.str$
1917 format.article.volume.internal
1918 }
1919 if$
1920 }
1921 if$
1922 }
1923 % \end{macrocode}
1924 % \end{macro}
1925 %
1926 % \begin{macro}{format.article.germanpages.pages.internal}
1927 % This function applies all necessary formatting to pages of \emph{Angew.\
1928 % Chem.}, the german edition of \emph{Angew.\ Chem.\ Engl.\ Ed.}
1929 % \begin{macrocode}
1930 FUNCTION {format.article.germanpages.pages.internal}
1931 {
1932 n.dashify
1933 }
1934 % \end{macrocode}
1935 % \end{macro}
1936 %
1937 % \begin{macro}{format.article.date}
1938 % This function formats the date of an article.
1939 % \begin{macrocode}
1940 FUNCTION {format.article.date}
1941 {
1942 format.date
1943 format.article.year.internal
1944 }
1945 % \end{macrocode}
1946 % \end{macro}
1947 %
1948 % \begin{macro}{format.article.numpages}
1949 % This function formats the number of pages of an article. The number of pages
1950 % (|numpages| field) is only used in conjunction with an EID. The number of
1951 % pages is assumed to be already on the stack.
1952 % \begin{macrocode}
1953 FUNCTION {format.article.numpages}
1954 {
1955 duplicate$ empty$
1956 'skip$
1957 {
1958 duplicate$ "1" =
1959 { "~" * bbl.eidp * }
1960 { "~" * bbl.eidpp * }
1961 if$
1962 "(" swap$ * ")" *
1963 }
1964 if$
1965 }
1966 % \end{macrocode}
1967 % \end{macro}
1968 %
1969 % \begin{macro}{format.article.eid}
1970 % \changes{0.2.4}{2008/03/18}{Include number of pages only for style 'cv'}
1971 % This function formats the EID of an article.
1972 % \begin{macrocode}
1973 FUNCTION {format.article.eid}
1974 {
1975 eid bibinfo.check
1976 duplicate$ empty$
1977 'pop$
1978 {
1979 cat.comma
1980 %<cv> numpages bibinfo.check
1981 %<cv> format.article.numpages
1982 %<cv> cat.blank
1983 }
1984 if$
1985 }
1986 % \end{macrocode}
1987 % \end{macro}
1988 %
1989 % \begin{macro}{format.article.journal}
1990 % This function formats the journal an article was published in.
1991 % \begin{macrocode}
1992 FUNCTION {format.article.journal}
1993 {
1994 journal bibinfo.check
1995 duplicate$ empty$
1996 'skip$
1997 { emphasize }
1998 if$
1999 }
2000 % \end{macrocode}
2001 % \end{macro}
2002 %
2003 % \begin{macro}{format.article.germanpages.journalname}
2004 % This function formats \emph{Angew.\ Chem.} as the name of the german version
2005 % of \emph{Angew.\ Chem.\ Int.\ Ed.}
2006 % \begin{macrocode}
2007 FUNCTION {format.article.germanpages.journalname}
2008 {
2009 "Angew.\ Chem."
2010 emphasize
2011 }
2012 % \end{macrocode}
2013 % \end{macro}
2014 %
2015 % \begin{macro}{format.article.erratum.germanpages.pages}
2016 % This function is used for an erratum in \emph{Angew.\ Chem.\ Int.\ Ed.} It
2017 % formats the pages of the german version.
2018 % \begin{macrocode}
2019 FUNCTION {format.article.erratum.germanpages.pages}
2020 {
2021 erratumgermanpages bibinfo.check
2022 format.article.germanpages.pages.internal
2023 }
2024 % \end{macrocode}
2025 % \end{macro}
2026 %
2027 % \begin{macro}{format.article.erratum.year}
2028 % This function formats the year an erratum was published.
2029 % \begin{macrocode}
2030 FUNCTION {format.article.erratum.year}
2031 {
2032 erratumyear bibinfo.check
2033 format.year.internal
2034 format.article.year.internal
2035 }
2036 % \end{macrocode}
2037 % \end{macro}
2038 %
2039 % \begin{macro}{format.article.erratum.germanpages.volume}
2040 % This function is used for an erratum in \emph{Angew.\ Chem.\ Int.\ Ed.} It
2041 % formats the erratum's volume in the german version.
2042 % \begin{macrocode}
2043 FUNCTION {format.article.erratum.germanpages.volume}
2044 {
2045 erratumvolume "erratumvolume" bibinfo.warn
2046 format.article.germanpages.volume.internal
2047 }
2048 % \end{macrocode}
2049 % \end{macro}
2050 %
2051 % \begin{macro}{format.article.erratum.germanpages}
2052 % \changes{0.2.0}{2006/07/27}{Use format.article.cat.journal.year}
2053 % This function formats the german version of an erratum published in
2054 % \emph{Angew.\ Chem.\ Int.\ Ed.}
2055 % \begin{macrocode}
2056 FUNCTION {format.article.erratum.germanpages}
2057 {
2058 erratumgermanpages empty$
2059 { "" }
2060 {
2061 format.article.germanpages.journalname
2062 format.article.erratum.year format.article.cat.journal.year
2063 format.article.erratum.germanpages.volume cat.comma
2064 format.article.erratum.germanpages.pages cat.comma
2065 }
2066 if$
2067 }
2068 % \end{macrocode}
2069 % \end{macro}
2070 %
2071 % \begin{macro}{format.article.erratum.journal}
2072 % This function formats the journal of an erratum. Normally this is the same
2073 % journal the original article was published in.
2074 % \begin{macrocode}
2075 FUNCTION {format.article.erratum.journal} { format.article.journal }
2076 % \end{macrocode}
2077 % \end{macro}
2078 %
2079 % \begin{macro}{format.article.erratum.pages}
2080 % This function formats the pages of an erratum.
2081 % \begin{macrocode}
2082 FUNCTION {format.article.erratum.pages}
2083 {
2084 erratumpages bibinfo.check
2085 n.dashify
2086 }
2087 % \end{macrocode}
2088 % \end{macro}
2089 %
2090 % \begin{macro}{format.article.erratum.eid}
2091 % This function formats the EID of an erratum.
2092 % \begin{macrocode}
2093 FUNCTION {format.article.erratum.eid}
2094 {
2095 erratumeid bibinfo.check
2096 erratumnumpages bibinfo.check format.article.numpages *
2097 }
2098 % \end{macrocode}
2099 % \end{macro}
2100 %
2101 % \begin{macro}{format.article.erratum.volume}
2102 % This function formats the volume of an erratum.
2103 % \begin{macrocode}
2104 FUNCTION {format.article.erratum.volume}
2105 {
2106 erratumvolume bibinfo.check
2107 format.article.volume.internal
2108 }
2109 % \end{macrocode}
2110 % \end{macro}
2111 %
2112 % \begin{macro}{format.article.erratum}
2113 % \changes{0.2.0}{2006/07/27}{Use format.article.cat.journal.year}
2114 % This function formats an erratum of an article.
2115 % The erratum will be formatted if one of |erratumyear|, |erratumvolume|,
2116 % |erratumpages| or |erratumeid| is present.
2117 % \begin{macrocode}
2118 FUNCTION {format.article.erratum}
2119 {
2120 erratumyear bibinfo.check empty$
2121 erratumvolume bibinfo.check empty$ and
2122 erratumpages bibinfo.check empty$ and
2123 erratumeid bibinfo.check empty$ and
2124 { "" }
2125 {
2126 % \end{macrocode}
2127 % An erratum was detected.
2128 % Since at least one field is present, ``erratum:'' can already be printed.
2129 % \begin{macrocode}
2130 get.bbl.erratum
2131 format.article.erratum.journal cat.blank
2132 format.article.erratum.year format.article.cat.journal.year
2133 format.article.erratum.volume cat.comma
2134 erratumeid empty$
2135 { format.article.erratum.pages }
2136 { format.article.erratum.eid }
2137 if$
2138 cat.comma
2139 format.article.erratum.germanpages cat.semicolon
2140 }
2141 if$
2142 }
2143 % \end{macrocode}
2144 % \end{macro}
2145 %
2146 % \begin{macro}{format.article.germanpages.pages}
2147 % This function formats the pages of the german version of an article in
2148 % \emph{Angew.\ Chem.\ Int.\ Ed.}
2149 % \begin{macrocode}
2150 FUNCTION {format.article.germanpages.pages}
2151 {
2152 germanpages bibinfo.check
2153 format.article.germanpages.pages.internal
2154 }
2155 % \end{macrocode}
2156 % \end{macro}
2157 %
2158 % \begin{macro}{format.article.germanpages.volume}
2159 % This function formats the volume of the german version of an article in
2160 % \emph{Angew.\ Chem.\ Int.\ Ed.} It pushes the volume of the english version
2161 % onto the stack and calls |format.article.germanpages.volume.internal| which
2162 % automatically calculates and formats the german volume.
2163 % \begin{macrocode}
2164 FUNCTION {format.article.germanpages.volume}
2165 {
2166 volume "volume" bibinfo.warn
2167 format.article.germanpages.volume.internal
2168 }
2169 % \end{macrocode}
2170 % \end{macro}
2171 %
2172 % \begin{macro}{format.article.germanpages.year}
2173 % This function formats the year of the german version of an article in
2174 % \emph{Angew.\ Chem.\ Int.\ Ed.} This is always the same as the english
2175 % version.
2176 % \begin{macrocode}
2177 FUNCTION {format.article.germanpages.year} { format.article.date }
2178 % \end{macrocode}
2179 % \end{macro}
2180 %
2181 % \begin{macro}{format.article.germanpages}
2182 % \changes{0.2.0}{2006/07/27}{Use format.article.cat.journal.year}
2183 % This function formats the german version of an article in \emph{Angew.\
2184 % Chem.\ Int.\ Ed.}
2185 % \begin{macrocode}
2186 FUNCTION {format.article.germanpages}
2187 {
2188 germanpages empty$
2189 { "" }
2190 {
2191 format.article.germanpages.journalname
2192 format.article.germanpages.year format.article.cat.journal.year
2193 format.article.germanpages.volume cat.comma
2194 format.article.germanpages.pages cat.comma
2195 }
2196 if$
2197 }
2198 % \end{macrocode}
2199 % \end{macro}
2200 %
2201 % \begin{macro}{format.article.pages}
2202 % This function formats the pages of an article.
2203 % \begin{macrocode}
2204 FUNCTION {format.article.pages}
2205 {
2206 % \end{macrocode}
2207 % The stack contains whatever is the text directly preceding pages.
2208 % \begin{macrocode}
2209 pages
2210 duplicate$ empty$
2211 'pop$
2212 {
2213 % \end{macrocode}
2214 % Check whether preceding string is empty.
2215 % \begin{macrocode}
2216 swap$
2217 duplicate$ empty$
2218 % \end{macrocode}
2219 % If the preceding string is empty, pop it and the pages from stack and call
2220 % |format.pages|. This means that |pages| is the only text so far (except
2221 % bibitem).
2222 % \begin{macrocode}
2223 { pop$ pop$ format.pages }
2224 % \end{macrocode}
2225 % The preceding string is not empty. Therefore format the pages and append
2226 % them.
2227 % \begin{macrocode}
2228 {
2229 swap$
2230 n.dashify
2231 cat.comma
2232 }
2233 if$
2234 }
2235 if$
2236 }
2237 % \end{macrocode}
2238 % \end{macro}
2239 %
2240 % \begin{macro}{format.article.title}
2241 % \changes{0.1.2}{2006/05/3}{NEW}
2242 % This function formats the title of an article.
2243 % \begin{macrocode}
2244 FUNCTION {format.article.title}
2245 {
2246 title bibinfo.check
2247 duplicate$ empty$
2248 'skip$
2249 {
2250 new.sentence 'output.state :=
2251 }
2252 if$
2253 }
2254 % \end{macrocode}
2255 % \end{macro}
2256 %
2257 % \begin{macro}{format.article.volume.and.number}
2258 % This function formats the volume an article was published in. Optionally it
2259 % appends the issue to the volume.
2260 % \begin{macrocode}
2261 FUNCTION {format.article.volume.and.number}
2262 {
2263 volume bibinfo.check
2264 duplicate$ empty$
2265 'skip$
2266 { bibinfo.check }
2267 if$
2268 format.article.volume.internal
2269 %<*number>
2270 number bibinfo.check
2271 duplicate$ empty$
2272 'skip$
2273 {
2274 swap$
2275 duplicate$ empty$
2276 { "there's a number but no volume in " cite$ * warning$ }
2277 'skip$
2278 if$
2279 swap$
2280 "(" swap$ * ")" *
2281 }
2282 if$
2283 *
2284 %</number>
2285 }
2286 % \end{macrocode}
2287 % \end{macro}
2288 %
2289 %
2290 %
2291 % \subsection{@book related functions}
2292 %
2293 % \begin{macro}{format.book.authors}
2294 % This function formats the authors of a book. If no authors were given, the
2295 % editors are used instead.
2296 % \begin{macrocode}
2297 FUNCTION {format.book.authors}
2298 {
2299 author empty$
2300 { format.editors }
2301 {
2302 format.authors
2303 "author and editor" editor either.or.check
2304 }
2305 if$
2306 }
2307 % \end{macrocode}
2308 % \end{macro}
2309 %
2310 % \begin{macro}{format.book.editors}
2311 % This function formats the editors of a book. If the book has no authors then
2312 % the editors were already given as a substitute for the authors. In this case,
2313 % nothing is printed, since the editors should not be given twice.
2314 % \begin{macrocode}
2315 FUNCTION {format.book.editors}
2316 {
2317 author empty$
2318 { "" }
2319 { format.editors }
2320 if$
2321 }
2322 % \end{macrocode}
2323 % \end{macro}
2324 %
2325 % \begin{macro}{format.book.volume.internal}
2326 % This function formats the volume of a book.
2327 % \begin{macrocode}
2328 FUNCTION {format.book.volume.internal}
2329 {
2330 volume bibinfo.check
2331 duplicate$ empty$
2332 'skip$
2333 {
2334 tie.or.space.prefix *
2335 bbl.volume swap$ *
2336 }
2337 if$
2338 }
2339 % \end{macrocode}
2340 % \end{macro}
2341 %
2342 % \begin{macro}{format.book.volume.and.series}
2343 % This function formats the volume of a book and the series it is part of. For
2344 % this function to produce any non-empty output both |volume| and |series| must
2345 % be non-empty. To format the volume without a series the
2346 % |format.book.volume.noseries| function is used (see below).
2347 % \begin{macrocode}
2348 FUNCTION {format.book.volume.and.series}
2349 {
2350 series bibinfo.check
2351 duplicate$ empty$
2352 'skip$
2353 {
2354 %<ChemCommun|ChemEurJ|cv> emphasize
2355 % \end{macrocode}
2356 % Now the formatted series is on the stack.
2357 % \begin{macrocode}
2358 format.book.volume.internal
2359 %<ChemCommun|ChemEurJ|cv> bbl.of space.word *
2360 % \end{macrocode}
2361 % stack top-down: formatted volume; formatted series
2362 % \begin{macrocode}
2363 %<ChemCommun|ChemEurJ|cv> swap$ *
2364 %<JAmChemSoc|InorgChem> cat.comma
2365 }
2366 if$
2367 }
2368 % \end{macrocode}
2369 % \end{macro}
2370 %
2371 % \begin{macro}{format.book.volume.noseries}
2372 % This function formats the volume of a book if the |series| field is empty.
2373 % \begin{macrocode}
2374 FUNCTION {format.book.volume.noseries}
2375 {
2376 series empty$ not
2377 { "" }
2378 {
2379 format.book.volume.internal
2380 %<ChemCommun|ChemEurJ|cv> emphasize
2381 }
2382 if$
2383 }
2384 % \end{macrocode}
2385 % \end{macro}
2386 %
2387 %
2388 %
2389 % \subsection{@misc related functions}
2390 %
2391 % \begin{macro}{misc.empty.check}
2392 % This function checks whether fields of an |@misc| entry are empty and issues
2393 % a warning.
2394 % \begin{macrocode}
2395 FUNCTION {misc.empty.check}
2396 {
2397 author empty$ title empty$ howpublished empty$
2398 month empty$ year empty$ note empty$ url empty$
2399 and and and and and and
2400 { "all relevant fields are empty in " cite$ * warning$ }
2401 'skip$
2402 if$
2403 }
2404 % \end{macrocode}
2405 % \end{macro}
2406 %
2407 %
2408 %
2409 % \subsection{@program related functions}
2410 %
2411 % \begin{macro}{format.program.description}
2412 % This function formats the description of a program. It also temporarily
2413 % switches the language.
2414 % \begin{macrocode}
2415 FUNCTION {format.program.description}
2416 {
2417 description bibinfo.check
2418 duplicate$ empty$
2419 'skip$
2420 { select.language }
2421 if$
2422 }
2423 % \end{macrocode}
2424 % \end{macro}
2425 %
2426 % \begin{macro}{format.program.publisher.address}
2427 % This function formats the publisher of a program and its address.
2428 % \begin{macrocode}
2429 FUNCTION {format.program.publisher.address}
2430 {
2431 publisher bibinfo.check
2432 format.org.or.pub
2433 }
2434 % \end{macrocode}
2435 % \end{macro}
2436 %
2437 % \begin{macro}{format.program.title}
2438 % This function formats the title of a program.
2439 % \begin{macrocode}
2440 FUNCTION {format.program.title}
2441 {
2442 title "title" bibinfo.warn
2443 duplicate$ empty$
2444 'skip$
2445 {
2446 "t" change.case$
2447 " " swap$ *
2448 capitalize
2449 emphasize
2450 }
2451 if$
2452 }
2453 % \end{macrocode}
2454 % \end{macro}
2455 %
2456 % \begin{macro}{format.program.version}
2457 % This function formats the version of a program.
2458 % \begin{macrocode}
2459 FUNCTION {format.program.version}
2460 {
2461 version
2462 }
2463 % \end{macrocode}
2464 % \end{macro}
2465 %
2466 %
2467 % \subsection{Entry types}
2468 %
2469 % \begin{macro}{article}
2470 % \mbox{}
2471 % \begin{macrocode}
2472 FUNCTION {article}
2473 {
2474 output.bibitem
2475 format.authors "author"
2476 %<ChemCommun|ChemEurJ|cv> output.check
2477 %<JAmChemSoc|InorgChem> output.check.blank
2478 %<cv> format.article.title "title" output.check
2479 %<cv> new.sentence 'output.state :=
2480 format.article.journal "journal"
2481 %<ChemCommun|ChemEurJ|cv> output.check
2482 %<JAmChemSoc|InorgChem> output.check.blank
2483 format.article.date "year"
2484 % \end{macrocode}
2485 % If you change the way journal name and publication year are catenated, do not
2486 % forget to change |format.article.cat.journal.year|.
2487 % \begin{macrocode}
2488 %<ChemCommun> output.check
2489 %<ChemEurJ|cv|JAmChemSoc|InorgChem> output.check.blank
2490 format.article.volume.and.number output.comma
2491 eid empty$
2492 { format.article.pages }
2493 { format.article.eid }
2494 if$
2495 format.article.germanpages output.semicolon
2496 format.article.erratum output.semicolon
2497 format.note output
2498 fin.entry
2499 }
2500 % \end{macrocode}
2501 % \end{macro}
2502 %
2503 % \begin{macro}{book}
2504 % \mbox{}
2505 % \begin{macrocode}
2506 FUNCTION {book}
2507 {
2508 output.bibitem
2509 format.book.authors "author and editor" output.check
2510 format.title "title"
2511 %<ChemCommun|ChemEurJ|cv> output.check.comma
2512 %<JAmChemSoc|InorgChem> output.check.blank
2513 format.edition
2514 %<ChemCommun|ChemEurJ|cv> output.blank
2515 %<JAmChemSoc|InorgChem> output.comma
2516 %<JAmChemSoc|InorgChem> format.book.editors output.semicolon
2517 format.book.volume.and.series output
2518 %<ChemCommun|ChemEurJ|cv> format.book.volume.noseries output
2519 %<ChemCommun|ChemEurJ|cv> format.book.editors output.comma
2520 format.publisher.address output
2521 format.date "year" output.check.comma
2522 %<JAmChemSoc|InorgChem> format.volume.noseries output.semicolon
2523 format.note output
2524 fin.entry
2525 }
2526 % \end{macrocode}
2527 % \end{macro}
2528 %
2529 % \begin{macro}{booklet}
2530 % \mbox{}
2531 % \begin{macrocode}
2532 FUNCTION {booklet}
2533 {
2534 output.bibitem
2535 format.authors output
2536 format.title "title" output.check
2537 howpublished bibinfo.check output
2538 address bibinfo.check output
2539 format.date output
2540 format.note output
2541 fin.entry
2542 }
2543 % \end{macrocode}
2544 % \end{macro}
2545 %
2546 % \begin{macro}{inbook}
2547 % \mbox{}
2548 % \begin{macrocode}
2549 FUNCTION {inbook}
2550 {
2551 output.bibitem
2552 format.book.authors "author and editor" output.check
2553 crossref missing$
2554 {
2555 format.title "title"
2556 %<ChemCommun|ChemEurJ|cv> output.check.comma
2557 %<JAmChemSoc|InorgChem> output.check.blank
2558 format.edition
2559 %<ChemCommun|ChemEurJ|cv> output.blank
2560 %<JAmChemSoc|InorgChem> output.comma
2561 %<JAmChemSoc|InorgChem> format.book.editors output.semicolon
2562 format.book.volume.and.series output
2563 %<ChemCommun|ChemEurJ|cv> format.book.volume.noseries output
2564 %<ChemCommun|ChemEurJ|cv> format.book.editors output.comma
2565 format.publisher.address output
2566 format.date "year" output.check.comma
2567 % \end{macrocode}
2568 % The \emph{J.~Am.\ Chem.\ Soc.} requires ``; volume, chapter, pages''.
2569 % To handle empty entries gracefully we cat them together and write the entire
2570 % string afterwards.
2571 % \begin{macrocode}
2572 %<JAmChemSoc|InorgChem> format.volume.noseries
2573 %<ChemCommun|ChemEurJ|cv> ""
2574 }
2575 {
2576 format.crossref output.blank
2577 % \end{macrocode}
2578 % Push an empty string since there will not be a volume.
2579 % \begin{macrocode}
2580 ""
2581 }
2582 if$
2583 format.chapter cat.comma
2584 format.pages cat.comma
2585 output
2586 format.note output
2587 fin.entry
2588 }
2589 % \end{macrocode}
2590 % \end{macro}
2591 %
2592 % \begin{macro}{incollection}
2593 % \changes{0.2.1}{2007/02/28}{Added title for style cv}
2594 % \mbox{}
2595 % \begin{macrocode}
2596 FUNCTION {incollection}
2597 {
2598 output.bibitem
2599 format.authors "author" output.check
2600 %<cv> format.title "title" output.check
2601 crossref missing$
2602 {
2603 format.in.booktitle "booktitle" output.check.blank
2604 format.edition
2605 %<ChemCommun|ChemEurJ|cv> output.blank
2606 %<JAmChemSoc|InorgChem> output.comma
2607 %<JAmChemSoc|InorgChem> format.book.editors output.semicolon
2608 format.book.volume.and.series output
2609 %<ChemCommun|ChemEurJ|cv> format.book.volume.noseries output
2610 %<ChemCommun|ChemEurJ|cv> format.book.editors output.comma
2611 format.publisher.address output
2612 format.date "year" output.check.comma
2613 % \end{macrocode}
2614 % The \emph{J.~Am.\ Chem.\ Soc.} requires ``; volume, chapter, pages''.
2615 % To handle empty entries gracefully we cat them together and write the entire
2616 % string afterwards.
2617 % \begin{macrocode}
2618 %<JAmChemSoc|InorgChem> format.volume.noseries
2619 %<ChemCommun|ChemEurJ|cv> ""
2620 }
2621 {
2622 format.crossref output.blank
2623 % \end{macrocode}
2624 % Push an empty string since there will not be a volume.
2625 % \begin{macrocode}
2626 ""
2627 }
2628 if$
2629 format.chapter cat.comma
2630 format.pages cat.comma
2631 output
2632 format.note output
2633 fin.entry
2634 }
2635 % \end{macrocode}
2636 % \end{macro}
2637 %
2638 % \begin{macro}{inproceedings}
2639 % \changes{0.2.1}{2007/02/27}{Added title for style cv}
2640 % \changes{0.2.1}{2007/02/28}{Fixed formating of volume and series}
2641 % \mbox{}
2642 % \begin{macrocode}
2643 FUNCTION {inproceedings}
2644 {
2645 output.bibitem
2646 format.authors "author" output.check
2647 %<cv> format.title "title" output.check
2648 crossref missing$
2649 {
2650 format.in.booktitle "booktitle" output.check.blank
2651 publisher empty$
2652 { format.organization.address output }
2653 {
2654 organization bibinfo.check output
2655 format.publisher.address output
2656 }
2657 if$
2658 format.book.volume.and.series output
2659 }
2660 { format.crossref output.blank }
2661 if$
2662 format.pages "pages" output.check
2663 format.note output
2664 format.url output
2665 fin.entry
2666 }
2667 % \end{macrocode}
2668 % \end{macro}
2669 %
2670 % \begin{macro}{manual}
2671 % \mbox{}
2672 % \begin{macrocode}
2673 FUNCTION {manual}
2674 {
2675 output.bibitem
2676 author empty$
2677 {
2678 organization bibinfo.check
2679 duplicate$ empty$
2680 'pop$
2681 {
2682 output
2683 address bibinfo.check output
2684 }
2685 if$
2686 }
2687 { format.authors output }
2688 if$
2689 format.title "title" output.check
2690 author empty$
2691 {
2692 organization empty$
2693 { address bibinfo.check output }
2694 'skip$
2695 if$
2696 }
2697 {
2698 organization bibinfo.check output
2699 address bibinfo.check output
2700 }
2701 if$
2702 format.edition output
2703 format.date output
2704 format.note output
2705 format.url output
2706 fin.entry
2707 }
2708 % \end{macrocode}
2709 % \end{macro}
2710 %
2711 % \begin{macro}{mastersthesis}
2712 % \mbox{}
2713 % \begin{macrocode}
2714 FUNCTION {mastersthesis}
2715 {
2716 output.bibitem
2717 format.authors "author" output.check
2718 bbl.mthesis format.thesis.type output
2719 school "school" bibinfo.warn output
2720 address bibinfo.check output
2721 format.date "year" output.check
2722 format.note output
2723 format.url output
2724 fin.entry
2725 }
2726 % \end{macrocode}
2727 % \end{macro}
2728 %
2729 % \begin{macro}{misc}
2730 % \mbox{}
2731 % \begin{macrocode}
2732 FUNCTION {misc}
2733 {
2734 output.bibitem
2735 format.authors output
2736 format.title output
2737 howpublished bibinfo.check output
2738 format.date output
2739 format.note output
2740 format.url output
2741 fin.entry
2742 misc.empty.check
2743 }
2744 % \end{macrocode}
2745 % \end{macro}
2746 %
2747 % \begin{macro}{phdthesis}
2748 % \changes{0.2.1}{2007/02/27}{Added title for style cv}
2749 % \mbox{}
2750 % \begin{macrocode}
2751 FUNCTION {phdthesis}
2752 {
2753 output.bibitem
2754 format.authors "author" output.check
2755 %<cv> format.title "title" output.check
2756 bbl.phdthesis format.thesis.type output
2757 school "school" bibinfo.warn output
2758 address bibinfo.check output
2759 format.date "year" output.check
2760 format.note output
2761 format.url output
2762 fin.entry
2763 }
2764 % \end{macrocode}
2765 % \end{macro}
2766 %
2767 % \begin{macro}{proceedings}
2768 % \mbox{}
2769 % \begin{macrocode}
2770 FUNCTION {proceedings}
2771 {
2772 output.bibitem
2773 editor empty$
2774 { organization bibinfo.check output }
2775 { format.editors output }
2776 if$
2777 format.title "title" output.check
2778 format.volume output
2779 format.number.series output
2780 editor empty$
2781 {
2782 publisher empty$
2783 'skip$
2784 { format.publisher.address output }
2785 if$
2786 }
2787 {
2788 publisher empty$
2789 { format.organization.address output }
2790 {
2791 organization bibinfo.check output
2792 format.publisher.address output
2793 }
2794 if$
2795 }
2796 if$
2797 %<ChemCommun|ChemEurJ|cv> format.date "year" output.check
2798 format.note output
2799 format.url output
2800 fin.entry
2801 }
2802 % \end{macrocode}
2803 % \end{macro}
2804 %
2805 % \begin{macro}{program}
2806 % \changes{0.2.3}{2008/01/17}{ACS does not like a delimiter after last author
2807 % name}
2808 % \mbox{}
2809 % \begin{macrocode}
2810 FUNCTION {program}
2811 {
2812 output.bibitem
2813 format.authors output
2814 format.program.title "title"
2815 %<ChemCommun|ChemEurJ|cv> output.check
2816 %<JAmChemSoc|InorgChem> output.check.blank
2817 format.program.description output.comma
2818 format.program.version output
2819 %<ChemCommun|ChemEurJ|cv> format.date output
2820 format.program.publisher.address output
2821 %<JAmChemSoc|InorgChem> format.date output.comma
2822 format.note output
2823 format.url output
2824 fin.entry
2825 }
2826 % \end{macrocode}
2827 % \end{macro}
2828 %
2829 % \begin{macro}{techreport}
2830 % \mbox{}
2831 % \begin{macrocode}
2832 FUNCTION {techreport}
2833 {
2834 output.bibitem
2835 format.authors "author" output.check
2836 format.title
2837 "title" output.check
2838 format.tr.number output
2839 institution "institution" bibinfo.warn output
2840 address bibinfo.check output
2841 format.date "year" output.check
2842 format.note output
2843 format.url output
2844 fin.entry
2845 }
2846 % \end{macrocode}
2847 % \end{macro}
2848 %
2849 % \begin{macro}{unpublished}
2850 % \mbox{}
2851 % \begin{macrocode}
2852 FUNCTION {unpublished}
2853 {
2854 output.bibitem
2855 format.authors "author" output.check
2856 format.title "title" output
2857 format.date output
2858 format.note "note" output.check
2859 format.url output
2860 fin.entry
2861 }
2862 % \end{macrocode}
2863 % \end{macro}
2864 %
2865 % \begin{macro}{conference}
2866 % |conference| is an alias for |inproceedings|.
2867 % \begin{macrocode}
2868 FUNCTION {conference} { inproceedings }
2869 % \end{macrocode}
2870 % \end{macro}
2871 %
2872 % \begin{macro}{default.type}
2873 % The default type is |misc|.
2874 % \begin{macrocode}
2875 FUNCTION {default.type} { misc }
2876 % \end{macrocode}
2877 % \end{macro}
2878 %
2879 %
2880 %
2881 % \subsection{Main program}
2882 %
2883 % \begin{macro}{begin.bib}
2884 % This function starts the bibliography by opening the |thebibliography|
2885 % environment.
2886 % \begin{macrocode}
2887 FUNCTION {begin.bib}
2888 {
2889 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
2890 }
2891 % \end{macrocode}
2892 % \end{macro}
2893 %
2894 % \begin{macro}{end.bib}
2895 % This function ends the bibliography by closing the |thebibliography|
2896 % environment.
2897 % \begin{macrocode}
2898 FUNCTION {end.bib}
2899 {
2900 newline$
2901 "\end{thebibliography}" write$ newline$
2902 }
2903 % \end{macrocode}
2904 % \end{macro}
2905 %
2906 % \begin{macro}{initialize.longest.label}
2907 % This function sets up the variables for the longest label.
2908 % \begin{macrocode}
2909 FUNCTION {initialize.longest.label}
2910 {
2911 "" 'longest.label :=
2912 #1 'number.label :=
2913 #0 'longest.label.width :=
2914 }
2915 % \end{macrocode}
2916 % \end{macro}
2917 %
2918 % \begin{macro}{init.consts}
2919 % \changes{0.1.2}{2006/05/03}{Added new.sentence initialization}
2920 % This function sets up some constant used while formatting the bibliography.
2921 % \begin{macrocode}
2922 FUNCTION {init.consts}
2923 {
2924 #0 'before.all :=
2925 #1 'mid.sentence :=
2926 #2 'new.sentence :=
2927 }
2928 % \end{macrocode}
2929 % \end{macro}
2930 %
2931 % \begin{macro}{longest.label.pass}
2932 % This function is used to determine the length of the longest label.
2933 % It checks whether the current label is longer than the current longest label.
2934 % If so, it updates |longest.label.width|.
2935 % \begin{macrocode}
2936 FUNCTION {longest.label.pass}
2937 {
2938 number.label int.to.str$ 'label :=
2939 number.label #1 + 'number.label :=
2940 label width$ longest.label.width >
2941 {
2942 label 'longest.label :=
2943 label width$ 'longest.label.width :=
2944 }
2945 'skip$
2946 if$
2947 }
2948 % \end{macrocode}
2949 % \end{macro}
2950 %
2951 % \begin{macro}{write.babel.misc}
2952 % This function writes the default definitions of some commands used in
2953 % formatting a citation.
2954 % \begin{macrocode}
2955 FUNCTION {write.babel.misc}
2956 {
2957 "\providecommand{\bbland}{and}" write$ newline$
2958 "\providecommand{\bblchap}{chap.}" write$ newline$
2959 "\providecommand{\bblchapter}{chapter}" write$ newline$
2960 "\providecommand{\bbletal}{et~al.}" write$ newline$
2961 "\providecommand{\bbleditors}{editors}" write$ newline$
2962 "\providecommand{\bbleds}{eds.}" write$ newline$
2963 "\providecommand{\bbleditor}{editor}" write$ newline$
2964 "\providecommand{\bbled}{ed.}" write$ newline$
2965 "\providecommand{\bbledition}{edition}" write$ newline$
2966 "\providecommand{\bbledn}{ed.}" write$ newline$
2967 "\providecommand{\bbleidp}{page}" write$ newline$
2968 "\providecommand{\bbleidpp}{pages}" write$ newline$
2969 "\providecommand{\bblerratum}{erratum}" write$ newline$
2970 "\providecommand{\bblin}{in}" write$ newline$
2971 "\providecommand{\bblmthesis}{Master's thesis}" write$ newline$
2972 "\providecommand{\bblno}{no.}" write$ newline$
2973 "\providecommand{\bblnumber}{number}" write$ newline$
2974 "\providecommand{\bblof}{of}" write$ newline$
2975 "\providecommand{\bblpage}{page}" write$ newline$
2976 "\providecommand{\bblpages}{pages}" write$ newline$
2977 "\providecommand{\bblp}{p}" write$ newline$
2978 "\providecommand{\bblphdthesis}{Ph.D. thesis}" write$ newline$
2979 "\providecommand{\bblpp}{pp}" write$ newline$
2980 "\providecommand{\bbltechrep}{Tech. Rep.}" write$ newline$
2981 "\providecommand{\bbltechreport}{Technical Report}" write$ newline$
2982 "\providecommand{\bblvolume}{volume}" write$ newline$
2983 "\providecommand{\bblvol}{Vol.}" write$ newline$
2984 }
2985 % \end{macrocode}
2986 % \end{macro}
2987 %
2988 % \begin{macro}{write.babel.months}
2989 % This function writes the default names of the months.
2990 % \begin{macrocode}
2991 FUNCTION {write.babel.months}
2992 {
2993 "\providecommand{\bbljan}{January}" write$ newline$
2994 "\providecommand{\bblfeb}{February}" write$ newline$
2995 "\providecommand{\bblmar}{March}" write$ newline$
2996 "\providecommand{\bblapr}{April}" write$ newline$
2997 "\providecommand{\bblmay}{May}" write$ newline$
2998 "\providecommand{\bbljun}{June}" write$ newline$
2999 "\providecommand{\bbljul}{July}" write$ newline$
3000 "\providecommand{\bblaug}{August}" write$ newline$
3001 "\providecommand{\bblsep}{September}" write$ newline$
3002 "\providecommand{\bbloct}{October}" write$ newline$
3003 "\providecommand{\bblnov}{November}" write$ newline$
3004 "\providecommand{\bbldec}{December}" write$ newline$
3005 }
3006 % \end{macrocode}
3007 % \end{macro}
3008 %
3009 % \begin{macro}{write.babel.ordinals}
3010 % This function writes the default names of the ordinals.
3011 % \begin{macrocode}
3012 FUNCTION {write.babel.ordinals}
3013 {
3014 "\providecommand{\bblfirst}{First}" write$ newline$
3015 "\providecommand{\bblfirsto}{1st}" write$ newline$
3016 "\providecommand{\bblsecond}{Second}" write$ newline$
3017 "\providecommand{\bblsecondo}{2nd}" write$ newline$
3018 "\providecommand{\bblthird}{Third}" write$ newline$
3019 "\providecommand{\bblthirdo}{3rd}" write$ newline$
3020 "\providecommand{\bblfourth}{Fourth}" write$ newline$
3021 "\providecommand{\bblfourtho}{4th}" write$ newline$
3022 "\providecommand{\bblfifth}{Fifth}" write$ newline$
3023 "\providecommand{\bblfiftho}{5th}" write$ newline$
3024 "\providecommand{\bblst}{st}" write$ newline$
3025 "\providecommand{\bblnd}{nd}" write$ newline$
3026 "\providecommand{\bblrd}{rd}" write$ newline$
3027 "\providecommand{\bblth}{th}" write$ newline$
3028 }
3029 % \end{macrocode}
3030 % \end{macro}
3031 %
3032 % \begin{macro}{write.babel}
3033 % This function writes the default of all words used for formatting a citation.
3034 % \begin{macrocode}
3035 FUNCTION {write.babel}
3036 {
3037 write.babel.misc
3038 write.babel.months
3039 write.babel.ordinals
3040 }
3041 % \end{macrocode}
3042 % \end{macro}
3043 %
3044 % \begin{macro}{write.commands}
3045 % \changes{0.2.1}{2007/02/28}{Replaced newcommand by providecommand for
3046 % capitalize}
3047 % This function writes the commands used in a citation.
3048 % \begin{macrocode}
3049 FUNCTION {write.commands}
3050 {
3051 "\providecommand{\url}[1]{\texttt{#1}}" write$ newline$
3052 "\providecommand{\urlprefix}{}" write$ newline$
3053 "\providecommand{\foreignlanguage}[2]{#2}" write$ newline$
3054 "\providecommand{\Capitalize}[1]{\uppercase{#1}}" write$ newline$
3055 "\providecommand{\capitalize}[1]{\expandafter\Capitalize#1}" write$ newline$
3056 "\providecommand{\bibliographycite}[1]{\cite{#1}}" write$ newline$
3057 write.babel
3058 }
3059 % \end{macrocode}
3060 % \end{macro}
3061 %
3062 % \begin{macro}{write.header}
3063 % This function writes the header of the |.bbl| file. It does not, however,
3064 % start the |thebibliography| environment. The contents of |@preamble| is
3065 % always written first.
3066 % \begin{macrocode}
3067 FUNCTION {write.header}
3068 {
3069 preamble$ empty$
3070 'skip$
3071 { preamble$ write$ newline$ }
3072 if$
3073 write.commands
3074 }
3075 % \end{macrocode}
3076 % \end{macro}
3077 %
3078 % \begin{macro}{main}
3079 % Read all required entries from the database. The entries are in citation
3080 % order.
3081 % \begin{macrocode}
3082 READ
3083 % \end{macrocode}
3084 % Determine the length of the longest label.
3085 % \begin{macrocode}
3086 EXECUTE {initialize.longest.label}
3087 ITERATE {longest.label.pass}
3088 % \end{macrocode}
3089 % Write the header to the file and open the |thebibliography| environment.
3090 % \begin{macrocode}
3091 EXECUTE {init.consts}
3092 EXECUTE {write.header}
3093 EXECUTE {begin.bib}
3094 % \end{macrocode}
3095 % Format all entries
3096 % \begin{macrocode}
3097 ITERATE {call.type$}
3098 % \end{macrocode}
3099 % Close the |thebibliography| environment.
3100 % \begin{macrocode}
3101 EXECUTE {end.bib}
3102 % \end{macrocode}
3103 % \end{macro}
3104 %
3105 %
3106 %
3107 % \Finale
3108 % \PrintChanges
3109 % \setcounter{IndexColumns}{2}
3110 % \PrintIndex