Debian Codegraph @

texmf-dist/bibtex/bst/urlbst/plainurl.bst

raw
1 %%% Modification of BibTeX style file /usr/local/texlive/2022/texmf-dist/bibtex/bst/base/plain.bst
2 %%% ... by urlbst, version 0.9.1 (marked with "% urlbst")
3 %%% See <https://purl.org/nxg/dist/urlbst> and repository <https://heptapod.host/nxg/urlbst>
4 %%% Modifications Copyright 2002–23, Norman Gray,
5 %%% and distributed under the terms of the LPPL; see README for discussion.
6 %%%
7 %%% Added webpage entry type, and url and lastchecked fields.
8 %%% Added eprint support.
9 %%% Added DOI support.
10 %%% Added PUBMED support.
11 %%% Added hyperref support.
12 %%% Original headers follow...
13
14 % BibTeX standard bibliography style `plain'
15 % Version 0.99b (8-Dec-10 release) for BibTeX versions 0.99a or later.
16 % Copyright (C) 1984, 1985, 1988, 2010 Howard Trickey and Oren Patashnik.
17 % Unlimited copying and redistribution of this file are permitted as long as
18 % it is unmodified. Modifications (and redistribution of modified versions)
19 % are also permitted, but only if the resulting file is renamed to something
20 % besides btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
21 % This restriction helps ensure that all standard styles are identical.
22 % The file btxbst.doc has the documentation for this style.
23
24 ENTRY
25 { address
26 author
27 booktitle
28 chapter
29 edition
30 editor
31 howpublished
32 institution
33 journal
34 key
35 month
36 note
37 number
38 organization
39 pages
40 publisher
41 school
42 series
43 title
44 type
45 volume
46 year
47 eprint % urlbst
48 doi % urlbst
49 pubmed % urlbst
50 url % urlbst
51 lastchecked % urlbst
52 }
53 {}
54 { label }
55
56 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
57
58 % urlbst...
59 % urlbst constants and state variables
60 STRINGS { urlintro
61 eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl
62 citedstring onlinestring linktextstring
63 openinlinelink closeinlinelink }
64 INTEGERS { hrefform doiform inlinelinks makeinlinelink
65 addeprints adddoi addpubmed }
66 FUNCTION {init.urlbst.variables}
67 {
68 % The following constants may be adjusted by hand, if desired
69
70 % The first set allow you to enable or disable certain functionality.
71 #1 'adddoi := % 0=no DOI resolver; 1=include it
72 #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles
73 #2 'hrefform := % 0=no crossrefs; 1=hypertex hrefs; 2=hyperref hrefs
74 #1 'addeprints := % 0=no eprints; 1=include eprints
75 #0 'doiform := % 0=with href; 1=with \doi{}
76 #1 'addpubmed := % 0=no PUBMED resolver; 1=include it
77
78 % String constants, which you _might_ want to tweak.
79 "https://doi.org/" 'doiurl := % prefix to make URL from DOI
80 "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
81 "online" 'onlinestring := % label that a resource is online
82 "URL: " 'urlintro := % text prefix before URL
83 "doi:" 'doiprefix := % printed text to introduce DOI
84 "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
85 "[link]" 'linktextstring := % anonymous link text
86 "https://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
87 "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref
88 "cited " 'citedstring := % label in "lastchecked" remark
89
90 % The following are internal state variables, not configuration constants,
91 % so they shouldn't be fiddled with.
92 #0 'makeinlinelink := % state variable managed by possibly.setup.inlinelink
93 "" 'openinlinelink := % ditto
94 "" 'closeinlinelink := % ditto
95 }
96 INTEGERS {
97 bracket.state
98 outside.brackets
99 open.brackets
100 within.brackets
101 close.brackets
102 }
103 % ...urlbst to here
104 FUNCTION {init.state.consts}
105 { #0 'outside.brackets := % urlbst...
106 #1 'open.brackets :=
107 #2 'within.brackets :=
108 #3 'close.brackets := % ...urlbst to here
109
110 #0 'before.all :=
111 #1 'mid.sentence :=
112 #2 'after.sentence :=
113 #3 'after.block :=
114 }
115
116 STRINGS { s t }
117
118 % urlbst
119 FUNCTION {output.nonnull.original}
120 { 's :=
121 output.state mid.sentence =
122 { ", " * write$ }
123 { output.state after.block =
124 { add.period$ write$
125 newline$
126 "\newblock " write$
127 }
128 { output.state before.all =
129 'write$
130 { add.period$ " " * write$ }
131 if$
132 }
133 if$
134 mid.sentence 'output.state :=
135 }
136 if$
137 s
138 }
139
140 % urlbst...
141 % Minimal DOI parsing.
142 % Given a DOI on the stack, check whether it starts with 'doiurl' or not.
143 % In either case, leave on the stack first a DOI with, and then a DOI without, the URL prefix.
144 FUNCTION {parse.doi}
145 {
146 #1 doiurl text.length$ substring$
147 doiurl =
148 { doi
149 doi doiurl text.length$ #1 + #999 substring$ }
150 { doiurl doi *
151 doi }
152 if$
153 }
154 % The following three functions are for handling inlinelink. They wrap
155 % a block of text which is potentially output with write$ by multiple
156 % other functions, so we don't know the content a priori.
157 % They communicate between each other using the variables makeinlinelink
158 % (which is true if a link should be made), and closeinlinelink (which holds
159 % the string which should close any current link. They can be called
160 % at any time, but start.inlinelink will be a no-op unless something has
161 % previously set makeinlinelink true, and the two ...end.inlinelink functions
162 % will only do their stuff if start.inlinelink has previously set
163 % closeinlinelink to be non-empty.
164 % (thanks to 'ijvm' for suggested code here)
165 FUNCTION {uand}
166 { 'skip$ { pop$ #0 } if$ } % 'and' (which isn't defined at this point in the file)
167 FUNCTION {possibly.setup.inlinelink}
168 { makeinlinelink hrefform #0 > uand
169 { doi empty$ adddoi uand
170 { pubmed empty$ addpubmed uand
171 { eprint empty$ addeprints uand
172 { url empty$
173 { "" }
174 { url }
175 if$ }
176 { eprinturl eprint * }
177 if$ }
178 { pubmedurl pubmed * }
179 if$ }
180 % { doiurl doi * }
181 { doi empty$
182 { "XXX" }
183 { doi parse.doi pop$ }
184 if$
185 }
186 if$
187 % an appropriately-formatted URL is now on the stack
188 hrefform #1 = % hypertex
189 { "\special {html:<a href=" quote$ * swap$ * quote$ * "> }{" * 'openinlinelink :=
190 "\special {html:</a>}" 'closeinlinelink := }
191 { "\href {" swap$ * "} {" * 'openinlinelink := % hrefform=#2 -- hyperref
192 % the space between "} {" matters: a URL of just the right length can cause "\% newline em"
193 "}" 'closeinlinelink := }
194 if$
195 #0 'makeinlinelink :=
196 }
197 'skip$
198 if$ % makeinlinelink
199 }
200 FUNCTION {add.inlinelink}
201 { openinlinelink empty$
202 'skip$
203 { openinlinelink swap$ * closeinlinelink *
204 "" 'openinlinelink :=
205 }
206 if$
207 }
208 FUNCTION {output.nonnull}
209 { % Save the thing we've been asked to output
210 's :=
211 % If the bracket-state is close.brackets, then add a close-bracket to
212 % what is currently at the top of the stack, and set bracket.state
213 % to outside.brackets
214 bracket.state close.brackets =
215 { "]" *
216 outside.brackets 'bracket.state :=
217 }
218 'skip$
219 if$
220 bracket.state outside.brackets =
221 { % We're outside all brackets -- this is the normal situation.
222 % Write out what's currently at the top of the stack, using the
223 % original output.nonnull function.
224 s
225 add.inlinelink
226 output.nonnull.original % invoke the original output.nonnull
227 }
228 { % Still in brackets. Add open-bracket or (continuation) comma, add the
229 % new text (in s) to the top of the stack, and move to the close-brackets
230 % state, ready for next time (unless inbrackets resets it). If we come
231 % into this branch, then output.state is carefully undisturbed.
232 bracket.state open.brackets =
233 { " [" * }
234 { ", " * } % bracket.state will be within.brackets
235 if$
236 s *
237 close.brackets 'bracket.state :=
238 }
239 if$
240 }
241
242 % Call this function just before adding something which should be presented in
243 % brackets. bracket.state is handled specially within output.nonnull.
244 FUNCTION {inbrackets}
245 { bracket.state close.brackets =
246 { within.brackets 'bracket.state := } % reset the state: not open nor closed
247 { open.brackets 'bracket.state := }
248 if$
249 }
250
251 FUNCTION {format.lastchecked}
252 { lastchecked empty$
253 { "" }
254 { inbrackets citedstring lastchecked * }
255 if$
256 }
257 % ...urlbst to here
258
259 FUNCTION {output}
260 { duplicate$ empty$
261 'pop$
262 'output.nonnull
263 if$
264 }
265
266 FUNCTION {output.check}
267 { 't :=
268 duplicate$ empty$
269 { pop$ "empty " t * " in " * cite$ * warning$ }
270 'output.nonnull
271 if$
272 }
273
274 FUNCTION {output.bibitem.original} % urlbst (renamed from output.bibitem, so it can be wrapped below)
275 { newline$
276 "\bibitem{" write$
277 cite$ write$
278 "}" write$
279 newline$
280 ""
281 before.all 'output.state :=
282 }
283
284 FUNCTION {fin.entry.original} % urlbst (renamed from fin.entry, so it can be wrapped below)
285 { add.period$
286 write$
287 newline$
288 }
289
290 FUNCTION {new.block}
291 { output.state before.all =
292 'skip$
293 { after.block 'output.state := }
294 if$
295 }
296
297 FUNCTION {new.sentence}
298 { output.state after.block =
299 'skip$
300 { output.state before.all =
301 'skip$
302 { after.sentence 'output.state := }
303 if$
304 }
305 if$
306 }
307
308 FUNCTION {not}
309 { { #0 }
310 { #1 }
311 if$
312 }
313
314 FUNCTION {and}
315 { 'skip$
316 { pop$ #0 }
317 if$
318 }
319
320 FUNCTION {or}
321 { { pop$ #1 }
322 'skip$
323 if$
324 }
325
326 FUNCTION {new.block.checka}
327 { empty$
328 'skip$
329 'new.block
330 if$
331 }
332
333 FUNCTION {new.block.checkb}
334 { empty$
335 swap$ empty$
336 and
337 'skip$
338 'new.block
339 if$
340 }
341
342 FUNCTION {new.sentence.checka}
343 { empty$
344 'skip$
345 'new.sentence
346 if$
347 }
348
349 FUNCTION {new.sentence.checkb}
350 { empty$
351 swap$ empty$
352 and
353 'skip$
354 'new.sentence
355 if$
356 }
357
358 FUNCTION {field.or.null}
359 { duplicate$ empty$
360 { pop$ "" }
361 'skip$
362 if$
363 }
364
365 FUNCTION {emphasize}
366 { duplicate$ empty$
367 { pop$ "" }
368 { "{\em " swap$ * "}" * }
369 if$
370 }
371
372 INTEGERS { nameptr namesleft numnames }
373
374 FUNCTION {format.names}
375 { 's :=
376 #1 'nameptr :=
377 s num.names$ 'numnames :=
378 numnames 'namesleft :=
379 { namesleft #0 > }
380 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
381 nameptr #1 >
382 { namesleft #1 >
383 { ", " * t * }
384 { numnames #2 >
385 { "," * }
386 'skip$
387 if$
388 t "others" =
389 { " et~al." * }
390 { " and " * t * }
391 if$
392 }
393 if$
394 }
395 't
396 if$
397 nameptr #1 + 'nameptr :=
398 namesleft #1 - 'namesleft :=
399 }
400 while$
401 }
402
403 FUNCTION {format.authors}
404 { author empty$
405 { "" }
406 { author format.names }
407 if$
408 }
409
410 FUNCTION {format.editors}
411 { editor empty$
412 { "" }
413 { editor format.names
414 editor num.names$ #1 >
415 { ", editors" * }
416 { ", editor" * }
417 if$
418 }
419 if$
420 }
421
422 FUNCTION {format.title}
423 { title empty$
424 { "" }
425 { title "t" change.case$ }
426 if$
427 }
428
429 FUNCTION {n.dashify}
430 { 't :=
431 ""
432 { t empty$ not }
433 { t #1 #1 substring$ "-" =
434 { t #1 #2 substring$ "--" = not
435 { "--" *
436 t #2 global.max$ substring$ 't :=
437 }
438 { { t #1 #1 substring$ "-" = }
439 { "-" *
440 t #2 global.max$ substring$ 't :=
441 }
442 while$
443 }
444 if$
445 }
446 { t #1 #1 substring$ *
447 t #2 global.max$ substring$ 't :=
448 }
449 if$
450 }
451 while$
452 }
453
454 FUNCTION {format.date}
455 { year empty$
456 { month empty$
457 { "" }
458 { "there's a month but no year in " cite$ * warning$
459 month
460 }
461 if$
462 }
463 { month empty$
464 'year
465 { month " " * year * }
466 if$
467 }
468 if$
469 }
470
471 FUNCTION {format.btitle}
472 { title emphasize
473 }
474
475 FUNCTION {tie.or.space.connect}
476 { duplicate$ text.length$ #3 <
477 { "~" }
478 { " " }
479 if$
480 swap$ * *
481 }
482
483 FUNCTION {either.or.check}
484 { empty$
485 'pop$
486 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
487 if$
488 }
489
490 FUNCTION {format.bvolume}
491 { volume empty$
492 { "" }
493 { "volume" volume tie.or.space.connect
494 series empty$
495 'skip$
496 { " of " * series emphasize * }
497 if$
498 "volume and number" number either.or.check
499 }
500 if$
501 }
502
503 FUNCTION {format.number.series}
504 { volume empty$
505 { number empty$
506 { series field.or.null }
507 { output.state mid.sentence =
508 { "number" }
509 { "Number" }
510 if$
511 number tie.or.space.connect
512 series empty$
513 { "there's a number but no series in " cite$ * warning$ }
514 { " in " * series * }
515 if$
516 }
517 if$
518 }
519 { "" }
520 if$
521 }
522
523 FUNCTION {format.edition}
524 { edition empty$
525 { "" }
526 { output.state mid.sentence =
527 { edition "l" change.case$ " edition" * }
528 { edition "t" change.case$ " edition" * }
529 if$
530 }
531 if$
532 }
533
534 INTEGERS { multiresult }
535
536 FUNCTION {multi.page.check}
537 { 't :=
538 #0 'multiresult :=
539 { multiresult not
540 t empty$ not
541 and
542 }
543 { t #1 #1 substring$
544 duplicate$ "-" =
545 swap$ duplicate$ "," =
546 swap$ "+" =
547 or or
548 { #1 'multiresult := }
549 { t #2 global.max$ substring$ 't := }
550 if$
551 }
552 while$
553 multiresult
554 }
555
556 FUNCTION {format.pages}
557 { pages empty$
558 { "" }
559 { pages multi.page.check
560 { "pages" pages n.dashify tie.or.space.connect }
561 { "page" pages tie.or.space.connect }
562 if$
563 }
564 if$
565 }
566
567 FUNCTION {format.vol.num.pages}
568 { volume field.or.null
569 number empty$
570 'skip$
571 { "(" number * ")" * *
572 volume empty$
573 { "there's a number but no volume in " cite$ * warning$ }
574 'skip$
575 if$
576 }
577 if$
578 pages empty$
579 'skip$
580 { duplicate$ empty$
581 { pop$ format.pages }
582 { ":" * pages n.dashify * }
583 if$
584 }
585 if$
586 }
587
588 FUNCTION {format.chapter.pages}
589 { chapter empty$
590 'format.pages
591 { type empty$
592 { "chapter" }
593 { type "l" change.case$ }
594 if$
595 chapter tie.or.space.connect
596 pages empty$
597 'skip$
598 { ", " * format.pages * }
599 if$
600 }
601 if$
602 }
603
604 FUNCTION {format.in.ed.booktitle}
605 { booktitle empty$
606 { "" }
607 { editor empty$
608 { "In " booktitle emphasize * }
609 { "In " format.editors * ", " * booktitle emphasize * }
610 if$
611 }
612 if$
613 }
614
615 FUNCTION {empty.misc.check}
616 { author empty$ title empty$ howpublished empty$
617 month empty$ year empty$ note empty$
618 and and and and and
619 key empty$ not and
620 { "all relevant fields are empty in " cite$ * warning$ }
621 'skip$
622 if$
623 }
624
625 FUNCTION {format.thesis.type}
626 { type empty$
627 'skip$
628 { pop$
629 type "t" change.case$
630 }
631 if$
632 }
633
634 FUNCTION {format.tr.number}
635 { type empty$
636 { "Technical Report" }
637 'type
638 if$
639 number empty$
640 { "t" change.case$ }
641 { number tie.or.space.connect }
642 if$
643 }
644
645 FUNCTION {format.article.crossref}
646 { key empty$
647 { journal empty$
648 { "need key or journal for " cite$ * " to crossref " * crossref *
649 warning$
650 ""
651 }
652 { "In {\em " journal * "\/}" * }
653 if$
654 }
655 { "In " key * }
656 if$
657 " \cite{" * crossref * "}" *
658 }
659
660 FUNCTION {format.crossref.editor}
661 { editor #1 "{vv~}{ll}" format.name$
662 editor num.names$ duplicate$
663 #2 >
664 { pop$ " et~al." * }
665 { #2 <
666 'skip$
667 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
668 { " et~al." * }
669 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
670 if$
671 }
672 if$
673 }
674 if$
675 }
676
677 FUNCTION {format.book.crossref}
678 { volume empty$
679 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
680 "In "
681 }
682 { "Volume" volume tie.or.space.connect
683 " of " *
684 }
685 if$
686 editor empty$
687 editor field.or.null author field.or.null =
688 or
689 { key empty$
690 { series empty$
691 { "need editor, key, or series for " cite$ * " to crossref " *
692 crossref * warning$
693 "" *
694 }
695 { "{\em " * series * "\/}" * }
696 if$
697 }
698 { key * }
699 if$
700 }
701 { format.crossref.editor * }
702 if$
703 " \cite{" * crossref * "}" *
704 }
705
706 FUNCTION {format.incoll.inproc.crossref}
707 { editor empty$
708 editor field.or.null author field.or.null =
709 or
710 { key empty$
711 { booktitle empty$
712 { "need editor, key, or booktitle for " cite$ * " to crossref " *
713 crossref * warning$
714 ""
715 }
716 { "In {\em " booktitle * "\/}" * }
717 if$
718 }
719 { "In " key * }
720 if$
721 }
722 { "In " format.crossref.editor * }
723 if$
724 " \cite{" * crossref * "}" *
725 }
726
727 % urlbst...
728 % Functions for making hypertext links.
729 % In all cases, the stack has (link-text href-url)
730 %
731 % make 'null' specials
732 FUNCTION {make.href.null}
733 {
734 pop$
735 }
736 % make hypertex specials
737 FUNCTION {make.href.hypertex}
738 {
739 "\special {html:<a href=" quote$ *
740 swap$ * quote$ * "> }" * swap$ *
741 "\special {html:</a>}" *
742 }
743 % make hyperref specials
744 FUNCTION {make.href.hyperref}
745 {
746 "\href {" swap$ * "} {\path{" * swap$ * "}}" *
747 }
748 FUNCTION {make.href}
749 { hrefform #2 =
750 'make.href.hyperref % hrefform = 2
751 { hrefform #1 =
752 'make.href.hypertex % hrefform = 1
753 'make.href.null % hrefform = 0 (or anything else)
754 if$
755 }
756 if$
757 }
758
759 % If inlinelinks is true, then format.url should be a no-op, since it's
760 % (a) redundant, and (b) could end up as a link-within-a-link.
761 FUNCTION {format.url}
762 { inlinelinks #1 = url empty$ or
763 { "" }
764 { hrefform #1 =
765 { % special case -- add HyperTeX specials
766 urlintro "\url{" url * "}" * url make.href.hypertex * }
767 { urlintro "\url{" * url * "}" * }
768 if$
769 }
770 if$
771 }
772 FUNCTION {format.eprint}
773 { eprint empty$
774 { "" }
775 { eprintprefix eprint * eprinturl eprint * make.href }
776 if$
777 }
778
779 FUNCTION {format.doi}
780 { doi empty$
781 { "" }
782 { doi parse.doi % leaves "https://doi.org/DOI" DOI on the stack
783 's := 't :=
784 doiform #1 =
785 { "\doi{" s * "}" * }
786 { doiprefix s * t make.href }
787 if$
788 }
789 if$
790 }
791
792 FUNCTION {format.pubmed}
793 { pubmed empty$
794 { "" }
795 { pubmedprefix pubmed * pubmedurl pubmed * make.href }
796 if$
797 }
798
799 % Output a URL. We can't use the more normal idiom (something like
800 % `format.url output'), because the `inbrackets' within
801 % format.lastchecked applies to everything between calls to `output',
802 % so that `format.url format.lastchecked * output' ends up with both
803 % the URL and the lastchecked in brackets.
804 FUNCTION {output.url}
805 { url empty$
806 'skip$
807 { new.block
808 format.url output
809 format.lastchecked output
810 }
811 if$
812 }
813
814 FUNCTION {output.web.refs}
815 {
816 new.block
817 inlinelinks
818 'skip$ % links were inline -- don't repeat them
819 { % If the generated DOI will be the same as the URL,
820 % then don't print the URL (thanks to Joseph Wright
821 % for (the original version of) this code,
822 % at http://tex.stackexchange.com/questions/5660)
823 adddoi
824 doi empty$ { "X" } { doi parse.doi pop$ } if$ % DOI URL to be generated
825 url empty$ { "Y" } { url } if$ % the URL, or "Y" if empty
826 = % are the strings equal?
827 and
828 'skip$
829 { output.url }
830 if$
831 addeprints eprint empty$ not and
832 { format.eprint output.nonnull }
833 'skip$
834 if$
835 adddoi doi empty$ not and
836 { format.doi output.nonnull }
837 'skip$
838 if$
839 addpubmed pubmed empty$ not and
840 { format.pubmed output.nonnull }
841 'skip$
842 if$
843 }
844 if$
845 }
846
847 % Wrapper for output.bibitem.original.
848 % If the URL field is not empty, set makeinlinelink to be true,
849 % so that an inline link will be started at the next opportunity
850 FUNCTION {output.bibitem}
851 { outside.brackets 'bracket.state :=
852 output.bibitem.original
853 inlinelinks url empty$ not doi empty$ not or pubmed empty$ not or eprint empty$ not or and
854 { #1 'makeinlinelink := }
855 { #0 'makeinlinelink := }
856 if$
857 }
858
859 % Wrapper for fin.entry.original
860 FUNCTION {fin.entry}
861 { output.web.refs % urlbst
862 makeinlinelink % ooops, it appears we didn't have a title for inlinelink
863 { possibly.setup.inlinelink % add some artificial link text here, as a fallback
864 linktextstring output.nonnull }
865 'skip$
866 if$
867 bracket.state close.brackets = % urlbst
868 { "]" * }
869 'skip$
870 if$
871 fin.entry.original
872 }
873
874 % Webpage entry type.
875 % Title and url fields required;
876 % author, note, year, month, and lastchecked fields optional
877 % See references
878 % ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm
879 % http://www.classroom.net/classroom/CitingNetResources.html
880 % http://neal.ctstateu.edu/history/cite.html
881 % http://www.cas.usf.edu/english/walker/mla.html
882 % for citation formats for web pages.
883 FUNCTION {webpage}
884 { output.bibitem
885 author empty$
886 { editor empty$
887 'skip$ % author and editor both optional
888 { format.editors output.nonnull }
889 if$
890 }
891 { editor empty$
892 { format.authors output.nonnull }
893 { "can't use both author and editor fields in " cite$ * warning$ }
894 if$
895 }
896 if$
897 new.block
898 title empty$ 'skip$ 'possibly.setup.inlinelink if$
899 format.title "title" output.check
900 inbrackets onlinestring output
901 new.block
902 year empty$
903 'skip$
904 { format.date "year" output.check }
905 if$
906 % We don't need to output the URL details ('lastchecked' and 'url'),
907 % because fin.entry does that for us, using output.web.refs. The only
908 % reason we would want to put them here is if we were to decide that
909 % they should go in front of the rather miscellaneous information in 'note'.
910 new.block
911 note output
912 fin.entry
913 }
914 % ...urlbst to here
915
916
917 FUNCTION {article}
918 { output.bibitem
919 format.authors "author" output.check
920 new.block
921 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
922 format.title "title" output.check
923 new.block
924 crossref missing$
925 { journal emphasize "journal" output.check
926 possibly.setup.inlinelink format.vol.num.pages output% urlbst
927 format.date "year" output.check
928 }
929 { format.article.crossref output.nonnull
930 format.pages output
931 }
932 if$
933 new.block
934 note output
935 fin.entry
936 }
937
938 FUNCTION {book}
939 { output.bibitem
940 author empty$
941 { format.editors "author and editor" output.check }
942 { format.authors output.nonnull
943 crossref missing$
944 { "author and editor" editor either.or.check }
945 'skip$
946 if$
947 }
948 if$
949 new.block
950 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
951 format.btitle "title" output.check
952 crossref missing$
953 { format.bvolume output
954 new.block
955 format.number.series output
956 new.sentence
957 publisher "publisher" output.check
958 address output
959 }
960 { new.block
961 format.book.crossref output.nonnull
962 }
963 if$
964 format.edition output
965 format.date "year" output.check
966 new.block
967 note output
968 fin.entry
969 }
970
971 FUNCTION {booklet}
972 { output.bibitem
973 format.authors output
974 new.block
975 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
976 format.title "title" output.check
977 howpublished address new.block.checkb
978 howpublished output
979 address output
980 format.date output
981 new.block
982 note output
983 fin.entry
984 }
985
986 FUNCTION {inbook}
987 { output.bibitem
988 author empty$
989 { format.editors "author and editor" output.check }
990 { format.authors output.nonnull
991 crossref missing$
992 { "author and editor" editor either.or.check }
993 'skip$
994 if$
995 }
996 if$
997 new.block
998 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
999 format.btitle "title" output.check
1000 crossref missing$
1001 { format.bvolume output
1002 format.chapter.pages "chapter and pages" output.check
1003 new.block
1004 format.number.series output
1005 new.sentence
1006 publisher "publisher" output.check
1007 address output
1008 }
1009 { format.chapter.pages "chapter and pages" output.check
1010 new.block
1011 format.book.crossref output.nonnull
1012 }
1013 if$
1014 format.edition output
1015 format.date "year" output.check
1016 new.block
1017 note output
1018 fin.entry
1019 }
1020
1021 FUNCTION {incollection}
1022 { output.bibitem
1023 format.authors "author" output.check
1024 new.block
1025 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1026 format.title "title" output.check
1027 new.block
1028 crossref missing$
1029 { format.in.ed.booktitle "booktitle" output.check
1030 format.bvolume output
1031 format.number.series output
1032 format.chapter.pages output
1033 new.sentence
1034 publisher "publisher" output.check
1035 address output
1036 format.edition output
1037 format.date "year" output.check
1038 }
1039 { format.incoll.inproc.crossref output.nonnull
1040 format.chapter.pages output
1041 }
1042 if$
1043 new.block
1044 note output
1045 fin.entry
1046 }
1047
1048 FUNCTION {inproceedings}
1049 { output.bibitem
1050 format.authors "author" output.check
1051 new.block
1052 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1053 format.title "title" output.check
1054 new.block
1055 crossref missing$
1056 { format.in.ed.booktitle "booktitle" output.check
1057 format.bvolume output
1058 format.number.series output
1059 format.pages output
1060 address empty$
1061 { organization publisher new.sentence.checkb
1062 organization output
1063 publisher output
1064 format.date "year" output.check
1065 }
1066 { address output.nonnull
1067 format.date "year" output.check
1068 new.sentence
1069 organization output
1070 publisher output
1071 }
1072 if$
1073 }
1074 { format.incoll.inproc.crossref output.nonnull
1075 format.pages output
1076 }
1077 if$
1078 new.block
1079 note output
1080 fin.entry
1081 }
1082
1083 FUNCTION {conference} { inproceedings }
1084
1085 FUNCTION {manual}
1086 { output.bibitem
1087 author empty$
1088 { organization empty$
1089 'skip$
1090 { organization output.nonnull
1091 address output
1092 }
1093 if$
1094 }
1095 { format.authors output.nonnull }
1096 if$
1097 new.block
1098 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1099 format.btitle "title" output.check
1100 author empty$
1101 { organization empty$
1102 { address new.block.checka
1103 address output
1104 }
1105 'skip$
1106 if$
1107 }
1108 { organization address new.block.checkb
1109 organization output
1110 address output
1111 }
1112 if$
1113 format.edition output
1114 format.date output
1115 new.block
1116 note output
1117 fin.entry
1118 }
1119
1120 FUNCTION {mastersthesis}
1121 { output.bibitem
1122 format.authors "author" output.check
1123 new.block
1124 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1125 format.title "title" output.check
1126 new.block
1127 "Master's thesis" format.thesis.type output.nonnull
1128 school "school" output.check
1129 address output
1130 format.date "year" output.check
1131 new.block
1132 note output
1133 fin.entry
1134 }
1135
1136 FUNCTION {misc}
1137 { output.bibitem
1138 format.authors output
1139 title howpublished new.block.checkb
1140 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1141 format.title output
1142 howpublished new.block.checka
1143 howpublished output
1144 format.date output
1145 new.block
1146 note output
1147 fin.entry
1148 empty.misc.check
1149 }
1150
1151 FUNCTION {phdthesis}
1152 { output.bibitem
1153 format.authors "author" output.check
1154 new.block
1155 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1156 format.btitle "title" output.check
1157 new.block
1158 "PhD thesis" format.thesis.type output.nonnull
1159 school "school" output.check
1160 address output
1161 format.date "year" output.check
1162 new.block
1163 note output
1164 fin.entry
1165 }
1166
1167 FUNCTION {proceedings}
1168 { output.bibitem
1169 editor empty$
1170 { organization output }
1171 { format.editors output.nonnull }
1172 if$
1173 new.block
1174 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1175 format.btitle "title" output.check
1176 format.bvolume output
1177 format.number.series output
1178 address empty$
1179 { editor empty$
1180 { publisher new.sentence.checka }
1181 { organization publisher new.sentence.checkb
1182 organization output
1183 }
1184 if$
1185 publisher output
1186 format.date "year" output.check
1187 }
1188 { address output.nonnull
1189 format.date "year" output.check
1190 new.sentence
1191 editor empty$
1192 'skip$
1193 { organization output }
1194 if$
1195 publisher output
1196 }
1197 if$
1198 new.block
1199 note output
1200 fin.entry
1201 }
1202
1203 FUNCTION {techreport}
1204 { output.bibitem
1205 format.authors "author" output.check
1206 new.block
1207 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1208 format.title "title" output.check
1209 new.block
1210 format.tr.number output.nonnull
1211 institution "institution" output.check
1212 address output
1213 format.date "year" output.check
1214 new.block
1215 note output
1216 fin.entry
1217 }
1218
1219 FUNCTION {unpublished}
1220 { output.bibitem
1221 format.authors "author" output.check
1222 new.block
1223 title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
1224 format.title "title" output.check
1225 new.block
1226 note "note" output.check
1227 format.date output
1228 fin.entry
1229 }
1230
1231 FUNCTION {default.type} { misc }
1232
1233 MACRO {jan} {"January"}
1234
1235 MACRO {feb} {"February"}
1236
1237 MACRO {mar} {"March"}
1238
1239 MACRO {apr} {"April"}
1240
1241 MACRO {may} {"May"}
1242
1243 MACRO {jun} {"June"}
1244
1245 MACRO {jul} {"July"}
1246
1247 MACRO {aug} {"August"}
1248
1249 MACRO {sep} {"September"}
1250
1251 MACRO {oct} {"October"}
1252
1253 MACRO {nov} {"November"}
1254
1255 MACRO {dec} {"December"}
1256
1257 MACRO {acmcs} {"ACM Computing Surveys"}
1258
1259 MACRO {acta} {"Acta Informatica"}
1260
1261 MACRO {cacm} {"Communications of the ACM"}
1262
1263 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1264
1265 MACRO {ibmsj} {"IBM Systems Journal"}
1266
1267 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1268
1269 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1270
1271 MACRO {ieeetcad}
1272 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1273
1274 MACRO {ipl} {"Information Processing Letters"}
1275
1276 MACRO {jacm} {"Journal of the ACM"}
1277
1278 MACRO {jcss} {"Journal of Computer and System Sciences"}
1279
1280 MACRO {scp} {"Science of Computer Programming"}
1281
1282 MACRO {sicomp} {"SIAM Journal on Computing"}
1283
1284 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1285
1286 MACRO {tods} {"ACM Transactions on Database Systems"}
1287
1288 MACRO {tog} {"ACM Transactions on Graphics"}
1289
1290 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1291
1292 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1293
1294 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1295
1296 MACRO {tcs} {"Theoretical Computer Science"}
1297
1298 READ
1299
1300 FUNCTION {sortify}
1301 { purify$
1302 "l" change.case$
1303 }
1304
1305 INTEGERS { len }
1306
1307 FUNCTION {chop.word}
1308 { 's :=
1309 'len :=
1310 s #1 len substring$ =
1311 { s len #1 + global.max$ substring$ }
1312 's
1313 if$
1314 }
1315
1316 FUNCTION {sort.format.names}
1317 { 's :=
1318 #1 'nameptr :=
1319 ""
1320 s num.names$ 'numnames :=
1321 numnames 'namesleft :=
1322 { namesleft #0 > }
1323 { nameptr #1 >
1324 { " " * }
1325 'skip$
1326 if$
1327 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1328 nameptr numnames = t "others" = and
1329 { "et al" * }
1330 { t sortify * }
1331 if$
1332 nameptr #1 + 'nameptr :=
1333 namesleft #1 - 'namesleft :=
1334 }
1335 while$
1336 }
1337
1338 FUNCTION {sort.format.title}
1339 { 't :=
1340 "A " #2
1341 "An " #3
1342 "The " #4 t chop.word
1343 chop.word
1344 chop.word
1345 sortify
1346 #1 global.max$ substring$
1347 }
1348
1349 FUNCTION {author.sort}
1350 { author empty$
1351 { key empty$
1352 { "to sort, need author or key in " cite$ * warning$
1353 ""
1354 }
1355 { key sortify }
1356 if$
1357 }
1358 { author sort.format.names }
1359 if$
1360 }
1361
1362 FUNCTION {author.editor.sort}
1363 { author empty$
1364 { editor empty$
1365 { key empty$
1366 { "to sort, need author, editor, or key in " cite$ * warning$
1367 ""
1368 }
1369 { key sortify }
1370 if$
1371 }
1372 { editor sort.format.names }
1373 if$
1374 }
1375 { author sort.format.names }
1376 if$
1377 }
1378
1379 FUNCTION {author.organization.sort}
1380 { author empty$
1381 { organization empty$
1382 { key empty$
1383 { "to sort, need author, organization, or key in " cite$ * warning$
1384 ""
1385 }
1386 { key sortify }
1387 if$
1388 }
1389 { "The " #4 organization chop.word sortify }
1390 if$
1391 }
1392 { author sort.format.names }
1393 if$
1394 }
1395
1396 FUNCTION {editor.organization.sort}
1397 { editor empty$
1398 { organization empty$
1399 { key empty$
1400 { "to sort, need editor, organization, or key in " cite$ * warning$
1401 ""
1402 }
1403 { key sortify }
1404 if$
1405 }
1406 { "The " #4 organization chop.word sortify }
1407 if$
1408 }
1409 { editor sort.format.names }
1410 if$
1411 }
1412
1413 FUNCTION {presort}
1414 { type$ "book" =
1415 type$ "inbook" =
1416 or
1417 'author.editor.sort
1418 { type$ "proceedings" =
1419 'editor.organization.sort
1420 { type$ "manual" =
1421 'author.organization.sort
1422 'author.sort
1423 if$
1424 }
1425 if$
1426 }
1427 if$
1428 " "
1429 *
1430 year field.or.null sortify
1431 *
1432 " "
1433 *
1434 title field.or.null
1435 sort.format.title
1436 *
1437 #1 entry.max$ substring$
1438 'sort.key$ :=
1439 }
1440
1441 ITERATE {presort}
1442
1443 SORT
1444
1445 STRINGS { longest.label }
1446
1447 INTEGERS { number.label longest.label.width }
1448
1449 FUNCTION {initialize.longest.label}
1450 { "" 'longest.label :=
1451 #1 'number.label :=
1452 #0 'longest.label.width :=
1453 }
1454
1455 FUNCTION {longest.label.pass}
1456 { number.label int.to.str$ 'label :=
1457 number.label #1 + 'number.label :=
1458 label width$ longest.label.width >
1459 { label 'longest.label :=
1460 label width$ 'longest.label.width :=
1461 }
1462 'skip$
1463 if$
1464 }
1465
1466 EXECUTE {initialize.longest.label}
1467
1468 ITERATE {longest.label.pass}
1469
1470 FUNCTION {begin.bib}
1471 { preamble$ empty$
1472 'skip$
1473 { preamble$ write$ newline$ }
1474 if$
1475 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1476 }
1477
1478 EXECUTE {begin.bib}
1479
1480 EXECUTE {init.urlbst.variables} % urlbst
1481 EXECUTE {init.state.consts}
1482
1483 ITERATE {call.type$}
1484
1485 FUNCTION {end.bib}
1486 { newline$
1487 "\end{thebibliography}" write$ newline$
1488 }
1489
1490 EXECUTE {end.bib}