Dear Developers,

Version running: 1.1.5 fix 1

CITATIONS

I'm using lyx to write my PhD thesis, and I have set up a TeX preamble to 
allow citations in three different formats, rather than the single format 
allowed using the menu selection "insert -> citation reference".  These 
formats are similar in form to most journals in the geophysical fluids 
field.

The code is pretty messy, and I don't know if you're interested, because 
I've fumbled my way around a lot.  However, the bibtex style file and 
latex preamble to be placed in a layout file are attached and they work.  
It should be noted that much of this code has been constructed my various 
members of the geophysical fluids field in Australia, and I have simply 
changed parts of it to fit into lyx.


BIBTEX HEADING

Is it possible to change the heading of the bibtex reference from 
"References" to "Bibliography"?  Also, can this be made to be the 
equivelent level of a Chapter heading, so it shows up in the TOC.  I have 
tried changing the style of "bibliography" in my customised layout file, 
however this only changes attributes of the bibliography constructed 
within Lyx, not of the Bibtex references heading.


Regards,

Andrew Roberts  [EMAIL PROTECTED]   ph-03 6226 2939
Ph.D. Student   http://www.antcrc.utas.edu.au  Antarctic CRC
% BibTeX `ametsoc' bibliography style (28-Jan-92 version)
% John L. Wilkin ([EMAIL PROTECTED])
% Adapted from BibTeX `ramojgr' bibliography style (27-Mar-90 version)
% Adapted from BibTeX `apalike' bibliography style (24-Jan-88 version)
% Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
% Copyright (C) 1990, all rights reserved.
% Copying of this file is allowed, provided that if you make any changes at all
% you name it something other than `ametsoc.bst'.
% This restriction helps ensure that all copies are identical.

% This BiBTeX style produces a reference list in the style of American
% Meteorological Society publications, e.g. Journal of Physical 
% Oceanography.  Citations in the text are of the form, e.g. (Smith 1992), 
% (Smith et al. 1992a).  Note: (1) there is no comma preceeding the date, 
% (2) a letter "a", "b" etc follows citations having the same author, year,
% (3) there are no typeface changes, (4) the citation is enclosed in 
% parentheses.  In order to get this citation format correct this BiBTeX 
% style needs to be used with Wilkin's `oceancite' LaTeX style (oceancite.sty).
% Oceancite.sty is precisely the same citation style used in `ramojgr.sty' 
% but with () rather than [].  Separating the citation style from the 
% documentstyle means that this BiBTeX style can be used with any LaTeX
% documentstyle.  It also means that the BiBTeX styles ramjgr.bst and
% ametsoc.bst can be interchanged -- handy when AMS reject your paper and you
% decide to submit it to AGU without modification.  
% The reference list incorporates the AMS convention of placing a 
% horizontal rule when an author appears in the same place in the 
% preceeding reference.  Edit FUNCTION {format.names} if you wish to change 
% this feature. 

% BUGS: The punctuation in the reference list does not follow the correct
% typeface conventions.  The comma following a journal volume number 
% should be boldfaced, following the article title emapsized, etc.  To get
% this right will need some major restructuring and I just don't care
% about it at the moment.  If AMS ever accept camera ready copy and complain
% then maybe I'll do something about it. 

% USAGE: e.g.
%
% \documentstyle[12pt,oceancite]{article}
%  ...
% \begin{document}
%  ...
% \bibliographystyle{ametsoc}
%  ...
%
% \cite{Hardy89}           will give   (Hardy 1989)
% \cite{Laurel89,Hardy90)  will give   (Laurel 1989; Hardy 1990)
% \shortcite{Laurel90}     will give   (1990)  
%     ( shortcite is intended for in-line citations e.g.: 
%       " Hardy's (1990) calculation used ... " or
%       " as suggested by Hardy (1990) ... "
%

% HISTORY:
%   15-sep-86   (SK,OP) Original version, by Susan King and Oren Patashnik.
%   10-nov-86   (OP)    Truncated the sort.key$ string to the correct length
%                       in bib.sort.order to eliminate error message.
%   24-jan-88   (OP)    Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
%                       apalike now sorts by author, then year, then title;
%                       THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
%   27-mar-90   (RAMO)  Created JGR compatible style
%    2-jan-92   (JLW)   Hacked into an American Meteorological 
%                       Society style using hints from Peter McIntosh's 
%                       jpo.bst for Publisher (TM).
% This BibTeX style has support for short (year only) citations.  This
% is done by having the citations actually look like
%         \citename{name-info, }year

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

INTEGERS { output.state before.all mid.sentence after.sentence after.block }

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

STRINGS { s t prev.first.author prev.second.author prev.third.author}

FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { add.period$ " " * write$ }
          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 {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "{\em " swap$ * "\rm}" * }
  if$
}

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


%                                       apalike needs this function because
%                                       the year has special punctuation;
%                                       apalike ignores the month
FUNCTION {output.year.check}
{ year empty$
    { "empty year in " cite$ * warning$ }
    { write$
      ", " year * extra.label * ". " * 
      mid.sentence 'output.state :=
    }
  if$
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  label write$
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {fin.entry}
{ "." * add.period$
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
    'skip$
%   { after.block 'output.state := }  only one sentence/block in JGR style!
    { mid.sentence 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
%       { after.sentence 'output.state := } only one sentence in JGR style!
    { mid.sentence 'output.state := }
      if$
    }
  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$
}

INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { s nameptr "{f. }{vv~}{ll}{ jj}" format.name$ 't := }
        { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := }
      if$

% The following blocks check for the repetition of authors in the
% sorted reference list.  If one of the first three authors appears 
% in the same place in the author list as in the preceeding reference
% their name is replaced with a horizontal rule.  If you need this facility
% for more than three authors (!) just add another block and another STRING
% variable.  Commenting out these blocks will produce a reference list
% with all the authors names entered in full which is possibly more 
% appropriate when submitting a manuscript.
 
      nameptr #1 =
        { t prev.first.author =
          { "{\vrule height3pt depth-2pt width1cm}" 't := }
          'skip$
        if$
        }
        'skip$
      if$
      nameptr #1 =
        {t 'prev.first.author :=}
        'skip$
      if$

      nameptr #2 =
        { t prev.second.author =
          { "{\vrule height3pt depth-2pt width1cm}" 't := }
          'skip$
        if$
        }
        'skip$
      if$
      nameptr #2 =
        {t 'prev.second.author :=}
        'skip$
      if$

      nameptr #3 =
        { t prev.third.author =
          { "{\vrule height3pt depth-2pt width1cm}" 't := }
          'skip$
        if$
        }
        'skip$
      if$
      nameptr #3 =
        {t 'prev.third.author :=}
        'skip$
      if$

      nameptr #1 >
        { namesleft #1 >
            { ", " * t * }
            { numnames #2 >
                'skip$
                { "," * }
              if$
              t "others" =
                { " et~al." * }
                { " and " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {format.names.reverse.all}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := % first name first
      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.names.reverse1}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
       {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=} % first name first
       {s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=} % last name first
      if$
      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 {scapify}
{ duplicate$ empty$
    { pop$ "" }
    { "{\sc " swap$ * "}" * }
  if$
}

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

FUNCTION {format.key}                   % this function is just for apalike
{ empty$
    { key field.or.null }
    { "" }
  if$
}

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

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$ }
  if$
}

FUNCTION {format.note}
{ note empty$
    { "" }
    { " (" note * ")" * }
  if$
}

FUNCTION {format.publisher}
{ publisher empty$
    { "" }
%    { " " publisher * extra.label * " " * }
    { " " publisher }
  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 * extra.label emphasize * }
      if$
    }
  if$
}


FUNCTION {format.btitle}
{ title emphasize
}

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
      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 =
            { "number" }
            { "Number" }
          if$
          number tie.or.space.connect
          series empty$
            { "there's a number but no series in " cite$ * warning$ }
            { " in " * series * }
          if$
        }
      if$
    }
    { series }
  if$
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { edition "l" change.case$ " ed." * }
        { edition "t" change.case$ " ed." * }
      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
        { " " pages n.dashify tie.or.space.connect }
%       { pages tie.or.space.connect "pp." }
%       { " " pages * extra.label * "pp." * }
        { " " pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.vol.num.pages}
{ volume bold field.or.null
  number empty$
    'skip$
    { "(" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ", " * pages n.dashify * }
      if$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
        { "chapter" }
        { type "l" change.case$ }
      if$
      chapter tie.or.space.connect
      pages empty$
        { "pages missing from " cite$ * warning$}
        { ", " * format.pages * }
      if$
    }
  if$
}

FUNCTION {format.in.ed.booktitle}
{ " in " 
  booktitle empty$
    { "booktitle missing in " cite$ * warning$}
    { booktitle emphasize * }
  if$
  volume empty$
    'skip$
    { ", " * format.bvolume * }
  if$
  editor empty$
    { "editor missing in " cite$ * warning$}
    { ", edited by " editor format.names.reverse.all * *}
  if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and

  key empty$ not 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$
    { "Tech. Rep." }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
  emphasize
}

FUNCTION {format.article.crossref}
{ key empty$
    { journal empty$
        { "need key or journal for " cite$ * " to crossref " * crossref *
          warning$
          ""
        }
        { "in {\em " journal * "\/}" * }
      if$
    }
    { "in" }
  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 "{f. }{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$
              "" *
            }
            { "{\em " * 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 {\em " booktitle * "\/}" * }
          if$
        }
        { "in" }
      if$
    }
    { "in " format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}


FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  output.year.check
  before.all 'output.state :=
%  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      format.number.series output
      format.vol.num.pages output
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.note output
  fin.entry
}

FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
      editor format.key output
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  output.year.check
  before.all 'output.state :=
% new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
%      pages empty$
%        { "pages empty in " cite$ * warning$}
%        {format.pages output}
%      if$
      new.block
      format.number.series output
      new.sentence
%      format.publisher "publisher" output.check
      publisher "publisher" output.check
      address output
    }
    { new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  pages empty$
    { "pages empty in " cite$ * warning$}
    { format.pages output }
  if$
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check
  new.block
  howpublished output
  address output
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check
      editor format.key output
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  output.year.check
  before.all 'output.state :=
% new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
%      format.chapter.pages "chapter and pages" output.check
      new.block
      format.number.series output
      new.sentence
      publisher "publisher" output.check
      address output
      format.chapter.pages "chapter and pages" output.check
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check
  before.all 'output.state :=
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.number.series output
%      format.chapter.pages output
      new.sentence
%      format.publisher "publisher" output.check
      publisher "publisher" output.check
      address output
      format.edition output
      format.chapter.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.number.series output
%      format.pages output
      address output                                    % for apalike
      new.sentence                                      % there's no year
      organization output                               % here so things
      publisher output                                  % are simpler
      format.pages output
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  format.authors output
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.btitle "title" output.check
  organization address new.block.checkb
  organization output
  address output
  format.edition output
% format.date "year" output.check
  note output
  fin.entry
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% 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
  format.note output
  fin.entry
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title output
  new.block
  howpublished output
% format.date output
  format.note output
  fin.entry
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check 
  new.block
  "Ph.D. thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {proceedings}
{ output.bibitem
  format.editors output
  editor format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.btitle "title" output.check
  format.bvolume output
  format.number.series output
  address output                                % for apalike
  new.sentence                                  % we always output
  organization output                           % a nonempty organization
  publisher output                              % here
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check
  new.block
  format.tr.number output.nonnull
%  format.pages output.nonnull 
  institution "institution" output.check
  address output
% format.date "year" output.check
  format.pages output.nonnull 
  format.note output
  fin.entry
}

FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  author format.key output                              % special for
  output.year.check
  before.all 'output.state :=
% new.block
  format.title "title" output.check
% format.date "year" output.check
  format.note output
  fin.entry
}

FUNCTION {default.type} { misc }

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sept."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

MACRO {acmcs} {"ACM Computing Surveys"}

MACRO {acta} {"Acta Informatica"}

MACRO {cacm} {"Communications of the ACM"}

MACRO {ibmjrd} {"IBM Journal of Research and Development"}

MACRO {ibmsj} {"IBM Systems Journal"}

MACRO {ieeese} {"IEEE Transactions on Software Engineering"}

MACRO {ieeetc} {"IEEE Transactions on Computers"}

MACRO {ieeetcad}
 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}

MACRO {ipl} {"Information Processing Letters"}

MACRO {jacm} {"Journal of the ACM"}

MACRO {jcss} {"Journal of Computer and System Sciences"}

MACRO {scp} {"Science of Computer Programming"}

MACRO {sicomp} {"SIAM Journal on Computing"}

MACRO {tocs} {"ACM Transactions on Computer Systems"}

MACRO {tods} {"ACM Transactions on Database Systems"}

MACRO {tog} {"ACM Transactions on Graphics"}

MACRO {toms} {"ACM Transactions on Mathematical Software"}

MACRO {toois} {"ACM Transactions on Office Information Systems"}

MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}

MACRO {tcs} {"Theoretical Computer Science"}

MACRO {jgr} {"J. Geophys. Res."}

MACRO {jpo} {"J. Phys. Oceanogr."}

MACRO {annals} {"Ann. Glaciol."}

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$
}

%                       There are three apalike cases: one person (Jones),
%                       two (Jones and de~Bruijn), and more (Jones et~al.).
%                       This function is much like format.crossref.editors.
%
FUNCTION {format.lab.names}
{ 's :=
  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$
  #2 >
    { pop$ " et~al." * }
    { #2 <
        'skip$
        { s #2 "{f. }{vv }{ll}{ jj}" format.name$ "others" =
            { " et~al." * }
            { " and " * s #2 "{vv~}{ll}" format.name$ * }
          if$
        }
      if$
    }
  if$
}

FUNCTION {author.key.label}
{ author empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key                                    % apalike uses the whole key
      if$
    }
    { author format.lab.names } 
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            'key                                % apalike uses the whole key
          if$
        }
        { editor format.lab.names }
      if$
    }
    { author format.lab.names } 
  if$
}

FUNCTION {editor.key.label}
{ editor empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key                    % apalike uses the whole key, no organization
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.label}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.label
        { type$ "manual" =
            'author.key.label
            'author.key.label
          if$
        }
      if$
    }
  if$
  duplicate$
  "\protect\citename{" swap$ * "}" *
  year field.or.null purify$ *
  'label :=
  year field.or.null purify$ *

  sortify 'sort.label :=
}

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 {editor.sort}
{ editor empty$
    { key empty$
        { "to sort, need editor or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

%                       apalike uses two sorting passes; the first one sets the
%                       labels so that the `a's, `b's, etc. can be computed;
%                       the second pass puts the references in "correct" order.
%                       The presort function is for the first pass. It computes
%                       label, sort.label, and title, and then concatenates.
FUNCTION {presort}
{ calc.label
  label sortify
  "    "
  *
  type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.sort
        'author.sort
      if$
    }
  if$
  #1 entry.max$ substring$      % for
  'sort.label :=                % apalike
  sort.label                    % style
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

SORT            % by label, sort.label, title---for final label calculation

STRINGS { last.label next.extra }       % apalike labels are only for the text;

INTEGERS { last.extra.num }             % there are none in the bibliography

FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
{ #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'last.extra.num :=
}

FUNCTION {forward.pass}
{ last.label label =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      label 'last.label :=
    }
  if$
}

FUNCTION {reverse.pass}
{ next.extra "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  label extra.label * 'label :=
  extra.label 'next.extra :=
}

EXECUTE {initialize.extra.label.stuff}

ITERATE {forward.pass}

REVERSE {reverse.pass}

%                               Now that the label is right we sort for real,
%                               on sort.label then year then title.  This is
%                               for the second sorting pass.
FUNCTION {bib.sort.order}
{ sort.label
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {bib.sort.order}

SORT            % by sort.label, year, title---giving final bibliography order

FUNCTION {begin.bib}
{ preamble$ empty$                              % no \etalchar in apalike
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{}" write$ newline$           % no labels in apalike
}

EXECUTE {begin.bib}

EXECUTE {init.state.consts}

ITERATE {call.type$}

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

EXECUTE {end.bib}
###################################################################################
# This preamble takes care of the bibliography with three citations possible:
# \cite (a normal citation: "Bloggs [1998]")
# \xcite (citation(s) of the form "[Bloggs, 1998]" or "[Bloggs, 1998; Johnston, 
2000]")
# \egcite (citation(s) of the form "[e.g. Bloggs, 1998]") 


Preamble
%% Bibliography %%

% Allow short (name-less) citations, when used in
% conjunction with a bibliography style that creates labels like
%       \citename{<names>, }<year>
\let\@internalcite\cite

\def\cite{\def\citename##1{{##1} [}\def\@cite##1##2{{##1\if@tempswa, 
##2\fi}]}\@internalcite}

\def\xcite{\def\citename##1{{##1}, } \def\@cite##1##2{[{##1\if@tempswa, 
##2\fi}]}\@internalcite}

\def\egcite{\def\citename##1{{##1}, } \def\@cite##1##2{[e.g. {##1\if@tempswa, 
##2\fi}]}\@internalcite}

\def\@biblabel#1{\def\citename##1{##1}[#1]\hfill}

\def\thebibliography#1{\section*{References\markboth
 {REFERENCES}{REFERENCES}}\list
 %% default is no labels, for those not using \cite or BibTeX
 {}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}\@bibsetup}
 \def\newblock{\hskip .11em plus .33em minus -.07em}
 \sloppy
 \sfcode`\.=1000\relax}

% Don't put the citation in an hbox.
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{\@citesep}\@ifundefined
       {b@\@citeb}{{\bf ?}\@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}

% Set length of hanging indentation for bibliography entries
%
\newlength{\bibhang}
\setlength{\bibhang}{0em}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: \itemsep and \parsep HAS BEEN CHANGED TO 5pt FROM 0pt IN ORIGINAL
% (Modified by Neil Holbrook on 8 APRIL 1994.)
% undent first line of a reference by using negative \itemindent.
% set \itemsep and \parsep to 5pt so there is a 5pt space between items.
\def\@bibsetup{\itemindent=-\leftmargin \itemsep=2pt \parsep=2pt \small}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Use a semicolon instead of a comma between multiple citations.
\def\@citesep{; }

\def\@cite#1#2{[{#1\if@tempswa , #2\fi}]}

% square brackets instead of the round parens that most nat. sci.
% publications use.
\def\@cite#1#2{[{#1\if@tempswa , #2\fi}]}
% parentheses
\def\@cite#1#2{({#1\if@tempswa , #2\fi})}
% Definition of \@cite moved into definition of \cite, \shortcite and \xcite
% to allow citation form Hardy (1990) using \xcite

% Labels should not be printed in References
\def\@biblabel#1{}
%\def\@biblabel#1{\hfill}
EndPreamble
#####################################################################################


Reply via email to