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