elsarticle/elsarticle-harv.bst
changeset 3 550f81b2f81c
equal deleted inserted replaced
-1:000000000000 0:4114b0a3e565
       
     1 %% 
       
     2 %% Copyright 2007, 2008, 2009 Elsevier Ltd
       
     3 %% 
       
     4 %% This file is part of the 'Elsarticle Bundle'.
       
     5 %% ---------------------------------------------
       
     6 %% 
       
     7 %% It may be distributed under the conditions of the LaTeX Project Public
       
     8 %% License, either version 1.2 of this license or (at your option) any
       
     9 %% later version.  The latest version of this license is in
       
    10 %%    http://www.latex-project.org/lppl.txt
       
    11 %% and version 1.2 or later is part of all distributions of LaTeX
       
    12 %% version 1999/12/01 or later.
       
    13 %% 
       
    14 %% The list of all files belonging to the 'Elsarticle Bundle' is
       
    15 %% given in the file `manifest.txt'.
       
    16 %% 
       
    17 
       
    18  %%-------------------------------------------------------------------
       
    19  %% This bibliography style file is intended for texts in ENGLISH
       
    20  %% This is an author-year citation style bibliography. As such, it is
       
    21  %% non-standard LaTeX, and requires a special package file
       
    22  %% to function properly.
       
    23  %% Such a package is    natbib.sty   by Patrick W. Daly
       
    24  %% The form of the \bibitem entries is
       
    25  %%   \bibitem[Jones et al.(1990)]{key}...
       
    26  %%   \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}...
       
    27  %% The essential feature is that the label (the part in brackets) consists
       
    28  %% of the author names, as they should appear in the citation, with the year
       
    29  %% in parentheses following. There must be no space before the opening
       
    30  %% parenthesis!
       
    31  %% With natbib v5.3, a full list of authors may also follow the year.
       
    32  %% In natbib.sty, it is possible to define the type of enclosures that is
       
    33  %% really wanted (brackets or parentheses), but in either case, there must
       
    34  %% be parentheses in the label.
       
    35  %% The \cite command functions as follows:
       
    36  %%   \citet{key} ==>>                Jones et al. (1990)
       
    37  %%   \citet*{key} ==>>               Jones, Baker, and Smith (1990)
       
    38  %%   \citep{key} ==>>                (Jones et al., 1990)
       
    39  %%   \citep*{key} ==>>               (Jones, Baker, and Smith, 1990)
       
    40  %%   \citep[chap. 2]{key} ==>>       (Jones et al., 1990, chap. 2)
       
    41  %%   \citep[e.g.][]{key} ==>>        (e.g. Jones et al., 1990)
       
    42  %%   \citep[e.g.][p. 32]{key} ==>>   (e.g. Jones et al., p. 32)
       
    43  %%   \citeauthor{key} ==>>           Jones et al.
       
    44  %%   \citeauthor*{key} ==>>          Jones, Baker, and Smith
       
    45  %%   \citeyear{key} ==>>             1990
       
    46  %%---------------------------------------------------------------------
       
    47 
       
    48 ENTRY
       
    49   { address
       
    50     author
       
    51     booktitle
       
    52     chapter
       
    53     edition
       
    54     editor
       
    55     howpublished
       
    56     institution
       
    57     journal
       
    58     key
       
    59     month
       
    60     note
       
    61     number
       
    62     organization
       
    63     pages
       
    64     publisher
       
    65     school
       
    66     series
       
    67     title
       
    68     type
       
    69     url
       
    70     volume
       
    71     year
       
    72   }
       
    73   {}
       
    74   { label extra.label sort.label short.list }
       
    75 
       
    76 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
       
    77 
       
    78 FUNCTION {init.state.consts}
       
    79 { #0 'before.all :=
       
    80   #1 'mid.sentence :=
       
    81   #2 'after.sentence :=
       
    82   #3 'after.block :=
       
    83 }
       
    84 
       
    85 STRINGS { s t }
       
    86 
       
    87 FUNCTION {output.nonnull}
       
    88 { 's :=
       
    89   output.state mid.sentence =
       
    90     { ", " * write$ }
       
    91     { output.state after.block =
       
    92         { add.period$ write$
       
    93           newline$
       
    94           "\newblock " write$
       
    95         }
       
    96         { output.state before.all =
       
    97             'write$
       
    98             { add.period$ " " * write$ }
       
    99           if$
       
   100         }
       
   101       if$
       
   102       mid.sentence 'output.state :=
       
   103     }
       
   104   if$
       
   105   s
       
   106 }
       
   107 
       
   108 FUNCTION {output}
       
   109 { duplicate$ empty$
       
   110     'pop$
       
   111     'output.nonnull
       
   112   if$
       
   113 }
       
   114 
       
   115 FUNCTION {output.check}
       
   116 { 't :=
       
   117   duplicate$ empty$
       
   118     { pop$ "empty " t * " in " * cite$ * warning$ }
       
   119     'output.nonnull
       
   120   if$
       
   121 }
       
   122 
       
   123 FUNCTION {fin.entry}
       
   124 { add.period$
       
   125   write$
       
   126   newline$
       
   127 }
       
   128 
       
   129 FUNCTION {new.block}
       
   130 { output.state before.all =
       
   131     'skip$
       
   132     { after.block 'output.state := }
       
   133   if$
       
   134 }
       
   135 
       
   136 FUNCTION {new.sentence}
       
   137 { output.state after.block =
       
   138     'skip$
       
   139     { output.state before.all =
       
   140         'skip$
       
   141         { after.sentence 'output.state := }
       
   142       if$
       
   143     }
       
   144   if$
       
   145 }
       
   146 
       
   147 %%SP 2003/07/25
       
   148 %% No longer used
       
   149 FUNCTION {add.blank}
       
   150 {  " " * before.all 'output.state :=
       
   151 }
       
   152 
       
   153 FUNCTION {date.block}
       
   154 {
       
   155   new.sentence
       
   156 }
       
   157 
       
   158 FUNCTION {not}
       
   159 {   { #0 }
       
   160     { #1 }
       
   161   if$
       
   162 }
       
   163 
       
   164 FUNCTION {and}
       
   165 {   'skip$
       
   166     { pop$ #0 }
       
   167   if$
       
   168 }
       
   169 
       
   170 FUNCTION {or}
       
   171 {   { pop$ #1 }
       
   172     'skip$
       
   173   if$
       
   174 }
       
   175 
       
   176 FUNCTION {new.block.checkb}
       
   177 { empty$
       
   178   swap$ empty$
       
   179   and
       
   180     'skip$
       
   181     'new.block
       
   182   if$
       
   183 }
       
   184 
       
   185 FUNCTION {field.or.null}
       
   186 { duplicate$ empty$
       
   187     { pop$ "" }
       
   188     'skip$
       
   189   if$
       
   190 }
       
   191 
       
   192 FUNCTION {emphasize}
       
   193 { skip$ }
       
   194 
       
   195 FUNCTION {capitalize}
       
   196 { "u" change.case$ "t" change.case$ }
       
   197 
       
   198 FUNCTION {space.word}
       
   199 { " " swap$ * " " * }
       
   200 
       
   201  %% Here are the language-specific definitions for explicit words.
       
   202  %% Each function has a name bbl.xxx where xxx is the English word.
       
   203  %% The language selected here is ENGLISH
       
   204 FUNCTION {bbl.and}
       
   205 { "and"}
       
   206 
       
   207 FUNCTION {bbl.etal}
       
   208 { "et~al." }
       
   209 
       
   210 FUNCTION {bbl.editors}
       
   211 { "Eds." }
       
   212 
       
   213 FUNCTION {bbl.editor}
       
   214 { "Ed." }
       
   215 
       
   216 FUNCTION {bbl.edby}
       
   217 { "edited by" }
       
   218 
       
   219 FUNCTION {bbl.edition}
       
   220 { "Edition" }
       
   221 
       
   222 FUNCTION {bbl.volume}
       
   223 { "Vol." }
       
   224 
       
   225 FUNCTION {bbl.of}
       
   226 { "of" }
       
   227 
       
   228 FUNCTION {bbl.number}
       
   229 { "no." }
       
   230 
       
   231 FUNCTION {bbl.nr}
       
   232 { "no." }
       
   233 
       
   234 FUNCTION {bbl.in}
       
   235 { "in" }
       
   236 
       
   237 FUNCTION {bbl.pages}
       
   238 { "pp." }
       
   239 
       
   240 FUNCTION {bbl.page}
       
   241 { "p." }
       
   242 
       
   243 FUNCTION {bbl.chapter}
       
   244 { "Ch." }
       
   245 
       
   246 FUNCTION {bbl.techrep}
       
   247 { "Tech. Rep." }
       
   248 
       
   249 FUNCTION {bbl.mthesis}
       
   250 { "Master's thesis" }
       
   251 
       
   252 FUNCTION {bbl.phdthesis}
       
   253 { "Ph.D. thesis" }
       
   254 
       
   255 FUNCTION {bbl.first}
       
   256 { "1st" }
       
   257 
       
   258 FUNCTION {bbl.second}
       
   259 { "2nd" }
       
   260 
       
   261 FUNCTION {bbl.third}
       
   262 { "3rd" }
       
   263 
       
   264 FUNCTION {bbl.fourth}
       
   265 { "4th" }
       
   266 
       
   267 FUNCTION {bbl.fifth}
       
   268 { "5th" }
       
   269 
       
   270 FUNCTION {bbl.st}
       
   271 { "st" }
       
   272 
       
   273 FUNCTION {bbl.nd}
       
   274 { "nd" }
       
   275 
       
   276 FUNCTION {bbl.rd}
       
   277 { "rd" }
       
   278 
       
   279 FUNCTION {bbl.th}
       
   280 { "th" }
       
   281 
       
   282 MACRO {jan} {"Jan."}
       
   283 
       
   284 MACRO {feb} {"Feb."}
       
   285 
       
   286 MACRO {mar} {"Mar."}
       
   287 
       
   288 MACRO {apr} {"Apr."}
       
   289 
       
   290 MACRO {may} {"May"}
       
   291 
       
   292 MACRO {jun} {"Jun."}
       
   293 
       
   294 MACRO {jul} {"Jul."}
       
   295 
       
   296 MACRO {aug} {"Aug."}
       
   297 
       
   298 MACRO {sep} {"Sep."}
       
   299 
       
   300 MACRO {oct} {"Oct."}
       
   301 
       
   302 MACRO {nov} {"Nov."}
       
   303 
       
   304 MACRO {dec} {"Dec."}
       
   305 
       
   306 FUNCTION {eng.ord}
       
   307 { duplicate$ "1" swap$ *
       
   308   #-2 #1 substring$ "1" =
       
   309      { bbl.th * }
       
   310      { duplicate$ #-1 #1 substring$
       
   311        duplicate$ "1" =
       
   312          { pop$ bbl.st * }
       
   313          { duplicate$ "2" =
       
   314              { pop$ bbl.nd * }
       
   315              { "3" =
       
   316                  { bbl.rd * }
       
   317                  { bbl.th * }
       
   318                if$
       
   319              }
       
   320            if$
       
   321           }
       
   322        if$
       
   323      }
       
   324    if$
       
   325 }
       
   326 
       
   327 MACRO {acmcs} {"ACM Comput. Surv."}
       
   328 
       
   329 MACRO {acta} {"Acta Inf."}
       
   330 
       
   331 MACRO {cacm} {"Commun. ACM"}
       
   332 
       
   333 MACRO {ibmjrd} {"IBM J. Res. Dev."}
       
   334 
       
   335 MACRO {ibmsj} {"IBM Syst.~J."}
       
   336 
       
   337 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
       
   338 
       
   339 MACRO {ieeetc} {"IEEE Trans. Comput."}
       
   340 
       
   341 MACRO {ieeetcad}
       
   342  {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
       
   343 
       
   344 MACRO {ipl} {"Inf. Process. Lett."}
       
   345 
       
   346 MACRO {jacm} {"J.~ACM"}
       
   347 
       
   348 MACRO {jcss} {"J.~Comput. Syst. Sci."}
       
   349 
       
   350 MACRO {scp} {"Sci. Comput. Programming"}
       
   351 
       
   352 MACRO {sicomp} {"SIAM J. Comput."}
       
   353 
       
   354 MACRO {tocs} {"ACM Trans. Comput. Syst."}
       
   355 
       
   356 MACRO {tods} {"ACM Trans. Database Syst."}
       
   357 
       
   358 MACRO {tog} {"ACM Trans. Gr."}
       
   359 
       
   360 MACRO {toms} {"ACM Trans. Math. Softw."}
       
   361 
       
   362 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
       
   363 
       
   364 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
       
   365 
       
   366 MACRO {tcs} {"Theoretical Comput. Sci."}
       
   367 
       
   368 FUNCTION {write.url}
       
   369 { url empty$
       
   370     { skip$ }
       
   371     { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
       
   372   if$
       
   373 }
       
   374 
       
   375 INTEGERS { nameptr namesleft numnames }
       
   376 
       
   377 FUNCTION {format.names}
       
   378 { 's :=
       
   379   #1 'nameptr :=
       
   380   s num.names$ 'numnames :=
       
   381   numnames 'namesleft :=
       
   382     { namesleft #0 > }
       
   383     { s nameptr
       
   384       "{vv~}{ll}{, jj}{, f.}" format.name$
       
   385     't :=
       
   386       nameptr #1 >
       
   387         {
       
   388           namesleft #1 >
       
   389             { ", " * t * }
       
   390             {
       
   391               "," *
       
   392               s nameptr "{ll}" format.name$ duplicate$ "others" =
       
   393                 { 't := }
       
   394                 { pop$ }
       
   395               if$
       
   396               t "others" =
       
   397                 {
       
   398                   " " * bbl.etal *
       
   399                 }
       
   400                 { " " * t * }
       
   401               if$
       
   402             }
       
   403           if$
       
   404         }
       
   405         't
       
   406       if$
       
   407       nameptr #1 + 'nameptr :=
       
   408       namesleft #1 - 'namesleft :=
       
   409     }
       
   410   while$
       
   411 }
       
   412 FUNCTION {format.names.ed}
       
   413 { format.names }
       
   414 FUNCTION {format.key}
       
   415 { empty$
       
   416     { key field.or.null }
       
   417     { "" }
       
   418   if$
       
   419 }
       
   420 
       
   421 FUNCTION {format.authors}
       
   422 { author empty$
       
   423     { "" }
       
   424     { author format.names }
       
   425   if$
       
   426 }
       
   427 
       
   428 FUNCTION {format.editors}
       
   429 { editor empty$
       
   430     { "" }
       
   431     { editor format.names
       
   432       editor num.names$ #1 >
       
   433         { " (" * bbl.editors * ")" * }
       
   434         { " (" * bbl.editor * ")" * }
       
   435       if$
       
   436     }
       
   437   if$
       
   438 }
       
   439 
       
   440 FUNCTION {format.in.editors}
       
   441 { editor empty$
       
   442     { "" }
       
   443     { editor format.names.ed
       
   444       editor num.names$ #1 >
       
   445         { " (" * bbl.editors * ")" * }
       
   446         { " (" * bbl.editor * ")" * }
       
   447       if$
       
   448     }
       
   449   if$
       
   450 }
       
   451 
       
   452 FUNCTION {format.note}
       
   453 {
       
   454  note empty$
       
   455     { "" }
       
   456     { note #1 #1 substring$
       
   457       duplicate$ "{" =
       
   458         'skip$
       
   459         { output.state mid.sentence =
       
   460           { "l" }
       
   461           { "u" }
       
   462         if$
       
   463         change.case$
       
   464         }
       
   465       if$
       
   466       note #2 global.max$ substring$ *
       
   467     }
       
   468   if$
       
   469 }
       
   470 
       
   471 FUNCTION {format.title}
       
   472 { title empty$
       
   473     { "" }
       
   474     { title "t" change.case$
       
   475     }
       
   476   if$
       
   477 }
       
   478 
       
   479 FUNCTION {format.full.names}
       
   480 {'s :=
       
   481   #1 'nameptr :=
       
   482   s num.names$ 'numnames :=
       
   483   numnames 'namesleft :=
       
   484     { namesleft #0 > }
       
   485     { s nameptr
       
   486       "{vv~}{ll}" format.name$
       
   487       't :=
       
   488       nameptr #1 >
       
   489         {
       
   490           namesleft #1 >
       
   491             { ", " * t * }
       
   492             {
       
   493               numnames #2 >
       
   494                 { "," * }
       
   495                 'skip$
       
   496               if$
       
   497               s nameptr "{ll}" format.name$ duplicate$ "others" =
       
   498                 { 't := }
       
   499                 { pop$ }
       
   500               if$
       
   501               t "others" =
       
   502                 {
       
   503                   " " * bbl.etal *
       
   504                 }
       
   505                 { bbl.and
       
   506                   space.word * t *
       
   507                 }
       
   508               if$
       
   509             }
       
   510           if$
       
   511         }
       
   512         't
       
   513       if$
       
   514       nameptr #1 + 'nameptr :=
       
   515       namesleft #1 - 'namesleft :=
       
   516     }
       
   517   while$
       
   518 }
       
   519 
       
   520 FUNCTION {author.editor.key.full}
       
   521 { author empty$
       
   522     { editor empty$
       
   523         { key empty$
       
   524             { cite$ #1 #3 substring$ }
       
   525             'key
       
   526           if$
       
   527         }
       
   528         { editor format.full.names }
       
   529       if$
       
   530     }
       
   531     { author format.full.names }
       
   532   if$
       
   533 }
       
   534 
       
   535 FUNCTION {author.key.full}
       
   536 { author empty$
       
   537     { key empty$
       
   538          { cite$ #1 #3 substring$ }
       
   539           'key
       
   540       if$
       
   541     }
       
   542     { author format.full.names }
       
   543   if$
       
   544 }
       
   545 
       
   546 FUNCTION {editor.key.full}
       
   547 { editor empty$
       
   548     { key empty$
       
   549          { cite$ #1 #3 substring$ }
       
   550           'key
       
   551       if$
       
   552     }
       
   553     { editor format.full.names }
       
   554   if$
       
   555 }
       
   556 
       
   557 FUNCTION {make.full.names}
       
   558 { type$ "book" =
       
   559   type$ "inbook" =
       
   560   or
       
   561     'author.editor.key.full
       
   562     { type$ "proceedings" =
       
   563         'editor.key.full
       
   564         'author.key.full
       
   565       if$
       
   566     }
       
   567   if$
       
   568 }
       
   569 
       
   570 FUNCTION {output.bibitem}
       
   571 { newline$
       
   572   "\bibitem[{" write$
       
   573   label write$
       
   574   ")" make.full.names duplicate$ short.list =
       
   575      { pop$ }
       
   576      { * }
       
   577    if$
       
   578   "}]{" * write$
       
   579   cite$ write$
       
   580   "}" write$
       
   581   newline$
       
   582   ""
       
   583   before.all 'output.state :=
       
   584 }
       
   585 
       
   586 FUNCTION {n.dashify}
       
   587 {
       
   588   't :=
       
   589   ""
       
   590     { t empty$ not }
       
   591     { t #1 #1 substring$ "-" =
       
   592         { t #1 #2 substring$ "--" = not
       
   593             { "--" *
       
   594               t #2 global.max$ substring$ 't :=
       
   595             }
       
   596             {   { t #1 #1 substring$ "-" = }
       
   597                 { "-" *
       
   598                   t #2 global.max$ substring$ 't :=
       
   599                 }
       
   600               while$
       
   601             }
       
   602           if$
       
   603         }
       
   604         { t #1 #1 substring$ *
       
   605           t #2 global.max$ substring$ 't :=
       
   606         }
       
   607       if$
       
   608     }
       
   609   while$
       
   610 }
       
   611 
       
   612 FUNCTION {word.in}
       
   613 { bbl.in capitalize
       
   614   ":" *
       
   615   " " * }
       
   616 
       
   617 FUNCTION {format.date}
       
   618 { year duplicate$ empty$
       
   619     { "empty year in " cite$ * "; set to ????" * warning$
       
   620        pop$ "????" }
       
   621     'skip$
       
   622   if$
       
   623   month empty$
       
   624     'skip$
       
   625     { month
       
   626       " " * swap$ *
       
   627     }
       
   628   if$
       
   629   extra.label *
       
   630   before.all 'output.state :=
       
   631   ", " swap$ *
       
   632 }
       
   633 
       
   634 FUNCTION {format.btitle}
       
   635 { title
       
   636 }
       
   637 
       
   638 FUNCTION {tie.or.space.connect}
       
   639 { duplicate$ text.length$ #3 <
       
   640     { "~" }
       
   641     { " " }
       
   642   if$
       
   643   swap$ * *
       
   644 }
       
   645 
       
   646 FUNCTION {either.or.check}
       
   647 { empty$
       
   648     'pop$
       
   649     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
       
   650   if$
       
   651 }
       
   652 
       
   653 FUNCTION {format.bvolume}
       
   654 { volume empty$
       
   655     { "" }
       
   656     { bbl.volume volume tie.or.space.connect
       
   657       series empty$
       
   658         'skip$
       
   659         { bbl.of space.word * series emphasize * }
       
   660       if$
       
   661       "volume and number" number either.or.check
       
   662     }
       
   663   if$
       
   664 }
       
   665 
       
   666 FUNCTION {format.number.series}
       
   667 { volume empty$
       
   668     { number empty$
       
   669         { series field.or.null }
       
   670         { output.state mid.sentence =
       
   671             { bbl.number }
       
   672             { bbl.number capitalize }
       
   673           if$
       
   674           number tie.or.space.connect
       
   675           series empty$
       
   676             { "there's a number but no series in " cite$ * warning$ }
       
   677             { bbl.in space.word * series * }
       
   678           if$
       
   679         }
       
   680       if$
       
   681     }
       
   682     { "" }
       
   683   if$
       
   684 }
       
   685 
       
   686 FUNCTION {is.num}
       
   687 { chr.to.int$
       
   688   duplicate$ "0" chr.to.int$ < not
       
   689   swap$ "9" chr.to.int$ > not and
       
   690 }
       
   691 
       
   692 FUNCTION {extract.num}
       
   693 { duplicate$ 't :=
       
   694   "" 's :=
       
   695   { t empty$ not }
       
   696   { t #1 #1 substring$
       
   697     t #2 global.max$ substring$ 't :=
       
   698     duplicate$ is.num
       
   699       { s swap$ * 's := }
       
   700       { pop$ "" 't := }
       
   701     if$
       
   702   }
       
   703   while$
       
   704   s empty$
       
   705     'skip$
       
   706     { pop$ s }
       
   707   if$
       
   708 }
       
   709 
       
   710 FUNCTION {convert.edition}
       
   711 { edition extract.num "l" change.case$ 's :=
       
   712   s "first" = s "1" = or
       
   713     { bbl.first 't := }
       
   714     { s "second" = s "2" = or
       
   715         { bbl.second 't := }
       
   716         { s "third" = s "3" = or
       
   717             { bbl.third 't := }
       
   718             { s "fourth" = s "4" = or
       
   719                 { bbl.fourth 't := }
       
   720                 { s "fifth" = s "5" = or
       
   721                     { bbl.fifth 't := }
       
   722                     { s #1 #1 substring$ is.num
       
   723                         { s eng.ord 't := }
       
   724                         { edition 't := }
       
   725                       if$
       
   726                     }
       
   727                   if$
       
   728                 }
       
   729               if$
       
   730             }
       
   731           if$
       
   732         }
       
   733       if$
       
   734     }
       
   735   if$
       
   736   t
       
   737 }
       
   738 
       
   739 FUNCTION {format.edition}
       
   740 { edition empty$
       
   741     { "" }
       
   742     { output.state mid.sentence =
       
   743         { convert.edition "l" change.case$ " " * bbl.edition * }
       
   744         { convert.edition "t" change.case$ " " * bbl.edition * }
       
   745       if$
       
   746     }
       
   747   if$
       
   748 }
       
   749 
       
   750 INTEGERS { multiresult }
       
   751 
       
   752 FUNCTION {multi.page.check}
       
   753 { 't :=
       
   754   #0 'multiresult :=
       
   755     { multiresult not
       
   756       t empty$ not
       
   757       and
       
   758     }
       
   759     { t #1 #1 substring$
       
   760       duplicate$ "-" =
       
   761       swap$ duplicate$ "," =
       
   762       swap$ "+" =
       
   763       or or
       
   764         { #1 'multiresult := }
       
   765         { t #2 global.max$ substring$ 't := }
       
   766       if$
       
   767     }
       
   768   while$
       
   769   multiresult
       
   770 }
       
   771 
       
   772 FUNCTION {format.pages}
       
   773 { pages empty$
       
   774     { "" }
       
   775     { pages multi.page.check
       
   776         { bbl.pages pages n.dashify tie.or.space.connect }
       
   777         { bbl.page pages tie.or.space.connect }
       
   778       if$
       
   779     }
       
   780   if$
       
   781 }
       
   782 
       
   783 FUNCTION {format.journal.pages}
       
   784 { pages empty$
       
   785     'skip$
       
   786     { duplicate$ empty$
       
   787         { pop$ format.pages }
       
   788         {
       
   789           ", " *
       
   790           pages n.dashify *
       
   791         }
       
   792       if$
       
   793     }
       
   794   if$
       
   795 }
       
   796 
       
   797 %%SP 2001/01/23
       
   798 %% Only used in articles
       
   799 FUNCTION {format.vol.num.pages}
       
   800 {
       
   801 %%SP 2001/01/23
       
   802 %% Add the leading space only if there is a volume
       
   803   %% volume field.or.null
       
   804   " "
       
   805   volume empty$
       
   806     { pop$ "" }
       
   807     { volume * }
       
   808   if$
       
   809   number empty$
       
   810     'skip$
       
   811     {
       
   812       "~(" number * ")" * *
       
   813       volume empty$
       
   814         { "there's a number but no volume in " cite$ * warning$ }
       
   815         'skip$
       
   816       if$
       
   817     }
       
   818   if$
       
   819 }
       
   820 
       
   821 FUNCTION {format.chapter.pages}
       
   822 { chapter empty$
       
   823     { "" }
       
   824     { type empty$
       
   825         { bbl.chapter }
       
   826         { type "l" change.case$ }
       
   827       if$
       
   828       chapter tie.or.space.connect
       
   829     }
       
   830   if$
       
   831 }
       
   832 
       
   833 FUNCTION {format.in.ed.booktitle}
       
   834 { booktitle empty$
       
   835     { "" }
       
   836     { editor empty$
       
   837         { word.in booktitle * }
       
   838         { word.in format.in.editors * ", " *
       
   839           booktitle * }
       
   840       if$
       
   841     }
       
   842   if$
       
   843 }
       
   844 
       
   845 FUNCTION {format.thesis.type}
       
   846 { type empty$
       
   847     'skip$
       
   848     { pop$
       
   849       type "t" change.case$
       
   850     }
       
   851   if$
       
   852 }
       
   853 
       
   854 FUNCTION {format.tr.number}
       
   855 { type empty$
       
   856     { bbl.techrep }
       
   857     'type
       
   858   if$
       
   859   number empty$
       
   860     { "t" change.case$ }
       
   861     { number tie.or.space.connect }
       
   862   if$
       
   863 }
       
   864 
       
   865 FUNCTION {format.article.crossref}
       
   866 {
       
   867   word.in
       
   868   " \cite{" * crossref * "}" *
       
   869 }
       
   870 
       
   871 FUNCTION {format.book.crossref}
       
   872 { volume empty$
       
   873     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
       
   874       word.in
       
   875     }
       
   876     { bbl.volume capitalize
       
   877       volume tie.or.space.connect
       
   878       bbl.of space.word *
       
   879     }
       
   880   if$
       
   881   " \cite{" * crossref * "}" *
       
   882 }
       
   883 
       
   884 FUNCTION {format.incoll.inproc.crossref}
       
   885 {
       
   886   word.in
       
   887   " \cite{" * crossref * "}" *
       
   888 }
       
   889 
       
   890 FUNCTION {format.org.or.pub}
       
   891 { 't :=
       
   892   ""
       
   893   address empty$ t empty$ and
       
   894     'skip$
       
   895     {
       
   896       t empty$
       
   897         { address empty$
       
   898           'skip$
       
   899           { address * }
       
   900           if$
       
   901         }
       
   902         { t *
       
   903           address empty$
       
   904             'skip$
       
   905             { ", " * address * }
       
   906           if$
       
   907         }
       
   908       if$
       
   909     }
       
   910   if$
       
   911 }
       
   912 
       
   913 FUNCTION {format.publisher.address}
       
   914 { publisher empty$
       
   915     { "empty publisher in " cite$ * warning$
       
   916       ""
       
   917     }
       
   918     { publisher }
       
   919   if$
       
   920   format.org.or.pub
       
   921 }
       
   922 
       
   923 FUNCTION {format.organization.address}
       
   924 { organization empty$
       
   925     { "" }
       
   926     { organization }
       
   927   if$
       
   928   format.org.or.pub
       
   929 }
       
   930 
       
   931 FUNCTION {article}
       
   932 { output.bibitem
       
   933   format.authors "author" output.check
       
   934   author format.key output
       
   935   format.date "year" output.check
       
   936   date.block
       
   937   format.title "title" output.check
       
   938   new.sentence
       
   939   crossref missing$
       
   940     { journal
       
   941       "journal" output.check
       
   942 %%SP 2001/01/23
       
   943 %% Add the space in format.vol.num.pages
       
   944       %% add.blank
       
   945   before.all 'output.state :=
       
   946       format.vol.num.pages output
       
   947     }
       
   948     { format.article.crossref output.nonnull
       
   949       format.pages output
       
   950     }
       
   951   if$
       
   952   format.journal.pages
       
   953   format.note output
       
   954   fin.entry
       
   955   write.url
       
   956 }
       
   957 
       
   958 FUNCTION {book}
       
   959 { output.bibitem
       
   960   author empty$
       
   961     { format.editors "author and editor" output.check
       
   962       editor format.key output
       
   963     }
       
   964     { format.authors output.nonnull
       
   965       crossref missing$
       
   966         { "author and editor" editor either.or.check }
       
   967         'skip$
       
   968       if$
       
   969     }
       
   970   if$
       
   971   format.date "year" output.check
       
   972   date.block
       
   973   format.btitle "title" output.check
       
   974   crossref missing$
       
   975     { format.edition output
       
   976       new.sentence
       
   977   format.bvolume output
       
   978       format.number.series output
       
   979       new.sentence
       
   980       format.publisher.address output
       
   981     }
       
   982     {
       
   983   new.sentence
       
   984       format.book.crossref output.nonnull
       
   985     }
       
   986   if$
       
   987   format.note output
       
   988   fin.entry
       
   989   write.url
       
   990 }
       
   991 
       
   992 FUNCTION {booklet}
       
   993 { output.bibitem
       
   994   format.authors output
       
   995   author format.key output
       
   996   format.date "year" output.check
       
   997   date.block
       
   998   format.title "title" output.check
       
   999   new.sentence
       
  1000   howpublished output
       
  1001   address output
       
  1002   format.note output
       
  1003   fin.entry
       
  1004   write.url
       
  1005 }
       
  1006 
       
  1007 FUNCTION {inbook}
       
  1008 { output.bibitem
       
  1009   author empty$
       
  1010     { format.editors "author and editor" output.check
       
  1011       editor format.key output
       
  1012     }
       
  1013     { format.authors output.nonnull
       
  1014       crossref missing$
       
  1015         { "author and editor" editor either.or.check }
       
  1016         'skip$
       
  1017       if$
       
  1018     }
       
  1019   if$
       
  1020   format.date "year" output.check
       
  1021   date.block
       
  1022   format.btitle "title" output.check
       
  1023   crossref missing$
       
  1024     {
       
  1025       format.edition output
       
  1026       new.sentence
       
  1027       format.bvolume output
       
  1028       format.number.series output
       
  1029       new.sentence
       
  1030       format.publisher.address output
       
  1031       format.chapter.pages "chapter and pages" output.check
       
  1032     }
       
  1033     {
       
  1034       format.chapter.pages "chapter and pages" output.check
       
  1035   new.sentence
       
  1036       format.book.crossref output.nonnull
       
  1037     }
       
  1038   if$
       
  1039   format.pages "pages" output.check
       
  1040   format.note output
       
  1041   fin.entry
       
  1042   write.url
       
  1043 }
       
  1044 
       
  1045 FUNCTION {incollection}
       
  1046 { output.bibitem
       
  1047   format.authors "author" output.check
       
  1048   author format.key output
       
  1049   format.date "year" output.check
       
  1050   date.block
       
  1051   format.title "title" output.check
       
  1052   new.sentence
       
  1053   crossref missing$
       
  1054     { format.in.ed.booktitle "booktitle" output.check
       
  1055       format.edition output
       
  1056       new.sentence
       
  1057       format.bvolume output
       
  1058       format.number.series output
       
  1059       new.sentence
       
  1060       format.publisher.address output
       
  1061       format.chapter.pages output
       
  1062     }
       
  1063     { format.incoll.inproc.crossref output.nonnull
       
  1064       format.chapter.pages output
       
  1065     }
       
  1066   if$
       
  1067   format.pages "pages" output.check
       
  1068   format.note output
       
  1069   fin.entry
       
  1070   write.url
       
  1071 }
       
  1072 
       
  1073 FUNCTION {inproceedings}
       
  1074 { output.bibitem
       
  1075   format.authors "author" output.check
       
  1076   author format.key output
       
  1077   format.date "year" output.check
       
  1078   date.block
       
  1079   format.title "title" output.check
       
  1080   new.sentence
       
  1081   crossref missing$
       
  1082     { format.in.ed.booktitle "booktitle" output.check
       
  1083       format.edition output
       
  1084       new.sentence
       
  1085       format.bvolume output
       
  1086       format.number.series output
       
  1087       new.sentence
       
  1088       publisher empty$
       
  1089         { format.organization.address output }
       
  1090         { organization output
       
  1091           format.publisher.address output
       
  1092         }
       
  1093       if$
       
  1094 %%SP 2001/01/23
       
  1095 %%      format.pages output
       
  1096     }
       
  1097     { format.incoll.inproc.crossref output.nonnull
       
  1098 %%SP 2001/01/23
       
  1099 %%      format.pages output
       
  1100     }
       
  1101   if$
       
  1102 %%SP 2001/01/23
       
  1103   format.pages "pages" output.check
       
  1104   format.note output
       
  1105   fin.entry
       
  1106   write.url
       
  1107 }
       
  1108 
       
  1109 FUNCTION {conference} { inproceedings }
       
  1110 
       
  1111 FUNCTION {manual}
       
  1112 { output.bibitem
       
  1113   format.authors output
       
  1114   author format.key output
       
  1115   format.date "year" output.check
       
  1116   date.block
       
  1117   format.btitle "title" output.check
       
  1118   new.sentence
       
  1119   organization output
       
  1120   address output
       
  1121   format.edition output
       
  1122   format.note output
       
  1123   fin.entry
       
  1124   write.url
       
  1125 }
       
  1126 
       
  1127 FUNCTION {mastersthesis}
       
  1128 { output.bibitem
       
  1129   format.authors "author" output.check
       
  1130   author format.key output
       
  1131   format.date "year" output.check
       
  1132   date.block
       
  1133   format.title "title" output.check
       
  1134   new.sentence
       
  1135   bbl.mthesis format.thesis.type output.nonnull
       
  1136   school "school" output.check
       
  1137   address output
       
  1138   format.note output
       
  1139   fin.entry
       
  1140   write.url
       
  1141 }
       
  1142 
       
  1143 FUNCTION {misc}
       
  1144 { output.bibitem
       
  1145   format.authors output
       
  1146   author format.key output
       
  1147   format.date "year" output.check
       
  1148   date.block
       
  1149   format.title output
       
  1150   new.sentence
       
  1151   howpublished output
       
  1152   format.note output
       
  1153   fin.entry
       
  1154   write.url
       
  1155 }
       
  1156 
       
  1157 FUNCTION {phdthesis}
       
  1158 { output.bibitem
       
  1159   format.authors "author" output.check
       
  1160   author format.key output
       
  1161   format.date "year" output.check
       
  1162   date.block
       
  1163   format.title "title" output.check
       
  1164   new.sentence
       
  1165   bbl.phdthesis format.thesis.type output.nonnull
       
  1166   school "school" output.check
       
  1167   address output
       
  1168   format.note output
       
  1169   fin.entry
       
  1170   write.url
       
  1171 }
       
  1172 
       
  1173 FUNCTION {proceedings}
       
  1174 { output.bibitem
       
  1175   format.editors output
       
  1176   editor format.key output
       
  1177   format.date "year" output.check
       
  1178   date.block
       
  1179   format.btitle "title" output.check
       
  1180   new.sentence
       
  1181   format.bvolume output
       
  1182   format.number.series output
       
  1183   new.sentence
       
  1184   publisher empty$
       
  1185     { format.organization.address output }
       
  1186     { organization output
       
  1187       format.publisher.address output
       
  1188     }
       
  1189   if$
       
  1190   format.note output
       
  1191   fin.entry
       
  1192   write.url
       
  1193 }
       
  1194 
       
  1195 FUNCTION {techreport}
       
  1196 { output.bibitem
       
  1197   format.authors "author" output.check
       
  1198   author format.key output
       
  1199   format.date "year" output.check
       
  1200   date.block
       
  1201   format.title "title" output.check
       
  1202   new.sentence
       
  1203   format.tr.number output.nonnull
       
  1204   institution "institution" output.check
       
  1205   address output
       
  1206   format.note output
       
  1207   fin.entry
       
  1208   write.url
       
  1209 }
       
  1210 
       
  1211 FUNCTION {unpublished}
       
  1212 { output.bibitem
       
  1213   format.authors "author" output.check
       
  1214   author format.key output
       
  1215   format.date "year" output.check
       
  1216   date.block
       
  1217   format.title "title" output.check
       
  1218   format.note "note" output.check
       
  1219   fin.entry
       
  1220   write.url
       
  1221 }
       
  1222 
       
  1223 FUNCTION {default.type} { misc }
       
  1224 
       
  1225 READ
       
  1226 
       
  1227 FUNCTION {sortify}
       
  1228 { purify$
       
  1229   "l" change.case$
       
  1230 }
       
  1231 
       
  1232 INTEGERS { len }
       
  1233 
       
  1234 FUNCTION {chop.word}
       
  1235 { 's :=
       
  1236   'len :=
       
  1237   s #1 len substring$ =
       
  1238     { s len #1 + global.max$ substring$ }
       
  1239     's
       
  1240   if$
       
  1241 }
       
  1242 
       
  1243 FUNCTION {format.lab.names}
       
  1244 { 's :=
       
  1245   s #1 "{vv~}{ll}" format.name$
       
  1246   s num.names$ duplicate$
       
  1247   #2 >
       
  1248     { pop$
       
  1249       " " * bbl.etal *
       
  1250     }
       
  1251     { #2 <
       
  1252         'skip$
       
  1253         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
       
  1254             {
       
  1255               " " * bbl.etal *
       
  1256             }
       
  1257             { bbl.and space.word * s #2 "{vv~}{ll}" format.name$
       
  1258               * }
       
  1259           if$
       
  1260         }
       
  1261       if$
       
  1262     }
       
  1263   if$
       
  1264 }
       
  1265 
       
  1266 FUNCTION {author.key.label}
       
  1267 { author empty$
       
  1268     { key empty$
       
  1269         { cite$ #1 #3 substring$ }
       
  1270         'key
       
  1271       if$
       
  1272     }
       
  1273     { author format.lab.names }
       
  1274   if$
       
  1275 }
       
  1276 
       
  1277 FUNCTION {author.editor.key.label}
       
  1278 { author empty$
       
  1279     { editor empty$
       
  1280         { key empty$
       
  1281             { cite$ #1 #3 substring$ }
       
  1282             'key
       
  1283           if$
       
  1284         }
       
  1285         { editor format.lab.names }
       
  1286       if$
       
  1287     }
       
  1288     { author format.lab.names }
       
  1289   if$
       
  1290 }
       
  1291 
       
  1292 FUNCTION {editor.key.label}
       
  1293 { editor empty$
       
  1294     { key empty$
       
  1295         { cite$ #1 #3 substring$ }
       
  1296         'key
       
  1297       if$
       
  1298     }
       
  1299     { editor format.lab.names }
       
  1300   if$
       
  1301 }
       
  1302 
       
  1303 FUNCTION {calc.short.authors}
       
  1304 { type$ "book" =
       
  1305   type$ "inbook" =
       
  1306   or
       
  1307     'author.editor.key.label
       
  1308     { type$ "proceedings" =
       
  1309         'editor.key.label
       
  1310         'author.key.label
       
  1311       if$
       
  1312     }
       
  1313   if$
       
  1314   'short.list :=
       
  1315 }
       
  1316 
       
  1317 FUNCTION {calc.label}
       
  1318 { calc.short.authors
       
  1319   short.list
       
  1320   "("
       
  1321   *
       
  1322   year duplicate$ empty$
       
  1323      { pop$ "????" }
       
  1324      'skip$
       
  1325   if$
       
  1326   *
       
  1327   'label :=
       
  1328 }
       
  1329 
       
  1330 FUNCTION {sort.format.names}
       
  1331 { 's :=
       
  1332   #1 'nameptr :=
       
  1333   ""
       
  1334   s num.names$ 'numnames :=
       
  1335   numnames 'namesleft :=
       
  1336     { namesleft #0 > }
       
  1337     { s nameptr
       
  1338       "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
       
  1339       format.name$ 't :=
       
  1340       nameptr #1 >
       
  1341         {
       
  1342           "   "  *
       
  1343           namesleft #1 = t "others" = and
       
  1344             { "zzzzz" * }
       
  1345             { t sortify * }
       
  1346           if$
       
  1347         }
       
  1348         { t sortify * }
       
  1349       if$
       
  1350       nameptr #1 + 'nameptr :=
       
  1351       namesleft #1 - 'namesleft :=
       
  1352     }
       
  1353   while$
       
  1354 }
       
  1355 
       
  1356 FUNCTION {sort.format.title}
       
  1357 { 't :=
       
  1358   "A " #2
       
  1359     "An " #3
       
  1360       "The " #4 t chop.word
       
  1361     chop.word
       
  1362   chop.word
       
  1363   sortify
       
  1364   #1 global.max$ substring$
       
  1365 }
       
  1366 
       
  1367 FUNCTION {author.sort}
       
  1368 { author empty$
       
  1369     { key empty$
       
  1370         { "to sort, need author or key in " cite$ * warning$
       
  1371           ""
       
  1372         }
       
  1373         { key sortify }
       
  1374       if$
       
  1375     }
       
  1376     { author sort.format.names }
       
  1377   if$
       
  1378 }
       
  1379 
       
  1380 FUNCTION {author.editor.sort}
       
  1381 { author empty$
       
  1382     { editor empty$
       
  1383         { key empty$
       
  1384             { "to sort, need author, editor, or key in " cite$ * warning$
       
  1385               ""
       
  1386             }
       
  1387             { key sortify }
       
  1388           if$
       
  1389         }
       
  1390         { editor sort.format.names }
       
  1391       if$
       
  1392     }
       
  1393     { author sort.format.names }
       
  1394   if$
       
  1395 }
       
  1396 
       
  1397 FUNCTION {editor.sort}
       
  1398 { editor empty$
       
  1399     { key empty$
       
  1400         { "to sort, need editor or key in " cite$ * warning$
       
  1401           ""
       
  1402         }
       
  1403         { key sortify }
       
  1404       if$
       
  1405     }
       
  1406     { editor sort.format.names }
       
  1407   if$
       
  1408 }
       
  1409 
       
  1410 FUNCTION {presort}
       
  1411 { calc.label
       
  1412   label sortify
       
  1413   "    "
       
  1414   *
       
  1415   type$ "book" =
       
  1416   type$ "inbook" =
       
  1417   or
       
  1418     'author.editor.sort
       
  1419     { type$ "proceedings" =
       
  1420         'editor.sort
       
  1421         'author.sort
       
  1422       if$
       
  1423     }
       
  1424   if$
       
  1425   #1 entry.max$ substring$
       
  1426   'sort.label :=
       
  1427   sort.label
       
  1428   *
       
  1429   "    "
       
  1430   *
       
  1431   title field.or.null
       
  1432   sort.format.title
       
  1433   *
       
  1434   #1 entry.max$ substring$
       
  1435   'sort.key$ :=
       
  1436 }
       
  1437 
       
  1438 ITERATE {presort}
       
  1439 
       
  1440 SORT
       
  1441 
       
  1442 STRINGS { last.label next.extra }
       
  1443 
       
  1444 INTEGERS { last.extra.num number.label }
       
  1445 
       
  1446 FUNCTION {initialize.extra.label.stuff}
       
  1447 { #0 int.to.chr$ 'last.label :=
       
  1448   "" 'next.extra :=
       
  1449   #0 'last.extra.num :=
       
  1450   #0 'number.label :=
       
  1451 }
       
  1452 
       
  1453 FUNCTION {forward.pass}
       
  1454 { last.label label =
       
  1455     { last.extra.num #1 + 'last.extra.num :=
       
  1456       last.extra.num int.to.chr$ 'extra.label :=
       
  1457     }
       
  1458     { "a" chr.to.int$ 'last.extra.num :=
       
  1459       "" 'extra.label :=
       
  1460       label 'last.label :=
       
  1461     }
       
  1462   if$
       
  1463   number.label #1 + 'number.label :=
       
  1464 }
       
  1465 
       
  1466 FUNCTION {reverse.pass}
       
  1467 { next.extra "b" =
       
  1468     { "a" 'extra.label := }
       
  1469     'skip$
       
  1470   if$
       
  1471   extra.label 'next.extra :=
       
  1472   extra.label
       
  1473   duplicate$ empty$
       
  1474     'skip$
       
  1475     { "{\natexlab{" swap$ * "}}" * }
       
  1476   if$
       
  1477   'extra.label :=
       
  1478   label extra.label * 'label :=
       
  1479 }
       
  1480 
       
  1481 EXECUTE {initialize.extra.label.stuff}
       
  1482 
       
  1483 ITERATE {forward.pass}
       
  1484 
       
  1485 REVERSE {reverse.pass}
       
  1486 
       
  1487 FUNCTION {bib.sort.order}
       
  1488 { sort.label
       
  1489   "    "
       
  1490   *
       
  1491   year field.or.null sortify
       
  1492   *
       
  1493   "    "
       
  1494   *
       
  1495   title field.or.null
       
  1496   sort.format.title
       
  1497   *
       
  1498   #1 entry.max$ substring$
       
  1499   'sort.key$ :=
       
  1500 }
       
  1501 
       
  1502 ITERATE {bib.sort.order}
       
  1503 
       
  1504 SORT
       
  1505 
       
  1506 FUNCTION {begin.bib}
       
  1507 { preamble$ empty$
       
  1508     'skip$
       
  1509     { preamble$ write$ newline$ }
       
  1510   if$
       
  1511   "\begin{thebibliography}{" number.label int.to.str$ * "}" *
       
  1512   write$ newline$
       
  1513   "\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi"
       
  1514   write$ newline$
       
  1515   "\expandafter\ifx\csname url\endcsname\relax"
       
  1516   write$ newline$
       
  1517   "  \def\url#1{\texttt{#1}}\fi"
       
  1518   write$ newline$
       
  1519   "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi"
       
  1520   write$ newline$
       
  1521 }
       
  1522 
       
  1523 EXECUTE {begin.bib}
       
  1524 
       
  1525 EXECUTE {init.state.consts}
       
  1526 
       
  1527 ITERATE {call.type$}
       
  1528 
       
  1529 FUNCTION {end.bib}
       
  1530 { newline$
       
  1531   "\end{thebibliography}" write$ newline$
       
  1532 }
       
  1533 
       
  1534 EXECUTE {end.bib}
       
  1535 %% End of customized bst file
       
  1536 %%
       
  1537 %% End of file `elsarticle-harv.bst'.