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.zvolume}
320 " Vol." volume tie.or.space.connect *
321 "volume and number" number either.or.check
325 FUNCTION {format.number.series}
328 { series field.or.null }
330 { "there's a number but no series in " cite$ * warning$ }
333 " No. " number tie.or.space.connect *
340 FUNCTION {format.edition}
343 { output.state mid.sentence =
344 { ", " edition "l" change.case$ * }
345 { ", " edition "t" change.case$ * }
351 INTEGERS { multiresult }
352 FUNCTION {multi.page.check}
361 swap$ duplicate$ "," =
364 { #1 'multiresult := }
365 { t #2 global.max$ substring$ 't := }
371 FUNCTION {format.pages}
374 { pages multi.page.check
375 { "pp." pages n.dashify tie.or.space.connect }
376 { "p." pages tie.or.space.connect }
381 FUNCTION {format.pages.a}
384 { "p." pages first.page tie.or.space.connect }
387 FUNCTION {format.vol.num.pages}
388 { volume field.or.null embolden
393 { pop$ format.pages.a }
394 { ", " * pages first.page * }
399 FUNCTION {format.chapter.pages}
404 { type "l" change.case$ }
406 chapter tie.or.space.connect
409 { ", " * format.pages * }
414 FUNCTION {format.pub.addr.date}
416 { "" "empty publisher in " cite$ * warning$ }
425 { "empty year in " cite$ * warning$ }
430 FUNCTION {format.book.entry}
433 format.number.series *
435 format.pub.addr.date *
437 FUNCTION {format.inbook.entry}
440 format.chapter.pages *
442 FUNCTION {format.in.ed.booktitle}
446 { "in " booktitle emphasize * }
447 { "in " booktitle emphasize * ", " * format.edited * }
452 FUNCTION {empty.misc.check}
453 { author empty$ title empty$ howpublished empty$
454 month empty$ year empty$ note empty$
456 { "all relevant fields are empty in " cite$ * warning$ }
460 FUNCTION {format.thesis.type}
464 type "t" change.case$
468 FUNCTION {format.inst.tr.num.date}
470 { "" "empty institution in " cite$ * warning$ }
476 { number tie.or.space.connect }
479 { "empty year in " cite$ * warning$ }
480 { ", " * year * " (unpublished)" * }
483 FUNCTION {format.article.crossref}
486 { "need key or journal for " cite$ * " to crossref " * crossref *
495 " \cite{" * crossref * "}" *
497 FUNCTION {format.crossref.editor}
498 { editor #1 "{vv~}{ll}" format.name$
499 editor num.names$ duplicate$
501 { pop$ " {\em et~al.}" * }
504 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
505 { " {\em et~al.}" * }
506 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
513 FUNCTION {format.book.crossref}
515 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
518 { "Volume" volume tie.or.space.connect
523 editor field.or.null author field.or.null =
527 { "need editor, key, or series for " cite$ * " to crossref " *
531 { "{\em " * series * "\/}" * }
537 { format.crossref.editor * }
539 " \cite{" * crossref * "}" *
541 FUNCTION {format.incoll.inproc.crossref}
543 editor field.or.null author field.or.null =
547 { "need editor, key, or booktitle for " cite$ * " to crossref " *
551 { "In {\em " booktitle * "\/}" * }
557 { "In " format.crossref.editor * }
559 " \cite{" * crossref * "}" *
564 format.authors "author" output.check
567 { journal field.or.null
572 { pop$ format.date paren }
573 { " " * format.date paren * }
579 { format.article.crossref output.nonnull
586 %format.SLACcitation output
593 { format.editors "author and editor" output.check }
594 { format.authors output.nonnull
596 { "author and editor" editor either.or.check }
603 { format.book.entry output }
605 format.book.crossref output.nonnull
611 %format.SLACcitation output
617 format.authors output
619 format.title "title" output.check
620 howpublished address new.block.checkb
627 %format.SLACcitation output
634 { format.editors "author and editor" output.check }
635 { format.authors output.nonnull
637 { "author and editor" editor either.or.check }
644 { format.inbook.entry output }
645 { format.chapter.pages "chapter and pages" output.check
647 format.book.crossref output.nonnull
653 %format.SLACcitation output
656 FUNCTION {incollection}
659 format.authors "author" output.check
661 format.title "title" output.check
664 %{ format.in.ed.booktitle "booktitle" output.check
665 { format.zvolume output
666 format.number.series output
667 format.chapter.pages output
669 publisher "publisher" output.check
671 format.edition output
672 format.date "year" output.check
674 { format.incoll.inproc.crossref output.nonnull
675 format.chapter.pages output
681 %format.SLACcitation output
684 FUNCTION {inproceedings}
687 format.authors "author" output.check
689 %format.title "title" output.check
692 { format.in.ed.booktitle "booktitle" output.check
693 format.bvolume output
694 format.number.series output
697 { organization publisher new.sentence.checkb
700 format.date "year" output.check
702 { address output.nonnull
703 format.date "year" output.check
710 { format.incoll.inproc.crossref output.nonnull
717 %format.SLACcitation output
720 FUNCTION {conference} { inproceedings }
725 { organization empty$
727 { organization output.nonnull
732 { format.authors output.nonnull }
735 format.btitle "title" output.check
737 { organization empty$
738 { address new.block.checka
744 { organization address new.block.checkb
749 format.edition output
756 FUNCTION {mastersthesis}
758 format.authors "author" output.check
760 format.title "title" output.check
762 "Master's thesis" format.thesis.type output.nonnull
763 school "school" output.check
765 format.date "year" output.check
774 format.authors output
775 title howpublished new.block.checkb
777 howpublished new.block.checka
788 format.authors "author" output.check
790 format.btitle "title" output.check
792 "PhD thesis" format.thesis.type output.nonnull
793 school "school" output.check
795 format.date "year" output.check
799 %format.SLACcitation output
802 FUNCTION {proceedings}
806 { organization output }
807 { format.editors output.nonnull }
810 format.btitle "title" output.check
811 format.bvolume output
812 format.number.series output
815 { publisher new.sentence.checka }
816 { organization publisher new.sentence.checkb
821 format.date "year" output.check
823 { address output.nonnull
824 format.date "year" output.check
828 { organization output }
836 %format.SLACcitation output
839 FUNCTION {techreport}
842 format.authors "author" output.check
844 format.inst.tr.num.date output.nonnull
850 FUNCTION {unpublished}
853 format.authors "author" output.check
855 format.title "title" output.check
857 note "note" output.check
859 %format.SLACcitation output
862 FUNCTION {default.type} { misc }
871 MACRO {sep} {"Sept."}
875 MACRO {acmcs} {"ACM Comput. Surv."}
876 MACRO {acta} {"Acta Inf."}
877 MACRO {cacm} {"Commun. ACM"}
878 MACRO {ibmjrd} {"IBM J. Res. Dev."}
879 MACRO {ibmsj} {"IBM Syst.~J."}
880 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
881 MACRO {ieeetc} {"IEEE Trans. Comput."}
883 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
884 MACRO {ipl} {"Inf. Process. Lett."}
885 MACRO {jacm} {"J.~ACM"}
886 MACRO {jcss} {"J.~Comput. Syst. Sci."}
887 MACRO {scp} {"Sci. Comput. Programming"}
888 MACRO {sicomp} {"SIAM J. Comput."}
889 MACRO {tocs} {"ACM Trans. Comput. Syst."}
890 MACRO {tods} {"ACM Trans. Database Syst."}
891 MACRO {tog} {"ACM Trans. Gr."}
892 MACRO {toms} {"ACM Trans. Math. Softw."}
893 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
894 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
895 MACRO {tcs} {"Theoretical Comput. Sci."}
896 MACRO {advp} {"Adv. Phys."}
897 MACRO {ajp} {"Am. J. Phys."}
898 MACRO {ao} {"Appl. Opt."}
899 MACRO {apj} {"Astrophys. J."}
900 MACRO {apl} {"Appl. Phys. Lett."}
901 MACRO {arnps} {"Ann. Rev. Nucl. Sci."}
902 MACRO {arns} {"Ann. Rev. Nucl. Part. Sci."}
903 MACRO {baps} {"Bull. Am. Phys. Soc."}
904 MACRO {cpc} {"Computer Phys. Comm."}
905 MACRO {cppcf} {"Comments Plasma Phys. Controlled Fusion"}
906 MACRO {fed} {"Fusion Eng. Design"}
907 MACRO {ft} {"Fusion Tech."}
908 MACRO {ieeens} {"IEEE Trans. Nucl. Sci."}
909 MACRO {ieeeps} {"IEEE Trans. Plasma Sci."}
910 MACRO {ijimw} {"Int. J. Infrared Millimeter Waves"}
911 MACRO {ip} {"Infrared Phys."}
912 MACRO {jap} {"J. Appl. Phys."}
913 MACRO {jcp} {"J. Comput. Phys."}
914 MACRO {jetp} {"Sov. Phys.-JETP"}
915 MACRO {jfe} {"J. Fusion Energy"}
916 MACRO {jfm} {"J. Fluid Mech."}
917 MACRO {jgr} {"J. Geophys. Res."}
918 MACRO {jmp} {"J. Math. Phys."}
919 MACRO {jne} {"J. Nucl. Energy"}
920 MACRO {jnm} {"J. Nucl. Mater."}
921 MACRO {josa} {"J. Opt. Soc. Am."}
922 MACRO {jpg} {"J. Phys.~G: Nucl. and Part. Phys."}
923 MACRO {jphys} {"J. Phys"}
924 MACRO {jpp} {"J. Plasma Phys."}
925 MACRO {jpsj} {"J. Phys. Soc. Jpn"}
926 MACRO {jvst} {"J. Vac. Sci. Technol."}
927 MACRO {modphyslettA} {"Mod. Phys. Lett. A"}
928 MACRO {nedf} {"Nucl. Eng. Design/Fusion"}
929 MACRO {nf} {"Nucl. Fusion"}
930 MACRO {nim} {"Nucl. Instrum. Methods"}
931 MACRO {np} {"Nucl. Phys."}
932 MACRO {npb} {"Nucl. Phys.~B"}
933 MACRO {npbps} {"Nucl. Phys. B (Proc. Suppl.)"}
934 MACRO {nt/f} {"Nucl. Tech./Fusion"}
935 MACRO {pf} {"Phys. Fluids"}
936 MACRO {pl} {"Phys. Lett."}
937 MACRO {plb} {"Phys. Lett.~B"}
938 MACRO {pnas} {"Proc. Nat. Acad. Sci. USA"}
939 MACRO {pp} {"Plasma Phys."}
940 MACRO {physrep} {"Phys. Rep."}
941 MACRO {physrev} {"Phys. Rev."}
942 MACRO {pr} {"Phys. Rev."}
943 MACRO {prd} {"Phys. Rev.~D"}
944 MACRO {prl} {"Phys. Rev. Lett."}
945 MACRO {procroysoc} {"Proc. Roy. Soc"}
946 MACRO {ps} {"Physica Scripta"}
947 MACRO {rmp} {"Rev. Mod. Phys."}
948 MACRO {rsi} {"Rev. Sci. Instrum."}
949 MACRO {sjnp} {"Sov. J. Nucl. Phys."}
950 MACRO {sjpp} {"Sov. J. Plasma Phys."}
951 MACRO {spd} {"Sov. Phys.-Dokl."}
952 MACRO {sptp} {"Sov. Phys.-Tech. Phys."}
953 MACRO {spu} {"Sov. Phys.-Usp."}
954 MACRO {zp} {"Z. Phys."}
955 MACRO {zpc} {"Z. Phys.~C"}
957 STRINGS { longest.label }
958 INTEGERS { number.label longest.label.width }
959 FUNCTION {initialize.longest.label}
960 { "" 'longest.label :=
962 #0 'longest.label.width :=
964 FUNCTION {longest.label.pass}
965 { number.label int.to.str$ 'label :=
966 number.label #1 + 'number.label :=
967 label width$ longest.label.width >
968 { label 'longest.label :=
969 label width$ 'longest.label.width :=
974 EXECUTE {initialize.longest.label}
975 ITERATE {longest.label.pass}
979 { preamble$ write$ newline$ }
981 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
984 EXECUTE {init.state.consts}
988 "\end{thebibliography}" write$ newline$