2 %%Modified to avoid extra comma at end of citations
4 %%Jonathan Flynn's h-physrev.bst modified to allow citation information
5 %%for SPIRES processing by Heath O'Connell following suggestions by
38 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
39 FUNCTION {init.state.consts}
46 FUNCTION {output.nonnull}
48 output.state mid.sentence =
50 { output.state after.block =
55 { output.state before.all =
57 { add.period$ " " * write$ }
61 mid.sentence 'output.state :=
72 FUNCTION {output.check}
75 { pop$ "empty " t * " in " * cite$ * warning$ }
79 FUNCTION {output.newline}
84 before.all 'output.state :=
86 FUNCTION {output.bibitem}
93 before.all 'output.state :=
98 % modified to add SLACcitation field if present
101 { newline$ SLACcitation write$ }
103 % end of modification
107 { output.state before.all =
109 { after.block 'output.state := }
112 FUNCTION {new.sentence}
130 FUNCTION {new.block.checka}
136 FUNCTION {new.block.checkb}
144 FUNCTION {new.sentence.checka}
150 FUNCTION {new.sentence.checkb}
158 FUNCTION {field.or.null}
164 FUNCTION {printabstract}
167 { "{\footnotesize{\bf Abstract} " swap$ * "}" * }
170 FUNCTION {printsmall}
173 { "{\footnotesize " swap$ * "}" * }
179 { "{\bf\footnotesize " swap$ * "}" * }
185 { "{\em\footnotesize " swap$ * "}" * }
191 { "{\bf " swap$ * "}" * }
197 { "(" swap$ * ")" * }
200 INTEGERS { nameptr namesleft numnames }
202 FUNCTION {format.names}
205 s num.names$ 'numnames :=
207 s numnames "{ll}" format.name$ "others" = numnames #1 > and
210 { #1 #1 + 'namesleft := }
211 { numnames 'namesleft := }
214 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
224 { " {\em et~al.}" * }
232 nameptr #1 + 'nameptr :=
233 namesleft #1 - 'namesleft :=
237 FUNCTION {format.authors}
240 { author format.names }
243 FUNCTION {format.editors}
246 { editor format.names
247 editor num.names$ #1 >
254 FUNCTION {format.edited}
257 { "edited by " editor format.names * }
260 FUNCTION {format.title}
263 { title "t" change.case$ }
270 { t #1 #1 substring$ "-" =
271 { t #1 #2 substring$ "--" = not
273 t #2 global.max$ substring$ 't :=
275 { { t #1 #1 substring$ "-" = }
277 t #2 global.max$ substring$ 't :=
283 { t #1 #1 substring$ *
284 t #2 global.max$ substring$ 't :=
290 FUNCTION {first.page}
293 { t empty$ not t #1 #1 substring$ "-" = not and }
294 { t #1 #1 substring$ *
295 t #2 global.max$ substring$ 't :=
299 FUNCTION {format.date}
305 %FUNCTION {format.SLACcitation}
306 %{ SLACcitation empty$
311 FUNCTION {format.btitle}
314 FUNCTION {tie.or.space.connect}
315 { duplicate$ text.length$ #3 <
321 FUNCTION {either.or.check}
324 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
327 FUNCTION {format.bvolume}
334 " Vol." volume tie.or.space.connect *
335 "volume and number" number either.or.check
339 FUNCTION {format.number.series}
342 { series field.or.null }
344 { "there's a number but no series in " cite$ * warning$ }
347 " No. " number tie.or.space.connect *
354 FUNCTION {format.edition}
357 { output.state mid.sentence =
358 { ", " edition "l" change.case$ * }
359 { ", " edition "t" change.case$ * }
365 INTEGERS { multiresult }
366 FUNCTION {multi.page.check}
375 swap$ duplicate$ "," =
378 { #1 'multiresult := }
379 { t #2 global.max$ substring$ 't := }
385 FUNCTION {format.pages}
388 { pages multi.page.check
389 { "pp." pages n.dashify tie.or.space.connect }
390 { "p." pages tie.or.space.connect }
395 FUNCTION {format.pages.a}
398 { "p." pages first.page tie.or.space.connect }
401 FUNCTION {format.vol.num.pages}
402 { volume field.or.null embolden
407 { pop$ format.pages.a }
408 { ", " * pages first.page * }
413 FUNCTION {format.chapter.pages}
418 { type "l" change.case$ }
420 chapter tie.or.space.connect
423 { ", " * format.pages * }
428 FUNCTION {format.pub.addr.date}
430 { "" "empty publisher in " cite$ * warning$ }
439 { "empty year in " cite$ * warning$ }
444 FUNCTION {format.book.entry}
447 format.number.series *
449 format.pub.addr.date *
451 FUNCTION {format.inbook.entry}
454 format.chapter.pages *
456 FUNCTION {format.in.ed.booktitle}
460 { "in " booktitle emphasize * }
461 { "in " booktitle emphasize * ", " * format.edited * }
466 FUNCTION {empty.misc.check}
467 { author empty$ title empty$ howpublished empty$
468 month empty$ year empty$ note empty$
470 { "all relevant fields are empty in " cite$ * warning$ }
474 FUNCTION {format.thesis.type}
478 type "t" change.case$
482 FUNCTION {format.inst.tr.num.date}
484 { "" "empty institution in " cite$ * warning$ }
490 { number tie.or.space.connect }
493 { "empty year in " cite$ * warning$ }
494 { ", " * year * " (unpublished)" * }
497 FUNCTION {format.article.crossref}
500 { "need key or journal for " cite$ * " to crossref " * crossref *
509 " \cite{" * crossref * "}" *
511 FUNCTION {format.crossref.editor}
512 { editor #1 "{vv~}{ll}" format.name$
513 editor num.names$ duplicate$
515 { pop$ " {\em et~al.}" * }
518 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
519 { " {\em et~al.}" * }
520 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
527 FUNCTION {format.book.crossref}
529 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
532 { "Volume" volume tie.or.space.connect
537 editor field.or.null author field.or.null =
541 { "need editor, key, or series for " cite$ * " to crossref " *
545 { "{\em " * series * "\/}" * }
551 { format.crossref.editor * }
553 " \cite{" * crossref * "}" *
555 FUNCTION {format.incoll.inproc.crossref}
557 editor field.or.null author field.or.null =
561 { "need editor, key, or booktitle for " cite$ * " to crossref " *
565 { "In {\em " booktitle * "\/}" * }
571 { "In " format.crossref.editor * }
573 " \cite{" * crossref * "}" *
577 %collaboration output
578 %format.authors "author" output.check
579 format.authors "author" output.check
581 format.title "title" output.check embolden
585 { journal field.or.null
590 { pop$ format.date paren }
591 { " " * format.date paren * }
597 { format.article.crossref output.nonnull
603 %abstract printabstract output
610 { format.editors "author and editor" output.check }
611 { format.authors output.nonnull
613 { "author and editor" editor either.or.check }
620 { format.book.entry output }
622 format.book.crossref output.nonnull
628 %format.SLACcitation output
634 format.authors output
636 format.title "title" output.check
637 howpublished address new.block.checkb
644 %format.SLACcitation output
651 { format.editors "author and editor" output.check }
652 { format.authors output.nonnull
654 { "author and editor" editor either.or.check }
661 { format.inbook.entry output }
662 { format.chapter.pages "chapter and pages" output.check
664 format.book.crossref output.nonnull
670 %format.SLACcitation output
673 FUNCTION {incollection}
676 format.authors "author" output.check
678 %format.title "title" output.check
681 { format.in.ed.booktitle "booktitle" output.check
682 format.bvolume output
683 format.number.series output
684 format.chapter.pages output
686 publisher "publisher" output.check
688 format.edition output
689 format.date "year" output.check
691 { format.incoll.inproc.crossref output.nonnull
692 format.chapter.pages output
698 %format.SLACcitation output
701 FUNCTION {inproceedings}
704 format.authors "author" output.check
706 %format.title "title" output.check
709 { format.in.ed.booktitle "booktitle" output.check
710 format.bvolume output
711 format.number.series output
714 { organization publisher new.sentence.checkb
717 format.date "year" output.check
719 { address output.nonnull
720 format.date "year" output.check
727 { format.incoll.inproc.crossref output.nonnull
734 %format.SLACcitation output
737 FUNCTION {conference} { inproceedings }
742 { organization empty$
744 { organization output.nonnull
749 { format.authors output.nonnull }
752 format.btitle "title" output.check
754 { organization empty$
755 { address new.block.checka
761 { organization address new.block.checkb
766 format.edition output
773 FUNCTION {mastersthesis}
775 format.authors "author" output.check
777 format.title "title" output.check
779 "Master's thesis" format.thesis.type output.nonnull
780 school "school" output.check
782 format.date "year" output.check
791 format.authors output
792 title howpublished new.block.checkb
794 howpublished new.block.checka
805 format.authors "author" output.check
807 format.btitle "title" output.check
809 "PhD thesis" format.thesis.type output.nonnull
810 school "school" output.check
812 format.date "year" output.check
816 %format.SLACcitation output
819 FUNCTION {proceedings}
823 { organization output }
824 { format.editors output.nonnull }
827 format.btitle "title" output.check
828 format.bvolume output
829 format.number.series output
832 { publisher new.sentence.checka }
833 { organization publisher new.sentence.checkb
838 format.date "year" output.check
840 { address output.nonnull
841 format.date "year" output.check
845 { organization output }
853 %format.SLACcitation output
856 FUNCTION {techreport}
859 format.authors "author" output.check
861 format.inst.tr.num.date output.nonnull
867 FUNCTION {unpublished}
870 format.authors "author" output.check
872 format.title "title" output.check
874 note "note" output.check
876 %format.SLACcitation output
879 FUNCTION {default.type} { misc }
888 MACRO {sep} {"Sept."}
892 MACRO {acmcs} {"ACM Comput. Surv."}
893 MACRO {acta} {"Acta Inf."}
894 MACRO {cacm} {"Commun. ACM"}
895 MACRO {ibmjrd} {"IBM J. Res. Dev."}
896 MACRO {ibmsj} {"IBM Syst.~J."}
897 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
898 MACRO {ieeetc} {"IEEE Trans. Comput."}
900 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
901 MACRO {ipl} {"Inf. Process. Lett."}
902 MACRO {jacm} {"J.~ACM"}
903 MACRO {jcss} {"J.~Comput. Syst. Sci."}
904 MACRO {scp} {"Sci. Comput. Programming"}
905 MACRO {sicomp} {"SIAM J. Comput."}
906 MACRO {tocs} {"ACM Trans. Comput. Syst."}
907 MACRO {tods} {"ACM Trans. Database Syst."}
908 MACRO {tog} {"ACM Trans. Gr."}
909 MACRO {toms} {"ACM Trans. Math. Softw."}
910 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
911 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
912 MACRO {tcs} {"Theoretical Comput. Sci."}
913 MACRO {advp} {"Adv. Phys."}
914 MACRO {ajp} {"Am. J. Phys."}
915 MACRO {ao} {"Appl. Opt."}
916 MACRO {apj} {"Astrophys. J."}
917 MACRO {apl} {"Appl. Phys. Lett."}
918 MACRO {arnps} {"Ann. Rev. Nucl. Sci."}
919 MACRO {arns} {"Ann. Rev. Nucl. Part. Sci."}
920 MACRO {baps} {"Bull. Am. Phys. Soc."}
921 MACRO {cpc} {"Computer Phys. Comm."}
922 MACRO {cppcf} {"Comments Plasma Phys. Controlled Fusion"}
923 MACRO {fed} {"Fusion Eng. Design"}
924 MACRO {ft} {"Fusion Tech."}
925 MACRO {ieeens} {"IEEE Trans. Nucl. Sci."}
926 MACRO {ieeeps} {"IEEE Trans. Plasma Sci."}
927 MACRO {ijimw} {"Int. J. Infrared Millimeter Waves"}
928 MACRO {ip} {"Infrared Phys."}
929 MACRO {jap} {"J. Appl. Phys."}
930 MACRO {jcp} {"J. Comput. Phys."}
931 MACRO {jetp} {"Sov. Phys.-JETP"}
932 MACRO {jfe} {"J. Fusion Energy"}
933 MACRO {jfm} {"J. Fluid Mech."}
934 MACRO {jgr} {"J. Geophys. Res."}
935 MACRO {jmp} {"J. Math. Phys."}
936 MACRO {jne} {"J. Nucl. Energy"}
937 MACRO {jnm} {"J. Nucl. Mater."}
938 MACRO {josa} {"J. Opt. Soc. Am."}
939 MACRO {jpg} {"J. Phys.~G: Nucl. and Part. Phys."}
940 MACRO {jphys} {"J. Phys"}
941 MACRO {jpp} {"J. Plasma Phys."}
942 MACRO {jpsj} {"J. Phys. Soc. Jpn"}
943 MACRO {jvst} {"J. Vac. Sci. Technol."}
944 MACRO {modphyslettA} {"Mod. Phys. Lett. A"}
945 MACRO {nedf} {"Nucl. Eng. Design/Fusion"}
946 MACRO {nf} {"Nucl. Fusion"}
947 MACRO {nim} {"Nucl. Instrum. Methods"}
948 MACRO {np} {"Nucl. Phys."}
949 MACRO {npb} {"Nucl. Phys.~B"}
950 MACRO {npbps} {"Nucl. Phys. B (Proc. Suppl.)"}
951 MACRO {nt/f} {"Nucl. Tech./Fusion"}
952 MACRO {pf} {"Phys. Fluids"}
953 MACRO {pl} {"Phys. Lett."}
954 MACRO {plb} {"Phys. Lett.~B"}
955 MACRO {pnas} {"Proc. Nat. Acad. Sci. USA"}
956 MACRO {pp} {"Plasma Phys."}
957 MACRO {physrep} {"Phys. Rep."}
958 MACRO {physrev} {"Phys. Rev."}
959 MACRO {pr} {"Phys. Rev."}
960 MACRO {prd} {"Phys. Rev.~D"}
961 MACRO {prl} {"Phys. Rev. Lett."}
962 MACRO {procroysoc} {"Proc. Roy. Soc"}
963 MACRO {ps} {"Physica Scripta"}
964 MACRO {rmp} {"Rev. Mod. Phys."}
965 MACRO {rsi} {"Rev. Sci. Instrum."}
966 MACRO {sjnp} {"Sov. J. Nucl. Phys."}
967 MACRO {sjpp} {"Sov. J. Plasma Phys."}
968 MACRO {spd} {"Sov. Phys.-Dokl."}
969 MACRO {sptp} {"Sov. Phys.-Tech. Phys."}
970 MACRO {spu} {"Sov. Phys.-Usp."}
971 MACRO {zp} {"Z. Phys."}
972 MACRO {zpc} {"Z. Phys.~C"}
974 STRINGS { longest.label }
975 INTEGERS { number.label longest.label.width }
976 FUNCTION {initialize.longest.label}
977 { "" 'longest.label :=
979 #0 'longest.label.width :=
981 FUNCTION {longest.label.pass}
982 { number.label int.to.str$ 'label :=
983 number.label #1 + 'number.label :=
984 label width$ longest.label.width >
985 { label 'longest.label :=
986 label width$ 'longest.label.width :=
991 EXECUTE {initialize.longest.label}
992 ITERATE {longest.label.pass}
996 { preamble$ write$ newline$ }
998 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1001 EXECUTE {init.state.consts}
1002 ITERATE {call.type$}
1005 "\end{thebibliography}" write$ newline$