source: trunk/MagicSoft/TDAS-Extractor/bibstyle.bst@ 9488

Last change on this file since 9488 was 5216, checked in by gaug, 20 years ago
*** empty log message ***
File size: 61.1 KB
Line 
1% BibTeX styles for various physics journals (27-Feb-1990).
2% This file, physics.btx, is based on the file btxbst.doc.
3 % Please notify Charles Karney (Karney@Princeton.EDU)
4 % of any bugs, improvements, etc.
5% Run this file through cpp to get specific versions. I have written
6% a version of cpp within Emacs. To access it put
7% (autoload 'cpp "tex$bibtex:cpp" ; Use cpp for BibTeX styles
8% "C preprocessor"
9% t)
10% into your .emacs file. Read in this file with
11% emacs tex$bibtex:physics.btx
12% and run cpp with e.g.,
13% M-x cpp <ret> aip <ret>
14% Save the resulting file to tex$latex:aip.bst.
15% To accomodate the variations we need (in addition to the definitions below)
16% ATIT_SUPPRESS: do not include the titles of journal articles
17% NAME_INVERT: put the initials last
18% NAME_UPPER: convert names to all caps.
19% MONTH_SUPPRESS: do not include months in journal articles
20% PAREN_DATE: dates go in parens in journal articles
21% DATE_FIRST: dates go before page numbers
22% VOLUME_SPACE: volume set off with space (not colon)
23% NUM_SUPPRESS: do not include numbers in journal articles
24% BOLD_VOL: volume numbers in bold face in journal articles
25% BRACKET_NOTE: notes in brackets
26% PAGE_START_J: include only starting page for journal articles
27% PAGE_START_O: include only starting page for other entries
28% PAGE_ABBREV: abbreviate page to p. and pages to pp.
29% PHYSICS_JOUR: include abbreviations for Physics journals
30% COMMA_DELIMIT: use comma (instead of period) to divide a citation
31% NOTE_SUPPRESS: suppress the note
32% MAX_NAMES: max number of authors before using et al (0 = infinity)
33% MIN_NAMES: number of authors to list with et al.
34% EDIT_VAR: use "edited by ..." instead of "..., editors"
35% RMP_LABELS: create RMP-style labels
36% KEY_CITE: use key as label
37% NAMED_REFS: use (Smith, 1988) style of citations
38% CSC_NAMES: names set in caps and small caps
39% JOUR_DEEMPH: don't emphasize journal name
40% ETAL_EMPH: emphasize et al.
41% ALT_INCOLL alternate ordering of fields in incollections
42% These are all boolean (0 or 1) except for MAX_NAMES and MIN_NAMES.
43% These need to satisfy 0 <= MIN_NAMES <= MAX_NAMES.
44% The rule here is that if all these are defined to be zero, we revert to
45% the standard styles. For that reason we initialize them all to 0.
46% These are the original macros
47 % Progress in Particle and Nuclear Physics
48% This is the start of btxbst.doc
49% BibTeX `plain' family
50 % version 0.99b for BibTeX versions 0.99a or later, LaTeX version 2.09.
51 % Copyright (C) 1985, all rights reserved.
52 % Copying of this file is authorized only if either
53 % (1) you make absolutely no changes to your copy, including name, or
54 % (2) if you do make changes, you name it something other than
55 % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
56 % This restriction helps ensure that all standard styles are identical.
57 % The file btxbst.doc has the documentation for this style.
58% Please notify Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU) of any bugs in
59% these standard styles or in this documentation file.
60%
61% This is file btxbxt.doc; it helps document bibliography styles,
62% and is also a template file that you can use to make
63% several different style files, if you have access to a C preprocessor.
64% For example, the standard styles were made by doing something like
65% cpp -P -DPLAIN btxbst.doc plain.txt
66% cpp -P -DUNSRT btxbst.doc unsrt.txt
67% cpp -P -DALPHA btxbst.doc alpha.txt
68% cpp -P -DABBRV btxbst.doc abbrv.txt
69% and then renaming after removing unwanted comments and blank lines.
70% If you don't have access,
71% you can edit this file by hand to imitate the preprocessor,
72% with the following explanation of the C preprocessor constructs used here.
73%
74% The output of the preprocessor is the same as the input, except that certain
75% lines will be excluded (and some blank lines will be added). The sequence
76% #if VAR
77% lines to be included when VAR is not zero
78% #else
79% lines to be included when VAR is zero
80% #endif
81% (with the #-signs appearing in column 1) means that one set or the other of
82% the lines are to be included depending on the value of VAR.
83% The #else part is optional. Comments can be added after #else and #endif.
84% Variables can be set by
85% #define VAR value
86% and one can also use #ifdef VAR to see if VAR has any value, and #ifndef
87% to see if it has none.
88% Another #if form used in this file is #if !VAR, which includes the lines
89% after the #if only if VAR is zero.
90%
91% Convention: Use all uppercase identifiers for these preprocessor variables
92% so you can spot them easily
93%
94% The command line to the preprocessor should define one of PLAIN, UNSRT, ALPHA
95% or ABBRV (though PLAIN will be used by default if none is given),
96% and the following lines will set various boolean variables to control the
97% various lines that are chosen from the rest of the file.
98% Each boolean variable should be set true (1) or false (0) in each style.
99% Here are the current variables, and their meanings:
100% 0 : an alphabetic label is used (if false then a numeric
101% label is used)
102% 0 : the entries should be sorted by label (if nonnumeric)
103% and other info, like authors (if false, then
104% entries remain in order of occurrence)
105% 0 : the authors, editors, etc., get the full names as
106% given in the bibliography file (if false, the first
107% names become initials)
108% 1 : titles of non-"books" (e.g., articles) should be
109% converted to lower-case, except the first letter or
110% first letter after a colon
111% (if false then they appear as in the database)
112% 0 : months are spelled out in full (if false, then
113% they're abbreviated)
114% 0 : macro journal names are spelled out in full
115% (if false then they are abbreviated, currently
116% as they appear in ACM publications)
117%# define PLAIN 1
118%
119% Entry formatting: Similar to that recommended by Mary-Claire van Leunen
120% in "A Handbook for Scholars". Book-like titles are italicized
121% (emphasized) and non-book titles are converted to sentence
122% capitilization (and not enclosed in quotes).
123% This file outputs a \newblock between major blocks of an entry
124% (the name \newblock is analogous to the names \newline and \newpage)
125% so that the user can obtain an "open" format, which has a line break
126% before each block and lines after the first are indented within blocks,
127% by giving the optional \documentstyle argument `openbib';
128% The default is the "closed" format---blocks runs together.
129%
130% Citation alphabetic label format:
131% [Knu73] for single author (or editor or key)
132% [AHU83] (first letters of last names) for multiple authors
133%
134% Citation label numberic format:
135% [number]
136%
137% Reference list ordering for sorted, alphabetic lables:
138% alphabetical by citation label, then by author(s) or whatever
139% passes for author in the absence of one, then by year,
140% then title
141%
142% Reference list ordering for sorted, numeric lables:
143% alphabetical by author(s) or whatever passes
144% for author in the absence of one, then by year, then title
145%
146% Reference list ordering for unsorted:
147% by the order cited in the text
148%
149% History
150% 12/16/84 (HWT) Original `plain' version, by Howard Trickey.
151% 12/23/84 (LL) Some comments made by Leslie Lamport.
152% 2/16/85 (OP) Changes based on LL's comments, Oren Patashnik.
153% 2/17/85 (HWT) Template file and other standard styles made.
154% 3/28/85 (OP) First release, version 0.98b for BibTeX 0.98f.
155% 5/ 9/85 (OP) Version 0.98c for BibTeX 0.98i:
156% fixed Theoretical Computer Science macro name;
157% fixed the format.vol.num.pages function.
158% 1/24/88 (OP) Version 0.99a for BibTeX 0.99a, main changes:
159% assignment operator (:=) arguments reversed;
160% the preamble$ function outputs the database PREAMBLE;
161% entry.max$ and global.max$ (built-in) variables replace
162% entry.string.max and global.string.max functions;
163% alphabetizing by year then title, not just title;
164% many unnecessary ties removed; \it ==> \em;
165% the `alpha' style uses a superscripted `+' instead of a
166% `*' for unnamed names in constructing the label;
167% the `abbrv' style now uses "Mar." and "Sept.";
168% the functions calc.label and presort now look at just
169% the fields they're supposed to;
170% BOOKLET, MASTERSTHESIS, TECHREPORT use nonbook titles;
171% INBOOK and INCOLLECTION take an optional type (e.g.
172% type = "Section"), overriding the default "chapter";
173% BOOK, INBOOK, INCOLLECTION, and PROCEEDINGS now allow
174% either volume or number, not just volume;
175% INCOLLECTION now allows an edition and series field;
176% PROCEEDINGS and INPROCEEDINGS now use the address field
177% to tell where a conference was held;
178% INPROCEEDINGS and PROCEEDINGS now allow either volume
179% or number, and also a series field;
180% MASTERSTHESIS and PHDTHESIS accept types other than
181% "Master's thesis" and "PhD thesis";
182% UNPUBLISHED now outputs, in one block, note then date;
183% MANUAL now prints out the organization in
184% the first block if the author field is empty;
185% MISC can't be empty---it requires some optional field.
186% 3/23/88 (OP) Version 0.99b for BibTeX 0.99c---changed the three
187% erroneous occurrences of `cite ' to `cite$ '; this
188% change didn't affect the four standard styles, so the
189% 0.99a versions of those styles are still current.
190%
191% The ENTRY declaration
192% Like Scribe's (according to pages 231-2 of the April '84 edition),
193% but no fullauthor or editors fields because BibTeX does name handling.
194% The annote field is commented out here because this family doesn't
195% include an annotated bibliography style. And in addition to the fields
196% listed here, BibTeX has a built-in crossref field, explained later.
197ENTRY
198% Fields:
199 { address
200% Usually the address of a publisher or other type of organization.
201% Put information in this field only if it helps the reader find the
202% thing---for example you should omit the address of a major
203% publisher entirely. For a PROCEEDINGS or an INPROCEEDINGS,
204% however, it's the address of the conference; for those two entry
205% types, include the publisher's or organization's address, if
206% necessary, in the publisher or organization field.
207% annote
208% Long annotation---for annotated bibliographies (begins sentence).
209 author
210% Name(s) of author(s), in BibTeX name format.
211 booktitle
212% Book title when the thing being referenced isn't the whole book.
213% For book entries, the title field should be used instead.
214 chapter
215% Chapter (or section or whatever) number.
216 collaboration
217 edition
218% Edition of a book---should be an ordinal (e.g., "Second").
219 editor
220% Name(s) of editor(s), in BibTeX name format.
221% If there is also an author field, then the editor field should be
222% for the book or collection that the work appears in.
223 howpublished
224% How something strange has been published (begins sentence).
225 institution
226% Sponsoring institution of a technical report.
227 journal
228% Journal name (macros are provided for many).
229 key
230% Alphabetizing, labeling, and cross-referencing key
231% (needed when an entry has no author or editor).
232 month
233% Month (macros are provided).
234 note
235% To help the reader find a reference (begins sentence).
236 eprint
237% ArXiv identifier
238 number
239% Number of a journal or technical report, or of a work in a series.
240 organization
241% Organization sponsoring a conference (or publishing a manual); if
242% the editor (or author) is empty, and if the organization produces
243% an awkward label or cross reference, you should put appropriately
244% condensed organization information in the key field as well.
245 pages
246% Page number or numbers (use `--' to separate a range, use `+'
247% to indicate pages following that don't form a simple range).
248 publisher
249% Publisher name.
250 school
251% School name (for theses).
252 series
253% The name of a series or set of books.
254% An individual book will will also have it's own title.
255 title
256% The title of the thing you're referred to.
257 type
258% Type of a Techreport (e.g., "Research Note") to be used instead of
259% the default "Technical Report"; or, similarly, the type of a
260% thesis; or of a part of a book.
261 volume
262% The volume number of a journal or multivolume work.
263 year
264% The year should contain only numerals (technically, it should end
265% with four numerals, after purification; doesn't a begin sentence).
266 url
267 }
268% There are no integer entry variables
269 {}
270% These string entry variables are used to form the citation label.
271% In a storage pinch, sort.label can be easily computed on the fly.
272 { label }
273% Each entry function starts by calling output.bibitem, to write the
274% \bibitem and its arguments to the .BBL file. Then the various fields
275% are formatted and printed by output or output.check. Those functions
276% handle the writing of separators (commas, periods, \newblock's),
277% taking care not to do so when they are passed a null string.
278% Finally, fin.entry is called to add the final period and finish the
279% entry.
280%
281% A bibliographic reference is formatted into a number of `blocks':
282% in the open format, a block begins on a new line and subsequent
283% lines of the block are indented. A block may contain more than
284% one sentence (well, not a grammatical sentence, but something to
285% be ended with a sentence ending period). The entry functions should
286% call new.block whenever a block other than the first is about to be
287% started. They should call new.sentence whenever a new sentence is
288% to be started. The output functions will ensure that if two
289% new.sentence's occur without any non-null string being output between
290% them then there won't be two periods output. Similarly for two
291% successive new.block's.
292%
293% The output routines don't write their argument immediately.
294% Instead, by convention, that argument is saved on the stack to be
295% output next time (when we'll know what separator needs to come
296% after it). Meanwhile, the output routine has to pop the pending
297% output off the stack, append any needed separator, and write it.
298%
299% To tell which separator is needed, we maintain an output.state.
300% It will be one of these values:
301% before.all just after the \bibitem
302% mid.sentence in the middle of a sentence: comma needed
303% if more sentence is output
304% after.sentence just after a sentence: period needed
305% after.block just after a block (and sentence):
306% period and \newblock needed.
307% Note: These styles don't use after.sentence
308%
309% VAR: output.state : INTEGER -- state variable for output
310%
311% The output.nonnull function saves its argument (assumed to be nonnull)
312% on the stack, and writes the old saved value followed by any needed
313% separator. The ordering of the tests is decreasing frequency of
314% occurrence.
315%
316% output.nonnull(s) ==
317% BEGIN
318% s := argument on stack
319% if output.state = mid.sentence then
320% write$(pop() * ", ")
321% -- "pop" isn't a function: just use stack top
322% else
323% if output.state = after.block then
324% write$(add.period$(pop()))
325% newline$
326% write$("\newblock ")
327% else
328% if output.state = before.all then
329% write$(pop())
330% else -- output.state should be after.sentence
331% write$(add.period$(pop()) * " ")
332% fi
333% fi
334% output.state := mid.sentence
335% fi
336% push s on stack
337% END
338%
339% The output function calls output.nonnull if its argument is non-empty;
340% its argument may be a missing field (thus, not necessarily a string)
341%
342% output(s) ==
343% BEGIN
344% if not empty$(s) then output.nonnull(s)
345% fi
346% END
347%
348% The output.check function is the same as the output function except that, if
349% necessary, output.check warns the user that the t field shouldn't be empty
350% (this is because it probably won't be a good reference without the field;
351% the entry functions try to make the formatting look reasonable even when
352% such fields are empty).
353%
354% output.check(s,t) ==
355% BEGIN
356% if empty$(s) then
357% warning$("empty " * t * " in " * cite$)
358% else output.nonnull(s)
359% fi
360% END
361%
362% The output.bibitem function writes the \bibitem for the current entry
363% (the label should already have been set up), and sets up the separator
364% state for the output functions. And, it leaves a string on the stack
365% as per the output convention.
366%
367% output.bibitem ==
368% BEGIN
369% newline$
370% write$("\bibitem[") % for alphabetic labels,
371% write$(label) % these three lines
372% write$("]{") % are used
373% write$("\bibitem{") % this line for numeric labels
374% write$(cite$)
375% write$("}")
376% push "" on stack
377% output.state := before.all
378% END
379%
380% The fin.entry function finishes off an entry by adding a period to the
381% string remaining on the stack. If the state is still before.all
382% then nothing was produced for this entry, so the result will look bad,
383% but the user deserves it. (We don't omit the whole entry because the
384% entry was cited, and a bibitem is needed to define the citation label.)
385%
386% fin.entry ==
387% BEGIN
388% write$(add.period$(pop()))
389% newline$
390% END
391%
392% The new.block function prepares for a new block to be output, and
393% new.sentence prepares for a new sentence.
394%
395% new.block ==
396% BEGIN
397% if output.state <> before.all then
398% output.state := after.block
399% fi
400% END
401%
402% new.sentence ==
403% BEGIN
404% if output.state <> after.block then
405% if output.state <> before.all then
406% output.state := after.sentence
407% fi
408% fi
409% END
410%
411INTEGERS { output.state before.all mid.sentence after.sentence after.block }
412FUNCTION {init.state.consts}
413{ #0 'before.all :=
414 #1 'mid.sentence :=
415 #2 'after.sentence :=
416 #3 'after.block :=
417}
418% the variables s and t are temporary string holders
419STRINGS { s t }
420FUNCTION {output.nonnull}
421{ 's :=
422 output.state mid.sentence =
423 { ", " * write$ }
424 { output.state after.block =
425 { "," * write$
426 newline$
427 "\newblock " write$
428 }
429 { output.state before.all =
430 'write$
431 { add.period$ " " * write$ }
432 if$
433 }
434 if$
435 mid.sentence 'output.state :=
436 }
437 if$
438 s
439}
440FUNCTION {output}
441{ duplicate$ empty$
442 'pop$
443 'output.nonnull
444 if$
445}
446FUNCTION {output.check}
447{ 't :=
448 duplicate$ empty$
449 { pop$ "empty " t * " in " * cite$ * warning$ }
450 'output.nonnull
451 if$
452}
453FUNCTION {output.bibitem}
454{ newline$
455 "\bibitem{" write$
456 cite$ write$
457 "}" write$
458 newline$
459 ""
460 before.all 'output.state :=
461}
462% This function finishes all entries.
463FUNCTION {fin.entry}
464{ add.period$
465 write$
466 newline$
467}
468FUNCTION {new.block}
469{ output.state before.all =
470 'skip$
471 { after.block 'output.state := }
472 if$
473}
474FUNCTION {new.sentence}
475{ skip$
476}
477% These three functions pop one or two (integer) arguments from the stack
478% and push a single one, either 0 or 1.
479% The 'skip$ in the `and' and `or' functions are used because
480% the corresponding if$ would be idempotent
481FUNCTION {not}
482{ { #0 }
483 { #1 }
484 if$
485}
486FUNCTION {and}
487{ 'skip$
488 { pop$ #0 }
489 if$
490}
491FUNCTION {or}
492{ { pop$ #1 }
493 'skip$
494 if$
495}
496% Sometimes we begin a new block only if the block will be big enough. The
497% new.block.checka function issues a new.block if its argument is nonempty;
498% new.block.checkb does the same if either of its TWO arguments is nonempty.
499FUNCTION {new.block.checka}
500{ empty$
501 'skip$
502 'new.block
503 if$
504}
505FUNCTION {new.block.checkb}
506{ empty$
507 swap$ empty$
508 and
509 'skip$
510 'new.block
511 if$
512}
513% The new.sentence.check functions are analogous.
514FUNCTION {new.sentence.checka}
515{ empty$
516 'skip$
517 'new.sentence
518 if$
519}
520FUNCTION {new.sentence.checkb}
521{ empty$
522 swap$ empty$
523 and
524 'skip$
525 'new.sentence
526 if$
527}
528% Here are some functions for formatting chunks of an entry.
529% By convention they either produce a string that can be followed by
530% a comma or period (using add.period$, so it is OK to end in a period),
531% or they produce the null string.
532%
533% A useful utility is the field.or.null function, which checks if the
534% argument is the result of pushing a `missing' field (one for which no
535% assignment was made when the current entry was read in from the database)
536% or the result of pushing a string having no non-white-space characters.
537% It returns the null string if so, otherwise it returns the field string.
538% Its main (but not only) purpose is to guarantee that what's left on the
539% stack is a string rather than a missing field.
540%
541% field.or.null(s) ==
542% BEGIN
543% if empty$(s) then return ""
544% else return s
545% END
546%
547% Another helper function is emphasize, which returns the argument emphazised,
548% if that is non-empty, otherwise it returns the null string. Italic
549% corrections aren't used, so this function should be used when punctation
550% will follow the result.
551%
552% emphasize(s) ==
553% BEGIN
554% if empty$(s) then return ""
555% else return "{\em " * s * "}"
556%
557% The format.names function formats the argument (which should be in
558% BibTeX name format) into "First Von Last, Junior", separated by commas
559% and with an "and" before the last (but ending with "et~al." if the last
560% of multiple authors is "others"). This function's argument should always
561% contain at least one name.
562%
563% VAR: nameptr, namesleft, numnames: INTEGER
564% pseudoVAR: nameresult: STRING (it's what's accumulated on the stack)
565%
566% format.names(s) ==
567% BEGIN
568% nameptr := 1
569% numnames := num.names$(s)
570% namesleft := numnames
571% while namesleft > 0
572% do
573% % for full names:
574% t := format.name$(s, nameptr, "{ff~}{vv~}{ll}{, jj}")
575% % for abbreviated first names:
576% t := format.name$(s, nameptr, "{f.~}{vv~}{ll}{, jj}")
577% if nameptr > 1 then
578% if namesleft > 1 then nameresult := nameresult * ", " * t
579% else if numnames > 2
580% then nameresult := nameresult * ","
581% fi
582% if t = "others"
583% then nameresult := nameresult * " et~al."
584% else nameresult := nameresult * " and " * t
585% fi
586% fi
587% else nameresult := t
588% fi
589% nameptr := nameptr + 1
590% namesleft := namesleft - 1
591% od
592% return nameresult
593% END
594%
595% The format.authors function returns the result of format.names(author)
596% if the author is present, or else it returns the null string
597%
598% format.authors ==
599% BEGIN
600% if empty$(author) then return ""
601% else return format.names(author)
602% fi
603% END
604%
605% Format.editors is like format.authors, but it uses the editor field,
606% and appends ", editor" or ", editors"
607%
608% format.editors ==
609% BEGIN
610% if empty$(editor) then return ""
611% else
612% if num.names$(editor) > 1 then
613% return format.names(editor) * ", editors"
614% else
615% return format.names(editor) * ", editor"
616% fi
617% fi
618% END
619%
620% Other formatting functions are similar, so no "comment version" will be
621% given for them.
622%
623% The `pop$' in this function gets rid of the duplicate `empty' value and
624% the `skip$' returns the duplicate field value
625FUNCTION {field.or.null}
626{ duplicate$ empty$
627 { pop$ "" }
628 'skip$
629 if$
630}
631FUNCTION {emphasize}
632{ duplicate$ empty$
633 { pop$ "" }
634 { "{\em " swap$ * "}" * }
635 if$
636}
637FUNCTION {embolden}
638{ duplicate$ empty$
639 { pop$ "" }
640 { "{\bf " swap$ * "}" * }
641 if$
642}
643FUNCTION {bracket}
644{ duplicate$ empty$
645 { pop$ "" }
646 { "[" swap$ * "]" * }
647 if$
648}
649FUNCTION {paren}
650{ duplicate$ empty$
651 { pop$ "" }
652 { "(" swap$ * ")" * }
653 if$
654}
655INTEGERS { nameptr namesleft numnames }
656INTEGERS { etal }
657FUNCTION {format.names}
658{ 's :=
659 #1 'nameptr :=
660 s num.names$ 'numnames :=
661 numnames #3 >
662 s numnames "{ll}" format.name$ "others" = numnames #1 > and
663 or 'etal :=
664 etal
665 { #1 #1 + 'namesleft := }
666 { numnames 'namesleft := }
667 if$
668 { namesleft #0 > }
669 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
670 nameptr #1 >
671 { namesleft #1 >
672 { ", " * t * }
673 { nameptr #2 >
674 { "," * }
675 'skip$
676 if$
677 t "others" =
678 etal or
679 { " et~al." * }
680 { " and " * t * }
681 if$
682 }
683 if$
684 }
685 't
686 if$
687 nameptr #1 + 'nameptr :=
688 namesleft #1 - 'namesleft :=
689 }
690 while$
691}
692FUNCTION {format.authors}
693{ author empty$
694 { "" }
695 { author format.names }
696 if$
697}
698FUNCTION {format.editors}
699{ editor empty$
700 { "" }
701 { editor format.names
702 editor num.names$ #1 >
703 { ", editors" * }
704 { ", editor" * }
705 if$
706 }
707 if$
708}
709% The format.title function is used for non-book-like titles.
710% For most styles we convert to lowercase (except for the very first letter,
711% and except for the first one after a colon (followed by whitespace)),
712% and hope the user has brace-surrounded words that need to stay capitilized;
713% for some styles, however, we leave it as it is in the database.
714FUNCTION {format.title}
715{ title empty$
716 { "" }
717 { title "t" change.case$ }
718 if$
719}
720% By default, BibTeX sets the global integer variable global.max$ to the BibTeX
721% constant glob_str_size, the maximum length of a global string variable.
722% Analogously, BibTeX sets the global integer variable entry.max$ to
723% ent_str_size, the maximum length of an entry string variable.
724% The style designer may change these if necessary (but this is unlikely)
725% The n.dashify function makes each single `-' in a string a double `--'
726% if it's not already
727%
728% pseudoVAR: pageresult: STRING (it's what's accumulated on the stack)
729%
730% n.dashify(s) ==
731% BEGIN
732% t := s
733% pageresult := ""
734% while (not empty$(t))
735% do
736% if (first character of t = "-")
737% then
738% if (next character isn't)
739% then
740% pageresult := pageresult * "--"
741% t := t with the "-" removed
742% else
743% while (first character of t = "-")
744% do
745% pageresult := pageresult * "-"
746% t := t with the "-" removed
747% od
748% fi
749% else
750% pageresult := pageresult * the first character
751% t := t with the first character removed
752% fi
753% od
754% return pageresult
755% END
756FUNCTION {n.dashify}
757{ 't :=
758 ""
759 { t empty$ not }
760 { t #1 #1 substring$ "-" =
761 { t #1 #2 substring$ "--" = not
762 { "--" *
763 t #2 global.max$ substring$ 't :=
764 }
765 { { t #1 #1 substring$ "-" = }
766 { "-" *
767 t #2 global.max$ substring$ 't :=
768 }
769 while$
770 }
771 if$
772 }
773 { t #1 #1 substring$ *
774 t #2 global.max$ substring$ 't :=
775 }
776 if$
777 }
778 while$
779}
780FUNCTION {first.page}
781{ 't :=
782 ""
783 { t empty$ not t #1 #1 substring$ "-" = not and }
784 { t #1 #1 substring$ *
785 t #2 global.max$ substring$ 't :=
786 }
787 while$
788}
789% The format.date function is for the month and year, but we give a warning if
790% there's an empty year but the month is there, and we return the empty string
791% if they're both empty.
792FUNCTION {format.collaboration}
793{ collaboration empty$
794 { "" * }
795 { " (" * collaboration * " Collab.)" }
796 if$
797}
798FUNCTION {format.collabbook}
799{ collaboration empty$
800 { "" * }
801 { "The " * collaboration * " Collaboration" }
802 if$
803}
804
805
806FUNCTION {format.url}
807{ url empty$
808 { "" }
809 { new.block "\url{" url * "}" * }
810 if$
811}
812
813
814
815FUNCTION {format.date}
816{ year empty$
817 { "" }
818 'year
819 if$
820}
821% The format.btitle is for formatting the title field when it is a book-like
822% entry---the style used here keeps it in uppers-and-lowers and emphasizes it.
823FUNCTION {format.btitle}
824{ title emphasize
825}
826% For several functions we'll need to connect two strings with a
827% tie (~) if the second one isn't very long (fewer than 3 characters).
828% The tie.or.space.connect function does that. It concatenates the two
829% strings on top of the stack, along with either a tie or space between
830% them, and puts this concatenation back onto the stack:
831%
832% tie.or.space.connect(str1,str2) ==
833% BEGIN
834% if text.length$(str2) < 3
835% then return the concatenation of str1, "~", and str2
836% else return the concatenation of str1, " ", and str2
837% END
838FUNCTION {tie.or.space.connect}
839{ duplicate$ text.length$ #3 <
840 { "~" }
841 { " " }
842 if$
843 swap$ * *
844}
845% The either.or.check function complains if both fields or an either-or pair
846% are nonempty.
847%
848% either.or.check(t,s) ==
849% BEGIN
850% if empty$(s) then
851% warning$(can't use both " * t * " fields in " * cite$)
852% fi
853% END
854FUNCTION {either.or.check}
855{ empty$
856 'pop$
857 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
858 if$
859}
860% The format.bvolume function is for formatting the volume and perhaps
861% series name of a multivolume work. If both a volume and a series field
862% are there, we assume the series field is the title of the whole multivolume
863% work (the title field should be the title of the thing being referred to),
864% and we add an "of <series>". This function is called in mid-sentence.
865FUNCTION {format.bvolume}
866{ volume empty$
867 { "" }
868 { "volume" volume tie.or.space.connect
869 series empty$
870 'skip$
871 { " of " * series emphasize * }
872 if$
873 "volume and number" number either.or.check
874 }
875 if$
876}
877% The format.number.series function is for formatting the series name
878% and perhaps number of a work in a series. This function is similar to
879% format.bvolume, although for this one the series must exist (and the
880% volume must not exist). If the number field is empty we output either
881% the series field unchanged if it exists or else the null string.
882% If both the number and series fields are there we assume the series field
883% gives the name of the whole series (the title field should be the title
884% of the work being one referred to), and we add an "in <series>".
885% We capitilize Number when this function is used at the beginning of a block.
886FUNCTION {format.number.series}
887{ volume empty$
888 { number empty$
889 { series field.or.null }
890 { output.state mid.sentence =
891 { "number" }
892 { "Number" }
893 if$
894 number tie.or.space.connect
895 series empty$
896 { "there's a number but no series in " cite$ * warning$ }
897 { " in " * series * }
898 if$
899 }
900 if$
901 }
902 { "" }
903 if$
904}
905% The format.edition function appends " edition" to the edition, if present.
906% We lowercase the edition (it should be something like "Third"), because
907% this doesn't start a sentence.
908FUNCTION {format.edition}
909{ edition empty$
910 { "" }
911 { output.state mid.sentence =
912 { edition "l" change.case$ " edition" * }
913 { edition "t" change.case$ " edition" * }
914 if$
915 }
916 if$
917}
918% The format.pages function is used for formatting a page range in a book
919% (and in rare circumstances, an article).
920%
921% The multi.page.check function examines the page field for a "-" or "," or "+"
922% so that format.pages can use "page" instead of "pages" if none exists.
923% Note: global.max$ here means "take the rest of the string"
924%
925% VAR: multiresult: INTEGER (actually, a boolean)
926%
927% multi.page.check(s) ==
928% BEGIN
929% t := s
930% multiresult := false
931% while ((not multiresult) and (not empty$(t)))
932% do
933% if (first character of t = "-" or "," or "+")
934% then multiresult := true
935% else t := t with the first character removed
936% fi
937% od
938% return multiresult
939% END
940INTEGERS { multiresult }
941FUNCTION {multi.page.check}
942{ 't :=
943 #0 'multiresult :=
944 { multiresult not
945 t empty$ not
946 and
947 }
948 { t #1 #1 substring$
949 duplicate$ "-" =
950 swap$ duplicate$ "," =
951 swap$ "+" =
952 or or
953 { #1 'multiresult := }
954 { t #2 global.max$ substring$ 't := }
955 if$
956 }
957 while$
958 multiresult
959}
960% This function doesn't begin a sentence so "pages" isn't capitalized.
961% Other functions that use this should keep that in mind.
962FUNCTION {format.pages}
963{ pages empty$
964 { "" }
965 { pages multi.page.check
966 { "pp." pages n.dashify tie.or.space.connect }
967 { "p." pages tie.or.space.connect }
968 if$
969 }
970 if$
971}
972FUNCTION {format.pages.a}
973{ pages empty$
974 { "" }
975 { "p." pages first.page tie.or.space.connect }
976 if$
977}
978% The format.vol.num.pages function is for the volume, number, and page range
979% of a journal article. We use the format: vol(number):pages, with some
980% variations for empty fields. This doesn't begin a sentence.
981FUNCTION {format.vol.num.pages}
982{ volume field.or.null embolden
983 " " swap$ * *
984 format.date empty$
985 'skip$
986 { duplicate$ empty$
987 { pop$ format.date paren }
988 { " " * format.date paren * }
989 if$
990 }
991 if$
992 pages empty$
993 'skip$
994 { duplicate$ empty$
995 { pop$ format.pages.a }
996 { " " * pages first.page *}
997 if$
998 }
999 if$
1000}
1001% The format.chapter.pages, if the chapter is present, puts whatever is in the
1002% type field (or else "chapter" if type is empty) in front of a chapter number.
1003% It then appends the pages, if present. This doesn't begin a sentence.
1004FUNCTION {format.chapter.pages}
1005{ chapter empty$
1006 'format.pages
1007 { type empty$
1008 { "chapter" }
1009 { type "l" change.case$ }
1010 if$
1011 chapter tie.or.space.connect
1012 pages empty$
1013 'skip$
1014 { ", " * format.pages * }
1015 if$
1016 }
1017 if$
1018}
1019% The format.in.ed.booktitle function is used for starting out a sentence
1020% that begins "In <booktitle>", putting an editor before the title if one
1021% exists.
1022FUNCTION {format.in.ed.booktitle}
1023{ booktitle empty$
1024 { "" }
1025 { editor empty$
1026 { "in " booktitle emphasize * }
1027 { "in " format.editors * ", " * booktitle emphasize * }
1028 if$
1029 }
1030 if$
1031}
1032% The function empty.misc.check complains if all six fields are empty, and
1033% if there's been no sorting or alphabetic-label complaint.
1034FUNCTION {empty.misc.check}
1035{ author empty$ title empty$ howpublished empty$
1036 month empty$ year empty$ note empty$ eprint empty$
1037 and and and and and
1038 { "all relevant fields are empty in " cite$ * warning$ }
1039 'skip$
1040 if$
1041}
1042% The function format.thesis.type returns either the (case-changed) type field,
1043% if it is defined, or else the default string already on the stack
1044% (like "Master's thesis" or "PhD thesis").
1045FUNCTION {format.thesis.type}
1046{ type empty$
1047 'skip$
1048 { pop$
1049 type "t" change.case$
1050 }
1051 if$
1052}
1053% The function format.tr.number makes a string starting with "Technical Report"
1054% (or type, if that field is defined), followed by the number if there is one;
1055% it returns the starting part (with a case change) even if there is no number.
1056% This is used at the beginning of a sentence.
1057FUNCTION {format.tr.number}
1058{ type empty$
1059 { "Technical Report" }
1060 'type
1061 if$
1062 number empty$
1063 { "t" change.case$ }
1064 { number tie.or.space.connect }
1065 if$
1066}
1067% Now come the cross-referencing functions (these are invoked because
1068% one entry in the database file(s) cross-references another, by giving
1069% the other entry's database key in a `crossref' field). This feature
1070% allows one or more titled things that are part of a larger titled
1071% thing to cross-reference the larger thing. These styles allow for
1072% five posibilities: (1) an ARTICLE may cross-reference an ARTICLE;
1073% (2) a BOOK, (3) INBOOK, or (4) INCOLLECTION may cross-reference a BOOK;
1074% or (5) an INPROCEEDINGS may cross-reference a PROCEEDINGS.
1075% Each of these is explained in more detail later.
1076%
1077% An ARTICLE entry type may cross reference another ARTICLE (this is
1078% intended for when an entire journal is devoted to a single topic---
1079% but since there is no JOURNAL entry type, the journal, too, should be
1080% classified as an ARTICLE but without the author and title fields).
1081% This will result in two warning messages for the journal's entry
1082% if it's included in the reference list, but such is life.
1083%
1084% format.article.crossref ==
1085% BEGIN
1086% if empty$(key) then
1087% if empty$(journal) then
1088% warning$("need key or journal for " * cite$ *
1089% " to crossref " * crossref)
1090% return(" \cite{" * crossref * "}")
1091% else
1092% return("In " * emphazise.correct (journal) *
1093% " \cite{" * crossref * "}")
1094% fi
1095% else
1096% return("In " * key * " \cite{" * crossref * "}")
1097% fi
1098% END
1099%
1100% The other cross-referencing functions are similar, so no "comment version"
1101% will be given for them.
1102FUNCTION {format.article.crossref}
1103{ key empty$
1104 { journal empty$
1105 { "need key or journal for " cite$ * " to crossref " * crossref *
1106 warning$
1107 ""
1108 }
1109 { "In " journal * }
1110 if$
1111 }
1112 { "In " key * }
1113 if$
1114 " \cite{" * crossref * "}" *
1115}
1116% We use just the last names of editors for a cross reference: either
1117% "editor", or "editor1 and editor2", or "editor1 et~al." depending on
1118% whether there are one, or two, or more than two editors.
1119FUNCTION {format.crossref.editor}
1120{ editor #1 "{vv~}{ll}" format.name$
1121 editor num.names$ duplicate$
1122 { pop$ " et~al." * }
1123 { #2 <
1124 'skip$
1125 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1126 { " et~al." * }
1127 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
1128 if$
1129 }
1130 if$
1131 }
1132 if$
1133}
1134% A BOOK (or INBOOK) entry type (assumed to be for a single volume in a
1135% multivolume work) may cross reference another BOOK (the entire multivolume).
1136% Usually there will be an editor, in which case we use that to construct the
1137% cross reference; otherwise we use a nonempty key field or else the series
1138% field (since the series gives the title of the multivolume work).
1139FUNCTION {format.book.crossref}
1140{ volume empty$
1141 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
1142 "In "
1143 }
1144 { "Volume" volume tie.or.space.connect
1145 " of " *
1146 }
1147 if$
1148 editor empty$
1149 editor field.or.null author field.or.null =
1150 or
1151 { key empty$
1152 { series empty$
1153 { "need editor, key, or series for " cite$ * " to crossref " *
1154 crossref * warning$
1155 "" *
1156 }
1157 { "{\em " * series * "\/}" * }
1158 if$
1159 }
1160 { key * }
1161 if$
1162 }
1163 { format.crossref.editor * }
1164 if$
1165 " \cite{" * crossref * "}" *
1166}
1167% An INCOLLECTION entry type may cross reference a BOOK (assumed to be the
1168% collection), or an INPROCEEDINGS may cross reference a PROCEEDINGS.
1169% Often there will be an editor, in which case we use that to construct
1170% the cross reference; otherwise we use a nonempty key field or else
1171% the booktitle field (which gives the cross-referenced work's title).
1172FUNCTION {format.incoll.inproc.crossref}
1173{ editor empty$
1174 editor field.or.null author field.or.null =
1175 or
1176 { key empty$
1177 { booktitle empty$
1178 { "need editor, key, or booktitle for " cite$ * " to crossref " *
1179 crossref * warning$
1180 ""
1181 }
1182 { "In {\em " booktitle * "\/}" * }
1183 if$
1184 }
1185 { "In " key * }
1186 if$
1187 }
1188 { "In " format.crossref.editor * }
1189 if$
1190 " \cite{" * crossref * "}" *
1191}
1192% Now we define the type functions for all entry types that may appear
1193% in the .BIB file---e.g., functions like `article' and `book'. These
1194% are the routines that actually generate the .BBL-file output for
1195% the entry. These must all precede the READ command. In addition, the
1196% style designer should have a function `default.type' for unknown types.
1197% Note: The fields (within each list) are listed in order of appearance,
1198% except as described for an `inbook' or a `proceedings'.
1199%
1200% The article function is for an article in a journal. An article may
1201% CROSSREF another article.
1202% Required fields: author, title, journal, year
1203% Optional fields: volume, number, pages, month, note, eprint
1204%
1205% article ==
1206% BEGIN
1207% output.bibitem
1208% output.check(format.authors,"author")
1209% new.block
1210% output.check(format.title,"title")
1211% new.block
1212% if missing$(crossref) then
1213% output.check(emphasize(journal),"journal")
1214% output(format.vol.num.pages)
1215% output.check(format.date,"year")
1216% else
1217% output.nonnull(format.article.crossref)
1218% output(format.pages)
1219% fi
1220% new.block
1221% output(note)
1222% fin.entry
1223% END
1224%
1225% The book function is for a whole book. A book may CROSSREF another book.
1226% Required fields: author or editor, title, publisher, year
1227% Optional fields: volume or number, series, address, edition, month,
1228% note
1229%
1230% book ==
1231% BEGIN
1232% if empty$(author) then output.check(format.editors,"author and editor")
1233% else output.check(format.authors,"author")
1234% if missing$(crossref) then
1235% either.or.check("author and editor",editor)
1236% fi
1237% fi
1238% new.block
1239% output.check(format.btitle,"title")
1240% if missing$(crossref) then
1241% output(format.bvolume)
1242% new.block
1243% output(format.number.series)
1244% new.sentence
1245% output.check(publisher,"publisher")
1246% output(address)
1247% else
1248% new.block
1249% output.nonnull(format.book.crossref)
1250% fi
1251% output(format.edition)
1252% output.check(format.date,"year")
1253% new.block
1254% output(note)
1255% fin.entry
1256% END
1257%
1258% The other entry functions are all quite similar, so no "comment version"
1259% will be given for them.
1260FUNCTION {article}
1261{ output.bibitem
1262 format.authors *
1263 format.collaboration "collaboration" output.check
1264% format.authors "author" *
1265% format.collaboration empty$
1266% 'skip$
1267% { duplicate$ empty$
1268% { pop$ format.collaboration paren }
1269% { " " * format.collaboration paren * }
1270% if$
1271% }
1272% if$
1273% output.check
1274
1275 new.block
1276 format.btitle "title" output.check
1277
1278 new.block
1279 crossref missing$
1280 { journal field.or.null
1281 format.vol.num.pages output
1282 }
1283 { format.article.crossref output.nonnull
1284 format.pages output
1285 }
1286 if$
1287 note output
1288 eprint output
1289 fin.entry
1290}
1291FUNCTION {book}
1292{ output.bibitem
1293 author empty$
1294 { format.editors "author and editor" output.check }
1295 { format.authors output.nonnull
1296 crossref missing$
1297 { "author and editor" editor either.or.check }
1298 'skip$
1299 if$
1300 }
1301 if$
1302 format.collabbook "collaboration" output.check
1303 new.block
1304 format.btitle "title" output.check
1305 crossref missing$
1306 { format.bvolume output
1307 new.block
1308 format.number.series output
1309 new.sentence
1310 publisher "publisher" output.check
1311 address output
1312 }
1313 { new.block
1314 format.book.crossref output.nonnull
1315 }
1316 if$
1317 format.edition output
1318 format.date "year" output.check
1319 new.block
1320 note output
1321 fin.entry
1322}
1323% A booklet is a bound thing without a publisher or sponsoring institution.
1324% Required: title
1325% Optional: author, howpublished, address, month, year, note
1326FUNCTION {booklet}
1327{ output.bibitem
1328 format.authors output
1329 new.block
1330 format.title "title" output.check
1331 howpublished address new.block.checkb
1332 howpublished output
1333 address output
1334 format.date output
1335 new.block
1336 note output
1337 fin.entry
1338}
1339% For the conference entry type, see inproceedings.
1340% An inbook is a piece of a book: either a chapter and/or a page range.
1341% It may CROSSREF a book. If there's no volume field, the type field
1342% will come before number and series.
1343% Required: author or editor, title, chapter and/or pages, publisher,year
1344% Optional: volume or number, series, type, address, edition, month, note
1345FUNCTION {inbook}
1346{ output.bibitem
1347 author empty$
1348 { format.editors "author and editor" output.check }
1349 { format.authors output.nonnull
1350 crossref missing$
1351 { "author and editor" editor either.or.check }
1352 'skip$
1353 if$
1354 }
1355 if$
1356 new.block
1357 format.btitle "title" output.check
1358 crossref missing$
1359 { format.bvolume output
1360 format.chapter.pages "chapter and pages" output.check
1361 new.block
1362 format.number.series output
1363 new.sentence
1364 publisher "publisher" output.check
1365 address output
1366 }
1367 { format.chapter.pages "chapter and pages" output.check
1368 new.block
1369 format.book.crossref output.nonnull
1370 }
1371 if$
1372 format.edition output
1373 format.date "year" output.check
1374 new.block
1375 note output
1376 fin.entry
1377}
1378% An incollection is like inbook, but where there is a separate title
1379% for the referenced thing (and perhaps an editor for the whole).
1380% An incollection may CROSSREF a book.
1381% Required: author, title, booktitle, publisher, year
1382% Optional: editor, volume or number, series, type, chapter, pages,
1383% address, edition, month, note
1384FUNCTION {incollection}
1385{ output.bibitem
1386 format.authors "author" output.check
1387 new.block
1388 format.title "title" output.check
1389 new.block
1390 crossref missing$
1391 { format.in.ed.booktitle "booktitle" output.check
1392 format.bvolume output
1393 format.number.series output
1394 format.chapter.pages output
1395 new.sentence
1396 publisher "publisher" output.check
1397 address output
1398 format.edition output
1399 format.date "year" output.check
1400 }
1401 { format.incoll.inproc.crossref output.nonnull
1402 format.chapter.pages output
1403 }
1404 if$
1405 new.block
1406 note output
1407 fin.entry
1408}
1409% An inproceedings is an article in a conference proceedings, and it may
1410% CROSSREF a proceedings. If there's no address field, the month (& year)
1411% will appear just before note.
1412% Required: author, title, booktitle, year
1413% Optional: editor, volume or number, series, pages, address, month,
1414% organization, publisher, note
1415FUNCTION {inproceedings}
1416{ output.bibitem
1417 format.authors "author" output.check
1418 new.block
1419 format.title "title" output.check
1420 new.block
1421 crossref missing$
1422 { format.in.ed.booktitle "booktitle" output.check
1423 format.bvolume output
1424 format.number.series output
1425 format.pages output
1426 address empty$
1427 { organization publisher new.sentence.checkb
1428 organization output
1429 publisher output
1430 format.date "year" output.check
1431 }
1432 { address output.nonnull
1433 format.date "year" output.check
1434 new.sentence
1435 organization output
1436 publisher output
1437 }
1438 if$
1439 }
1440 { format.incoll.inproc.crossref output.nonnull
1441 format.pages output
1442 }
1443 if$
1444 new.block
1445 note output
1446 fin.entry
1447}
1448% The conference function is included for Scribe compatibility.
1449FUNCTION {conference} { inproceedings }
1450% A manual is technical documentation.
1451% Required: title
1452% Optional: author, organization, address, edition, month, year, note
1453FUNCTION {manual}
1454{ output.bibitem
1455 author empty$
1456 { organization empty$
1457 'skip$
1458 { organization output.nonnull
1459 address output
1460 }
1461 if$
1462 }
1463 { format.authors output.nonnull }
1464 if$
1465 new.block
1466 format.btitle "title" output.check
1467 author empty$
1468 { organization empty$
1469 { address new.block.checka
1470 address output
1471 }
1472 'skip$
1473 if$
1474 }
1475 { organization address new.block.checkb
1476 organization output
1477 address output
1478 }
1479 if$
1480 format.edition output
1481 format.date output
1482 new.block
1483 note output
1484 fin.entry
1485}
1486% A mastersthesis is a Master's thesis.
1487% Required: author, title, school, year
1488% Optional: type, address, month, note
1489FUNCTION {mastersthesis}
1490{ output.bibitem
1491 format.authors "author" output.check
1492 new.block
1493 format.title "title" output.check
1494 new.block
1495 "Master's thesis" format.thesis.type output.nonnull
1496 school "school" output.check
1497 address output
1498 format.date "year" output.check
1499 new.block
1500 note output
1501 fin.entry
1502}
1503FUNCTION {diplomathesis}
1504{ output.bibitem
1505 format.authors "author" output.check
1506 new.block
1507 format.btitle "title" output.check
1508 new.block
1509 "Diploma thesis" format.thesis.type output.nonnull
1510 school "school" output.check
1511 address output
1512 format.date "year" output.check
1513 new.block
1514 note output
1515 fin.entry
1516}
1517FUNCTION {personal_communication}
1518{ output.bibitem
1519 format.authors "author" output.check
1520 new.block
1521 "private communication" format.thesis.type output.nonnull
1522 new.block
1523 note output
1524 fin.entry
1525}
1526
1527
1528% A misc is something that doesn't fit elsewhere.
1529% Required: at least one of the `optional' fields
1530% Optional: author, title, howpublished, month, year, note
1531FUNCTION {misc}
1532{ output.bibitem
1533 format.authors output
1534 title howpublished new.block.checkb
1535 format.title output
1536 howpublished new.block.checka
1537 howpublished output
1538 format.date output
1539 new.block
1540 note output
1541 fin.entry
1542 empty.misc.check
1543}
1544% A phdthesis is like a mastersthesis.
1545% Required: author, title, school, year
1546% Optional: type, address, month, note
1547FUNCTION {phdthesis}
1548{ output.bibitem
1549 format.authors "author" output.check
1550 new.block
1551 format.btitle "title" output.check
1552 new.block
1553 "PhD thesis" format.thesis.type output.nonnull
1554 school "school" output.check
1555 address output
1556 format.date "year" output.check
1557 new.block
1558 note output
1559 fin.entry
1560}
1561% A proceedings is a conference proceedings.
1562% If there is an organization but no editor field, the organization will
1563% appear as the first optional field (we try to make the first block nonempty);
1564% if there's no address field, the month (& year) will appear just before note.
1565% Required: title, year
1566% Optional: editor, volume or number, series, address, month,
1567% organization, publisher, note
1568FUNCTION {proceedings}
1569{ output.bibitem
1570 editor empty$
1571 { organization output }
1572 { format.editors output.nonnull }
1573 if$
1574 new.block
1575 format.btitle "title" output.check
1576 format.bvolume output
1577 format.number.series output
1578 address empty$
1579 { editor empty$
1580 { publisher new.sentence.checka }
1581 { organization publisher new.sentence.checkb
1582 organization output
1583 }
1584 if$
1585 publisher output
1586 format.date "year" output.check
1587 }
1588 { address output.nonnull
1589 format.date "year" output.check
1590 new.sentence
1591 editor empty$
1592 'skip$
1593 { organization output }
1594 if$
1595 publisher output
1596 }
1597 if$
1598 new.block
1599 note output
1600 fin.entry
1601}
1602% A techreport is a technical report.
1603% Required: author, title, institution, year
1604% Optional: type, number, address, month, note
1605FUNCTION {techreport}
1606{ output.bibitem
1607
1608 format.authors "author" output.check
1609 new.block
1610
1611 format.collabbook "collaboration" output.check
1612 new.block
1613
1614 format.btitle "title" output.check
1615 new.block
1616
1617 institution "institution" output.check
1618 address output
1619 format.date "year" output.check
1620 new.block
1621 note output
1622 fin.entry
1623}
1624%format.title "title" output.check
1625% format.tr.number output.nonnull
1626
1627
1628FUNCTION {urlcite}
1629{ output.bibitem
1630
1631 format.authors "author" output.check
1632 new.block
1633
1634 format.btitle "title" output.check
1635 new.block
1636
1637 format.url output
1638 new.block
1639
1640 note output
1641 fin.entry
1642}
1643
1644
1645
1646% An unpublished is something that hasn't been published.
1647% Required: author, title, note
1648% Optional: month, year
1649FUNCTION {unpublished}
1650{ output.bibitem
1651 format.authors "author" output.check
1652 new.block
1653 format.title "title" output.check
1654 new.block
1655 note "note" output.check
1656 format.date output
1657 fin.entry
1658}
1659% We use entry type `misc' for an unknown type; BibTeX gives a warning.
1660FUNCTION {default.type} { misc }
1661% Here are macros for common things that may vary from style to style.
1662% Users are encouraged to use these macros.
1663%
1664% Months are either written out in full or abbreviated
1665MACRO {jan} {"Jan."}
1666MACRO {feb} {"Feb."}
1667MACRO {mar} {"Mar."}
1668MACRO {apr} {"Apr."}
1669MACRO {may} {"May"}
1670MACRO {jun} {"June"}
1671MACRO {jul} {"July"}
1672MACRO {aug} {"Aug."}
1673MACRO {sep} {"Sept."}
1674MACRO {oct} {"Oct."}
1675MACRO {nov} {"Nov."}
1676MACRO {dec} {"Dec."}
1677% Journals are either written out in full or abbreviated;
1678% the abbreviations are like those found in ACM publications.
1679%
1680% To get a completely different set of abbreviations, it may be best to make
1681% a separate .bib file with nothing but those abbreviations; users could then
1682% include that file name as the first argument to the \bibliography command
1683MACRO {acmcs} {"ACM Comput. Surv."}
1684MACRO {acta} {"Acta Inf."}
1685MACRO {cacm} {"Commun. ACM"}
1686MACRO {ibmjrd} {"IBM J. Res. Dev."}
1687MACRO {ibmsj} {"IBM Syst.~J."}
1688MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
1689MACRO {ieeetc} {"IEEE Trans. Comput."}
1690MACRO {ieeetcad}
1691 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
1692MACRO {ipl} {"Inf. Process. Lett."}
1693MACRO {jacm} {"J.~ACM"}
1694MACRO {jcss} {"J.~Comput. Syst. Sci."}
1695MACRO {scp} {"Sci. Comput. Programming"}
1696MACRO {sicomp} {"SIAM J. Comput."}
1697MACRO {tocs} {"ACM Trans. Comput. Syst."}
1698MACRO {tods} {"ACM Trans. Database Syst."}
1699MACRO {tog} {"ACM Trans. Gr."}
1700MACRO {toms} {"ACM Trans. Math. Softw."}
1701MACRO {toois} {"ACM Trans. Office Inf. Syst."}
1702MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
1703MACRO {tcs} {"Theoretical Comput. Sci."}
1704%% /usr/local/lib/tex/bibtex/phyjfull.btx, Tue Jun 30 08:37:48 1992
1705%% Edit by Nelson H. F. Beebe <beebe@alfred.math.utah.edu>
1706%% Change file names in leading comment
1707% Journal Title Abbreviations from the Physical Review Style and Notation
1708% Guide, July, 1983, in BAPS Vol. 28.
1709% Selected by Cris Barnes and Charles Karney, March 1988
1710% IMPORTANT!! Don't make changes to this file without making the
1711% corresponding changes to
1712% phyjabb.bib
1713% phyjabb.btx
1714MACRO {advp} {"Advances in Physics"}
1715MACRO {ajp} {"American Journal of Physics"}
1716MACRO {ao} {"Applied Optics"}
1717MACRO {apl} {"Applied Physics Letters"}
1718MACRO {apj} {"Astrophysical Journal"}
1719MACRO {baps} {"Bulletin of the American Physical Society"}
1720MACRO {cpc} {"Computer Physics Communications"}
1721MACRO {cppcf} {"Comments on Plasma Physics and Controlled Fusion"}
1722MACRO {fed} {"Fusion Engineering and Design"}
1723MACRO {ft} {"Fusion Technology"}
1724MACRO {ieeens} {"IEEE Transactions on Nuclear Science"}
1725MACRO {ieeeps} {"IEEE Transactions on Plasma Science"}
1726MACRO {ijimw} {"International Journal of Infrared and Millimeter Waves"}
1727MACRO {ip} {"Infrared Physics"}
1728MACRO {jap} {"Journal of Applied Physics"}
1729MACRO {jcp} {"Journal of Computational Physics"}
1730MACRO {jetp} {"Soviet Physics-JETP"}
1731MACRO {jfe} {"Journal of Fusion Energy"}
1732MACRO {jfm} {"Journal of Fluid Mechanics"}
1733MACRO {jgr} {"Journal of Geophysical Research"}
1734MACRO {jmp} {"Journal of Mathematical Physics"}
1735MACRO {jne} {"Journal of Nuclear Energy"}
1736MACRO {jnec} {"Journal of Nuclear Energy, Part C: Plasma Physics, Accelerators, Thermonuclear Research"}
1737MACRO {jnm} {"Journal of Nuclear Materials"}
1738MACRO {josa} {"Journal of the Optical Society of America"}
1739MACRO {jpp} {"Journal of Plasma Physics"}
1740MACRO {jpsj} {"Journal of the Physical Society of Japan"}
1741MACRO {jvst} {"Journal of Vacuum Science and Technology"}
1742MACRO {nedf} {"Nuclear Engineering and Design/Fusion"}
1743MACRO {nf} {"Nuclear Fusion"}
1744MACRO {nim} {"Nuclear Instruments and Methods"}
1745MACRO {nimpr} {"Nuclear Instruments and Methods in Physics Research"}
1746MACRO {nt/f} {"Nuclear Technology/Fusion"}
1747MACRO {pf} {"Physics of Fluids"}
1748MACRO {pfa} {"Physics of Fluids A: Fluid Dynamics"}
1749MACRO {pfb} {"Physics of Fluids B: Plasma Physics"}
1750MACRO {pl} {"Physics Letters"}
1751MACRO {pla} {"Physics Letters A"}
1752MACRO {pnas} {"Proceedings of the National Academy of Sciences of the USA"}
1753MACRO {pp} {"Plasma Physics"}
1754MACRO {ppcf} {"Plasma Physics and Controlled Fusion"}
1755MACRO {prl} {"Physical Review Letters"}
1756MACRO {pr} {"Physical Review"}
1757MACRO {pra} {"Physical Review A: General Physics"}
1758MACRO {ps} {"Physica Scripta"}
1759MACRO {rmp} {"Reviews of Modern Physics"}
1760MACRO {rsi} {"Review of Scientific Instruments"}
1761MACRO {sjpp} {"Soviet Journal of Plasma Phys."}
1762MACRO {spd} {"Soviet Physics-Doklady"}
1763MACRO {sptp} {"Soviet Physics-Technical Physics"}
1764MACRO {spu} {"Soviet Physics-Uspeki"}
1765% Now we read in the .BIB entries.
1766READ
1767% The sortify function converts to lower case after purify$ing; it's
1768% used in sorting and in computing alphabetic labels after sorting
1769%
1770% The chop.word(w,len,s) function returns either s or, if the first len
1771% letters of s equals w (this comparison is done in the third line of the
1772% function's definition), it returns that part of s after w.
1773% This long comment applies only to alphabetic labels
1774%
1775% The format.lab.names function makes a short label by using the initials of
1776% the von and Last parts of the names (but if there are more than four names,
1777% (i.e., people) it truncates after three and adds a superscripted "+";
1778% it also adds such a "+" if the last of multiple authors is "others").
1779% If there is only one name, and its von and Last parts combined have just
1780% a single name-token ("Knuth" has a single token, "Brinch Hansen" has two),
1781% we take the first three letters of the last name. The boolean
1782% et.al.char.used tells whether we've used a superscripted "+", so that we
1783% know whether to include a LaTeX macro for it.
1784%
1785% format.lab.names(s) ==
1786% BEGIN
1787% numnames := num.names$(s)
1788% if numnames > 1 then
1789% if numnames > 4 then
1790% namesleft := 3
1791% else
1792% namesleft := numnames
1793% nameptr := 1
1794% nameresult := ""
1795% while namesleft > 0
1796% do
1797% if (name_ptr = numnames) and
1798% format.name$(s, nameptr, "{ff }{vv }{ll}{ jj}") = "others"
1799% then nameresult := nameresult * "{\etalchar{+}}"
1800% et.al.char.used := true
1801% else nameresult := nameresult *
1802% format.name$(s, nameptr, "{v{}}{l{}}")
1803% nameptr := nameptr + 1
1804% namesleft := namesleft - 1
1805% od
1806% if numnames > 4 then
1807% nameresult := nameresult * "{\etalchar{+}}"
1808% et.al.char.used := true
1809% else
1810% t := format.name$(s, 1, "{v{}}{l{}}")
1811% if text.length$(t) < 2 then % there's just one name-token
1812% nameresult := text.prefix$(format.name$(s,1,"{ll}"),3)
1813% else
1814% nameresult := t
1815% fi
1816% fi
1817% return nameresult
1818% END
1819%
1820% Exactly what fields we look at in constructing the primary part of the label
1821% depends on the entry type; this selectivity (as opposed to, say, always
1822% looking at author, then editor, then key) helps ensure that "ignored" fields,
1823% as described in the LaTeX book, really are ignored. Note that MISC is part
1824% of the deepest `else' clause in the nested part of calc.label; thus, any
1825% unrecognized entry type in the database is handled correctly.
1826%
1827% There is one auxiliary function for each of the four different sequences of
1828% fields we use. The first of these functions looks at the author field, and
1829% then, if necessary, the key field. The other three functions, which might
1830% look at two fields and the key field, are similar, except that the key field
1831% takes precedence over the organization field (for labels---not for sorting).
1832%
1833% The calc.label function calculates the preliminary label of an entry, which
1834% is formed by taking three letters of information from the author or editor or
1835% key or organization field (depending on the entry type and on what's empty,
1836% but ignoring a leading "The " in the organization), and appending the last
1837% two characters (digits) of the year. It is an error if the appropriate fields
1838% among author, editor, organization, and key are missing, and we use
1839% the first three letters of the cite$ in desperation when this happens.
1840% The resulting label has the year part, but not the name part, purify$ed
1841% (purify$ing the year allows some sorting shenanigans by the user).
1842%
1843% This function also calculates the version of the label to be used in sorting.
1844%
1845% The final label may need a trailing 'a', 'b', etc., to distinguish it from
1846% otherwise identical labels, but we can't calculated those "extra.label"s
1847% until after sorting.
1848%
1849% calc.label ==
1850% BEGIN
1851% if type$ = "book" or "inbook" then
1852% author.editor.key.label
1853% else if type$ = "proceedings" then
1854% editor.key.organization.label
1855% else if type$ = "manual" then
1856% author.key.organization.label
1857% else
1858% author.key.label
1859% fi fi fi
1860% label := label * substring$(purify$(field.or.null(year)), -1, 2)
1861% % assuming we will also sort, we calculate a sort.label
1862% sort.label := sortify(label), but use the last four, not two, digits
1863% END
1864% When sorting, we compute the sortkey by executing "presort" on each entry.
1865% The presort key contains a number of "sortify"ed strings, concatenated
1866% with multiple blanks between them. This makes things like "brinch per"
1867% come before "brinch hansen per".
1868%
1869% The fields used here are: the sort.label for alphabetic labels (as set by
1870% calc.label), followed by the author names (or editor names or organization
1871% (with a leading "The " removed) or key field, depending on entry type and on
1872% what's empty), followed by year, followed by the first bit of the title
1873% (chopping off a leading "The ", "A ", or "An ").
1874% Names are formatted: Von Last First Junior.
1875% The names within a part will be separated by a single blank
1876% (such as "brinch hansen"), two will separate the name parts themselves
1877% (except the von and last), three will separate the names,
1878% four will separate the names from year (and from label, if alphabetic),
1879% and four will separate year from title.
1880%
1881% The sort.format.names function takes an argument that should be in
1882% BibTeX name format, and returns a string containing " "-separated
1883% names in the format described above. The function is almost the same
1884% as format.names.
1885% This long comment applies only to alphabetic labels, when sorted
1886%
1887% Now comes the final computation for alphabetic labels, putting in the 'a's
1888% and 'b's and so forth if required. This involves two passes: a forward
1889% pass to put in the 'b's, 'c's and so on, and a backwards pass
1890% to put in the 'a's (we don't want to put in 'a's unless we know there
1891% are 'b's).
1892% We have to keep track of the longest (in width$ terms) label, for use
1893% by the "thebibliography" environment.
1894%
1895% VAR: longest.label, last.sort.label, next.extra: string
1896% longest.label.width, last.extra.num: integer
1897%
1898% initialize.longest.label ==
1899% BEGIN
1900% longest.label := ""
1901% last.sort.label := int.to.chr$(0)
1902% next.extra := ""
1903% longest.label.width := 0
1904% last.extra.num := 0
1905% END
1906%
1907% forward.pass ==
1908% BEGIN
1909% if last.sort.label = sort.label then
1910% last.extra.num := last.extra.num + 1
1911% extra.label := int.to.chr$(last.extra.num)
1912% else
1913% last.extra.num := chr.to.int$("a")
1914% extra.label := ""
1915% last.sort.label := sort.label
1916% fi
1917% END
1918%
1919% reverse.pass ==
1920% BEGIN
1921% if next.extra = "b" then
1922% extra.label := "a"
1923% fi
1924% label := label * extra.label
1925% if width$(label) > longest.label.width then
1926% longest.label := label
1927% longest.label.width := width$(label)
1928% fi
1929% next.extra := extra.label
1930% END
1931% Now comes the computation for numeric labels.
1932% We use either the sorted order or original order.
1933% We still have to keep track of the longest (in width$ terms) label, for use
1934% by the "thebibliography" environment.
1935STRINGS { longest.label }
1936INTEGERS { number.label longest.label.width }
1937FUNCTION {initialize.longest.label}
1938{ "" 'longest.label :=
1939 #1 'number.label :=
1940 #0 'longest.label.width :=
1941}
1942FUNCTION {longest.label.pass}
1943{ number.label int.to.str$ 'label :=
1944 number.label #1 + 'number.label :=
1945 label width$ longest.label.width >
1946 { label 'longest.label :=
1947 label width$ 'longest.label.width :=
1948 }
1949 'skip$
1950 if$
1951}
1952EXECUTE {initialize.longest.label}
1953ITERATE {longest.label.pass}
1954% Now we're ready to start writing the .BBL file.
1955% We begin, if necessary, with a LaTeX macro for unnamed names in an alphabetic
1956% label; next comes stuff from the `preamble' command in the database files.
1957% Then we give an incantation containing the command
1958% \begin{thebibliography}{...}
1959% where the `...' is the longest label.
1960%
1961% We also call init.state.consts, for use by the output routines.
1962FUNCTION {begin.bib}
1963{ preamble$ empty$
1964 'skip$
1965 { preamble$ write$ newline$ }
1966 if$
1967 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1968}
1969EXECUTE {begin.bib}
1970EXECUTE {init.state.consts}
1971% Now we produce the output for all the entries
1972ITERATE {call.type$}
1973% Finally, we finish up by writing the `\end{thebibliography}' command.
1974FUNCTION {end.bib}
1975{ newline$
1976 "\end{thebibliography}" write$ newline$
1977}
1978EXECUTE {end.bib}
Note: See TracBrowser for help on using the repository browser.