2 %% Copyright 2007, 2008, 2009 Elsevier Ltd
4 %% This file is part of the 'Elsarticle Bundle'.
5 %% ---------------------------------------------
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.
14 %% The list of all files belonging to the 'Elsarticle Bundle' is
15 %% given in the file `manifest.txt'.
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...
27 %% This is file `elsarticle-num.bst',
28 %% generated with the docstrip utility.
30 %% The original source files were:
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)
35 %% ----------------------------------------
68 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
70 STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl openinlinelink closeinlinelink } % urlbst...
71 INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver }
72 FUNCTION {init.urlbst.variables}
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
95 FUNCTION {init.state.consts}
96 { #0 'outside.brackets := % urlbst
98 #2 'within.brackets :=
103 #2 'after.sentence :=
109 FUNCTION {output.nonnull.original}
111 output.state mid.sentence =
113 { output.state after.block =
118 { output.state before.all =
120 { add.period$ " " * write$ }
124 mid.sentence 'output.state :=
130 FUNCTION {setup.inlinelink}
132 { hrefform #1 = % hypertex
133 { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink :=
134 "\special {html:</a>}" 'closeinlinelink :=
136 { hrefform #2 = % hyperref
137 { "\href{" url * "}{" * 'openinlinelink :=
138 "}" 'closeinlinelink :=
144 #0 'makeinlinelink :=
149 FUNCTION {add.inlinelink}
150 { openinlinelink empty$
152 { openinlinelink swap$ * closeinlinelink *
153 "" 'openinlinelink :=
157 FUNCTION {output.nonnull}
158 { % Save the thing we've been asked to output
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 =
165 outside.brackets 'bracket.state :=
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.
175 output.nonnull.original % invoke the original output.nonnull
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 =
183 { ", " * } % bracket.state will be within.brackets
186 close.brackets 'bracket.state :=
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 := }
198 FUNCTION {format.lastchecked}
201 { inbrackets "cited " lastchecked * }
212 FUNCTION {output.check}
215 { pop$ "empty " t * " in " * cite$ * warning$ }
220 FUNCTION {fin.entry.original}
227 { output.state before.all =
229 { after.block 'output.state := }
233 FUNCTION {new.sentence}
234 { output.state after.block =
236 { output.state before.all =
238 { after.sentence 'output.state := }
245 { " " * before.all 'output.state :=
248 FUNCTION {date.block}
271 FUNCTION {new.block.checka}
278 FUNCTION {new.block.checkb}
287 FUNCTION {new.sentence.checka}
294 FUNCTION {new.sentence.checkb}
303 FUNCTION {field.or.null}
313 FUNCTION {capitalize}
314 { "u" change.case$ "t" change.case$ }
316 FUNCTION {space.word}
317 { " " swap$ * " " * }
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
328 FUNCTION {bbl.editors}
331 FUNCTION {bbl.editor}
337 FUNCTION {bbl.edition}
340 FUNCTION {bbl.volume}
346 FUNCTION {bbl.number}
361 FUNCTION {bbl.chapter}
364 FUNCTION {bbl.techrep}
367 FUNCTION {bbl.mthesis}
368 { "Master's thesis" }
370 FUNCTION {bbl.phdthesis}
376 FUNCTION {bbl.second}
382 FUNCTION {bbl.fourth}
425 { duplicate$ "1" swap$ *
426 #-2 #1 substring$ "1" =
428 { duplicate$ #-1 #1 substring$
445 MACRO {acmcs} {"ACM Comput. Surv."}
447 MACRO {acta} {"Acta Inf."}
449 MACRO {cacm} {"Commun. ACM"}
451 MACRO {ibmjrd} {"IBM J. Res. Dev."}
453 MACRO {ibmsj} {"IBM Syst.~J."}
455 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
457 MACRO {ieeetc} {"IEEE Trans. Comput."}
460 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
462 MACRO {ipl} {"Inf. Process. Lett."}
464 MACRO {jacm} {"J.~ACM"}
466 MACRO {jcss} {"J.~Comput. Syst. Sci."}
468 MACRO {scp} {"Sci. Comput. Programming"}
470 MACRO {sicomp} {"SIAM J. Comput."}
472 MACRO {tocs} {"ACM Trans. Comput. Syst."}
474 MACRO {tods} {"ACM Trans. Database Syst."}
476 MACRO {tog} {"ACM Trans. Gr."}
478 MACRO {toms} {"ACM Trans. Math. Softw."}
480 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
482 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
484 MACRO {tcs} {"Theoretical Comput. Sci."}
489 { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
493 INTEGERS { nameptr namesleft numnames }
495 FUNCTION {format.names}
498 s num.names$ 'numnames :=
499 numnames 'namesleft :=
502 "{f.~}{vv~}{ll}{, jj}" format.name$
510 s nameptr "{ll}" format.name$ duplicate$ "others" =
525 nameptr #1 + 'nameptr :=
526 namesleft #1 - 'namesleft :=
530 FUNCTION {format.names.ed}
532 FUNCTION {format.authors}
535 { author format.names }
539 FUNCTION {format.editors}
542 { editor format.names
543 editor num.names$ #1 >
544 { " (" * bbl.editors * ")" * }
545 { " (" * bbl.editor * ")" * }
551 FUNCTION {format.in.editors}
554 { editor format.names.ed
555 editor num.names$ #1 >
556 { " (" * bbl.editors * ")" * }
557 { " (" * bbl.editor * ")" * }
563 FUNCTION {format.note}
567 { note #1 #1 substring$
570 { output.state mid.sentence =
577 note #2 global.max$ substring$ *
582 FUNCTION {format.title}
585 { title "t" change.case$
590 FUNCTION {output.bibitem.original}
597 before.all 'output.state :=
605 { t #1 #1 substring$ "-" =
606 { t #1 #2 substring$ "--" = not
608 t #2 global.max$ substring$ 't :=
610 { { t #1 #1 substring$ "-" = }
612 t #2 global.max$ substring$ 't :=
618 { t #1 #1 substring$ *
619 t #2 global.max$ substring$ 't :=
631 FUNCTION {format.date}
635 { "there's a month but no year in " cite$ * warning$
642 { month " " * year * }
649 before.all 'output.state :=
655 FUNCTION{format.year}
656 { year duplicate$ empty$
657 { "empty year in " cite$ * warning$ pop$ "" }
658 { "(" swap$ * ")" * }
662 FUNCTION {format.btitle}
666 FUNCTION {tie.or.space.connect}
667 { duplicate$ text.length$ #3 <
674 FUNCTION {either.or.check}
677 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
681 FUNCTION {format.bvolume}
684 { bbl.volume volume tie.or.space.connect
687 { bbl.of space.word * series emphasize * }
689 "volume and number" number either.or.check
694 FUNCTION {format.number.series}
697 { series field.or.null }
698 { output.state mid.sentence =
700 { bbl.number capitalize }
702 number tie.or.space.connect
704 { "there's a number but no series in " cite$ * warning$ }
705 { bbl.in space.word * series * }
716 duplicate$ "0" chr.to.int$ < not
717 swap$ "9" chr.to.int$ > not and
720 FUNCTION {extract.num}
725 t #2 global.max$ substring$ 't :=
738 FUNCTION {convert.edition}
739 { edition extract.num "l" change.case$ 's :=
740 s "first" = s "1" = or
742 { s "second" = s "2" = or
744 { s "third" = s "3" = or
746 { s "fourth" = s "4" = or
748 { s "fifth" = s "5" = or
750 { s #1 #1 substring$ is.num
767 FUNCTION {format.edition}
770 { output.state mid.sentence =
771 { convert.edition "l" change.case$ " " * bbl.edition * }
772 { convert.edition "t" change.case$ " " * bbl.edition * }
778 INTEGERS { multiresult }
780 FUNCTION {multi.page.check}
789 swap$ duplicate$ "," =
792 { #1 'multiresult := }
793 { t #2 global.max$ substring$ 't := }
800 FUNCTION {format.pages}
803 { pages multi.page.check
804 { bbl.pages pages n.dashify tie.or.space.connect }
805 { bbl.page pages tie.or.space.connect }
811 FUNCTION {format.journal.pages}
815 { pop$ format.pages }
826 FUNCTION {format.vol.num.pages}
828 % volume field.or.null
837 "~(" number * ")" * *
839 { "there's a number but no volume in " cite$ * warning$ }
846 FUNCTION {format.chapter.pages}
851 { type "l" change.case$ }
853 chapter tie.or.space.connect
858 FUNCTION {format.in.ed.booktitle}
862 { word.in booktitle * }
863 { word.in format.in.editors * ", " *
870 FUNCTION {empty.misc.check}
871 { author empty$ title empty$ howpublished empty$
872 month empty$ year empty$ note empty$
874 { "all relevant fields are empty in " cite$ * warning$ }
879 FUNCTION {format.thesis.type}
883 type "t" change.case$
888 FUNCTION {format.tr.number}
895 { number tie.or.space.connect }
899 FUNCTION {format.article.crossref}
903 { "need key or journal for " cite$ * " to crossref " * crossref *
907 { word.in journal emphasize * }
910 { word.in key * " " *}
912 " \cite{" * crossref * "}" *
915 FUNCTION {format.crossref.editor}
916 { editor #1 "{vv~}{ll}" format.name$
917 editor num.names$ duplicate$
924 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
928 { bbl.and space.word * editor #2 "{vv~}{ll}" format.name$
937 FUNCTION {format.book.crossref}
939 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
942 { bbl.volume volume tie.or.space.connect
947 editor field.or.null author field.or.null =
951 { "need editor, key, or series for " cite$ * " to crossref " *
955 { series emphasize * }
961 { format.crossref.editor * }
963 " \cite{" * crossref * "}" *
966 FUNCTION {format.incoll.inproc.crossref}
969 editor field.or.null author field.or.null =
973 { "need editor, key, or booktitle for " cite$ * " to crossref " *
977 { word.in booktitle * }
980 { word.in key * " " *}
983 { word.in format.crossref.editor * " " *}
985 " \cite{" * crossref * "}" *
988 FUNCTION {format.org.or.pub}
992 { "empty year in " cite$ * warning$ }
995 address empty$ t empty$ and
1008 { ", " * address * }
1014 { t empty$ address empty$ and
1025 FUNCTION {format.publisher.address}
1027 { "empty publisher in " cite$ * warning$
1035 FUNCTION {format.organization.address}
1036 { organization empty$
1043 FUNCTION {make.href.null}
1047 FUNCTION {make.href.hypertex}
1049 "\special {html:<a href=" quote$ *
1050 swap$ * quote$ * "> }" * swap$ *
1051 "\special {html:</a>}" *
1053 FUNCTION {make.href.hyperref}
1055 "\href {" swap$ * "} {\path{" * swap$ * "}}" *
1057 FUNCTION {make.href}
1059 'make.href.hyperref % hrefform = 2
1061 'make.href.hypertex % hrefform = 1
1062 'make.href.null % hrefform = 0 (or anything else)
1068 FUNCTION {format.url}
1069 { inlinelinks #1 = url empty$ or
1072 { % special case -- add HyperTeX specials
1073 urlintro "\url{" url * "}" * url make.href.hypertex * }
1074 { urlintro "\url{" * url * "}" * }
1080 FUNCTION {format.eprint}
1083 { eprintprefix eprint * eprinturl eprint * make.href }
1087 FUNCTION {format.doi}
1090 { doiprefix doi * doiurl doi * make.href }
1094 FUNCTION {output.url}
1099 format.lastchecked output
1104 FUNCTION {output.web.refs}
1108 addeprints eprint empty$ not and
1109 { format.eprint output.nonnull }
1112 adddoiresolver doi empty$ not and
1113 { format.doi output.nonnull }
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 := }
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 }
1134 bracket.state close.brackets = % urlbst
1145 'skip$ % author and editor both optional
1146 { format.editors output.nonnull }
1150 { format.authors output.nonnull }
1151 { "can't use both author and editor fields in " cite$ * warning$ }
1156 title empty$ 'skip$ 'setup.inlinelink if$
1157 format.title "title" output.check
1158 inbrackets "online" output
1162 { format.date "year" output.check }
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'.
1175 format.authors "author" output.check
1176 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1177 format.title "title" output.check
1180 "journal" output.check
1182 before.all 'output.state :=
1183 format.vol.num.pages output
1185 { format.article.crossref output.nonnull
1189 format.journal.pages
1198 { format.editors "author and editor" output.check
1200 { format.authors output.nonnull
1202 { "author and editor" editor either.or.check }
1207 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1208 format.btitle "title" output.check
1210 { format.edition output
1211 format.bvolume output
1212 format.number.series output
1213 format.publisher.address output
1216 format.book.crossref output.nonnull
1226 format.authors output
1227 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1228 format.title "title" output.check
1240 { format.editors "author and editor" output.check
1242 { format.authors output.nonnull
1244 { "author and editor" editor either.or.check }
1249 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1250 format.btitle "title" output.check
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
1260 format.chapter.pages "chapter and pages" output.check
1261 format.book.crossref output.nonnull
1264 format.pages "pages" output.check
1270 FUNCTION {incollection}
1272 format.authors "author" output.check
1273 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1274 format.title "title" output.check
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
1283 { format.incoll.inproc.crossref output.nonnull
1284 format.chapter.pages output
1287 format.pages "pages" output.check
1293 FUNCTION {inproceedings}
1295 format.authors "author" output.check
1296 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1297 format.title "title" output.check
1299 { format.in.ed.booktitle "booktitle" output.check
1300 format.edition output
1301 format.bvolume output
1302 format.number.series output
1304 { format.organization.address output }
1305 { organization output
1306 format.publisher.address output
1310 { format.incoll.inproc.crossref output.nonnull
1313 format.pages "pages" output.check
1319 FUNCTION {conference} { inproceedings }
1324 { organization empty$
1326 { organization output.nonnull
1331 { format.authors output.nonnull }
1333 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1334 format.btitle "title" output.check
1336 { organization empty$
1348 format.edition output
1355 FUNCTION {mastersthesis}
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
1364 format.date "year" output.check
1371 format.authors output
1372 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1382 FUNCTION {phdthesis}
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
1391 format.date "year" output.check
1396 FUNCTION {proceedings}
1399 { organization output }
1400 { format.editors output.nonnull }
1402 title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
1403 format.btitle "title" output.check
1404 format.bvolume output
1405 format.number.series output
1410 format.publisher.address output
1416 format.organization.address output }
1419 format.publisher.address output
1429 FUNCTION {techreport}
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
1438 format.date "year" output.check
1443 FUNCTION {unpublished}
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
1454 FUNCTION {default.type} { misc }
1458 STRINGS { longest.label }
1460 INTEGERS { number.label longest.label.width }
1462 FUNCTION {initialize.longest.label}
1463 { "" 'longest.label :=
1465 #0 'longest.label.width :=
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 :=
1479 EXECUTE {initialize.longest.label}
1481 ITERATE {longest.label.pass}
1483 FUNCTION {begin.bib}
1486 { preamble$ write$ newline$ }
1488 "\begin{thebibliography}{" longest.label * "}" *
1490 "\expandafter\ifx\csname url\endcsname\relax"
1492 " \def\url#1{\texttt{#1}}\fi"
1494 "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi"
1496 "\expandafter\ifx\csname href\endcsname\relax"
1498 " \def\href#1#2{#2} \def\path#1{#1}\fi"
1504 EXECUTE {init.urlbst.variables}
1505 EXECUTE {init.state.consts}
1507 ITERATE {call.type$}
1511 "\end{thebibliography}" write$ newline$
1515 %% End of customized bst file
1517 %% End of file `elsarticle-num.bst'.