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
37 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
38 FUNCTION {init.state.consts}
45 FUNCTION {output.nonnull}
47 output.state mid.sentence =
49 { output.state after.block =
54 { output.state before.all =
56 { add.period$ " " * write$ }
60 mid.sentence 'output.state :=
71 FUNCTION {output.check}
74 { pop$ "empty " t * " in " * cite$ * warning$ }
78 FUNCTION {output.bibitem}
85 before.all 'output.state :=
90 % modified to add SLACcitation field if present
93 { newline$ SLACcitation write$ }
99 { output.state before.all =
101 { after.block 'output.state := }
104 FUNCTION {new.sentence}
122 FUNCTION {new.block.checka}
128 FUNCTION {new.block.checkb}
136 FUNCTION {new.sentence.checka}
142 FUNCTION {new.sentence.checkb}
150 FUNCTION {field.or.null}
159 { "{\em " swap$ * "}" * }
165 { "{\bf " swap$ * "}" * }
171 { "(" swap$ * ")" * }
174 INTEGERS { nameptr namesleft numnames }
176 FUNCTION {format.names}
179 s num.names$ 'numnames :=
181 s numnames "{ll}" format.name$ "others" = numnames #1 > and
184 { #1 #1 + 'namesleft := }
185 { numnames 'namesleft := }
188 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
198 { " {\em et~al.}" * }
206 nameptr #1 + 'nameptr :=
207 namesleft #1 - 'namesleft :=
211 FUNCTION {format.authors}
214 { author format.names }
217 FUNCTION {format.editors}
220 { editor format.names
221 editor num.names$ #1 >
228 FUNCTION {format.edited}
231 { "edited by " editor format.names * }
234 FUNCTION {format.title}
237 { title "t" change.case$ }
244 { t #1 #1 substring$ "-" =
245 { t #1 #2 substring$ "--" = not
247 t #2 global.max$ substring$ 't :=
249 { { t #1 #1 substring$ "-" = }
251 t #2 global.max$ substring$ 't :=
257 { t #1 #1 substring$ *
258 t #2 global.max$ substring$ 't :=
264 FUNCTION {first.page}
267 { t empty$ not t #1 #1 substring$ "-" = not and }
268 { t #1 #1 substring$ *
269 t #2 global.max$ substring$ 't :=
273 FUNCTION {format.date}
279 %FUNCTION {format.SLACcitation}
280 %{ SLACcitation empty$
285 FUNCTION {format.btitle}
288 FUNCTION {tie.or.space.connect}
289 { duplicate$ text.length$ #3 <
295 FUNCTION {either.or.check}
298 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
301 FUNCTION {format.bvolume}
308 " Vol." volume tie.or.space.connect *
309 "volume and number" number either.or.check
313 FUNCTION {format.number.series}
316 { series field.or.null }
318 { "there's a number but no series in " cite$ * warning$ }
321 " No. " number tie.or.space.connect *
328 FUNCTION {format.edition}
331 { output.state mid.sentence =
332 { ", " edition "l" change.case$ * }
333 { ", " edition "t" change.case$ * }
339 INTEGERS { multiresult }
340 FUNCTION {multi.page.check}
349 swap$ duplicate$ "," =
352 { #1 'multiresult := }
353 { t #2 global.max$ substring$ 't := }
359 FUNCTION {format.pages}
362 { pages multi.page.check
363 { "pp." pages n.dashify tie.or.space.connect }
364 { "p." pages tie.or.space.connect }
369 FUNCTION {format.pages.a}
372 { "p." pages first.page tie.or.space.connect }
375 FUNCTION {format.vol.num.pages}
376 { volume field.or.null embolden
381 { pop$ format.pages.a }
382 { ", " * pages first.page * }
387 FUNCTION {format.chapter.pages}
392 { type "l" change.case$ }
394 chapter tie.or.space.connect
397 { ", " * format.pages * }
402 FUNCTION {format.pub.addr.date}
404 { "" "empty publisher in " cite$ * warning$ }
413 { "empty year in " cite$ * warning$ }
418 FUNCTION {format.book.entry}
421 format.number.series *
423 format.pub.addr.date *
425 FUNCTION {format.inbook.entry}
428 format.chapter.pages *
430 FUNCTION {format.in.ed.booktitle}
434 { "in " booktitle emphasize * }
435 { "in " booktitle emphasize * ", " * format.edited * }
440 FUNCTION {empty.misc.check}
441 { author empty$ title empty$ howpublished empty$
442 month empty$ year empty$ note empty$
444 { "all relevant fields are empty in " cite$ * warning$ }
448 FUNCTION {format.thesis.type}
452 type "t" change.case$
456 FUNCTION {format.inst.tr.num.date}
458 { "" "empty institution in " cite$ * warning$ }
464 { number tie.or.space.connect }
467 { "empty year in " cite$ * warning$ }
468 { ", " * year * " (unpublished)" * }
471 FUNCTION {format.article.crossref}
474 { "need key or journal for " cite$ * " to crossref " * crossref *
483 " \cite{" * crossref * "}" *
485 FUNCTION {format.crossref.editor}
486 { editor #1 "{vv~}{ll}" format.name$
487 editor num.names$ duplicate$
489 { pop$ " {\em et~al.}" * }
492 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
493 { " {\em et~al.}" * }
494 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
501 FUNCTION {format.book.crossref}
503 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
506 { "Volume" volume tie.or.space.connect
511 editor field.or.null author field.or.null =
515 { "need editor, key, or series for " cite$ * " to crossref " *
519 { "{\em " * series * "\/}" * }
525 { format.crossref.editor * }
527 " \cite{" * crossref * "}" *
529 FUNCTION {format.incoll.inproc.crossref}
531 editor field.or.null author field.or.null =
535 { "need editor, key, or booktitle for " cite$ * " to crossref " *
539 { "In {\em " booktitle * "\/}" * }
545 { "In " format.crossref.editor * }
547 " \cite{" * crossref * "}" *
552 format.authors "author" output.check
555 { journal field.or.null
560 { pop$ format.date paren }
561 { " " * format.date paren * }
567 { format.article.crossref output.nonnull
574 %format.SLACcitation output
581 { format.editors "author and editor" output.check }
582 { format.authors output.nonnull
584 { "author and editor" editor either.or.check }
591 { format.book.entry output }
593 format.book.crossref output.nonnull
599 %format.SLACcitation output
605 format.authors output
607 format.title "title" output.check
608 howpublished address new.block.checkb
615 %format.SLACcitation output
622 { format.editors "author and editor" output.check }
623 { format.authors output.nonnull
625 { "author and editor" editor either.or.check }
632 { format.inbook.entry output }
633 { format.chapter.pages "chapter and pages" output.check
635 format.book.crossref output.nonnull
641 %format.SLACcitation output
644 FUNCTION {incollection}
647 format.authors "author" output.check
649 %format.title "title" output.check
652 { format.in.ed.booktitle "booktitle" output.check
653 format.bvolume output
654 format.number.series output
655 format.chapter.pages output
657 publisher "publisher" output.check
659 format.edition output
660 format.date "year" output.check
662 { format.incoll.inproc.crossref output.nonnull
663 format.chapter.pages output
669 %format.SLACcitation output
672 FUNCTION {inproceedings}
675 format.authors "author" output.check
677 %format.title "title" output.check
680 { format.in.ed.booktitle "booktitle" output.check
681 format.bvolume output
682 format.number.series output
685 { organization publisher new.sentence.checkb
688 format.date "year" output.check
690 { address output.nonnull
691 format.date "year" output.check
698 { format.incoll.inproc.crossref output.nonnull
705 %format.SLACcitation output
708 FUNCTION {conference} { inproceedings }
713 { organization empty$
715 { organization output.nonnull
720 { format.authors output.nonnull }
723 format.btitle "title" output.check
725 { organization empty$
726 { address new.block.checka
732 { organization address new.block.checkb
737 format.edition output
744 FUNCTION {mastersthesis}
746 format.authors "author" output.check
748 format.title "title" output.check
750 "Master's thesis" format.thesis.type output.nonnull
751 school "school" output.check
753 format.date "year" output.check
762 format.authors output
763 title howpublished new.block.checkb
765 howpublished new.block.checka
776 format.authors "author" output.check
778 format.btitle "title" output.check
780 "PhD thesis" format.thesis.type output.nonnull
781 school "school" output.check
783 format.date "year" output.check
787 %format.SLACcitation output
790 FUNCTION {proceedings}
794 { organization output }
795 { format.editors output.nonnull }
798 format.btitle "title" output.check
799 format.bvolume output
800 format.number.series output
803 { publisher new.sentence.checka }
804 { organization publisher new.sentence.checkb
809 format.date "year" output.check
811 { address output.nonnull
812 format.date "year" output.check
816 { organization output }
824 %format.SLACcitation output
827 FUNCTION {techreport}
830 format.authors "author" output.check
832 format.inst.tr.num.date output.nonnull
838 FUNCTION {unpublished}
841 format.authors "author" output.check
843 format.title "title" output.check
845 note "note" output.check
847 %format.SLACcitation output
850 FUNCTION {default.type} { misc }
859 MACRO {sep} {"Sept."}
863 MACRO {acmcs} {"ACM Comput. Surv."}
864 MACRO {acta} {"Acta Inf."}
865 MACRO {cacm} {"Commun. ACM"}
866 MACRO {ibmjrd} {"IBM J. Res. Dev."}
867 MACRO {ibmsj} {"IBM Syst.~J."}
868 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
869 MACRO {ieeetc} {"IEEE Trans. Comput."}
871 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
872 MACRO {ipl} {"Inf. Process. Lett."}
873 MACRO {jacm} {"J.~ACM"}
874 MACRO {jcss} {"J.~Comput. Syst. Sci."}
875 MACRO {scp} {"Sci. Comput. Programming"}
876 MACRO {sicomp} {"SIAM J. Comput."}
877 MACRO {tocs} {"ACM Trans. Comput. Syst."}
878 MACRO {tods} {"ACM Trans. Database Syst."}
879 MACRO {tog} {"ACM Trans. Gr."}
880 MACRO {toms} {"ACM Trans. Math. Softw."}
881 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
882 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
883 MACRO {tcs} {"Theoretical Comput. Sci."}
884 MACRO {advp} {"Adv. Phys."}
885 MACRO {ajp} {"Am. J. Phys."}
886 MACRO {ao} {"Appl. Opt."}
887 MACRO {apj} {"Astrophys. J."}
888 MACRO {apl} {"Appl. Phys. Lett."}
889 MACRO {arnps} {"Ann. Rev. Nucl. Sci."}
890 MACRO {arns} {"Ann. Rev. Nucl. Part. Sci."}
891 MACRO {baps} {"Bull. Am. Phys. Soc."}
892 MACRO {cpc} {"Computer Phys. Comm."}
893 MACRO {cppcf} {"Comments Plasma Phys. Controlled Fusion"}
894 MACRO {fed} {"Fusion Eng. Design"}
895 MACRO {ft} {"Fusion Tech."}
896 MACRO {ieeens} {"IEEE Trans. Nucl. Sci."}
897 MACRO {ieeeps} {"IEEE Trans. Plasma Sci."}
898 MACRO {ijimw} {"Int. J. Infrared Millimeter Waves"}
899 MACRO {ip} {"Infrared Phys."}
900 MACRO {jap} {"J. Appl. Phys."}
901 MACRO {jcp} {"J. Comput. Phys."}
902 MACRO {jetp} {"Sov. Phys.-JETP"}
903 MACRO {jfe} {"J. Fusion Energy"}
904 MACRO {jfm} {"J. Fluid Mech."}
905 MACRO {jgr} {"J. Geophys. Res."}
906 MACRO {jmp} {"J. Math. Phys."}
907 MACRO {jne} {"J. Nucl. Energy"}
908 MACRO {jnm} {"J. Nucl. Mater."}
909 MACRO {josa} {"J. Opt. Soc. Am."}
910 MACRO {jpg} {"J. Phys.~G: Nucl. and Part. Phys."}
911 MACRO {jphys} {"J. Phys"}
912 MACRO {jpp} {"J. Plasma Phys."}
913 MACRO {jpsj} {"J. Phys. Soc. Jpn"}
914 MACRO {jvst} {"J. Vac. Sci. Technol."}
915 MACRO {modphyslettA} {"Mod. Phys. Lett. A"}
916 MACRO {nedf} {"Nucl. Eng. Design/Fusion"}
917 MACRO {nf} {"Nucl. Fusion"}
918 MACRO {nim} {"Nucl. Instrum. Methods"}
919 MACRO {np} {"Nucl. Phys."}
920 MACRO {npb} {"Nucl. Phys.~B"}
921 MACRO {npbps} {"Nucl. Phys. B (Proc. Suppl.)"}
922 MACRO {nt/f} {"Nucl. Tech./Fusion"}
923 MACRO {pf} {"Phys. Fluids"}
924 MACRO {pl} {"Phys. Lett."}
925 MACRO {plb} {"Phys. Lett.~B"}
926 MACRO {pnas} {"Proc. Nat. Acad. Sci. USA"}
927 MACRO {pp} {"Plasma Phys."}
928 MACRO {physrep} {"Phys. Rep."}
929 MACRO {physrev} {"Phys. Rev."}
930 MACRO {pr} {"Phys. Rev."}
931 MACRO {prd} {"Phys. Rev.~D"}
932 MACRO {prl} {"Phys. Rev. Lett."}
933 MACRO {procroysoc} {"Proc. Roy. Soc"}
934 MACRO {ps} {"Physica Scripta"}
935 MACRO {rmp} {"Rev. Mod. Phys."}
936 MACRO {rsi} {"Rev. Sci. Instrum."}
937 MACRO {sjnp} {"Sov. J. Nucl. Phys."}
938 MACRO {sjpp} {"Sov. J. Plasma Phys."}
939 MACRO {spd} {"Sov. Phys.-Dokl."}
940 MACRO {sptp} {"Sov. Phys.-Tech. Phys."}
941 MACRO {spu} {"Sov. Phys.-Usp."}
942 MACRO {zp} {"Z. Phys."}
943 MACRO {zpc} {"Z. Phys.~C"}
945 STRINGS { longest.label }
946 INTEGERS { number.label longest.label.width }
947 FUNCTION {initialize.longest.label}
948 { "" 'longest.label :=
950 #0 'longest.label.width :=
952 FUNCTION {longest.label.pass}
953 { number.label int.to.str$ 'label :=
954 number.label #1 + 'number.label :=
955 label width$ longest.label.width >
956 { label 'longest.label :=
957 label width$ 'longest.label.width :=
962 EXECUTE {initialize.longest.label}
963 ITERATE {longest.label.pass}
967 { preamble$ write$ newline$ }
969 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
972 EXECUTE {init.state.consts}
976 "\end{thebibliography}" write$ newline$