%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                `semfor.bst'
%
% BibTeX automatic references for Semigroup Forum with sorting by first name.
%
% BibTeX bibliography style file `semfor.bst' to be used with `semfor.sty'.
%
% BibTeX version 0.99a, LaTeX version 2.09 or later.
%
% Created by Steven Duplij from `unsrt.bst' <14 Oct 95>
% Improvements and questions are welcome: duplij@physik.uni-kl.de
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                INSTRUCTION
%
% AUTHOR: please do the following steps:
%
% 1. Create your  database `yourlit.bib' in the standard BibTeX format:
%
%@ARTICLE{bru/tor,
%            author = {H. H. Brungs and G. T\"{o}rner},
%            title = {A structure theorem for ${R}$-invariant holoids},
%            journal = {Semigroup Forum} ,
%            volume = {39},
%            pages = {39--50},
%            year = 1989  ,
%}
%@ARTICLE{fri/qiu/she,
%            author = {D. Friedan and Z. Qiu and S. Shenker},
%            title = {Superconformal invariance in two dimensions and the
%            tricritical {I}sing model},
%            journal =  {Physics Letters} ,
%            volume = {151B},
%            number =  1 ,
%            pages = {37--43},
%            year = 1985  ,
%}
%@BOOK{bai/lov,
%            author = {D. Bailin and A. Love},
%            title = {Supersymmetric Gauge Field Theory and String Theory},
%            publisher = {Institute of Physics},
%            address = {Bristol},
%            year = 1994  ,
%}
%@INCOLLECTION{dam/gro,
%            author = {G. D'Ambra and M. Gromov},
%            title = {Lectures on transformation groups: geometry and
%            dynamics},
%            year = 1991  ,
%            pages = {19--111},
%            booktitle = {Surveys in Differential Geometry},
%            address = {Bethlehem},
%            publisher = {Lehigh University}
%}
%@INPROCEEDINGS{boy,
%            author = {C. P. Boyer},
%            title = {On the structure of supermanifolds},
%            booktitle = {Symposium on Algebraic Topology in Honor
%            of Jos\'{e} Adem},
%            publisher = {Amer. Math. Soc.},
%            address = {Providence},
%            editor = {S. Gitler},
%            year = 1982  ,
%            pages = {53--59},
%}
%
% 2. Include in `yourfile.tex' prepared for Semigroup Forum
%    the BibTeX commands (pay attention on %):
%
% \documentstyle[12pt,semfor]{article}
% %\input yourfile.bbl
% \bibdata{yourlit.bib}
% \bibstyle{semfor}
% \begin{document}
% % YOUR ARTICLE %
% \bibliography{yourlit}
% \bibliographystyle{semfor}
% %\references
% \end{document}
%
% 3. Run LaTeX and obtain `yourfile.aux'.
%
% 4. Run `bibtex.exe' on `yourfile.aux' and obtain `yourfile.bbl'.
%
% 5. Change % in `yourfile.tex' as follows
%
% \documentstyle[12pt,semfor]{article}
% \input yourfile.bbl
% %\bibdata{yourlit.bib}
% %\bibstyle{semfor}
% \begin{document}
% % YOUR ARTICLE %
% %\bibliography{yourlit}
% %\bibliographystyle{semfor}
% \references
% \end{document}
%
% 6. Run LaTeX and obtain `yourfile.dvi' with automatic created and sorted
%    by first name references in Semigroup Forum style.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                           END OF INSTRUCTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ENTRY
  { address
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    journal
    key
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    volume
    year
  }
  { multi.ref }
  { label }

INTEGERS { output.state before.all mid.sentence after.sentence after.block }
INTEGERS { mid.block }
STRINGS { previous.author previous.journal }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #4 'mid.block :=
}

STRINGS { s t }

FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { " " * write$ }
    { output.state after.block =
	{ write$
      "" write$
	}
	{ output.state before.all =
	    'write$
	    { output.state mid.block =
           { ", " * write$  "" write$ }
           { " " * write$ }
	     if$
	    }
	  if$
	}
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

FUNCTION {output.bibitem}
{ multi.ref
  { ""
    before.all 'output.state :=
  }
  { newline$
    "\nextref{" write$
    cite$ write$
    "}" write$
    newline$
    ""
    before.all 'output.state :=
  }
 if$
}

FUNCTION {fin.entry}
{ multi.ref #1 >
  { "; " * write$
    newline$
    "  " write$
    before.all 'output.state :=
  }
  {write$
  newline$
  }
 if$
 multi.ref #1 =
 { "" "" }
 { author missing$
      { "" }
      { author }
    if$
    journal missing$
      { "" }
      { journal }
    if$
 }
 if$
 'previous.journal :=
 'previous.author :=
 }

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
	'skip$
	{ after.sentence 'output.state := }
      if$
    }
  if$
}

FUNCTION {btw.block}
{ output.state before.all =
    'skip$
    { mid.block 'output.state := }
  if$
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "{\it " swap$ * "}" * }
  if$
}

FUNCTION {quotation}
{ duplicate$ empty$
    { pop$ "" }
    { "``" swap$ * "''" * }
  if$
}

FUNCTION {emphbold}
{ duplicate$ empty$
    { pop$ "" }
    { "{\bf " swap$ * "}" * }
  if$
}

FUNCTION {bracket}
{ "(" swap$ ")" * *
}

FUNCTION {comma}
{ ", " *
}

FUNCTION {emp}
{ " " *
}

FUNCTION {lbrac}
{ "{" *
}

FUNCTION {rbrac}
{ "}" *
}
INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
    nameptr #1 =
     { "{vv~}{ll,}{, jj}{ ff}" }
     { "{ ff~}{vv~}{ll}{, jj}" }
    if$
    format.name$ 't :=
      nameptr #1 >
	{ namesleft #1 >
	    { ", " * t * }
        { numnames #1 >
		{ "," * }
		'skip$
	      if$
	      t "others" =
		{ " et~al." * }
		{ " and " * t * }
	      if$
	    }
	  if$
	}
	't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names }
  if$
}


FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
       { ", eds." * }
       { ", ed." * }
      if$
    }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$
      duplicate$ #-1 #1 substring$
      duplicate$ duplicate$ "?" =
      swap$ "!" = or
      swap$ "." = or
        'skip$
        { "" * }
      if$
      emphasize
    }
  if$
}

FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
	{ t #1 #2 substring$ "--" = not
	    { "--" *
	      t #2 global.max$ substring$ 't :=
	    }
	    {   { t #1 #1 substring$ "-" = }
		{ "-" *
		  t #2 global.max$ substring$ 't :=
		}
	      while$
	    }
	  if$
	}
	{ t #1 #1 substring$ *
	  t #2 global.max$ substring$ 't :=
	}
      if$
    }
  while$
}

FUNCTION {format.date}
{ year empty$
    { month empty$
	{ "" }
	{ "there's a month but no year in " cite$ * warning$
	  month
	}
      if$
    }
    { month empty$
	'year
	{ month " " * year * }
      if$
    }
  if$
}

FUNCTION {format.btitle}
{ title quotation
}

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { "Vol." volume tie.or.space.connect
      comma
      series empty$
	'skip$
	{ " of " * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}

FUNCTION {format.number.series}
{ volume empty$
    { number empty$
	{ series field.or.null }
	{ output.state mid.sentence =
	    { "n." }
	    { "Number" }
	  if$
	  number tie.or.space.connect
	  series empty$
	    { "there's a number but no series in " cite$ * warning$ }
	    { " in " * series * }
	  if$
	}
      if$
    }
    { "" }
  if$
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
	{ edition "l" change.case$ " edition" * }
	{ edition "t" change.case$ " edition" * }
      if$
    }
  if$
}

INTEGERS { multiresult }

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
	{ #1 'multiresult := }
	{ t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
        { "pp." pages n.dashify tie.or.space.connect }
        { "p." pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.vol.num.pages}
{ "" volume * duplicate$ empty$
  { "Empty volume in " cite$ * warning$ pop$
  }
  { emphbold
    pages empty$
      { "Empty pages in " cite$ * warning$
      }
      { " " * year bracket * ", " *
        pages duplicate$ multi.page.check
          'n.dashify
          'skip$
        if$
        *
      }
    if$
  }
if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
	{ "Chap." }
	{ type "l" change.case$ }
      if$
      chapter tie.or.space.connect
      pages empty$
	'skip$
	{ ", " * format.pages * }
      if$
    }
  if$
}

FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
    { "in " booktitle quotation * }
    { "in " booktitle quotation * ",  " * format.editors * }
      if$
    }
  if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" change.case$
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { "Technical Report" }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
}

FUNCTION {format.note}
{ note duplicate$ empty$
    { pop$ "" }
    { bracket }
  if$
}

FUNCTION {write.publ.addr.year}
{ publisher empty$
  { address empty$
    'new.block
    { "(" address * output.nonnull }
  if$
  }
  { "(" publisher * output.nonnull
    address output
  }
 if$
 format.date
 address empty$ publisher empty$ and
   'skip$
   { ")" * }
 if$
 output
}


FUNCTION {format.article.crossref}
{ key empty$
    { journal empty$
	{ "need key or journal for " cite$ * " to crossref " * crossref *
	  warning$
	  ""
	}
    { "In {\it " journal * "\/}" * }
      if$
    }
    { "In " key * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.crossref.editor}
{ editor #1 "{vv~}{ll}" format.name$
  editor num.names$ duplicate$
  #2 >
    { pop$ " et~al." * }
    { #2 <
	'skip$
	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
	    { " et~al." * }
	    { " and " * editor #2 "{vv~}{ll}" format.name$ * }
	  if$
	}
      if$
    }
  if$
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      "In "
    }
    { "Volume" volume tie.or.space.connect
      " of " *
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
	{ series empty$
	    { "need editor, key, or series for " cite$ * " to crossref " *
	      crossref * warning$
	      "" *
	    }
        { "{\it " * series * "\/}" * }
	  if$
	}
	{ key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{ editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
	{ booktitle empty$
	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
	      crossref * warning$
	      ""
	    }
        { "In {\it " booktitle * "\/}" * }
	  if$
	}
	{ "In " key * }
      if$
    }
    { "In " format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {article}
{ output.bibitem
  lbrac
  format.authors "author" output.check
  rbrac
  lbrac
  format.title "title" output.check
  format.title empty$
    'skip$
    { new.block }
  if$
  crossref missing$
    { rbrac
      lbrac
      journal "journal" output.check
      emp
      format.vol.num.pages output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.note output
  rbrac
  fin.entry
}

FUNCTION {book}
{ output.bibitem
  lbrac
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
	{ "author and editor" editor either.or.check }
	'skip$
      if$
    }
  if$
  rbrac
  lbrac
  format.btitle "title" output.check
  rbrac
  lbrac
  crossref missing$
    { format.bvolume output
      format.number.series output
      format.edition output
      publisher "publisher" output.check
      btw.block
      address output
    }
    { btw.block
      format.book.crossref output.nonnull
    }
  if$
  comma
  format.date "year" output.check
  new.block
  format.note output
  rbrac
  fin.entry
}


FUNCTION {booklet}
{ output.bibitem
  format.authors output
  new.block
  format.title "title" output.check
  howpublished address new.block.checkb
  howpublished output
  address output
  format.date output
  new.sentence
  format.note output
  fin.entry
}

FUNCTION {inbook}
{ output.bibitem
  lbrac
  author empty$
    { rbrac
      lbrac
      format.btitle "title" output.check
      rbrac
      lbrac
      format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
       { "author and editor" editor either.or.check }
       'skip$
      if$
      btw.block
      format.btitle "title" output.check
    }
  if$
  new.block
  crossref missing$
    { format.bvolume output
      format.edition output
      format.number.series output
      btw.block
      publisher "publisher" output.check
      address output
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.date "year" output.check
  btw.block
  format.chapter.pages "chapter and pages" output.check
  new.block
  format.note output
  rbrac
  fin.entry
}

FUNCTION {incollection}
{ output.bibitem
  lbrac
  format.authors "author" output.check
  rbrac
  lbrac
  format.title "title" output.check
  rbrac
  lbrac
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      btw.block
      publisher "publisher" output.check
      address output
      btw.block
      format.edition output
      format.date "year" output.check
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  btw.block
  format.chapter.pages output
  new.block
  format.note output
  rbrac
  fin.entry
}



FUNCTION {inproceedings}
{ output.bibitem
  lbrac
  format.authors "author" output.check
  rbrac
  lbrac
  format.title "title" output.check
  rbrac
  lbrac
   crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      btw.block
      address empty$
       { organization publisher new.sentence.checkb
         organization output
         publisher output
         btw.block
         format.date "year" output.check
       }
       { organization output
         publisher output
         btw.block
         address output.nonnull
         btw.block
         format.date "year" output.check
       }
      if$
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  btw.block
  format.pages output
  new.block
  format.note output
  rbrac
  fin.entry
}



FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
	'skip$
	{ organization output.nonnull
	  address output
	}
      if$
    }
    { format.authors output.nonnull }
  if$
  new.block
  format.btitle "title" output.check
  author empty$
    { organization empty$
	{ address new.block.checka
	  address output
	}
	'skip$
      if$
    }
    { organization output
      address output
    }
  if$
  format.edition output
  format.date output
  new.sentence
  format.note output
  fin.entry
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  "Master's thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  new.sentence
  format.note output
  fin.entry
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  title howpublished new.block.checkb
  format.title output
  howpublished new.block.checka
  howpublished output
  format.date output
  new.sentence
  format.note output
  fin.entry
  empty.misc.check
}

FUNCTION {mref}
{ title missing$
    { output.bibitem pop$ }
    { "Unknown 1st symbol in " cite$ * " ,the reference ignored" * warning$
    }
    if$
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  btw.block
  format.btitle "title" output.check
  btw.block
  "PhD thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  new.block
  format.note output
  fin.entry
}

FUNCTION {proceedings}
{ output.bibitem
  lbrac
  format.editors output.nonnull
  rbrac
  lbrac
  format.btitle "title" output.check
  rbrac
  lbrac
  format.bvolume output
  format.number.series output
  address empty$
    { editor empty$
        { publisher new.sentence.checka }
        { organization publisher new.sentence.checkb
          organization output
        }
      if$
      publisher output
    }
    { publisher comma output
      address output.nonnull
    }
  if$
  comma
  format.date "year" output.check
  new.block
  format.note output
  rbrac
  fin.entry
}



FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.date "year" output.check
  new.sentence
  format.note output
  fin.entry
}

FUNCTION {unpublished}
{ output.bibitem
  lbrac
  format.authors "author" output.check
  rbrac
  lbrac
  format.title output
  rbrac
  lbrac
  note "note" output.check
  comma
  format.date output
  rbrac
  fin.entry
}

FUNCTION {default.type} { misc }

MACRO {am} {"Adv. Math."}
MACRO {amh} {"Acta Math. Hung."}
MACRO {app} {"Acta Phys. Pol. "}
MACRO {ap} {"Ann. Phys."}
MACRO {bams} {"Bull. Amer. Math. Soc."}
MACRO {baums} {"Bull. Austr. Math. Soc."}
MACRO {cjm} {"Can. J. Math."}
MACRO {cmj} {"Czech. Math. J."}
MACRO {cmp} {"Commun. Math. Phys."}
MACRO {ca} {"Commun. Algebra"}
MACRO {cqg} {"Class. Q. Grav."}
MACRO {dm} {"Demonstr. Math."}
MACRO {dmj} {"Duke Math. J."}
MACRO {fan} {"Func. Anal. Appl."}
MACRO {gmj} {"Glasgow Math. J."}
MACRO {grg} {"Gen. Rel. Grav."}
MACRO {ijpam} {"Indian J. Pure Appl. Math."}
MACRO {ijtp} {"Int. J. Theor. Phys."}
MACRO {ijmp} {"Int. J. Mod. Phys."}
MACRO {ja} {"J.~Algebra"}
MACRO {jaums} {"J.~Austr. Math. Soc."}
MACRO {jgp} {"J.~Geom. Phys."}
MACRO {jlms} {"J.~London Math. Soc."}
MACRO {jmp} {"J.~Math. Phys."}
MACRO {jp} {"J.~Phys."}
MACRO {jpm} {"J.~Pure Math."}
MACRO {jpaa} {"J.~Pure Appl. Algebra"}
MACRO {kjm} {"Kobe J. Math."}
MACRO {lmp} {"Lett. Math. Phys."}
MACRO {lnp} {"Lect. Notes Phys."}
MACRO {lnm} {"Lect. Notes Math."}
MACRO {mn} {"Math. Notes"}
MACRO {mpcpc} {"Math. Proc. Cambridge Phil. Soc."}
MACRO {mpl} {"Mod. Phys. Lett."}
MACRO {ms} {"Math. Sbornik"}
MACRO {np} {"Nucl. Phys."}
MACRO {pams} {"Proc. Amer. Math. Soc."}
MACRO {pems} {"Proc. Edinburgh Math. Soc."}
MACRO {ph} {"Physica"}
MACRO {pjm} {"Pacific J. Math."}
MACRO {pl} {"Phys. Lett."}
MACRO {pma} {"Pure Math. Appl."}
MACRO {pnp} {"Probl. Nucl. Phys. Cosm. Rays"}
MACRO {pr} {"Phys. Rev."}
MACRO {prl} {"Phys. Rev. Lett."}
MACRO {prse} {"Proc. Roy. Soc. Edinburgh"}
MACRO {prsl} {"Proc. Roy. Soc. London"}
MACRO {prs} {"Phys. Repts"}
MACRO {ptp} {"Progr. Theor. Phys."}
MACRO {qm} {"Quaestiones Math."}
MACRO {rmp} {"Rev. Math. Phys."}
MACRO {rms} {"Russian Math. Surv."}
MACRO {sf} {"Semigroup Forum"}
MACRO {smj} {"Siberian Math. J."}
MACRO {smd} {"Soviet Math. Dokl."}
MACRO {tams} {"Trans. Amer. Math. Soc."}
MACRO {ta} {"Topology Appl."}
MACRO {tmp} {"Theor. Math. Phys."}
MACRO {tmj} {"Tohoku Math. J."}
MACRO {umj} {"Ukrainian Math. J."}
MACRO {yp} {"Sov. J. Nucl. Phys."}
MACRO {zp} {"Z.~Phys."}

READ

FUNCTION {sortify}
{ purify$
  "l" change.case$
}

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
	{ "   " * }
	'skip$
      if$
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr numnames = t "others" = and
	{ "et al" * }
	{ t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

FUNCTION {author.sort}
{ author empty$
    { key empty$
	{ "to sort, need author or key in " cite$ * warning$
	  ""
	}
	{ key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
	{ key empty$
	    { "to sort, need author, editor, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
	{ key empty$
	    { "to sort, need author, organization, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
	{ key empty$
	    { "to sort, need editor, organization, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

FUNCTION {presort}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
	'editor.organization.sort
	{ type$ "manual" =
	    'author.organization.sort
	    'author.sort
	  if$
	}
      if$
    }
  if$
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

SORT


STRINGS { longest.label }

INTEGERS { number.label longest.label.width num.multi.ref }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
  #0 'num.multi.ref :=
}

FUNCTION {longest.label.pass}
{ num.multi.ref duplicate$ 'multi.ref :=
  { #-1 num.multi.ref + 'num.multi.ref :=
    "" 'label :=
  }
  { number.label int.to.str$ 'label :=
    number.label #1 + 'number.label :=
    type$ "mref" =
    { cite$ #1 text.prefix$ ":" =
      { cite$ #2 #1 substring$ chr.to.int$ #-48 + 'num.multi.ref :=
      }
      'skip$
     if$
    }
    'skip$
   if$
   label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
   if$
  }
 if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\renewcommand{\entries}{"  write$ newline$
}

EXECUTE {begin.bib}

EXECUTE {init.state.consts}

ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
  " } " write$ newline$
}

EXECUTE {end.bib}
