diff options
Diffstat (limited to 'Master/texmf-dist')
13 files changed, 27003 insertions, 2274 deletions
diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-unsrt.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-unsrt.bst new file mode 100644 index 00000000000..0ad33155dc3 --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-unsrt.bst @@ -0,0 +1,4896 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This file is “iran-unsrt.bst”, v0.1.0 (2024/01/8) +%% generated with the DOCSTRIP utility, then modified to support +%% bilingual (English/Latin, and Persian/Farsi) in accordance with the +%% “Iran Manual of Style Citation Guide” (1st edn., 2016). +%% +%% +%% +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> +%% +%% This file can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of the License is at: latex-project.org/lppl.txt +%% +%% This BibTeX bibliography style (bst) file is part of +%% the “iran-bibtex” package. +%% +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% +%% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in Persian. +%% This is a numbered citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they can appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => [1] +%% \citep*{key} => [1] +%% \citep[chap. 2]{key} => [1, chap. 2] +%% \citep[e.g.][]{key} => [e.g. 1] +%% \citep[e.g.][p. 32]{key} => [e.g. 1, p. 32] +%% \citet{key} => Jones et al. [1] +%% \citet*{key} => Jones, Baker, and Smith [1] +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- + + + +ENTRY +{ + address + afterword % the added field + archive + author + authorfa % the added field + booktitle + by % the added field + chapter + collaboration + comment % the added field + commentator % the added field + compiler % the added field + doi + edition + editor + eid + eprint + foreword % the added field + howpublished + impression % the added field + institution + introduction % the added field + isbn + issn + issue % the added field + journal + key + language + month + note + number + numpages + organization + pages + preface % the added field + publisher + school + series + title + translator % the added field + translateyear % the added field + type + url + urldate % the added field + volume + volumes % the added field + year +} +{} +{ + label + sort.label + short.list +} + + + + + +% Logical operators + +FUNCTION {not} +{ + { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ + { pop$ #1 } + 'skip$ + if$ +} + + + + + + +% Check for language entry + +FUNCTION {is.language.persian} +{ + language missing$ + { #0 } + { language "l" change.case$ "persian" = } + if$ +} + + + + + +% Here are the language-specific definitions for explicit words. +% Each function has a name bbl.xxx where xxx is the English word. + +FUNCTION {bbl.afterwordby} +{ + is.language.persian + {"با پسگفتار"} + {"afterword by"} + if$ +} + +FUNCTION {bbl.and} +{ + is.language.persian + {"و"} + {"and"} + if$ +} + +FUNCTION {bbl.andothers} +{ + is.language.persian + {"و~دیگران"} + {"and~others"} + if$ +} + +FUNCTION {bbl.by} +{ + is.language.persian + {"نوشتهی"} + {"by"} + if$ +} + +FUNCTION {bbl.chapter} +{ + is.language.persian + {"فصل"} + {"chapter"} + if$ +} + +FUNCTION {bbl.comma} +{ + is.language.persian + {"،"} + {","} + if$ +} + +FUNCTION {bbl.commentator} +{ + is.language.persian + {"یادداشتنویس"} + {"comm."} + if$ +} + +FUNCTION {bbl.commentatedby} +{ + is.language.persian + {"با یادداشت"} + {"commentated by"} + if$ +} + +FUNCTION {bbl.compiler} +{ + is.language.persian + {"گردآورنده"} + {"comp."} + if$ +} + +FUNCTION {bbl.compilers} +{ + is.language.persian + {"گردآورندگان"} + {"comps."} + if$ +} + +FUNCTION {bbl.compiledby} +{ + is.language.persian + {"گردآوری"} + {"compiled by"} + if$ +} + +FUNCTION {bbl.doi} +{ + is.language.persian + {"شناسهی دیجیتال"} + {"doi"} + if$ +} + +FUNCTION {bbl.dquote} +{ + is.language.persian + {"\faquote{" swap$ * add.period$ "}" *} + {"\enquote{" swap$ * add.period$ "}" *} + if$ +} + +FUNCTION {bbl.editor} +{ + is.language.persian + {"ویراستار"} + {"ed."} + if$ +} + +FUNCTION {bbl.editors} +{ + is.language.persian + {"ویراستاران"} + {"eds."} + if$ +} + +FUNCTION {bbl.editedby} +{ + is.language.persian + {"ویراستهی"} + {"edited by"} + if$ +} + +FUNCTION {bbl.edition} +{ + is.language.persian + {"ویرایش"} + {"edn."} + if$ +} + +FUNCTION {bbl.eidpp} +{ + is.language.persian + {"صص"} + {"pages"} + if$ +} + +FUNCTION {bbl.etal} +{ + is.language.persian + {"و~همکاران"} + {"et~al."} + if$ +} + +FUNCTION {bbl.forewordby} +{ + is.language.persian + {"با پیشگفتار"} + {"forword by"} + if$ +} + +FUNCTION {bbl.impression} +{ + is.language.persian + {"چاپ"} + {"imp."} + if$ +} + +FUNCTION {bbl.in} +{ + is.language.persian + {"در"} + {"in"} + if$ +} + +FUNCTION {bbl.incollaborationwith} +{ + is.language.persian + {"با همکاری"} + {"in collaboration with"} + if$ +} + +FUNCTION {bbl.introby} +{ + is.language.persian + {"با مقدمهی"} + {"introduction by"} + if$ +} + +FUNCTION {bbl.isbn} +{ + is.language.persian + {"شابک"} + {"isbn"} + if$ +} + +FUNCTION {bbl.issn} +{ + is.language.persian + {"شاپا"} + {"issn"} + if$ +} + +FUNCTION {bbl.mthesis} +{ + is.language.persian + {"پایاننامهی کارشناسیارشد"} + {"Master's thesis"} + if$ +} + +FUNCTION {bbl.nr} +{ + is.language.persian + {"ش."} + {"no."} + if$ +} + +FUNCTION {bbl.number} +{ + is.language.persian + {"ش."} + {"no."} + if$ +} + +FUNCTION {bbl.of} +{ + is.language.persian + {"از"} + {"of"} + if$ +} + +FUNCTION {bbl.page} +{ + is.language.persian + {"ص"} + {"p."} + if$ +} + +FUNCTION {bbl.pages} +{ + is.language.persian + {"صص"} + {"pp."} + if$ +} + +FUNCTION {bbl.prefaceby} +{ + is.language.persian + {"با پیشگفتار"} + {"preface by"} + if$ +} + +FUNCTION {bbl.phdthesis} +{ + is.language.persian + {"رسالهی دکتری"} + {"PhD dissertation"} + if$ +} + +FUNCTION {bbl.retrieved} +{ + is.language.persian + {"دسترسی در"} + {"retrieved"} + if$ +} + +FUNCTION {bbl.semicolon} +{ + is.language.persian + {"؛"} + {";"} + if$ +} + +FUNCTION {bbl.techrep} +{ + is.language.persian + {"گزارش"} + {"tech. rep."} + if$ +} + +FUNCTION {bbl.thesis} +{ + is.language.persian + {"پایاننامه"} + {"Thesis"} + if$ +} + +FUNCTION {bbl.translator} +{ + is.language.persian + {"مترجم"} + {"trans."} + if$ +} + +FUNCTION {bbl.translators} +{ + is.language.persian + {"مترجمان"} + {"trans."} + if$ +} + +FUNCTION {bbl.translatedby} +{ + is.language.persian + {"ترجمهی"} + {"translated by"} + if$ +} + +FUNCTION {bbl.url} +{ + is.language.persian + {"تارنما"} + {"url"} + if$ +} + +FUNCTION {bbl.volume} +{ + is.language.persian + {"ج."} + {"vol."} + if$ +} + +FUNCTION {bbl.volumes} +{ + is.language.persian + {"ج."} + {"vols."} + if$ +} + + + + + +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + +% Functions to declare position + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + + +% Functions to print output + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ + 's := + output.state mid.sentence = + { bbl.comma * " " * write$ } + { + output.state after.block = + { + add.period$ write$ + newline$ + "\newblock " write$ + } + { + output.state before.all = + 'write$ + { add.period$ write$ " " write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ + duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ + 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + + + + + +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries + +FUNCTION {new.block} +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + +FUNCTION {new.sentence} +{ + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + + + +FUNCTION {add.blank} +{ + " " * before.all 'output.state := +} + + + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + + + +FUNCTION {date.block} +{ + new.block +} + + + +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + +FUNCTION {non.stop} +{ + duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + + + +STRINGS {z} + +FUNCTION {remove.dots} +{ + 'z := + "" + { + z empty$ not + } + { + z #1 #2 substring$ + duplicate$ "\." = + { + z #3 global.max$ substring$ 'z := * + } + { + pop$ + z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = + 'pop$ + { * } + if$ + } + if$ + } + while$ +} + + + +FUNCTION {separate.by.space} +{ " " swap$ * " " * } + + + +FUNCTION {space.word} +{ " " swap$ * " " * } + + + +FUNCTION {tie.or.space.prefix} +{ + duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + + + +FUNCTION {word.in} +{ + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } + if$ +} + + + + + +% Functions to format names + +INTEGERS { nameptr namesleft numnames } + +STRINGS { bibinfo} + +FUNCTION {format.names} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + duplicate$ #1 > + { "{ff~}{vv~}{ll}{, jj}" } + { "{vv~}{ll}{, ff}{, jj}" } + if$ + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{ff~}{vv~}{ll}{, jj}" + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.key} +{ + empty$ + { key field.or.null } + { "" } + if$ +} + + + +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + + + +STRINGS {oldname} + +FUNCTION {name.or.dash} +{ + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } + if$ +} + + + + + +% Functions to create the short name label for the entry + +FUNCTION {label.and} +{ + is.language.persian + { "و" } + { + authorfa missing$ + { "and" } + { "و" } + if$ + } + if$ +} + + + +FUNCTION {label.andothers} +{ + is.language.persian + { "و~دیگران" } + { + authorfa missing$ + { "and~others" } + { "و~دیگران" } + if$ + } + if$ +} + + + +FUNCTION {label.comma} +{ + is.language.persian + { "،" } + { + authorfa missing$ + { "," } + { "،" } + if$ + } + if$ +} + + + +FUNCTION {label.etal} +{ + is.language.persian + { "و~همکاران" } + { + authorfa missing$ + { "et~al." } + { "و~همکاران" } + if$ + } + if$ +} + + + +INTEGERS { is.authorfa.exist } + +FUNCTION {format.short.label.names} +{ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > + { + " " * label.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * " " * s #2 "{vv~}{ll}" format.name$ * + label.comma * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {book.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'short.list := +} + + + + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} +{ + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { + label.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal * + } + { + numnames #2 > + { label.comma * } + 'skip$ + if$ + label.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {author.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {book.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.full.label.names} +{ + type$ "book" = + 'book.full.label.names + { + type$ "incollection" = + 'incoll.full.label.names + { + type$ "article" = + 'article.full.label.names + { + type$ "proceedings" = + 'proc.full.label.names + { + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + is.language.persian + { + "\bibitem[{" write$ + } + { + "\begin{LTRbibitems}\resetlatinfont" write$ + newline$ + "\bibitem[{" write$ + } + if$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + + + +FUNCTION {end.bibitem} +{ + add.period$ write$ + newline$ + is.language.persian + 'skip$ + { + "\end{LTRbibitems}" write$ + newline$ + } + if$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + "edition" bibinfo.check + is.language.persian + { bbl.edition " " * swap$ * } + { " " * bbl.edition * } + if$ + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + is.language.persian + { bbl.impression " " * swap$ * } + { " " * bbl.impression * } + if$ + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { + output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify + } + { + } + if$ + "pages" bibinfo.check + } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not + { + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.btitle} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {field.title.dqoute} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {get.bbl.translator} +{ + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator + if$ +} + +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} + + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} +{ + volume empty$ + { "" } + { + bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ + 'pop$ + { emphasize ", " * swap$ * } + if$ + "volume and number" number either.or.check + } + if$ +} + + + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} +{ + volume empty$ + { + number empty$ + { series field.or.null } + { + series empty$ + { number "number" bibinfo.check } + { + output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} +{ + volume empty$ not + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * add.period$ + } + if$ + } + if$ + } + if$ + } + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + " " * number * + } + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + } + if$ + } + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + volumes "~" * bbl.volumes * add.period$ + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + series + " " * number * + } + { + series + } + if$ + } + { + number empty$ not + { + bbl.number "~" * number * + } + { + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} +{ + booktitle empty$ not + { + chapter empty$ not + { + bbl.chapter capitalize "~" * chapter * + " " * bbl.in * " " * field.booktitle * + pages empty$ not + { + bbl.comma * " " * pages * add.period$ + } + { + add.period$ + } + if$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + { + word.in field.booktitle * + pages empty$ not + { + volume empty$ not + { + volumes empty$ not + { + " " * volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + " " * volume * ": " * pages * add.period$ + } + if$ + } + { + volumes empty$ not + { + bbl.comma * " " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + bbl.comma * " " * pages * add.period$ + } + if$ + } + if$ + } + { + add.period$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + compiler empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + editor empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + if$ + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} +{ + booktitle empty$ not + { + volume empty$ not + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * add.period$ + volumes * "~" * bbl.volumes + } + { + field.booktitle " " * add.period$ + " " * volumes * "~" * bbl.volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * + } + { + field.booktitle + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +FUNCTION {inproc.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} +{ + series empty$ not + { + number empty$ not + { + pages empty$ not + { + series + bbl.comma * " " * bbl.number * "~" * number * + bbl.comma * " " * pages * + } + { + series + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + series + bbl.comma * " " * pages * + } + { series } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} +{ + type duplicate$ empty$ + 'pop$ + { + swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} + + + +FUNCTION {thesis.fields.school.type.address} +{ + type empty$ + { + type$ "mastersthesis" = + { bbl.mthesis "t" change.case$ } + { + type$ "phdthesis" = + { bbl.phdthesis "t" change.case$ } + { bbl.thesis "t" change.case$ } + if$ + } + if$ + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + { + type "~" = + { + school empty$ not + { + address empty$ not + { school bbl.comma * " " * address * } + { school } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + { + type + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {unpub.field.title} +{ + title empty$ not + { title bbl.dquote } + 'skip$ + if$ +} + + + +FUNCTION {misc.field.title} +{ + title empty$ not + { title } + 'skip$ + if$ +} + + + + + +% Functions to format entries based on type (compatible entries) + +FUNCTION {book} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {incollection} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {article} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not + { + article.field.journal output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {inproceedings} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author field is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {conference} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {thesis} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {mastersthesis} { thesis } + + + +FUNCTION {phdthesis} { thesis } + + + +FUNCTION {unpublished} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {misc} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + + + +% Functions to format entries based on type (incompatible entries) + +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + author empty$ + { field.editor "author and editor" output.check + editor format.key output + name.or.dash + } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + field.year "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + field.edition output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + + + +% Function to format entry if the type is not recognized + +FUNCTION {default.type} { misc } + + + + + + + + + + + + + + + + + + + + +% Reading bibliography database (.bib) file + +READ + + +% Function to generate a string that is suitable for sorting purposes + +FUNCTION {sortify} +{ + purify$ + "l" change.case$ +} + + + +% Length of the short name label of the entry + +INTEGERS { len } + +FUNCTION {chop.word} +{ + 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + + + + + +% Functions for sorting purposes + +FUNCTION {sort.format.names} +{ + 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ + 't := + nameptr #1 > + { + " " * + namesleft #1 = + t "others" = + and + { "zzzzz" 't := } + 'skip$ + if$ + t sortify * + } + { + t sortify * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {sort.field.title} +{ + 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + + + +FUNCTION {author.sort} +{ + author empty$ + { + key empty$ + { + "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + + + + +FUNCTION {author.editor.sort} +{ + author empty$ + { + editor empty$ + { + key empty$ + { + "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + + + +FUNCTION {editor.sort} +{ + editor empty$ + { + key empty$ + { + "to sort, need editor or key in " cite$ * warning$ + "" + } + { + key sortify + } + if$ + } + { + editor sort.format.names + } + if$ +} + + + +FUNCTION {book.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.sort} +{ + author empty$ not + { + author sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.sort} +{ + editor empty$ not + { editor sort.format.names } + { + compiler empty$ not + { compiler sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num := } + +EXECUTE {init.seq} + + + +FUNCTION {int.to.fix} +{ + "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + + + +FUNCTION {presort} +{ + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + + + +% Sort process + +ITERATE {presort} + +SORT + + + +INTEGERS { number.label } + +FUNCTION {initialize.longest.label} +{ + #0 'number.label := +} + +FUNCTION {forward.pass} +{ + number.label #1 + 'number.label := +} + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + + + +FUNCTION {bib.sort.order} +{ + sort.label + 'sort.key$ := +} + + + +ITERATE {bib.sort.order} + +SORT + + + + +% Functions to create bibliography +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + "% Generated by `iran-unsrt.bst`." write$ + newline$ + "% This bibliography style is part of the `iran-bibtex` package." write$ + newline$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + newline$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + newline$ + newline$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ + newline$ +} + + + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + + + +FUNCTION {end.bib} +{ + newline$ + "\end{thebibliography}" write$ + newline$ +} + + + +EXECUTE {end.bib} + + + +%% +%% End of file `iran-unsrt.bst'.
\ No newline at end of file diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-year.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-year.bst new file mode 100644 index 00000000000..06bae75f44c --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran-year.bst @@ -0,0 +1,5078 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This file is “iran-year.bst”, v0.1.0 (2024/01/8) +%% generated with the DOCSTRIP utility, then modified to support +%% bilingual (English/Latin, and Persian/Farsi) in accordance with the +%% “Iran Manual of Style Citation Guide” (1st edn., 2016). +%% +%% +%% +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> +%% +%% This file can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of the License is at: latex-project.org/lppl.txt +%% +%% This BibTeX bibliography style (bst) file is part of +%% the “iran-bibtex” package. +%% +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% +%% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in Persian. +%% This is an author-year citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they should appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => (Jones et al., 1990) +%% \citep*{key} => (Jones, Baker, and Smith, 1990) +%% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) +%% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) +%% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) +%% \citet{key} => Jones et al. (1990) +%% \citet*{key} => Jones, Baker, and Smith (1990) +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- + + + +ENTRY +{ + address + afterword % the added field + archive + author + authorfa % the added field + booktitle + by % the added field + chapter + collaboration + comment % the added field + commentator % the added field + compiler % the added field + doi + edition + editor + eid + eprint + foreword % the added field + howpublished + impression % the added field + institution + introduction % the added field + isbn + issn + issue % the added field + journal + key + language + month + note + number + numpages + organization + pages + preface % the added field + publisher + school + series + title + translator % the added field + translateyear % the added field + type + url + urldate % the added field + volume + volumes % the added field + year +} +{} +{ + label + extra.label + sort.label + short.list +} + + + + + +% Logical operators + +FUNCTION {not} +{ + { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ + { pop$ #1 } + 'skip$ + if$ +} + + + + + + +% Check for language entry + +FUNCTION {is.language.persian} +{ + language missing$ + { #0 } + { language "l" change.case$ "persian" = } + if$ +} + + + + + +% Here are the language-specific definitions for explicit words. +% Each function has a name bbl.xxx where xxx is the English word. + +FUNCTION {bbl.afterwordby} +{ + is.language.persian + {"با پسگفتار"} + {"afterword by"} + if$ +} + +FUNCTION {bbl.and} +{ + is.language.persian + {"و"} + {"and"} + if$ +} + +FUNCTION {bbl.andothers} +{ + is.language.persian + {"و~دیگران"} + {"and~others"} + if$ +} + +FUNCTION {bbl.by} +{ + is.language.persian + {"نوشتهی"} + {"by"} + if$ +} + +FUNCTION {bbl.chapter} +{ + is.language.persian + {"فصل"} + {"chapter"} + if$ +} + +FUNCTION {bbl.comma} +{ + is.language.persian + {"،"} + {","} + if$ +} + +FUNCTION {bbl.commentator} +{ + is.language.persian + {"یادداشتنویس"} + {"comm."} + if$ +} + +FUNCTION {bbl.commentatedby} +{ + is.language.persian + {"با یادداشت"} + {"commentated by"} + if$ +} + +FUNCTION {bbl.compiler} +{ + is.language.persian + {"گردآورنده"} + {"comp."} + if$ +} + +FUNCTION {bbl.compilers} +{ + is.language.persian + {"گردآورندگان"} + {"comps."} + if$ +} + +FUNCTION {bbl.compiledby} +{ + is.language.persian + {"گردآوری"} + {"compiled by"} + if$ +} + +FUNCTION {bbl.doi} +{ + is.language.persian + {"شناسهی دیجیتال"} + {"doi"} + if$ +} + +FUNCTION {bbl.dquote} +{ + is.language.persian + {"\faquote{" swap$ * add.period$ "}" *} + {"\enquote{" swap$ * add.period$ "}" *} + if$ +} + +FUNCTION {bbl.editor} +{ + is.language.persian + {"ویراستار"} + {"ed."} + if$ +} + +FUNCTION {bbl.editors} +{ + is.language.persian + {"ویراستاران"} + {"eds."} + if$ +} + +FUNCTION {bbl.editedby} +{ + is.language.persian + {"ویراستهی"} + {"edited by"} + if$ +} + +FUNCTION {bbl.edition} +{ + is.language.persian + {"ویرایش"} + {"edn."} + if$ +} + +FUNCTION {bbl.eidpp} +{ + is.language.persian + {"صص"} + {"pages"} + if$ +} + +FUNCTION {bbl.etal} +{ + is.language.persian + {"و~همکاران"} + {"et~al."} + if$ +} + +FUNCTION {bbl.forewordby} +{ + is.language.persian + {"با پیشگفتار"} + {"forword by"} + if$ +} + +FUNCTION {bbl.impression} +{ + is.language.persian + {"چاپ"} + {"imp."} + if$ +} + +FUNCTION {bbl.in} +{ + is.language.persian + {"در"} + {"in"} + if$ +} + +FUNCTION {bbl.incollaborationwith} +{ + is.language.persian + {"با همکاری"} + {"in collaboration with"} + if$ +} + +FUNCTION {bbl.introby} +{ + is.language.persian + {"با مقدمهی"} + {"introduction by"} + if$ +} + +FUNCTION {bbl.isbn} +{ + is.language.persian + {"شابک"} + {"isbn"} + if$ +} + +FUNCTION {bbl.issn} +{ + is.language.persian + {"شاپا"} + {"issn"} + if$ +} + +FUNCTION {bbl.mthesis} +{ + is.language.persian + {"پایاننامهی کارشناسیارشد"} + {"Master's thesis"} + if$ +} + +FUNCTION {bbl.nr} +{ + is.language.persian + {"ش."} + {"no."} + if$ +} + +FUNCTION {bbl.number} +{ + is.language.persian + {"ش."} + {"no."} + if$ +} + +FUNCTION {bbl.of} +{ + is.language.persian + {"از"} + {"of"} + if$ +} + +FUNCTION {bbl.page} +{ + is.language.persian + {"ص"} + {"p."} + if$ +} + +FUNCTION {bbl.pages} +{ + is.language.persian + {"صص"} + {"pp."} + if$ +} + +FUNCTION {bbl.prefaceby} +{ + is.language.persian + {"با پیشگفتار"} + {"preface by"} + if$ +} + +FUNCTION {bbl.phdthesis} +{ + is.language.persian + {"رسالهی دکتری"} + {"PhD dissertation"} + if$ +} + +FUNCTION {bbl.retrieved} +{ + is.language.persian + {"دسترسی در"} + {"retrieved"} + if$ +} + +FUNCTION {bbl.semicolon} +{ + is.language.persian + {"؛"} + {";"} + if$ +} + +FUNCTION {bbl.techrep} +{ + is.language.persian + {"گزارش"} + {"tech. rep."} + if$ +} + +FUNCTION {bbl.thesis} +{ + is.language.persian + {"پایاننامه"} + {"Thesis"} + if$ +} + +FUNCTION {bbl.translator} +{ + is.language.persian + {"مترجم"} + {"trans."} + if$ +} + +FUNCTION {bbl.translators} +{ + is.language.persian + {"مترجمان"} + {"trans."} + if$ +} + +FUNCTION {bbl.translatedby} +{ + is.language.persian + {"ترجمهی"} + {"translated by"} + if$ +} + +FUNCTION {bbl.url} +{ + is.language.persian + {"تارنما"} + {"url"} + if$ +} + +FUNCTION {bbl.volume} +{ + is.language.persian + {"ج."} + {"vol."} + if$ +} + +FUNCTION {bbl.volumes} +{ + is.language.persian + {"ج."} + {"vols."} + if$ +} + + + + + +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + +% Functions to declare position + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + + +% Functions to print output + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ + 's := + output.state mid.sentence = + { bbl.comma * " " * write$ } + { + output.state after.block = + { + add.period$ write$ + newline$ + "\newblock " write$ + } + { + output.state before.all = + 'write$ + { add.period$ write$ " " write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ + duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ + 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + + + + + +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries + +FUNCTION {new.block} +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + +FUNCTION {new.sentence} +{ + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + + + +FUNCTION {add.blank} +{ + " " * before.all 'output.state := +} + + + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + + + +FUNCTION {date.block} +{ + new.block +} + + + +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + +FUNCTION {non.stop} +{ + duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + + + +STRINGS {z} + +FUNCTION {remove.dots} +{ + 'z := + "" + { + z empty$ not + } + { + z #1 #2 substring$ + duplicate$ "\." = + { + z #3 global.max$ substring$ 'z := * + } + { + pop$ + z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = + 'pop$ + { * } + if$ + } + if$ + } + while$ +} + + + +FUNCTION {separate.by.space} +{ " " swap$ * " " * } + + + +FUNCTION {space.word} +{ " " swap$ * " " * } + + + +FUNCTION {tie.or.space.prefix} +{ + duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + + + +FUNCTION {word.in} +{ + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } + if$ +} + + + + + +% Functions to format names + +INTEGERS { nameptr namesleft numnames } + +STRINGS { bibinfo} + +FUNCTION {format.names} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + duplicate$ #1 > + { "{ff~}{vv~}{ll}{, jj}" } + { "{vv~}{ll}{, ff}{, jj}" } + if$ + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{ff~}{vv~}{ll}{, jj}" + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.key} +{ + empty$ + { key field.or.null } + { "" } + if$ +} + + + +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + + + +STRINGS {oldname} + +FUNCTION {name.or.dash} +{ + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } + if$ +} + + + + + +% Functions to create the short name label for the entry + +FUNCTION {label.and} +{ + is.language.persian + { "و" } + { + authorfa missing$ + { "and" } + { "و" } + if$ + } + if$ +} + + + +FUNCTION {label.andothers} +{ + is.language.persian + { "و~دیگران" } + { + authorfa missing$ + { "and~others" } + { "و~دیگران" } + if$ + } + if$ +} + + + +FUNCTION {label.comma} +{ + is.language.persian + { "،" } + { + authorfa missing$ + { "," } + { "،" } + if$ + } + if$ +} + + + +FUNCTION {label.etal} +{ + is.language.persian + { "و~همکاران" } + { + authorfa missing$ + { "et~al." } + { "و~همکاران" } + if$ + } + if$ +} + + + +INTEGERS { is.authorfa.exist } + +FUNCTION {format.short.label.names} +{ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > + { + " " * label.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * " " * s #2 "{vv~}{ll}" format.name$ * + label.comma * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {book.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'short.list := +} + + + + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} +{ + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { + label.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal * + } + { + numnames #2 > + { label.comma * } + 'skip$ + if$ + label.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {author.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {book.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.full.label.names} +{ + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.full.label.names} +{ + type$ "book" = + 'book.full.label.names + { + type$ "incollection" = + 'incoll.full.label.names + { + type$ "article" = + 'article.full.label.names + { + type$ "proceedings" = + 'proc.full.label.names + { + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + translateyear empty$ + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + author empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + compiler empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + editor empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + translateyear duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + is.language.persian + { + "\bibitem[{" write$ + } + { + "\begin{LTRbibitems}\resetlatinfont" write$ + newline$ + "\bibitem[{" write$ + } + if$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + + + +FUNCTION {end.bibitem} +{ + add.period$ write$ + newline$ + is.language.persian + 'skip$ + { + "\end{LTRbibitems}" write$ + newline$ + } + if$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + "edition" bibinfo.check + is.language.persian + { bbl.edition " " * swap$ * } + { " " * bbl.edition * } + if$ + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + is.language.persian + { bbl.impression " " * swap$ * } + { " " * bbl.impression * } + if$ + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { + output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify + } + { + } + if$ + "pages" bibinfo.check + } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not + { + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.btitle} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {field.title.dqoute} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {get.bbl.translator} +{ + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator + if$ +} + +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} + + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} +{ + volume empty$ + { "" } + { + bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ + 'pop$ + { emphasize ", " * swap$ * } + if$ + "volume and number" number either.or.check + } + if$ +} + + + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} +{ + volume empty$ + { + number empty$ + { series field.or.null } + { + series empty$ + { number "number" bibinfo.check } + { + output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} +{ + volume empty$ not + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * add.period$ + } + if$ + } + if$ + } + if$ + } + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + " " * number * + } + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + } + if$ + } + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + volumes "~" * bbl.volumes * add.period$ + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + series + " " * number * + } + { + series + } + if$ + } + { + number empty$ not + { + bbl.number "~" * number * + } + { + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} +{ + booktitle empty$ not + { + chapter empty$ not + { + bbl.chapter capitalize "~" * chapter * + " " * bbl.in * " " * field.booktitle * + pages empty$ not + { + bbl.comma * " " * pages * add.period$ + } + { + add.period$ + } + if$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + { + word.in field.booktitle * + pages empty$ not + { + volume empty$ not + { + volumes empty$ not + { + " " * volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + " " * volume * ": " * pages * add.period$ + } + if$ + } + { + volumes empty$ not + { + bbl.comma * " " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + bbl.comma * " " * pages * add.period$ + } + if$ + } + if$ + } + { + add.period$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + compiler empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + editor empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + if$ + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} +{ + booktitle empty$ not + { + volume empty$ not + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * add.period$ + volumes * "~" * bbl.volumes + } + { + field.booktitle " " * add.period$ + " " * volumes * "~" * bbl.volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * + } + { + field.booktitle + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +FUNCTION {inproc.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} +{ + series empty$ not + { + number empty$ not + { + pages empty$ not + { + series + bbl.comma * " " * bbl.number * "~" * number * + bbl.comma * " " * pages * + } + { + series + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + series + bbl.comma * " " * pages * + } + { series } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} +{ + type duplicate$ empty$ + 'pop$ + { + swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} + + + +FUNCTION {thesis.fields.school.type.address} +{ + type empty$ + { + type$ "mastersthesis" = + { bbl.mthesis "t" change.case$ } + { + type$ "phdthesis" = + { bbl.phdthesis "t" change.case$ } + { bbl.thesis "t" change.case$ } + if$ + } + if$ + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + { + type "~" = + { + school empty$ not + { + address empty$ not + { school bbl.comma * " " * address * } + { school } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + { + type + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {unpub.field.title} +{ + title empty$ not + { title bbl.dquote } + 'skip$ + if$ +} + + + +FUNCTION {misc.field.title} +{ + title empty$ not + { title } + 'skip$ + if$ +} + + + + + +% Functions to format entries based on type (compatible entries) + +FUNCTION {book} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {incollection} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {article} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not + { + article.field.journal output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {inproceedings} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author field is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {conference} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {thesis} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {mastersthesis} { thesis } + + + +FUNCTION {phdthesis} { thesis } + + + +FUNCTION {unpublished} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {misc} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + + + +% Functions to format entries based on type (incompatible entries) + +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + author empty$ + { field.editor "author and editor" output.check + editor format.key output + name.or.dash + } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + field.edition output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + + + +% Function to format entry if the type is not recognized + +FUNCTION {default.type} { misc } + + + + + + + + + + + + + + + + + + + + +% Reading bibliography database (.bib) file + +READ + + +% Function to generate a string that is suitable for sorting purposes + +FUNCTION {sortify} +{ + purify$ + "l" change.case$ +} + + + +% Length of the short name label of the entry + +INTEGERS { len } + +FUNCTION {chop.word} +{ + 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + + + + + +% Functions for sorting purposes + +FUNCTION {sort.format.names} +{ + 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ + 't := + nameptr #1 > + { + " " * + namesleft #1 = + t "others" = + and + { "zzzzz" 't := } + 'skip$ + if$ + t sortify * + } + { + t sortify * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {sort.field.title} +{ + 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + + + +FUNCTION {author.sort} +{ + author empty$ + { + key empty$ + { + "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + + + + +FUNCTION {author.editor.sort} +{ + author empty$ + { + editor empty$ + { + key empty$ + { + "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + + + +FUNCTION {editor.sort} +{ + editor empty$ + { + key empty$ + { + "to sort, need editor or key in " cite$ * warning$ + "" + } + { + key sortify + } + if$ + } + { + editor sort.format.names + } + if$ +} + + + +FUNCTION {book.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.sort} +{ + author empty$ not + { + author sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.sort} +{ + editor empty$ not + { editor sort.format.names } + { + compiler empty$ not + { compiler sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {presort} +{ + calc.label + label sortify + " " + * + type$ "book" = + 'book.sort + { + type$ "incollection" = + 'incoll.sort + { + type$ "article" = + 'article.sort + { + type$ "proceedings" = + 'proc.sort + { + type$ "inproceedings" = + 'inproc.sort + { + type$ "conference" = + 'conf.sort + { + type$ "inbook" = + 'author.editor.sort + 'author.sort + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + #1 entry.max$ substring$ + 'sort.label := + sort.label + * + " " + * + translateyear empty$ + { year field.or.null } + { + author empty$ not + { year field.or.null } + { + compiler empty$ not + { year field.or.null } + { + editor empty$ not + { year field.or.null } + { + translator empty$ not + { translateyear field.or.null } + { year field.or.null } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + + + +% Sort process + +ITERATE {presort} + +SORT + + + +STRINGS { last.label next.extra } + +INTEGERS { last.extra.num last.extra.num.extended last.extra.num.blank number.label } + +FUNCTION {initialize.extra.label.stuff} +{ + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'last.extra.num := + "a" chr.to.int$ #1 - 'last.extra.num.blank := + last.extra.num.blank 'last.extra.num.extended := + #0 'number.label := +} + + + +FUNCTION {forward.pass} +{ + last.label label = + { + last.extra.num #1 + 'last.extra.num := + last.extra.num "z" chr.to.int$ > + { + "a" chr.to.int$ 'last.extra.num := + last.extra.num.extended #1 + 'last.extra.num.extended := + } + 'skip$ + if$ + last.extra.num.extended last.extra.num.blank > + { + last.extra.num.extended int.to.chr$ + last.extra.num int.to.chr$ + * 'extra.label := + } + { + last.extra.num int.to.chr$ 'extra.label := + } + if$ + } + { + "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + + + +FUNCTION {reverse.pass} +{ + next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label duplicate$ empty$ + 'skip$ + { + is.language.persian + { "{\extrayearlabelfa{" swap$ * "}}" * } + { "{\extrayearlabelen{" swap$ * "}}" * } + if$ + } + if$ + 'extra.label := + label extra.label * 'label := +} + + + +EXECUTE {initialize.extra.label.stuff} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + + + +FUNCTION {bib.sort.order} +{ + sort.label + " " + * + translateyear empty$ + { year field.or.null sortify } + { + author empty$ not + { year field.or.null sortify } + { + compiler empty$ not + { year field.or.null sortify } + { + editor empty$ not + { year field.or.null sortify } + { + translator empty$ not + { translateyear field.or.null sortify } + { year field.or.null sortify } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + swap$ + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + +ITERATE {bib.sort.order} + +SORT + + + + +% Functions to create bibliography +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + "% Generated by `iran-year.bst`." write$ + newline$ + "% This bibliography style is part of the `iran-bibtex` package." write$ + newline$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + newline$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + newline$ + newline$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ + newline$ +} + + + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + + + +FUNCTION {end.bib} +{ + newline$ + "\end{thebibliography}" write$ + newline$ +} + + + +EXECUTE {end.bib} + + + +%% +%% End of file `iran-year.bst'.
\ No newline at end of file diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iran.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran.bst index 5d8ee98fa4b..e1575ba6be3 100644 --- a/Master/texmf-dist/bibtex/bst/iran-bibtex/iran.bst +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iran.bst @@ -1,13 +1,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% This file is “iran.bst”, v0.3.0 (2023/12/18) +%% This file is “iran.bst”, v0.4.0 (2024/01/8) %% generated with the DOCSTRIP utility, then modified to support -%% bilingual (English/Latin, and Persian) and be compatible with the +%% bilingual (English/Latin, and Persian/Farsi) in accordance with the %% “Iran Manual of Style Citation Guide” (1st edn., 2016). %% %% %% -%% Copyright (c) 2023 Farshad Rasuli <farshad.rasuli@gmail.com> +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> %% %% This file can be redistributed and/or modified under the terms %% of the LaTeX Project Public License version 1.3c, or any later version. @@ -16,40 +16,40 @@ %% This BibTeX bibliography style (bst) file is part of %% the “iran-bibtex” package. %% -%% CTAN: https://ctan.org/pkg/iran-bibtex -%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex -%% Repository: https://github.com/farshadrasuli/iran-bibtex -%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%------------------------------------------------------------------------------ -% This bibliography style file is intended for texts in ENGLISH, and Persian. -% This is an author-year citation style bibliography. This style file is based -% on natbib.sty package by Patrick W. Daly. -% The form of the \bibitem entries is -% \bibitem[Jones et al.(1990)]{key}... -% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... -% The essential feature is that the label (the part in brackets) consists -% of the author names, as they should appear in the citation, with the year -% in parentheses following. There must be no space before the opening -% parenthesis! -% -% The \cite command functions as follows (\cite is equal to \citep command): -% \citep{key} => (Jones et al., 1990) -% \citep*{key} => (Jones, Baker, and Smith, 1990) -% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) -% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) -% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) -% \citet{key} => Jones et al. (1990) -% \citet*{key} => Jones, Baker, and Smith (1990) -% \citeauthor{key} => Jones et al. -% \citeauthor*{key} => Jones, Baker, and Smith -% \citeyear{key} => 1990 -%------------------------------------------------------------------------------ +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in Persian. +%% This is an author-year citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they should appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => (Jones et al., 1990) +%% \citep*{key} => (Jones, Baker, and Smith, 1990) +%% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) +%% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) +%% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) +%% \citet{key} => Jones et al. (1990) +%% \citet*{key} => Jones, Baker, and Smith (1990) +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- @@ -115,7 +115,7 @@ ENTRY -% Basic boolean functions +% Logical operators FUNCTION {not} { @@ -143,12 +143,12 @@ FUNCTION {or} -% check for language of entry +% Check for language entry FUNCTION {is.language.persian} { language missing$ - {#0} + { #0 } { language "l" change.case$ "persian" = } if$ } @@ -176,22 +176,6 @@ FUNCTION {bbl.and} if$ } -FUNCTION {bbl.annotator} -{ - is.language.persian - {"حاشیهنویس"} - {"ann."} - if$ -} - -FUNCTION {bbl.annotatedby} -{ - is.language.persian - {"با حاشیهی"} - {"annotated by"} - if$ -} - FUNCTION {bbl.andothers} { is.language.persian @@ -216,14 +200,6 @@ FUNCTION {bbl.chapter} if$ } -FUNCTION {bbl.collaboration} -{ - is.language.persian - {"همکار"} - {"coll."} - if$ -} - FUNCTION {bbl.comma} { is.language.persian @@ -304,7 +280,7 @@ FUNCTION {bbl.editors} if$ } -FUNCTION {bbl.edby} +FUNCTION {bbl.editedby} { is.language.persian {"ویراستهی"} @@ -334,7 +310,6 @@ FUNCTION {bbl.etal} {"و~همکاران"} {"et~al."} if$ - } FUNCTION {bbl.forewordby} @@ -393,14 +368,6 @@ FUNCTION {bbl.issn} if$ } -FUNCTION {bbl.thesis} -{ - is.language.persian - {"پایاننامه"} - {"Thesis"} - if$ -} - FUNCTION {bbl.mthesis} { is.language.persian @@ -409,7 +376,7 @@ FUNCTION {bbl.mthesis} if$ } -FUNCTION {bbl.number} +FUNCTION {bbl.nr} { is.language.persian {"ش."} @@ -417,7 +384,7 @@ FUNCTION {bbl.number} if$ } -FUNCTION {bbl.nr} +FUNCTION {bbl.number} { is.language.persian {"ش."} @@ -436,16 +403,16 @@ FUNCTION {bbl.of} FUNCTION {bbl.page} { is.language.persian - {""} - {""} + {"ص"} + {"p."} if$ } FUNCTION {bbl.pages} { is.language.persian - {""} - {""} + {"صص"} + {"pp."} if$ } @@ -489,6 +456,14 @@ FUNCTION {bbl.techrep} if$ } +FUNCTION {bbl.thesis} +{ + is.language.persian + {"پایاننامه"} + {"Thesis"} + if$ +} + FUNCTION {bbl.translator} { is.language.persian @@ -541,6 +516,36 @@ FUNCTION {bbl.volumes} +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + % Functions to declare position INTEGERS { output.state before.all mid.sentence after.sentence after.block } @@ -574,7 +579,7 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ - { add.period$ " " * write$ } + { add.period$ write$ " " write$ } if$ } if$ @@ -605,7 +610,68 @@ FUNCTION {output.check} -% Functions to control format of entry +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries FUNCTION {new.block} { @@ -615,6 +681,20 @@ FUNCTION {new.block} if$ } + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + FUNCTION {new.sentence} { output.state after.block = @@ -637,10 +717,8 @@ FUNCTION {add.blank} -FUNCTION {no.blank.or.punct} -{ - "\hspace{0pt}" * before.all 'output.state := -} +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } @@ -651,6 +729,33 @@ FUNCTION {date.block} +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + FUNCTION {non.stop} { duplicate$ @@ -691,35 +796,13 @@ FUNCTION {remove.dots} -FUNCTION {new.block.checkb} -{ - empty$ - swap$ empty$ - and - 'skip$ - 'new.block - if$ -} - - - -FUNCTION {field.or.null} -{ - duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ -} +FUNCTION {separate.by.space} +{ " " swap$ * " " * } -FUNCTION {emphasize} -{ - duplicate$ empty$ - { pop$ "" } - { "{\it " swap$ * "}" * } - if$ -} +FUNCTION {space.word} +{ " " swap$ * " " * } @@ -734,97 +817,11 @@ FUNCTION {tie.or.space.prefix} -FUNCTION {capitalize} -{ "u" change.case$ "t" change.case$ } - - - -FUNCTION {space.word} -{ " " swap$ * " " * } - - - -FUNCTION {separate.by.space} -{ " " swap$ * " " * } - - - - - -% Macro for abbreviation of month - -MACRO {jan} {"Jan"} - -MACRO {feb} {"Feb"} - -MACRO {mar} {"Mar"} - -MACRO {apr} {"Apr"} - -MACRO {may} {"May"} - -MACRO {jun} {"Jun"} - -MACRO {jul} {"Jul"} - -MACRO {aug} {"Aug"} - -MACRO {sep} {"Sep"} - -MACRO {oct} {"Oct"} - -MACRO {nov} {"Nov"} - -MACRO {dec} {"Dec"} - - - - - -% Functions to check and warn bibinfo - -FUNCTION {bibinfo.check} -{ - swap$ - duplicate$ missing$ - { - pop$ pop$ - "" - } - { - duplicate$ empty$ - { - swap$ pop$ - } - { - swap$ - pop$ - } - if$ - } - if$ -} - - -FUNCTION {bibinfo.warn} +FUNCTION {word.in} { - swap$ - duplicate$ missing$ - { - swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ - "" - } - { - duplicate$ empty$ - { - swap$ "empty " swap$ * " in " * cite$ * warning$ - } - { - swap$ - pop$ - } - if$ - } + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } if$ } @@ -832,7 +829,7 @@ FUNCTION {bibinfo.warn} -% Functions to format fields +% Functions to format names INTEGERS { nameptr namesleft numnames } @@ -965,184 +962,465 @@ FUNCTION {format.key} -FUNCTION {format.authors} -{ author "author" format.names } +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} -FUNCTION {get.bbl.editor} +STRINGS {oldname} + +FUNCTION {name.or.dash} { - editor num.names$ #1 > - 'bbl.editors - 'bbl.editor + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } if$ } -FUNCTION {format.editors} + + + + +% Functions to create the short name label for the entry + +FUNCTION {label.and} { - editor "editor" format.names - duplicate$ empty$ - 'skip$ + is.language.persian + { "و" } { - bbl.comma * " " * get.bbl.editor * + authorfa missing$ + { "and" } + { "و" } + if$ } if$ } -FUNCTION {get.bbl.compiler} +FUNCTION {label.andothers} { - compiler num.names$ #1 > - 'bbl.compilers - 'bbl.compiler + is.language.persian + { "و~دیگران" } + { + authorfa missing$ + { "and~others" } + { "و~دیگران" } + if$ + } if$ } -FUNCTION {format.compilers} + + +FUNCTION {label.comma} { - compiler "compiler" format.names - duplicate$ empty$ - 'skip$ + is.language.persian + { "،" } { - bbl.comma * " " * get.bbl.compiler * + authorfa missing$ + { "," } + { "،" } + if$ } if$ } -FUNCTION {get.bbl.translator} +FUNCTION {label.etal} { - translator num.names$ #1 > - 'bbl.translators - 'bbl.translator + is.language.persian + { "و~همکاران" } + { + authorfa missing$ + { "et~al." } + { "و~همکاران" } + if$ + } if$ } -FUNCTION {format.translators} + + +INTEGERS { is.authorfa.exist } + +FUNCTION {format.short.label.names} { - translator "translator" format.names - duplicate$ empty$ - 'skip$ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > { - bbl.comma * " " * get.bbl.translator * + " " * label.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * label.etal * + } + { + label.comma * " " * s #2 "{vv~}{ll}" format.name$ * + label.comma * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.eprint} +FUNCTION {author.key.short.label.names} { - eprint duplicate$ empty$ - 'skip$ + authorfa empty$ not + { authorfa format.short.label.names } { - "\eprint" - archive empty$ - 'skip$ - { "[" * archive * "]" * } + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } if$ - "{" * swap$ * "}" * } if$ } -FUNCTION {format.url} +FUNCTION {author.editor.key.short.label.names} { - url duplicate$ empty$ - { pop$ "" } + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.urldate} +FUNCTION {editor.key.short.label.names} { - urldate duplicate$ empty$ - { pop$ "" } - { bbl.retrieved capitalize " " * swap$ * } + authorfa empty$ not + { authorfa format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ } -FUNCTION {format.isbn} +FUNCTION {book.short.label.names} { - isbn "isbn" bibinfo.check - duplicate$ empty$ - 'skip$ + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.isbn "u" change.case$ ": " * swap$ * + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.issn} +FUNCTION {incoll.short.label.names} { - issn "issn" bibinfo.check - duplicate$ empty$ - 'skip$ - { - bbl.issn "u" change.case$ ": " * swap$ * - } + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } if$ } -FUNCTION {format.doi} + + +FUNCTION {article.short.label.names} { - doi empty$ - { "" } + authorfa empty$ not + { authorfa format.short.label.names } { - bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } if$ } -FUNCTION {format.note} +FUNCTION {proc.short.label.names} { - note empty$ not + authorfa empty$ not + { authorfa format.short.label.names } { - note #1 #1 substring$ - duplicate$ "{" = - 'skip$ + editor empty$ not + { editor format.short.label.names } { - output.state mid.sentence = - { "l" } - { "u" } + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ - change.case$ } if$ - note #2 global.max$ substring$ * "note" bibinfo.check } - { "" } if$ } -FUNCTION {format.title} +FUNCTION {inproc.short.label.names} { - title - duplicate$ empty$ - 'skip$ - { bbl.dquote } + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + authorfa empty$ not + { authorfa format.short.label.names } + { + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } if$ + 'short.list := } -FUNCTION {format.full.names} + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} { 's := "" 't := @@ -1160,7 +1438,7 @@ FUNCTION {format.full.names} { namesleft #1 > { - bbl.comma * " " * t * + label.comma * " " * t * } { s nameptr "{ll}" format.name$ @@ -1174,10 +1452,10 @@ FUNCTION {format.full.names} } { numnames #2 > - { bbl.comma * } + { label.comma * } 'skip$ if$ - bbl.and + label.and separate.by.space * t * } if$ @@ -1193,74 +1471,100 @@ FUNCTION {format.full.names} } -FUNCTION {author.editor.key.full} + +FUNCTION {author.key.full.label.names} { - author empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - editor empty$ + author empty$ not + { author format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } + key empty$ not 'key + { cite$ #1 #3 substring$ } if$ } - { - editor format.full.names - } if$ } - { - author format.full.names - } if$ } -FUNCTION {author.key.full} +FUNCTION {author.editor.key.full.label.names} { - author empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } - 'key + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } if$ } - { - author format.full.names - } if$ } -FUNCTION {editor.key.full} +FUNCTION {editor.key.full.label.names} { - editor empty$ + authorfa empty$ not + { authorfa format.full.label.names } { - key empty$ - { cite$ #1 #3 substring$ } - 'key + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } if$ } - { - editor format.full.names - } if$ } -FUNCTION {make.full.names} +FUNCTION {book.full.label.names} { - type$ "book" = - type$ "inbook" = - or - 'author.editor.key.full + authorfa empty$ not + { authorfa format.full.label.names } { - type$ "proceedings" = - 'editor.key.full - 'author.key.full + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } if$ } if$ @@ -1268,224 +1572,658 @@ FUNCTION {make.full.names} -FUNCTION {n.dashify} +FUNCTION {incoll.full.label.names} { - 't := - "" - { - t empty$ not - } - { - t #1 #1 substring$ - "-" = - { - t #1 #2 substring$ - "--" = not - { - "--" * - t #2 global.max$ substring$ 't := - } - { - { - t #1 #1 substring$ "-" = - } + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } { - "-" * - t #2 global.max$ substring$ 't := + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ } - while$ - } - if$ - } - { - t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ + if$ + } + if$ + } + if$ } -FUNCTION {word.in} +FUNCTION {article.full.label.names} { - bbl.in capitalize " " * + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.date} +FUNCTION {proc.full.label.names} { - year "year" bibinfo.check - duplicate$ empty$ + authorfa empty$ not + { authorfa format.full.label.names } { + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } - 'skip$ if$ - extra.label * - before.all 'output.state := - after.sentence 'output.state := } -FUNCTION {format.comment} +FUNCTION {inproc.full.label.names} { - comment + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.article.journal} +FUNCTION {conf.full.label.names} { - journal remove.dots emphasize + authorfa empty$ not + { authorfa format.full.label.names } + { + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ } -FUNCTION {format.article.jour.iss.vol.num.pp} +FUNCTION {make.full.label.names} { - journal empty$ not + type$ "book" = + 'book.full.label.names { - issue empty$ not - { issue bbl.comma * " " *} - { "" } - if$ - format.article.journal * - volume empty$ not + type$ "incollection" = + 'incoll.full.label.names { - number empty$ not - { - pages empty$ not - { - " " * volume * "~" * - "(" * number * ")" * ": " * - pages * - } - { - " " * volume * bbl.comma * - " " * bbl.number * "~" * number * - } - if$ - } + type$ "article" = + 'article.full.label.names { - pages empty$ not - { - " " * volume * ": " * - pages * - } + type$ "proceedings" = + 'proc.full.label.names { - " " * volume * + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ } if$ } if$ } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + translateyear empty$ + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + author empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } { - number empty$ not + compiler empty$ not { - pages empty$ not - { - bbl.comma * " " * bbl.number * "~" * number * ": " * - pages * - } - { - bbl.comma * " " * bbl.number * "~" * number * - } + year duplicate$ empty$ + { pop$ "" } + 'skip$ if$ } { - pages empty$ not + editor empty$ not { - bbl.comma * " " * pages * + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + translateyear duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ } - 'skip$ if$ } if$ } if$ } + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + is.language.persian + { + "\bibitem[{" write$ + } { - "journal" output.check + "\begin{LTRbibitems}\resetlatinfont" write$ + newline$ + "\bibitem[{" write$ } if$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := } -FUNCTION {format.article.iss.vol.num.pp} +FUNCTION {end.bibitem} { - journal empty$ not + add.period$ write$ + newline$ + is.language.persian + 'skip$ { - issue empty$ not - { issue bbl.comma * " " *} - { "" } + "\end{LTRbibitems}" write$ + newline$ + } + if$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } if$ - volume empty$ not + change.case$ + "edition" bibinfo.check + is.language.persian + { bbl.edition " " * swap$ * } + { " " * bbl.edition * } + if$ + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + is.language.persian + { bbl.impression " " * swap$ * } + { " " * bbl.impression * } + if$ + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ { - number empty$ not - { - pages empty$ not - { - bbl.comma * " " * bbl.volume * "~" * volume * "~" * - "(" * number * ")" * ": " * - pages * - } - { - bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * - " " * bbl.number * "~" * number * - } - if$ - } - { - pages empty$ not - { - bbl.comma * " " * bbl.volume * "~" * volume * ":~" * - pages * - } - { - bbl.comma * " " * bbl.volume * "~" * volume * - } - if$ - } + output.state mid.sentence = + { "l" } + { "u" } if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify } { - number empty$ not - { - pages empty$ not - { - bbl.number * "~" * number * ": " * - pages * - } - { - bbl.number * "~" * number * - } - if$ - } - { - pages empty$ not - { - pages * - } - 'skip$ - if$ - } - if$ } if$ + "pages" bibinfo.check } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not { - "journal" output.check + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } if$ } -FUNCTION {format.btitle} +FUNCTION {field.btitle} { title "title" bibinfo.check duplicate$ empty$ @@ -1496,27 +2234,98 @@ FUNCTION {format.btitle} -FUNCTION {format.title.in.books} +FUNCTION {field.title.dqoute} { title duplicate$ empty$ 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ { emphasize } if$ } -FUNCTION {either.or.check} +FUNCTION {get.bbl.translator} { - empty$ - 'pop$ - { "can't use both " swap$ * " fields in " * cite$ * warning$ } + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator if$ } +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} -FUNCTION {format.bvolume} + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} { volume empty$ { "" } @@ -1534,7 +2343,102 @@ FUNCTION {format.bvolume} } -FUNCTION {format.number.series} + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} { volume empty$ { @@ -1562,7 +2466,139 @@ FUNCTION {format.number.series} -FUNCTION {format.book.volume.series.number} +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} { volume empty$ not { @@ -1691,22 +2727,14 @@ FUNCTION {format.book.volume.series.number} -FUNCTION {format.booktitle} -{ - booktitle "booktitle" bibinfo.check - emphasize -} - - - -FUNCTION {format.incoll.chapter.booktitle.volume.pages} +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} { booktitle empty$ not { chapter empty$ not { bbl.chapter capitalize "~" * chapter * - " " * bbl.in * " " * format.booktitle * + " " * bbl.in * " " * field.booktitle * pages empty$ not { bbl.comma * " " * pages * add.period$ @@ -1739,7 +2767,7 @@ FUNCTION {format.incoll.chapter.booktitle.volume.pages} if$ } { - word.in format.booktitle * + word.in field.booktitle * pages empty$ not { volume empty$ not @@ -1805,13 +2833,13 @@ FUNCTION {format.incoll.chapter.booktitle.volume.pages} -INTEGERS { emph.series } -FUNCTION {format.incoll.series.number} +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} { author empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1821,7 +2849,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1829,7 +2857,7 @@ FUNCTION {format.incoll.series.number} compiler empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1839,7 +2867,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1847,7 +2875,7 @@ FUNCTION {format.incoll.series.number} editor empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1857,7 +2885,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1870,7 +2898,7 @@ FUNCTION {format.incoll.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -1879,7 +2907,7 @@ FUNCTION {format.incoll.series.number} if$ series empty$ not { - emph.series #0 > + field.series.emph #0 > { number empty$ not { series emphasize " " * number * } @@ -1905,7 +2933,221 @@ FUNCTION {format.incoll.series.number} -FUNCTION {format.inproc.booktitle.volume.pages} +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} { booktitle empty$ not { @@ -1915,12 +3157,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * volume * ": " * pages * add.period$ " " * volumes * "~" * bbl.volumes * } { - format.booktitle add.period$ + field.booktitle add.period$ " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * } if$ @@ -1928,11 +3170,11 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * volume * ": " * pages * } { - format.booktitle add.period$ + field.booktitle add.period$ " " * bbl.volume * "~" * volume * } if$ @@ -1944,12 +3186,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * bbl.comma * " " * pages * add.period$ volumes * "~" * bbl.volumes } { - format.booktitle " " * add.period$ + field.booktitle " " * add.period$ " " * volumes * "~" * bbl.volumes * } if$ @@ -1957,11 +3199,11 @@ FUNCTION {format.inproc.booktitle.volume.pages} { pages empty$ not { - format.booktitle " " * + field.booktitle " " * bbl.comma * " " * pages * } { - format.booktitle + field.booktitle } if$ } @@ -1977,12 +3219,12 @@ FUNCTION {format.inproc.booktitle.volume.pages} -FUNCTION {format.inproc.series.number} +FUNCTION {inproc.fields.series.number} { author empty$ not { translator empty$ not - { #1 'emph.series := } + { #1 'field.series.emph := } { edition empty$ not { #1 } @@ -1992,7 +3234,7 @@ FUNCTION {format.inproc.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ } @@ -2005,12 +3247,12 @@ FUNCTION {format.inproc.series.number} { #1 } { #0 } if$ - + 'emph.series := + + 'field.series.emph := } if$ series empty$ not { - emph.series #0 > + field.series.emph #0 > { number empty$ not { series emphasize " " * number * } @@ -2036,7 +3278,11 @@ FUNCTION {format.inproc.series.number} -FUNCTION {format.conf.series.number.pages} +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} { series empty$ not { @@ -2071,62 +3317,24 @@ FUNCTION {format.conf.series.number.pages} -FUNCTION {format.conf.org.publisher.address} +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} { - organization empty$ not - { - publisher empty$ not - { - address empty$ not - { - organization add.period$ - address * ": " * publisher * - } - { - organization add.period$ - publisher * - } - if$ - } - { - address empty$ not - { - organization - bbl.comma * " " * address * - } - { - organization - } - if$ - } - if$ - } + type duplicate$ empty$ + 'pop$ { - publisher empty$ not - { - address empty$ not - { address ": " * publisher *} - { publisher } - if$ - } - { - address empty$ not - { address } - { "" } - if$ - } - if$ + swap$ pop$ + "t" change.case$ "type" bibinfo.check } if$ } -FUNCTION {format.proc.org.publisher.address} { format.conf.org.publisher.address } - - - -FUNCTION {format.thesis.school.type.address} +FUNCTION {thesis.fields.school.type.address} { type empty$ { @@ -2196,538 +3404,21 @@ FUNCTION {format.thesis.school.type.address} -FUNCTION {format.edition} -{ - edition duplicate$ empty$ - 'skip$ - { - output.state mid.sentence = - { "l" } - { "t" } - if$ - change.case$ - "edition" bibinfo.check - is.language.persian - { bbl.edition " " * swap$ * } - { " " * bbl.edition * } - if$ - } - if$ -} - - - -FUNCTION {format.impression} +FUNCTION {unpub.field.title} { - impression duplicate$ empty$ not - { - output.state mid.sentence = - { "l" } - { "t" } - if$ - change.case$ - is.language.persian - { bbl.impression " " * swap$ * } - { " " * bbl.impression * } - if$ - } - 'skip$ - if$ -} - - - -INTEGERS { multiresult } - -FUNCTION {multi.page.check} -{ - 't := - #0 'multiresult := - { - multiresult not - t empty$ not - and - } - { - t #1 #1 substring$ - duplicate$ "-" = - swap$ duplicate$ "," = - swap$ "+" = - or or - { #1 'multiresult := } - { t #2 global.max$ substring$ 't := } - if$ - } - while$ - multiresult -} - - - -FUNCTION {format.pages} -{ - pages duplicate$ empty$ - 'skip$ - { - duplicate$ multi.page.check - { - n.dashify - } - { - } - if$ - "pages" bibinfo.check - } - if$ -} - - - -FUNCTION {format.journal.pages} -{ - pages duplicate$ empty$ 'pop$ - { - swap$ duplicate$ empty$ - { - pop$ pop$ format.pages - } - { - ": " * - swap$ - n.dashify - "pages" bibinfo.check - * - } - if$ - } - if$ -} - - - -FUNCTION {format.journal.eid} -{ - eid "eid" bibinfo.check - duplicate$ empty$ - 'pop$ - { - swap$ - duplicate$ empty$ - 'skip$ - { - ": " * - } - if$ - swap$ * - numpages empty$ - 'skip$ - { - bbl.eidpp numpages tie.or.space.prefix - "numpages" bibinfo.check * * - " (" swap$ * ")" * * - } - if$ - } - if$ -} - - - -FUNCTION {format.vol.num.pages} -{ - volume field.or.null - duplicate$ empty$ - 'skip$ - { - "volume" bibinfo.check - } - if$ - number "number" bibinfo.check - duplicate$ empty$ - 'skip$ - { - swap$ - duplicate$ empty$ - { "there's a number but no volume in " cite$ * warning$ } - 'skip$ - if$ - swap$ - "~(" swap$ * ")" * - } - if$ - * - eid empty$ - { format.journal.pages } - { format.journal.eid } - if$ -} - - - -FUNCTION {format.chapter.pages} -{ - chapter empty$ - 'format.pages - { - type empty$ - { bbl.chapter } - { - type "l" change.case$ - "type" bibinfo.check - } - if$ - chapter tie.or.space.prefix - "chapter" bibinfo.check - * * - pages empty$ - 'skip$ - { bbl.comma * " " * format.pages * } - if$ - } - if$ -} - - - -FUNCTION {format.in.ed.booktitle} -{ - format.booktitle - duplicate$ empty$ - 'skip$ - { - format.bvolume - duplicate$ empty$ - 'pop$ - { bbl.comma " " * swap$ * * } - if$ - editor "editor" format.names.ed - duplicate$ empty$ - 'pop$ - { - bbl.edby capitalize " " * swap$ * - swap$ - add.period$ " " * swap$ * - } - if$ - word.in swap$ * - } - if$ -} - - - -FUNCTION {format.by} -{ - by empty$ not - { - by "by" format.names.ed - bbl.by " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.incollaborationwith} -{ - collaboration empty$ not - { - collaboration "collaboration" format.names.ed - bbl.incollaborationwith capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.commentatedby} -{ - commentator empty$ not - { - commentator "commentator" format.names.ed - bbl.commentatedby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.compiledby} -{ - compiler empty$ not - { - compiler "compiler" format.names.ed - bbl.compiledby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.edby} -{ - editor empty$ not - { - editor "editor" format.names.ed - bbl.edby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.translatedby} -{ - translator empty$ not - { - translator "translator" format.names.ed - bbl.translatedby capitalize " " * swap$ * - } - { "" } - if$ -} - - -FUNCTION {format.translateyear} -{ - translateyear empty$ not - { - translateyear - } - { "" } - if$ - before.all 'output.state := - after.sentence 'output.state := -} - - - -FUNCTION {format.introby} -{ - introduction empty$ not - { - introduction "introduction" format.names.ed - bbl.introby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.prefaceby} -{ - preface empty$ not - { - preface "preface" format.names.ed - bbl.prefaceby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.afterwordby} -{ - afterword empty$ not - { - afterword "afterword" format.names.ed - bbl.afterwordby capitalize " " * swap$ * - } - { "" } - if$ -} - - - -FUNCTION {format.thesis.type} -{ - type duplicate$ empty$ - 'pop$ - { - swap$ pop$ - "t" change.case$ "type" bibinfo.check - } - if$ -} - - - -FUNCTION {format.tr.number} -{ - number "number" bibinfo.check - type duplicate$ empty$ - { pop$ bbl.techrep } - 'skip$ - if$ - "type" bibinfo.check - swap$ duplicate$ empty$ - { pop$ "t" change.case$ } - { tie.or.space.prefix * * } - if$ -} - - - -FUNCTION {format.article.crossref} -{ - word.in - " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.book.crossref} -{ - volume duplicate$ empty$ - { - "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - pop$ word.in - } - { - bbl.volume - capitalize - swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * - } - if$ - " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.incoll.inproc.crossref} -{ - word.in " \cite{" * crossref * "}" * -} - - - -FUNCTION {format.org.or.pub} -{ - 't := - "" - address empty$ t empty$ and + title empty$ not + { title bbl.dquote } 'skip$ - { - address "address" bibinfo.check * - t empty$ - 'skip$ - { - address empty$ - 'skip$ - { ": " * } - if$ - t * - } - if$ - } if$ } -FUNCTION {format.publisher.address} -{ - publisher "publisher" bibinfo.check format.org.or.pub -} - - - -FUNCTION {format.organization.address} -{ - organization "organization" bibinfo.check format.org.or.pub -} - - - -FUNCTION {format.organization} +FUNCTION {misc.field.title} { - organization "organization" bibinfo.check -} - - - -STRINGS {oldname} - -FUNCTION {name.or.dash} -{ - 's := - oldname empty$ - { s 'oldname := s } - { - s oldname = - { "---{}---{}---" } - { s 'oldname := s } - if$ - } - if$ -} - - - - - -% Functions to open, and close the bibitem - -INTEGERS { is.authorfa.exist } - -FUNCTION {begin.bibitem} -{ - #0 'is.authorfa.exist := - newline$ - is.language.persian - { - "\bibitem[{" write$ - label write$ - ")" make.full.names - duplicate$ short.list = - { pop$ } - { * } - if$ - "}]{" * write$ - cite$ write$ - "}" write$ - newline$ - } - { - "\begin{LTRbibitems}" write$ - "\resetlatinfont" write$ - newline$ - "\bibitem[{" write$ - label write$ - ")" make.full.names - duplicate$ short.list = - { pop$ } - { * } - if$ - "}]{" * write$ - cite$ write$ - "}" write$ - newline$ - } - if$ - "" - before.all 'output.state := -} - - - -FUNCTION {end.bibitem} -{ - add.period$ write$ - newline$ - is.language.persian + title empty$ not + { title } 'skip$ - { - "\end{LTRbibitems}" write$ - newline$ - } if$ } @@ -2735,117 +3426,172 @@ FUNCTION {end.bibitem} -% Function to format entries +% Functions to format entries based on type (compatible entries) -FUNCTION {article} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -{ +FUNCTION {book} +{ begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.edby output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author is empty, proceeds with editor - editor empty$ not + { %%% if author field is empty, proceeds with compiler + compiler empty$ not { - format.editors output.nonnull + field.compiler output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author, and editor are empty, proceeds with translator - translator empty$ not + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not { - format.translators output.nonnull + field.editor output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check crossref missing$ { - new.sentence format.edby output - new.sentence format.article.jour.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.article.crossref output.nonnull - format.pages output + new.block book.field.crossref output.nonnull } if$ } - { %%% if author, editor, and translator are empty, proceeds with key - key empty$ not + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not { - format.article.journal output.nonnull + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.by output - crossref missing$ + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not { - new.sentence format.edby output - new.sentence format.article.iss.vol.num.pp output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ } { - format.article.crossref output.nonnull - format.pages output + "author, compiler, editor, translator, and key" output.check } if$ } - { - "author, translator, and key" output.check - } if$ } if$ @@ -2858,162 +3604,146 @@ FUNCTION {article} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -FUNCTION {book} +FUNCTION {incollection} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } { %%% if author field is empty, proceeds with compiler compiler empty$ not { - format.compilers output.nonnull + field.compiler output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.edby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } { %%% if author, and compiler fields are empty, proceeds with editor editor empty$ not { - format.editors output.nonnull + field.editor output.nonnull name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } - { %%% if author, compiler, and editor fields are empty, proceeds with translator + { %%% if author, compiler, and editor fields are empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } - { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key key empty$ not { - format.title.in.books "title" output.check + field.title.emph output name.or.dash - format.date "year" output.check + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.book.volume.series.number output - new.sentence format.incollaborationwith output - new.sentence format.commentatedby output - new.sentence format.introby output - new.sentence format.prefaceby output - new.sentence format.afterwordby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.book.crossref output.nonnull + new.block incoll.field.crossref output.nonnull } if$ } @@ -3034,226 +3764,208 @@ FUNCTION {book} -FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE -{ - begin.bibitem - format.authors output - author format.key output - name.or.dash - format.date "year" output.check - date.block - format.title "title" output.check - new.block - howpublished "howpublished" bibinfo.check output - address "address" bibinfo.check output - format.isbn output - format.doi output - new.block - format.note output - format.eprint output - format.url output - end.bibitem -} - - - -FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {article} { begin.bibitem - author empty$ - { format.editors "author and editor" output.check - editor format.key output - name.or.dash - } - { format.authors output.nonnull - name.or.dash - crossref missing$ - { "author and editor" editor either.or.check } - 'skip$ - if$ - } - if$ - format.date "year" output.check - date.block - format.btitle "title" output.check - crossref missing$ - { - format.bvolume output - format.chapter.pages output%"chapter and pages" output.check - new.block - format.number.series output - format.edition output - new.sentence - format.publisher.address output - } - { - format.chapter.pages "chapter and pages" output.check - new.block - format.book.crossref output.nonnull - } - if$ - crossref missing$ - { format.isbn output } - 'skip$ - if$ - format.doi output - new.block - format.note output - format.eprint output - format.url output - end.bibitem -} - - - -FUNCTION {incollection} -{ - begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author field is empty, proceeds with compiler - compiler empty$ not + { %%% if author is empty, proceeds with editor + editor empty$ not { - format.compilers output.nonnull + field.editor output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author, and compiler fields are empty, proceeds with editor - editor empty$ not + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not { - format.editors output.nonnull + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.comment output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.by output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.incoll.series.number output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - new.block format.incoll.inproc.crossref output.nonnull + article.field.crossref output.nonnull + field.pages output } if$ } - { %%% if author, compiler, and editor fields are empty, proceeds with translator - translator empty$ not + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not { - format.translators output.nonnull + article.field.journal output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author, compiler, editor, and translator fields are empty, proceeds with key - key empty$ not + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ { - format.title.in.books output - name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.by output - crossref missing$ - { - new.sentence format.incoll.chapter.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.incoll.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - new.block format.incoll.inproc.crossref output.nonnull - } - if$ + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - "author, compiler, editor, translator, and key" output.check + article.field.crossref output.nonnull + field.pages output } if$ } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } if$ } if$ @@ -3271,92 +3983,92 @@ FUNCTION {inproceedings} begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author field is empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.by output - new.sentence format.date output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author, and translator fields are empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.inproc.booktitle.volume.pages output - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.inproc.series.number output - new.sentence format.compiledby output - new.sentence format.edby output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } @@ -3378,77 +4090,77 @@ FUNCTION {conference} begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title "title" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author is empty, proceeds with translator translator empty$ not { - format.translators output.nonnull + field.translator output.nonnull name.or.dash - new.sentence format.translateyear output - new.block format.title "title" output.check - new.sentence format.by output - new.sentence format.date output + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output crossref missing$ { - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } { %%% if author, and translator are empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.by output + field.year extra.label * "year" output.check + new.sentence field.by output crossref missing$ { - new.sentence format.conf.series.number.pages output - new.sentence format.edby output - new.sentence format.conf.org.publisher.address output - new.sentence format.note output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { - format.incoll.inproc.crossref output.nonnull - format.pages output + inproc.field.crossref output.nonnull + field.pages output } if$ } @@ -3461,83 +4173,109 @@ FUNCTION {conference} } if$ end.bibitem - } -FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {thesis} { begin.bibitem - format.authors output - author format.key output - name.or.dash - format.date "year" output.check - date.block - format.btitle "title" output.check - organization address new.block.checkb - organization "organization" bibinfo.check output - address "address" bibinfo.check output - format.edition output - format.doi output - new.block - format.note output - format.eprint output - format.url output + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ end.bibitem } -FUNCTION {format.misc.title} -{ - title empty$ not - { title } - 'skip$ - if$ -} +FUNCTION {mastersthesis} { thesis } -FUNCTION {format.howpublished} -{ - howpublished -} +FUNCTION {phdthesis} { thesis } -FUNCTION {misc} +FUNCTION {unpublished} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.misc.title output - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } - { %%% if author is empty, proceeds with key - key empty$ not + { %%% if author is empty, proceeds with translator + translator empty$ not { - format.title.in.books output + field.translator output.nonnull name.or.dash - format.date "year" output.check - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.publisher.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + new.sentence field.translateyear extra.label * output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ } - { "author, and key" output.check } if$ } if$ @@ -3546,33 +4284,36 @@ FUNCTION {misc} -FUNCTION {thesis} +FUNCTION {misc} { begin.bibitem author empty$ not { - format.authors output.nonnull + field.author output.nonnull name.or.dash - format.date "year" output.check - new.block format.title output - new.sentence format.comment output - new.sentence format.thesis.school.type.address output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { %%% if author is empty, proceeds with key key empty$ not { - format.title.in.books output + field.title.emph output name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output + field.year extra.label * "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output } { "author, and key" output.check } if$ @@ -3583,202 +4324,132 @@ FUNCTION {thesis} -FUNCTION {mastersthesis} { thesis } +% Functions to format entries based on type (incompatible entries) -FUNCTION {phdthesis} { thesis } +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} -FUNCTION {proceedings} +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { begin.bibitem - editor empty$ not - { - format.editors output.nonnull + author empty$ + { field.editor "author and editor" output.check + editor format.key output name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.compiledby output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output } - { %%% if editor field is empty, proceeds with compiler - compiler empty$ not - { - format.compilers output.nonnull - name.or.dash - format.date "year" output.check - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if editor, and compiler fields are empty, proceeds with translator - translator empty$ not - { - format.translators output.nonnull - name.or.dash - new.sentence format.translateyear output - new.block format.title.in.books "title" output.check - new.sentence format.edition output - new.sentence format.impression output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - key empty$ not - { - format.title.in.books "title" output.check - name.or.dash - format.date "year" output.check - new.block format.edition output - new.sentence format.impression output - new.sentence format.book.volume.series.number output - new.sentence format.proc.org.publisher.address output - new.sentence format.note output - new.sentence format.isbn output - new.sentence format.issn output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { - "editor, compiler, translator, and key" output.check - } - if$ - } - if$ - } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ if$ } if$ + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output end.bibitem } -FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { begin.bibitem - format.authors "author" output.check + field.author output author format.key output name.or.dash - format.date "year" output.check + field.year extra.label * "year" output.check date.block - format.btitle - "title" output.check - new.block - format.tr.number output.nonnull - institution "institution" bibinfo.warn output + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output address "address" bibinfo.check output - format.doi output + field.edition output + field.doi output new.block - format.note output - format.eprint output - format.url output + field.note output + field.eprint output + field.url output end.bibitem } -FUNCTION {format.unpub.title} +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE { - title empty$ not - { title bbl.dquote } - 'skip$ - if$ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem } -FUNCTION {unpublished} -{ - begin.bibitem - author empty$ not - { - format.authors output.nonnull - name.or.dash - format.date "year" output.check - new.block format.unpub.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author is empty, proceeds with translator - translator empty$ not - { - format.translators output.nonnull - name.or.dash - new.sentence format.translateyear output - new.block format.unpub.title output - new.sentence format.comment output - new.sentence format.by output - new.sentence format.date output - new.sentence format.translatedby output - new.sentence format.translateyear output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { %%% if author, and translator are empty, proceeds with key - key empty$ not - { - format.title.in.books output - name.or.dash - format.date "year" output.check - new.sentence format.comment output - new.sentence format.by output - new.sentence format.howpublished output - new.sentence format.note output - new.sentence format.doi output - new.sentence format.urldate output - new.sentence format.url output - } - { "author, translator, and key" output.check } - if$ - } - if$ - } - if$ - end.bibitem -} +% Function to format entry if the type is not recognized FUNCTION {default.type} { misc } @@ -3806,6 +4477,7 @@ FUNCTION {default.type} { misc } READ +% Function to generate a string that is suitable for sorting purposes FUNCTION {sortify} { @@ -3815,7 +4487,7 @@ FUNCTION {sortify} -% Length of the label name of the entry +% Length of the short name label of the entry INTEGERS { len } @@ -3831,390 +4503,9 @@ FUNCTION {chop.word} -% Function to create the label name of the entry - -FUNCTION {label.and} -{ - is.language.persian - { "و" } - { - authorfa missing$ - { "and" } - { "و" } - if$ - } - if$ -} - -FUNCTION {label.etal} -{ - is.language.persian - { "و~همکاران" } - { - authorfa missing$ - { "et~al." } - { "و~همکاران" } - if$ - } - if$ -} - - - -FUNCTION {format.lab.names} -{ - 's := - authorfa empty$ - { - #0 'is.authorfa.exist := - } - { - authorfa 's := - #1 'is.authorfa.exist := - } - if$ - "" 't := - s #1 "{vv~}{ll}" format.name$ - s num.names$ #3 > - { - " " * label.etal * - } - { - s num.names$ #2 < - 'skip$ - { - s num.names$ #3 < - { - s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = - { - " " * label.etal * - } - { - bbl.comma * " " * label.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * - } - if$ - } - { - s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = - { - " " * label.etal * - } - { - bbl.comma * " " * s #2 "{vv~}{ll}" format.name$ * - bbl.comma * " " * label.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * - } - if$ - } - if$ - } - if$ - } - if$ - #0 'is.authorfa.exist := -} - - - -FUNCTION {author.key.label} -{ - author empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { author format.lab.names } - if$ -} - -FUNCTION {author.editor.key.label} -{ - author empty$ - { - editor empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { editor format.lab.names } - if$ - } - { author format.lab.names } - if$ -} - - - -FUNCTION {editor.key.label} -{ - editor empty$ - { - key empty$ - { cite$ #1 #3 substring$ } - 'key - if$ - } - { - editor format.lab.names - } - if$ -} - - - -FUNCTION {article.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {book.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {incoll.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - editor empty$ not - { editor format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {proc.creator.label.order} -{ - editor empty$ not - { editor format.lab.names } - { - compiler empty$ not - { compiler format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ - } - if$ -} - -FUNCTION {conf.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {inproc.creator.label.order} -{ - author empty$ not - { author format.lab.names } - { - translator empty$ not - { translator format.lab.names } - { - key empty$ not - 'key - { cite$ #1 #3 substring$ } - if$ - } - if$ - } - if$ -} - - - -FUNCTION {calc.short.authors} -{ - type$ "article" = - 'article.creator.label.order - { - type$ "book" = - 'book.creator.label.order - { - type$ "incollection" = - 'incoll.creator.label.order - { - type$ "proceedings" = - 'proc.creator.label.order - { - type$ "conference" = - 'conf.creator.label.order - { - type$ "inproceedings" = - 'inproc.creator.label.order - { - type$ "inbook" = - 'author.editor.key.label - 'author.key.label - if$ - } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - 'short.list := -} - - - -FUNCTION {calc.label} -{ - calc.short.authors - short.list - "(" - * - author empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - compiler empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - editor empty$ not - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - translator empty$ not - { - translateyear duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - { - year duplicate$ empty$ - { pop$ "" } - 'skip$ - if$ - } - if$ - } - if$ - } - if$ - } - if$ - * - 'label := -} - - - - - -% Functions for sort +% Functions for sorting purposes FUNCTION {sort.format.names} { @@ -4253,7 +4544,7 @@ FUNCTION {sort.format.names} -FUNCTION {sort.format.title} +FUNCTION {sort.field.title} { 't := "A " #2 @@ -4331,30 +4622,37 @@ FUNCTION {editor.sort} -FUNCTION {article.creator.sort.order} +FUNCTION {book.sort} { author empty$ not { author sort.format.names } { - editor empty$ not + compiler empty$ not { - editor sort.format.names + compiler sort.format.names } { - translator empty$ not + editor empty$ not { - translator sort.format.names + editor sort.format.names } { - key empty$ not + translator empty$ not { - key sortify + translator sort.format.names } { - "to sort, need author, editor, translator, or key in " cite$ * warning$ - "" + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ } if$ } @@ -4367,7 +4665,7 @@ FUNCTION {article.creator.sort.order} -FUNCTION {book.creator.sort.order} +FUNCTION {incoll.sort} { author empty$ not { @@ -4410,37 +4708,30 @@ FUNCTION {book.creator.sort.order} -FUNCTION {incoll.creator.sort.order} +FUNCTION {article.sort} { author empty$ not { author sort.format.names } { - compiler empty$ not + editor empty$ not { - compiler sort.format.names + editor sort.format.names } { - editor empty$ not + translator empty$ not { - editor sort.format.names + translator sort.format.names } { - translator empty$ not + key empty$ not { - translator sort.format.names + key sortify } { - key empty$ not - { - key sortify - } - { - "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ - "" - } - if$ + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" } if$ } @@ -4453,7 +4744,7 @@ FUNCTION {incoll.creator.sort.order} -FUNCTION {proc.creator.sort.order} +FUNCTION {proc.sort} { editor empty$ not { editor sort.format.names } @@ -4478,7 +4769,7 @@ FUNCTION {proc.creator.sort.order} -FUNCTION {conf.creator.sort.order} +FUNCTION {inproc.sort} { author empty$ not { author sort.format.names } @@ -4498,7 +4789,7 @@ FUNCTION {conf.creator.sort.order} -FUNCTION {inproc.creator.sort.order} +FUNCTION {conf.sort} { author empty$ not { author sort.format.names } @@ -4524,23 +4815,23 @@ FUNCTION {presort} label sortify " " * - type$ "article" = - 'article.creator.sort.order + type$ "book" = + 'book.sort { - type$ "book" = - 'book.creator.sort.order + type$ "incollection" = + 'incoll.sort { - type$ "incollection" = - 'incoll.creator.sort.order + type$ "article" = + 'article.sort { type$ "proceedings" = - 'proc.creator.sort.order + 'proc.sort { - type$ "conference" = - 'conf.creator.sort.order + type$ "inproceedings" = + 'inproc.sort { - type$ "inproceedings" = - 'inproc.creator.sort.order + type$ "conference" = + 'conf.sort { type$ "inbook" = 'author.editor.sort @@ -4564,8 +4855,7 @@ FUNCTION {presort} * " " * - title field.or.null - sort.format.title + title field.or.null sort.field.title * #1 entry.max$ substring$ 'sort.key$ := @@ -4573,10 +4863,16 @@ FUNCTION {presort} + + +% Sort process + ITERATE {presort} SORT + + STRINGS { last.label next.extra } INTEGERS { last.extra.num last.extra.num.extended last.extra.num.blank number.label } @@ -4648,49 +4944,78 @@ FUNCTION {reverse.pass} } + EXECUTE {initialize.extra.label.stuff} ITERATE {forward.pass} REVERSE {reverse.pass} + + FUNCTION {bib.sort.order} { sort.label " " * - year field.or.null sortify + translateyear empty$ + { year field.or.null sortify } + { + author empty$ not + { year field.or.null sortify } + { + compiler empty$ not + { year field.or.null sortify } + { + editor empty$ not + { year field.or.null sortify } + { + translator empty$ not + { translateyear field.or.null sortify } + { year field.or.null sortify } + if$ + } + if$ + } + if$ + } + if$ + } + if$ * " " * - title field.or.null - sort.format.title + title field.or.null sort.field.title * #1 entry.max$ substring$ 'sort.key$ := } + ITERATE {bib.sort.order} SORT + + +% Functions to create bibliography FUNCTION {begin.bib} { preamble$ empty$ 'skip$ { preamble$ write$ newline$ } if$ - "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ - "% generated by iran.bst," write$ + "% Generated by `iran.bst`." write$ newline$ - "% this bibliography style is part of the `iran-bib` package." write$ + "% This bibliography style is part of the `iran-bibtex` package." write$ newline$ - "% copyright (c) 2023 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ newline$ - "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ newline$ newline$ @@ -4699,15 +5024,15 @@ FUNCTION {begin.bib} } -EXECUTE {begin.bib} +EXECUTE {begin.bib} EXECUTE {init.state.consts} - ITERATE {call.type$} + FUNCTION {end.bib} { newline$ @@ -4716,6 +5041,7 @@ FUNCTION {end.bib} } + EXECUTE {end.bib} diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-unsrt.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-unsrt.bst new file mode 100644 index 00000000000..21624b47552 --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-unsrt.bst @@ -0,0 +1,4486 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This file is “iranlatin-unsrt.bst”, v0.1.0 (2024/01/8) +%% created by modifying “iranlatin.bst” file in accordance with the +%% “Iran Manual of Style Citation Guide” (1st edn., 2016) to support +%% English/Latin only. +%% +%% +%% +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> +%% +%% This file can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of the License is at: latex-project.org/lppl.txt +%% +%% This BibTeX bibliography style (bst) file is part of +%% the “iran-bibtex” package. +%% +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% +%% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in ENGLISH. +%% This is a numbered citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they can appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => [1] +%% \citep*{key} => [1] +%% \citep[chap. 2]{key} => [1, chap. 2] +%% \citep[e.g.][]{key} => [e.g. 1] +%% \citep[e.g.][p. 32]{key} => [e.g. 1, p. 32] +%% \citet{key} => Jones et al. [1] +%% \citet*{key} => Jones, Baker, and Smith [1] +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- + + + +ENTRY +{ + address + afterword % the added field + archive + author + booktitle + by % the added field + chapter + collaboration + comment % the added field + commentator % the added field + compiler % the added field + doi + edition + editor + eid + eprint + foreword % the added field + howpublished + impression % the added field + institution + introduction % the added field + isbn + issn + issue % the added field + journal + key + language + month + note + number + numpages + organization + pages + preface % the added field + publisher + school + series + title + translator % the added field + translateyear % the added field + type + url + urldate % the added field + volume + volumes % the added field + year +} +{} +{ + label + sort.label + short.list +} + + + + + +% Logical operators + +FUNCTION {not} +{ + { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ + { pop$ #1 } + 'skip$ + if$ +} + + + + + +% Here are the language-specific definitions for explicit words. +% Each function has a name bbl.xxx where xxx is the English word. + +FUNCTION {bbl.afterwordby} +{ "afterword by" } + +FUNCTION {bbl.and} +{ "and" } + +FUNCTION {bbl.andothers} +{ "and~others" } + +FUNCTION {bbl.by} +{ "by" } + +FUNCTION {bbl.chapter} +{ "chapter" } + +FUNCTION {bbl.comma} +{ "," } + +FUNCTION {bbl.commentator} +{ "comm." } + +FUNCTION {bbl.commentatedby} +{ "commentated by" } + +FUNCTION {bbl.compiler} +{ "comp." } + +FUNCTION {bbl.compilers} +{ "comps." } + +FUNCTION {bbl.compiledby} +{ "compiled by" } + +FUNCTION {bbl.doi} +{ "doi" } + +FUNCTION {bbl.dquote} +{ "\enquote{" swap$ * add.period$ "}" * } + +FUNCTION {bbl.editor} +{ "ed." } + +FUNCTION {bbl.editors} +{ "eds." } + +FUNCTION {bbl.editedby} +{ "edited by" } + +FUNCTION {bbl.edition} +{ "edn." } + +FUNCTION {bbl.eidpp} +{ "pages" } + +FUNCTION {bbl.etal} +{ "et~al." } + +FUNCTION {bbl.forewordby} +{ "forword by" } + +FUNCTION {bbl.impression} +{ "imp." } + +FUNCTION {bbl.in} +{ "in" } + +FUNCTION {bbl.incollaborationwith} +{ "in collaboration with" } + +FUNCTION {bbl.introby} +{ "introduction by" } + +FUNCTION {bbl.isbn} +{ "isbn" } + +FUNCTION {bbl.issn} +{ "issn" } + +FUNCTION {bbl.mthesis} +{ "Master's thesis" } + +FUNCTION {bbl.nr} +{ "no." } + +FUNCTION {bbl.number} +{ "no." } + +FUNCTION {bbl.of} +{ "of" } + +FUNCTION {bbl.page} +{ "p." } + +FUNCTION {bbl.pages} +{ "pp." } + +FUNCTION {bbl.prefaceby} +{ "preface by" } + +FUNCTION {bbl.phdthesis} +{ "PhD dissertation" } + +FUNCTION {bbl.retrieved} +{ "retrieved" } + +FUNCTION {bbl.semicolon} +{ ";" } + +FUNCTION {bbl.techrep} +{ "tech. rep." } + +FUNCTION {bbl.thesis} +{ "Thesis" } + +FUNCTION {bbl.translator} +{ "trans." } + +FUNCTION {bbl.translators} +{ "trans." } + +FUNCTION {bbl.translatedby} +{ "translated by" } + +FUNCTION {bbl.url} +{ "url" } + +FUNCTION {bbl.volume} +{ "vol." } + +FUNCTION {bbl.volumes} +{ "vols." } + + + + + +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + +% Functions to declare position + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + + +% Functions to print output + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ + 's := + output.state mid.sentence = + { bbl.comma * " " * write$ } + { + output.state after.block = + { + add.period$ write$ + newline$ + "\newblock " write$ + } + { + output.state before.all = + 'write$ + { add.period$ write$ " " write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ + duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ + 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + + + + + +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries + +FUNCTION {new.block} +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + +FUNCTION {new.sentence} +{ + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + + + +FUNCTION {add.blank} +{ + " " * before.all 'output.state := +} + + + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + + + +FUNCTION {date.block} +{ + new.block +} + + + +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + +FUNCTION {non.stop} +{ + duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + + + +STRINGS {z} + +FUNCTION {remove.dots} +{ + 'z := + "" + { + z empty$ not + } + { + z #1 #2 substring$ + duplicate$ "\." = + { + z #3 global.max$ substring$ 'z := * + } + { + pop$ + z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = + 'pop$ + { * } + if$ + } + if$ + } + while$ +} + + + +FUNCTION {separate.by.space} +{ " " swap$ * " " * } + + + +FUNCTION {space.word} +{ " " swap$ * " " * } + + + +FUNCTION {tie.or.space.prefix} +{ + duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + + + +FUNCTION {word.in} +{ + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } + if$ +} + + + + + +% Functions to format names + +INTEGERS { nameptr namesleft numnames } + +STRINGS { bibinfo} + +FUNCTION {format.names} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + duplicate$ #1 > + { "{ff~}{vv~}{ll}{, jj}" } + { "{vv~}{ll}{, ff}{, jj}" } + if$ + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{ff~}{vv~}{ll}{, jj}" + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.key} +{ + empty$ + { key field.or.null } + { "" } + if$ +} + + + +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + + + +STRINGS {oldname} + +FUNCTION {name.or.dash} +{ + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } + if$ +} + + + + + +% Functions to create the short name label for the entry + +FUNCTION {format.short.label.names} +{ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > + { + " " * bbl.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * bbl.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * " " * s #2 "{vv~}{ll}" format.name$ * + bbl.comma * bbl.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'short.list := +} + + + + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} +{ + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal * + } + { + numnames #2 > + { bbl.comma * } + 'skip$ + if$ + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {author.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.full.label.names} +{ + type$ "book" = + 'book.full.label.names + { + type$ "incollection" = + 'incoll.full.label.names + { + type$ "article" = + 'article.full.label.names + { + type$ "proceedings" = + 'proc.full.label.names + { + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + "\bibitem[{" write$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + + + +FUNCTION {end.bibitem} +{ + add.period$ write$ + newline$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + "edition" bibinfo.check + " " * bbl.edition * + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + " " * bbl.impression * + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { + output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify + } + { + } + if$ + "pages" bibinfo.check + } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not + { + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.btitle} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {field.title.dqoute} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {get.bbl.translator} +{ + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator + if$ +} + +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} + + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} +{ + volume empty$ + { "" } + { + bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ + 'pop$ + { emphasize ", " * swap$ * } + if$ + "volume and number" number either.or.check + } + if$ +} + + + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} +{ + volume empty$ + { + number empty$ + { series field.or.null } + { + series empty$ + { number "number" bibinfo.check } + { + output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} +{ + volume empty$ not + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * add.period$ + } + if$ + } + if$ + } + if$ + } + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + " " * number * + } + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + } + if$ + } + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + volumes "~" * bbl.volumes * add.period$ + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + series + " " * number * + } + { + series + } + if$ + } + { + number empty$ not + { + bbl.number "~" * number * + } + { + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} +{ + booktitle empty$ not + { + chapter empty$ not + { + bbl.chapter capitalize "~" * chapter * + " " * bbl.in * " " * field.booktitle * + pages empty$ not + { + bbl.comma * " " * pages * add.period$ + } + { + add.period$ + } + if$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + { + word.in field.booktitle * + pages empty$ not + { + volume empty$ not + { + volumes empty$ not + { + " " * volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + " " * volume * ": " * pages * add.period$ + } + if$ + } + { + volumes empty$ not + { + bbl.comma * " " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + bbl.comma * " " * pages * add.period$ + } + if$ + } + if$ + } + { + add.period$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + compiler empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + editor empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + if$ + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} +{ + booktitle empty$ not + { + volume empty$ not + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * add.period$ + volumes * "~" * bbl.volumes + } + { + field.booktitle " " * add.period$ + " " * volumes * "~" * bbl.volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * + } + { + field.booktitle + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +FUNCTION {inproc.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} +{ + series empty$ not + { + number empty$ not + { + pages empty$ not + { + series + bbl.comma * " " * bbl.number * "~" * number * + bbl.comma * " " * pages * + } + { + series + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + series + bbl.comma * " " * pages * + } + { series } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} +{ + type duplicate$ empty$ + 'pop$ + { + swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} + + + +FUNCTION {thesis.fields.school.type.address} +{ + type empty$ + { + type$ "mastersthesis" = + { bbl.mthesis "t" change.case$ } + { + type$ "phdthesis" = + { bbl.phdthesis "t" change.case$ } + { bbl.thesis "t" change.case$ } + if$ + } + if$ + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + { + type "~" = + { + school empty$ not + { + address empty$ not + { school bbl.comma * " " * address * } + { school } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + { + type + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {unpub.field.title} +{ + title empty$ not + { title bbl.dquote } + 'skip$ + if$ +} + + + +FUNCTION {misc.field.title} +{ + title empty$ not + { title } + 'skip$ + if$ +} + + + + + +% Functions to format entries based on type (compatible entries) + +FUNCTION {book} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {incollection} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {article} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not + { + article.field.journal output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {inproceedings} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author field is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {conference} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {thesis} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {mastersthesis} { thesis } + + + +FUNCTION {phdthesis} { thesis } + + + +FUNCTION {unpublished} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {misc} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + + + +% Functions to format entries based on type (incompatible entries) + +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + author empty$ + { field.editor "author and editor" output.check + editor format.key output + name.or.dash + } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + field.year "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + field.edition output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + + + +% Function to format entry if the type is not recognized + +FUNCTION {default.type} { misc } + + + + + + + + + + + + + + + + + + + + +% Reading bibliography database (.bib) file + +READ + + +% Function to generate a string that is suitable for sorting purposes + +FUNCTION {sortify} +{ + purify$ + "l" change.case$ +} + + + +% Length of the short name label of the entry + +INTEGERS { len } + +FUNCTION {chop.word} +{ + 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + + + + + +% Functions for sorting purposes + +FUNCTION {sort.format.names} +{ + 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ + 't := + nameptr #1 > + { + " " * + namesleft #1 = + t "others" = + and + { "zzzzz" 't := } + 'skip$ + if$ + t sortify * + } + { + t sortify * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {sort.field.title} +{ + 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + + + +FUNCTION {author.sort} +{ + author empty$ + { + key empty$ + { + "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + + + + +FUNCTION {author.editor.sort} +{ + author empty$ + { + editor empty$ + { + key empty$ + { + "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + + + +FUNCTION {editor.sort} +{ + editor empty$ + { + key empty$ + { + "to sort, need editor or key in " cite$ * warning$ + "" + } + { + key sortify + } + if$ + } + { + editor sort.format.names + } + if$ +} + + + +FUNCTION {book.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.sort} +{ + author empty$ not + { + author sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.sort} +{ + editor empty$ not + { editor sort.format.names } + { + compiler empty$ not + { compiler sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num := } + +EXECUTE {init.seq} + + + +FUNCTION {int.to.fix} +{ + "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + + + +FUNCTION {presort} +{ + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + + + +% Sort process + +ITERATE {presort} + +SORT + + + +INTEGERS { number.label } + +FUNCTION {initialize.longest.label} +{ + #0 'number.label := +} + +FUNCTION {forward.pass} +{ + number.label #1 + 'number.label := +} + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + + + +FUNCTION {bib.sort.order} +{ + sort.label + 'sort.key$ := +} + + + +ITERATE {bib.sort.order} + +SORT + + + + +% Functions to create bibliography +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + "% Generated by `iranlatin-unsrt.bst`." write$ + newline$ + "% This bibliography style is part of the `iran-bibtex` package." write$ + newline$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + newline$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + newline$ + newline$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ + newline$ +} + + + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + + + +FUNCTION {end.bib} +{ + newline$ + "\end{thebibliography}" write$ + newline$ +} + + + +EXECUTE {end.bib} + + + +%% +%% End of file `iranlatin-unsrt.bst'.
\ No newline at end of file diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-year.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-year.bst new file mode 100644 index 00000000000..fe31ac79885 --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-year.bst @@ -0,0 +1,4665 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This file is “iranlatin-year.bst”, v0.1.0 (2024/01/8) +%% created by modifying “iranlatin.bst” file in accordance with the +%% “Iran Manual of Style Citation Guide” (1st edn., 2016) to support +%% English/Latin only. +%% +%% +%% +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> +%% +%% This file can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of the License is at: latex-project.org/lppl.txt +%% +%% This BibTeX bibliography style (bst) file is part of +%% the “iran-bibtex” package. +%% +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% +%% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in ENGLISH. +%% This is an author-year citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they should appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => (Jones et al., 1990) +%% \citep*{key} => (Jones, Baker, and Smith, 1990) +%% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) +%% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) +%% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) +%% \citet{key} => Jones et al. (1990) +%% \citet*{key} => Jones, Baker, and Smith (1990) +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- + + + +ENTRY +{ + address + afterword % the added field + archive + author + booktitle + by % the added field + chapter + collaboration + comment % the added field + commentator % the added field + compiler % the added field + doi + edition + editor + eid + eprint + foreword % the added field + howpublished + impression % the added field + institution + introduction % the added field + isbn + issn + issue % the added field + journal + key + language + month + note + number + numpages + organization + pages + preface % the added field + publisher + school + series + title + translator % the added field + translateyear % the added field + type + url + urldate % the added field + volume + volumes % the added field + year +} +{} +{ + label + extra.label + sort.label + short.list +} + + + + + +% Logical operators + +FUNCTION {not} +{ + { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ + { pop$ #1 } + 'skip$ + if$ +} + + + + + +% Here are the language-specific definitions for explicit words. +% Each function has a name bbl.xxx where xxx is the English word. + +FUNCTION {bbl.afterwordby} +{ "afterword by" } + +FUNCTION {bbl.and} +{ "and" } + +FUNCTION {bbl.andothers} +{ "and~others" } + +FUNCTION {bbl.by} +{ "by" } + +FUNCTION {bbl.chapter} +{ "chapter" } + +FUNCTION {bbl.comma} +{ "," } + +FUNCTION {bbl.commentator} +{ "comm." } + +FUNCTION {bbl.commentatedby} +{ "commentated by" } + +FUNCTION {bbl.compiler} +{ "comp." } + +FUNCTION {bbl.compilers} +{ "comps." } + +FUNCTION {bbl.compiledby} +{ "compiled by" } + +FUNCTION {bbl.doi} +{ "doi" } + +FUNCTION {bbl.dquote} +{ "\enquote{" swap$ * add.period$ "}" * } + +FUNCTION {bbl.editor} +{ "ed." } + +FUNCTION {bbl.editors} +{ "eds." } + +FUNCTION {bbl.editedby} +{ "edited by" } + +FUNCTION {bbl.edition} +{ "edn." } + +FUNCTION {bbl.eidpp} +{ "pages" } + +FUNCTION {bbl.etal} +{ "et~al." } + +FUNCTION {bbl.forewordby} +{ "forword by" } + +FUNCTION {bbl.impression} +{ "imp." } + +FUNCTION {bbl.in} +{ "in" } + +FUNCTION {bbl.incollaborationwith} +{ "in collaboration with" } + +FUNCTION {bbl.introby} +{ "introduction by" } + +FUNCTION {bbl.isbn} +{ "isbn" } + +FUNCTION {bbl.issn} +{ "issn" } + +FUNCTION {bbl.mthesis} +{ "Master's thesis" } + +FUNCTION {bbl.nr} +{ "no." } + +FUNCTION {bbl.number} +{ "no." } + +FUNCTION {bbl.of} +{ "of" } + +FUNCTION {bbl.page} +{ "p." } + +FUNCTION {bbl.pages} +{ "pp." } + +FUNCTION {bbl.prefaceby} +{ "preface by" } + +FUNCTION {bbl.phdthesis} +{ "PhD dissertation" } + +FUNCTION {bbl.retrieved} +{ "retrieved" } + +FUNCTION {bbl.semicolon} +{ ";" } + +FUNCTION {bbl.techrep} +{ "tech. rep." } + +FUNCTION {bbl.thesis} +{ "Thesis" } + +FUNCTION {bbl.translator} +{ "trans." } + +FUNCTION {bbl.translators} +{ "trans." } + +FUNCTION {bbl.translatedby} +{ "translated by" } + +FUNCTION {bbl.url} +{ "url" } + +FUNCTION {bbl.volume} +{ "vol." } + +FUNCTION {bbl.volumes} +{ "vols." } + + + + + +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + +% Functions to declare position + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + + +% Functions to print output + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ + 's := + output.state mid.sentence = + { bbl.comma * " " * write$ } + { + output.state after.block = + { + add.period$ write$ + newline$ + "\newblock " write$ + } + { + output.state before.all = + 'write$ + { add.period$ write$ " " write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ + duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ + 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + + + + + +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries + +FUNCTION {new.block} +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + +FUNCTION {new.sentence} +{ + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + + + +FUNCTION {add.blank} +{ + " " * before.all 'output.state := +} + + + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + + + +FUNCTION {date.block} +{ + new.block +} + + + +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + +FUNCTION {non.stop} +{ + duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + + + +STRINGS {z} + +FUNCTION {remove.dots} +{ + 'z := + "" + { + z empty$ not + } + { + z #1 #2 substring$ + duplicate$ "\." = + { + z #3 global.max$ substring$ 'z := * + } + { + pop$ + z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = + 'pop$ + { * } + if$ + } + if$ + } + while$ +} + + + +FUNCTION {separate.by.space} +{ " " swap$ * " " * } + + + +FUNCTION {space.word} +{ " " swap$ * " " * } + + + +FUNCTION {tie.or.space.prefix} +{ + duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + + + +FUNCTION {word.in} +{ + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } + if$ +} + + + + + +% Functions to format names + +INTEGERS { nameptr namesleft numnames } + +STRINGS { bibinfo} + +FUNCTION {format.names} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + duplicate$ #1 > + { "{ff~}{vv~}{ll}{, jj}" } + { "{vv~}{ll}{, ff}{, jj}" } + if$ + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{ff~}{vv~}{ll}{, jj}" + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.key} +{ + empty$ + { key field.or.null } + { "" } + if$ +} + + + +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + + + +STRINGS {oldname} + +FUNCTION {name.or.dash} +{ + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } + if$ +} + + + + + +% Functions to create the short name label for the entry + +FUNCTION {format.short.label.names} +{ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > + { + " " * bbl.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * bbl.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * " " * s #2 "{vv~}{ll}" format.name$ * + bbl.comma * bbl.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'short.list := +} + + + + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} +{ + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal * + } + { + numnames #2 > + { bbl.comma * } + 'skip$ + if$ + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {author.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.full.label.names} +{ + type$ "book" = + 'book.full.label.names + { + type$ "incollection" = + 'incoll.full.label.names + { + type$ "article" = + 'article.full.label.names + { + type$ "proceedings" = + 'proc.full.label.names + { + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + translateyear empty$ + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + author empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + compiler empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + editor empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + translateyear duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + "\bibitem[{" write$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + + + +FUNCTION {end.bibitem} +{ + add.period$ write$ + newline$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + "edition" bibinfo.check + " " * bbl.edition * + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + " " * bbl.impression * + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { + output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify + } + { + } + if$ + "pages" bibinfo.check + } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not + { + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.btitle} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {field.title.dqoute} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {get.bbl.translator} +{ + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator + if$ +} + +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} + + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} +{ + volume empty$ + { "" } + { + bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ + 'pop$ + { emphasize ", " * swap$ * } + if$ + "volume and number" number either.or.check + } + if$ +} + + + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} +{ + volume empty$ + { + number empty$ + { series field.or.null } + { + series empty$ + { number "number" bibinfo.check } + { + output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} +{ + volume empty$ not + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * add.period$ + } + if$ + } + if$ + } + if$ + } + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + " " * number * + } + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + } + if$ + } + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + volumes "~" * bbl.volumes * add.period$ + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + series + " " * number * + } + { + series + } + if$ + } + { + number empty$ not + { + bbl.number "~" * number * + } + { + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} +{ + booktitle empty$ not + { + chapter empty$ not + { + bbl.chapter capitalize "~" * chapter * + " " * bbl.in * " " * field.booktitle * + pages empty$ not + { + bbl.comma * " " * pages * add.period$ + } + { + add.period$ + } + if$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + { + word.in field.booktitle * + pages empty$ not + { + volume empty$ not + { + volumes empty$ not + { + " " * volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + " " * volume * ": " * pages * add.period$ + } + if$ + } + { + volumes empty$ not + { + bbl.comma * " " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + bbl.comma * " " * pages * add.period$ + } + if$ + } + if$ + } + { + add.period$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + compiler empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + editor empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + if$ + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} +{ + booktitle empty$ not + { + volume empty$ not + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * add.period$ + volumes * "~" * bbl.volumes + } + { + field.booktitle " " * add.period$ + " " * volumes * "~" * bbl.volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * + } + { + field.booktitle + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +FUNCTION {inproc.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} +{ + series empty$ not + { + number empty$ not + { + pages empty$ not + { + series + bbl.comma * " " * bbl.number * "~" * number * + bbl.comma * " " * pages * + } + { + series + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + series + bbl.comma * " " * pages * + } + { series } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} +{ + type duplicate$ empty$ + 'pop$ + { + swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} + + + +FUNCTION {thesis.fields.school.type.address} +{ + type empty$ + { + type$ "mastersthesis" = + { bbl.mthesis "t" change.case$ } + { + type$ "phdthesis" = + { bbl.phdthesis "t" change.case$ } + { bbl.thesis "t" change.case$ } + if$ + } + if$ + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + { + type "~" = + { + school empty$ not + { + address empty$ not + { school bbl.comma * " " * address * } + { school } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + { + type + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {unpub.field.title} +{ + title empty$ not + { title bbl.dquote } + 'skip$ + if$ +} + + + +FUNCTION {misc.field.title} +{ + title empty$ not + { title } + 'skip$ + if$ +} + + + + + +% Functions to format entries based on type (compatible entries) + +FUNCTION {book} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {incollection} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {article} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not + { + article.field.journal output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {inproceedings} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author field is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {conference} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {thesis} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {mastersthesis} { thesis } + + + +FUNCTION {phdthesis} { thesis } + + + +FUNCTION {unpublished} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {misc} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + + + +% Functions to format entries based on type (incompatible entries) + +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + author empty$ + { field.editor "author and editor" output.check + editor format.key output + name.or.dash + } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + field.edition output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + + + +% Function to format entry if the type is not recognized + +FUNCTION {default.type} { misc } + + + + + + + + + + + + + + + + + + + + +% Reading bibliography database (.bib) file + +READ + + +% Function to generate a string that is suitable for sorting purposes + +FUNCTION {sortify} +{ + purify$ + "l" change.case$ +} + + + +% Length of the short name label of the entry + +INTEGERS { len } + +FUNCTION {chop.word} +{ + 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + + + + + +% Functions for sorting purposes + +FUNCTION {sort.format.names} +{ + 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ + 't := + nameptr #1 > + { + " " * + namesleft #1 = + t "others" = + and + { "zzzzz" 't := } + 'skip$ + if$ + t sortify * + } + { + t sortify * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {sort.field.title} +{ + 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + + + +FUNCTION {author.sort} +{ + author empty$ + { + key empty$ + { + "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + + + + +FUNCTION {author.editor.sort} +{ + author empty$ + { + editor empty$ + { + key empty$ + { + "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + + + +FUNCTION {editor.sort} +{ + editor empty$ + { + key empty$ + { + "to sort, need editor or key in " cite$ * warning$ + "" + } + { + key sortify + } + if$ + } + { + editor sort.format.names + } + if$ +} + + + +FUNCTION {book.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.sort} +{ + author empty$ not + { + author sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.sort} +{ + editor empty$ not + { editor sort.format.names } + { + compiler empty$ not + { compiler sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {presort} +{ + calc.label + label sortify + " " + * + type$ "book" = + 'book.sort + { + type$ "incollection" = + 'incoll.sort + { + type$ "article" = + 'article.sort + { + type$ "proceedings" = + 'proc.sort + { + type$ "inproceedings" = + 'inproc.sort + { + type$ "conference" = + 'conf.sort + { + type$ "inbook" = + 'author.editor.sort + 'author.sort + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + #1 entry.max$ substring$ + 'sort.label := + sort.label + * + " " + * + translateyear empty$ + { year field.or.null } + { + author empty$ not + { year field.or.null } + { + compiler empty$ not + { year field.or.null } + { + editor empty$ not + { year field.or.null } + { + translator empty$ not + { translateyear field.or.null } + { year field.or.null } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + + + +% Sort process + +ITERATE {presort} + +SORT + + + +STRINGS { last.label next.extra } + +INTEGERS { last.extra.num last.extra.num.extended last.extra.num.blank number.label } + +FUNCTION {initialize.extra.label.stuff} +{ + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'last.extra.num := + "a" chr.to.int$ #1 - 'last.extra.num.blank := + last.extra.num.blank 'last.extra.num.extended := + #0 'number.label := +} + + + +FUNCTION {forward.pass} +{ + last.label label = + { + last.extra.num #1 + 'last.extra.num := + last.extra.num "z" chr.to.int$ > + { + "a" chr.to.int$ 'last.extra.num := + last.extra.num.extended #1 + 'last.extra.num.extended := + } + 'skip$ + if$ + last.extra.num.extended last.extra.num.blank > + { + last.extra.num.extended int.to.chr$ + last.extra.num int.to.chr$ + * 'extra.label := + } + { + last.extra.num int.to.chr$ 'extra.label := + } + if$ + } + { + "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + + + +FUNCTION {reverse.pass} +{ + next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label duplicate$ empty$ + 'skip$ + { + "{\extrayearlabelen{" swap$ * "}}" * + } + if$ + 'extra.label := + label extra.label * 'label := +} + + + +EXECUTE {initialize.extra.label.stuff} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + + + +FUNCTION {bib.sort.order} +{ + sort.label + " " + * + translateyear empty$ + { year field.or.null sortify } + { + author empty$ not + { year field.or.null sortify } + { + compiler empty$ not + { year field.or.null sortify } + { + editor empty$ not + { year field.or.null sortify } + { + translator empty$ not + { translateyear field.or.null sortify } + { year field.or.null sortify } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + swap$ + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + +ITERATE {bib.sort.order} + +SORT + + + + +% Functions to create bibliography +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + "% Generated by `iranlatin-year.bst`." write$ + newline$ + "% This bibliography style is part of the `iran-bibtex` package." write$ + newline$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + newline$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + newline$ + newline$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ + newline$ +} + + + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + + + +FUNCTION {end.bib} +{ + newline$ + "\end{thebibliography}" write$ + newline$ +} + + + +EXECUTE {end.bib} + + + +%% +%% End of file `iranlatin-year.bst'.
\ No newline at end of file diff --git a/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin.bst b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin.bst new file mode 100644 index 00000000000..d56034edade --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin.bst @@ -0,0 +1,4637 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This file is “iranlatin.bst”, v0.1.0 (2024/01/8) +%% created by modifying “iran.bst” file in accordance with the +%% “Iran Manual of Style Citation Guide” (1st edn., 2016) to support +%% English/Latin only. +%% +%% +%% +%% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com> +%% +%% This file can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License version 1.3c, or any later version. +%% The latest version of the License is at: latex-project.org/lppl.txt +%% +%% This BibTeX bibliography style (bst) file is part of +%% the “iran-bibtex” package. +%% +%% CTAN catalog: https://ctan.org/pkg/iran-bibtex +%% CTAN archive: https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex +%% Repository: https://github.com/farshadrasuli/iran-bibtex +%% Bug tracker: https://github.com/farshadrasuli/iran-bibtex/issues +%% +%% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%----------------------------------------------------------------------------- +%% This bibliography style file is intended for texts in ENGLISH. +%% This is an author-year citation style bibliography. This style file is +%% based on natbib.sty package by Patrick W. Daly. +%% The form of the \bibitem entries is +%% \bibitem[Jones et al.(1990)]{key}... +%% \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... +%% The essential feature is that the label (the part in brackets) consists +%% of the author names, as they should appear in the citation, with the year +%% in parentheses following. There must be no space before the opening +%% parenthesis! +%% +%% The \cite command functions as follows (\cite is equal to \citep command): +%% \citep{key} => (Jones et al., 1990) +%% \citep*{key} => (Jones, Baker, and Smith, 1990) +%% \citep[chap. 2]{key} => (Jones et al., 1990, chap. 2) +%% \citep[e.g.][]{key} => (e.g. Jones et al., 1990) +%% \citep[e.g.][p. 32]{key} => (e.g. Jones et al., 1990, p. 32) +%% \citet{key} => Jones et al. (1990) +%% \citet*{key} => Jones, Baker, and Smith (1990) +%% \citeauthor{key} => Jones et al. +%% \citeauthor*{key} => Jones, Baker, and Smith +%% \citeyear{key} => 1990 +%%----------------------------------------------------------------------------- + + + +ENTRY +{ + address + afterword % the added field + archive + author + booktitle + by % the added field + chapter + collaboration + comment % the added field + commentator % the added field + compiler % the added field + doi + edition + editor + eid + eprint + foreword % the added field + howpublished + impression % the added field + institution + introduction % the added field + isbn + issn + issue % the added field + journal + key + language + month + note + number + numpages + organization + pages + preface % the added field + publisher + school + series + title + translator % the added field + translateyear % the added field + type + url + urldate % the added field + volume + volumes % the added field + year +} +{} +{ + label + extra.label + sort.label + short.list +} + + + + + +% Logical operators + +FUNCTION {not} +{ + { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ + { pop$ #1 } + 'skip$ + if$ +} + + + + + +% Here are the language-specific definitions for explicit words. +% Each function has a name bbl.xxx where xxx is the English word. + +FUNCTION {bbl.afterwordby} +{ "afterword by" } + +FUNCTION {bbl.and} +{ "and" } + +FUNCTION {bbl.andothers} +{ "and~others" } + +FUNCTION {bbl.by} +{ "by" } + +FUNCTION {bbl.chapter} +{ "chapter" } + +FUNCTION {bbl.comma} +{ "," } + +FUNCTION {bbl.commentator} +{ "comm." } + +FUNCTION {bbl.commentatedby} +{ "commentated by" } + +FUNCTION {bbl.compiler} +{ "comp." } + +FUNCTION {bbl.compilers} +{ "comps." } + +FUNCTION {bbl.compiledby} +{ "compiled by" } + +FUNCTION {bbl.doi} +{ "doi" } + +FUNCTION {bbl.dquote} +{ "\enquote{" swap$ * add.period$ "}" * } + +FUNCTION {bbl.editor} +{ "ed." } + +FUNCTION {bbl.editors} +{ "eds." } + +FUNCTION {bbl.editedby} +{ "edited by" } + +FUNCTION {bbl.edition} +{ "edn." } + +FUNCTION {bbl.eidpp} +{ "pages" } + +FUNCTION {bbl.etal} +{ "et~al." } + +FUNCTION {bbl.forewordby} +{ "forword by" } + +FUNCTION {bbl.impression} +{ "imp." } + +FUNCTION {bbl.in} +{ "in" } + +FUNCTION {bbl.incollaborationwith} +{ "in collaboration with" } + +FUNCTION {bbl.introby} +{ "introduction by" } + +FUNCTION {bbl.isbn} +{ "isbn" } + +FUNCTION {bbl.issn} +{ "issn" } + +FUNCTION {bbl.mthesis} +{ "Master's thesis" } + +FUNCTION {bbl.nr} +{ "no." } + +FUNCTION {bbl.number} +{ "no." } + +FUNCTION {bbl.of} +{ "of" } + +FUNCTION {bbl.page} +{ "p." } + +FUNCTION {bbl.pages} +{ "pp." } + +FUNCTION {bbl.prefaceby} +{ "preface by" } + +FUNCTION {bbl.phdthesis} +{ "PhD dissertation" } + +FUNCTION {bbl.retrieved} +{ "retrieved" } + +FUNCTION {bbl.semicolon} +{ ";" } + +FUNCTION {bbl.techrep} +{ "tech. rep." } + +FUNCTION {bbl.thesis} +{ "Thesis" } + +FUNCTION {bbl.translator} +{ "trans." } + +FUNCTION {bbl.translators} +{ "trans." } + +FUNCTION {bbl.translatedby} +{ "translated by" } + +FUNCTION {bbl.url} +{ "url" } + +FUNCTION {bbl.volume} +{ "vol." } + +FUNCTION {bbl.volumes} +{ "vols." } + + + + + +% Macro for abbreviation of month + +MACRO {jan} {"Jan"} + +MACRO {feb} {"Feb"} + +MACRO {mar} {"Mar"} + +MACRO {apr} {"Apr"} + +MACRO {may} {"May"} + +MACRO {jun} {"Jun"} + +MACRO {jul} {"Jul"} + +MACRO {aug} {"Aug"} + +MACRO {sep} {"Sep"} + +MACRO {oct} {"Oct"} + +MACRO {nov} {"Nov"} + +MACRO {dec} {"Dec"} + + + + + +% Functions to declare position + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +FUNCTION {init.state.consts} +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + + + +% Functions to print output + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ + 's := + output.state mid.sentence = + { bbl.comma * " " * write$ } + { + output.state after.block = + { + add.period$ write$ + newline$ + "\newblock " write$ + } + { + output.state before.all = + 'write$ + { add.period$ write$ " " write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ + duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.check} +{ + 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + + + + + +% Functions to check and warn bibinfo + +FUNCTION {bibinfo.check} +{ + swap$ + duplicate$ missing$ + { + pop$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ pop$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + +FUNCTION {bibinfo.warn} +{ + swap$ + duplicate$ missing$ + { + swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ + "" + } + { + duplicate$ empty$ + { + swap$ "empty " swap$ * " in " * cite$ * warning$ + } + { + swap$ + pop$ + } + if$ + } + if$ +} + + + +FUNCTION {either.or.check} +{ + empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + + + + + +% Functions to control the print format of entries + +FUNCTION {new.block} +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + + + +FUNCTION {new.block.checkb} +{ + empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + + + +FUNCTION {new.sentence} +{ + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + + + +FUNCTION {add.blank} +{ + " " * before.all 'output.state := +} + + + +FUNCTION {capitalize} +{ "u" change.case$ "t" change.case$ } + + + +FUNCTION {date.block} +{ + new.block +} + + + +FUNCTION {emphasize} +{ + duplicate$ empty$ + { pop$ "" } + { "{\it " swap$ * "}" * } + if$ +} + + + +FUNCTION {field.or.null} +{ + duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + + + +FUNCTION {no.blank.or.punct} +{ + "\hspace{0pt}" * before.all 'output.state := +} + + + +FUNCTION {non.stop} +{ + duplicate$ + "}" * add.period$ + #-1 #1 substring$ "." = +} + + + +STRINGS {z} + +FUNCTION {remove.dots} +{ + 'z := + "" + { + z empty$ not + } + { + z #1 #2 substring$ + duplicate$ "\." = + { + z #3 global.max$ substring$ 'z := * + } + { + pop$ + z #1 #1 substring$ + z #2 global.max$ substring$ 'z := + duplicate$ "." = + 'pop$ + { * } + if$ + } + if$ + } + while$ +} + + + +FUNCTION {separate.by.space} +{ " " swap$ * " " * } + + + +FUNCTION {space.word} +{ " " swap$ * " " * } + + + +FUNCTION {tie.or.space.prefix} +{ + duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ +} + + + +FUNCTION {word.in} +{ + output.state mid.sentence = + { bbl.in " " * } + { bbl.in capitalize " " * } + if$ +} + + + + + +% Functions to format names + +INTEGERS { nameptr namesleft numnames } + +STRINGS { bibinfo} + +FUNCTION {format.names} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + duplicate$ #1 > + { "{ff~}{vv~}{ll}{, jj}" } + { "{vv~}{ll}{, ff}{, jj}" } + if$ + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.names.ed} +{ + 'bibinfo := + duplicate$ empty$ + 'skip$ + { + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{ff~}{vv~}{ll}{, jj}" + format.name$ + bibinfo bibinfo.check + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + bbl.comma * + t "others" = + { + + " " * bbl.etal * + } + { + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + } + if$ +} + + + +FUNCTION {format.key} +{ + empty$ + { key field.or.null } + { "" } + if$ +} + + + +FUNCTION {n.dashify} +{ + 't := + "" + { + t empty$ not + } + { + t #1 #1 substring$ + "-" = + { + t #1 #2 substring$ + "--" = not + { + "--" * + t #2 global.max$ substring$ 't := + } + { + { + t #1 #1 substring$ "-" = + } + { + "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { + t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + + + +STRINGS {oldname} + +FUNCTION {name.or.dash} +{ + 's := + oldname empty$ + { s 'oldname := s } + { + s oldname = + { "---{}---{}---" } + { s 'oldname := s } + if$ + } + if$ +} + + + + + +% Functions to create the short name label for the entry + +FUNCTION {format.short.label.names} +{ + 's := + "" 't := + s #1 "{vv~}{ll}" format.name$ + s num.names$ #3 > + { + " " * bbl.etal * + } + { + s num.names$ #2 < + 'skip$ + { + s num.names$ #3 < + { + s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * bbl.and separate.by.space * s #2 "{vv~}{ll}" format.name$ * + } + if$ + } + { + s #3 "{ff }{vv }{ll}{ jj}" format.name$ "others" = + { + " " * bbl.etal * + } + { + bbl.comma * " " * s #2 "{vv~}{ll}" format.name$ * + bbl.comma * bbl.and separate.by.space * s #3 "{vv~}{ll}" format.name$ * + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {author.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + editor empty$ not + { editor format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.short.label.names} +{ + editor empty$ not + { editor format.short.label.names } + { + compiler empty$ not + { compiler format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.short.label.names} +{ + author empty$ not + { author format.short.label.names } + { + translator empty$ not + { translator format.short.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.short.label.names} +{ + type$ "book" = + 'book.short.label.names + { + type$ "incollection" = + 'incoll.short.label.names + { + type$ "article" = + 'article.short.label.names + { + type$ "proceedings" = + 'proc.short.label.names + { + type$ "inproceedings" = + 'inproc.short.label.names + { + type$ "conference" = + 'conf.short.label.names + { + type$ "inbook" = + 'author.editor.key.short.label.names + 'author.key.short.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'short.list := +} + + + + + +% Functions to create the full name label for the entry + +FUNCTION {format.full.label.names} +{ + 's := + "" 't := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv~}{ll}" format.name$ + 't := + nameptr #1 > + { + namesleft #1 > + { + bbl.comma * " " * t * + } + { + s nameptr "{ll}" format.name$ + duplicate$ "others" = + { 't := } + { pop$ } + if$ + t "others" = + { + " " * bbl.etal * + } + { + numnames #2 > + { bbl.comma * } + 'skip$ + if$ + bbl.and + separate.by.space * t * + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {author.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {author.editor.key.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {editor.key.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ +} + + + +FUNCTION {book.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + editor empty$ not + { editor format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.full.label.names} +{ + editor empty$ not + { editor format.full.label.names } + { + compiler empty$ not + { compiler format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.full.label.names} +{ + author empty$ not + { author format.full.label.names } + { + translator empty$ not + { translator format.full.label.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {make.full.label.names} +{ + type$ "book" = + 'book.full.label.names + { + type$ "incollection" = + 'incoll.full.label.names + { + type$ "article" = + 'article.full.label.names + { + type$ "proceedings" = + 'proc.full.label.names + { + type$ "inproceedings" = + 'inproc.full.label.names + { + type$ "conference" = + 'conf.full.label.names + { + type$ "inbook" = + 'author.editor.key.full.label.names + 'author.key.full.label.names + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + + + +% Functions to create the label of the entry + +FUNCTION {calc.label} +{ + make.short.label.names + short.list "(" * + translateyear empty$ + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + author empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + compiler empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + editor empty$ not + { + year duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + { + translateyear duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + 'label := +} + + + + + +% Functions to open, and close the bibitem + +FUNCTION {begin.bibitem} +{ + newline$ + "\bibitem[{" write$ + label write$ + ")" + make.full.label.names duplicate$ short.list = + { pop$ } + { * } + if$ + "}]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + + + +FUNCTION {end.bibitem} +{ + add.period$ write$ + newline$ +} + + + + + +% Functions to format fields + +FUNCTION {field.afterword} +{ + afterword empty$ not + { + afterword "afterword" format.names.ed + bbl.afterwordby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.author} +{ author "author" format.names } + + + +FUNCTION {field.booktitle} +{ + booktitle "booktitle" bibinfo.check + emphasize +} + + + +FUNCTION {field.by} +{ + by empty$ not + { + by "by" format.names.ed + bbl.by " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.collaboration} +{ + collaboration empty$ not + { + collaboration "collaboration" format.names.ed + bbl.incollaborationwith capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.comment} +{ + comment +} + + + +FUNCTION {field.commentator} +{ + commentator empty$ not + { + commentator "commentator" format.names.ed + bbl.commentatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {get.bbl.compiler} +{ + compiler num.names$ #1 > + 'bbl.compilers + 'bbl.compiler + if$ +} + +FUNCTION {field.compiler} +{ + compiler "compiler" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.compiler * + } + if$ +} + + + +FUNCTION {field.compiler.compiledby} +{ + compiler empty$ not + { + compiler "compiler" format.names.ed + bbl.compiledby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.doi} +{ + doi empty$ + { "" } + { + bbl.doi "u" change.case$ ":\doi{" * doi * "}" * + } + if$ +} + + + +FUNCTION {field.edition} +{ + edition duplicate$ empty$ + 'skip$ + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + "edition" bibinfo.check + " " * bbl.edition * + } + if$ +} + + + +FUNCTION {get.bbl.editor} +{ + editor num.names$ #1 > + 'bbl.editors + 'bbl.editor + if$ +} + +FUNCTION {field.editor} +{ + editor "editor" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.editor * + } + if$ +} + + + +FUNCTION {field.editor.editedby} +{ + editor empty$ not + { + editor "editor" format.names.ed + bbl.editedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.eprint} +{ + eprint duplicate$ empty$ + 'skip$ + { + "\eprint" + archive empty$ + 'skip$ + { "[" * archive * "]" * } + if$ + "{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.howpublished} +{ + howpublished +} + + + +FUNCTION {field.impression} +{ + impression duplicate$ empty$ not + { + output.state mid.sentence = + { "l" } + { "t" } + if$ + change.case$ + " " * bbl.impression * + } + 'skip$ + if$ +} + + + +FUNCTION {field.introduction} +{ + introduction empty$ not + { + introduction "introduction" format.names.ed + bbl.introby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.isbn} +{ + isbn "isbn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.isbn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.issn} +{ + issn "issn" bibinfo.check + duplicate$ empty$ + 'skip$ + { + bbl.issn "u" change.case$ ": " * swap$ * + } + if$ +} + + + +FUNCTION {field.note} +{ + note empty$ not + { + note #1 #1 substring$ + duplicate$ "{" = + 'skip$ + { + output.state mid.sentence = + { "l" } + { "u" } + if$ + change.case$ + } + if$ + note #2 global.max$ substring$ * "note" bibinfo.check + } + { "" } + if$ +} + + + +FUNCTION {field.organization} +{ + organization "organization" bibinfo.check +} + + + +INTEGERS { multiresult } + +FUNCTION {field.pages.check.multipage} +{ + 't := + #0 'multiresult := + { + multiresult not + t empty$ not + and + } + { + t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + + + +FUNCTION {field.pages} +{ + pages duplicate$ empty$ + 'skip$ + { + duplicate$ field.pages.check.multipage + { + n.dashify + } + { + } + if$ + "pages" bibinfo.check + } + if$ +} + + + +FUNCTION {field.preface} +{ + preface empty$ not + { + preface "preface" format.names.ed + bbl.prefaceby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.title} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.btitle} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {field.title.dqoute} +{ + title + duplicate$ empty$ + 'skip$ + { bbl.dquote } + if$ +} + + + +FUNCTION {field.title.emph} +{ + title "title" bibinfo.check + duplicate$ empty$ + 'skip$ + { emphasize } + if$ +} + + + +FUNCTION {get.bbl.translator} +{ + translator num.names$ #1 > + 'bbl.translators + 'bbl.translator + if$ +} + +FUNCTION {field.translator} +{ + translator "translator" format.names + duplicate$ empty$ + 'skip$ + { + bbl.comma * " " * get.bbl.translator * + } + if$ +} + + +FUNCTION {field.translateyear} +{ + translateyear empty$ not + { + translateyear + } + { "" } + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {field.translator.translatedby} +{ + translator empty$ not + { + translator "translator" format.names.ed + bbl.translatedby capitalize " " * swap$ * + } + { "" } + if$ +} + + + +FUNCTION {field.url} +{ + url duplicate$ empty$ + { pop$ "" } + { + bbl.url "u" change.case$ ": \url{" * swap$ * "}" * + } + if$ +} + + + +FUNCTION {field.urldate} +{ + urldate duplicate$ empty$ + { pop$ "" } + { bbl.retrieved capitalize " " * swap$ * } + if$ +} + + + +FUNCTION {field.bvolume} +{ + volume empty$ + { "" } + { + bbl.volume volume tie.or.space.prefix + "volume" bibinfo.check * * + series "series" bibinfo.check + duplicate$ empty$ + 'pop$ + { emphasize ", " * swap$ * } + if$ + "volume and number" number either.or.check + } + if$ +} + + + +FUNCTION {field.year} +{ + year "year" bibinfo.check + duplicate$ empty$ + { + } + 'skip$ + if$ + before.all 'output.state := + after.sentence 'output.state := +} + + + +FUNCTION {in.ed.field.booktitle} % NOT USED +{ + field.booktitle + duplicate$ empty$ + 'skip$ + { + field.bvolume + duplicate$ empty$ + 'pop$ + { bbl.comma " " * swap$ * * } + if$ + editor "editor" format.names.ed + duplicate$ empty$ + 'pop$ + { + bbl.editedby capitalize " " * swap$ * + swap$ + add.period$ " " * swap$ * + } + if$ + word.in swap$ * + } + if$ +} + + + + + +% Functions to format combined fields + +FUNCTION {fields.journal.pages} +{ + pages duplicate$ empty$ 'pop$ + { + swap$ duplicate$ empty$ + { + pop$ pop$ field.pages + } + { + ": " * + swap$ + n.dashify + "pages" bibinfo.check + * + } + if$ + } + if$ +} + + + +FUNCTION {fields.journal.eid} +{ + eid "eid" bibinfo.check + duplicate$ empty$ + 'pop$ + { + swap$ + duplicate$ empty$ + 'skip$ + { + ": " * + } + if$ + swap$ * + numpages empty$ + 'skip$ + { + bbl.eidpp numpages tie.or.space.prefix + "numpages" bibinfo.check * * + " (" swap$ * ")" * * + } + if$ + } + if$ +} + + +FUNCTION {fields.number.series} +{ + volume empty$ + { + number empty$ + { series field.or.null } + { + series empty$ + { number "number" bibinfo.check } + { + output.state mid.sentence = + { bbl.number } + { bbl.number capitalize } + if$ + number tie.or.space.prefix "number" bibinfo.check * * + bbl.in space.word * + series "series" bibinfo.check * + } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {fields.org.or.pub} +{ + 't := + "" + address empty$ t empty$ and + 'skip$ + { + address "address" bibinfo.check * + t empty$ + 'skip$ + { + address empty$ + 'skip$ + { ": " * } + if$ + t * + } + if$ + } + if$ +} + + + +FUNCTION {fields.publisher.address} +{ + publisher "publisher" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.organization.address} +{ + organization "organization" bibinfo.check fields.org.or.pub +} + + + +FUNCTION {fields.tr.number} +{ + number "number" bibinfo.check + type duplicate$ empty$ + { pop$ bbl.techrep } + 'skip$ + if$ + "type" bibinfo.check + swap$ duplicate$ empty$ + { pop$ "t" change.case$ } + { tie.or.space.prefix * * } + if$ +} + + + +FUNCTION {fields.vol.num.pages} +{ + volume field.or.null + duplicate$ empty$ + 'skip$ + { + "volume" bibinfo.check + } + if$ + number "number" bibinfo.check + duplicate$ empty$ + 'skip$ + { + swap$ + duplicate$ empty$ + { "there's a number but no volume in " cite$ * warning$ } + 'skip$ + if$ + swap$ + "~(" swap$ * ")" * + } + if$ + * + eid empty$ + { fields.journal.pages } + { fields.journal.eid } + if$ +} + + + +FUNCTION {fields.chapter.pages} +{ + chapter empty$ + 'field.pages + { + type empty$ + { bbl.chapter } + { + type "l" change.case$ + "type" bibinfo.check + } + if$ + chapter tie.or.space.prefix + "chapter" bibinfo.check + * * + pages empty$ + 'skip$ + { bbl.comma * " " * field.pages * } + if$ + } + if$ +} + + + + + +% Functions to format combined fields for specific entry + +FUNCTION {book.field.crossref} +{ + volume duplicate$ empty$ + { + "empty volume in " cite$ * "'s crossref of " * crossref * warning$ + pop$ word.in + } + { + bbl.volume + capitalize + swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of separate.by.space * + } + if$ + " \cite{" * crossref * "}" * +} + + + +FUNCTION {book.fields.volume.series.number} +{ + volume empty$ not + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * volumes * + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + " " * number * + } + { + bbl.volume capitalize "~" * volume * + " " * bbl.of * " " * series emphasize * + } + if$ + } + { + number empty$ not + { + bbl.volume capitalize "~" * volume * add.period$ + " " * bbl.number * "~" * number * + } + { + bbl.volume capitalize "~" * volume * add.period$ + } + if$ + } + if$ + } + if$ + } + { + volumes empty$ not + { + series empty$ not + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + " " * number * + } + { + volumes "~" * bbl.volumes * add.period$ + " " * series * + } + if$ + } + { + number empty$ not + { + volumes "~" * bbl.volumes * add.period$ + " " * bbl.number * "~" * number * + } + { + volumes "~" * bbl.volumes * add.period$ + } + if$ + } + if$ + } + { + series empty$ not + { + number empty$ not + { + series + " " * number * + } + { + series + } + if$ + } + { + number empty$ not + { + bbl.number "~" * number * + } + { + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.fields.chapter.booktitle.volume.pages} +{ + booktitle empty$ not + { + chapter empty$ not + { + bbl.chapter capitalize "~" * chapter * + " " * bbl.in * " " * field.booktitle * + pages empty$ not + { + bbl.comma * " " * pages * add.period$ + } + { + add.period$ + } + if$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + { + word.in field.booktitle * + pages empty$ not + { + volume empty$ not + { + volumes empty$ not + { + " " * volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + " " * volume * ": " * pages * add.period$ + } + if$ + } + { + volumes empty$ not + { + bbl.comma * " " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + bbl.comma * " " * pages * add.period$ + } + if$ + } + if$ + } + { + add.period$ + volume empty$ not + { + volumes empty$ not + { + " " * bbl.volume capitalize * "~" * volume * + " " * bbl.of * " " * volumes * add.period$ + } + { + " " * bbl.volume capitalize * "~" * volume * add.period$ + } + if$ + } + { + volumes empty$ not + { + " " * volumes * "~" * bbl.volumes * add.period$ + } + { + skip$ + } + if$ + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +INTEGERS { field.series.emph } +FUNCTION {incoll.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + compiler empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + editor empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + if$ + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {incoll.field.crossref} +{ + word.in " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.crossref} +{ + word.in + " \cite{" * crossref * "}" * +} + + + +FUNCTION {article.field.journal} +{ + journal remove.dots emphasize +} + + + +FUNCTION {article.fields.jour.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + article.field.journal * + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + " " * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + " " * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + " " * volume * ": " * + pages * + } + { + " " * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.number * "~" * number * ": " * + pages * + } + { + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {article.fields.issn.vol.num.pp} +{ + journal empty$ not + { + issue empty$ not + { issue bbl.comma * " " *} + { "" } + if$ + volume empty$ not + { + number empty$ not + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * "~" * + "(" * number * ")" * ": " * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * bbl.comma * + " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + bbl.comma * " " * bbl.volume * "~" * volume * ":~" * + pages * + } + { + bbl.comma * " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + number empty$ not + { + pages empty$ not + { + bbl.number * "~" * number * ": " * + pages * + } + { + bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + pages * + } + 'skip$ + if$ + } + if$ + } + if$ + } + { + "journal" output.check + } + if$ +} + + + +FUNCTION {proc.fields.org.publisher.address} +{ + organization empty$ not + { + publisher empty$ not + { + address empty$ not + { + organization add.period$ + address * ": " * publisher * + } + { + organization add.period$ + publisher * + } + if$ + } + { + address empty$ not + { + organization + bbl.comma * " " * address * + } + { + organization + } + if$ + } + if$ + } + { + publisher empty$ not + { + address empty$ not + { address ": " * publisher *} + { publisher } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.fields.booktitle.volume.pages} +{ + booktitle empty$ not + { + volume empty$ not + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * add.period$ + " " * volumes * "~" * bbl.volumes * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * bbl.of * " " * volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + volume * ": " * pages * + } + { + field.booktitle add.period$ + " " * bbl.volume * "~" * volume * + } + if$ + } + if$ + } + { + volumes empty$ not + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * add.period$ + volumes * "~" * bbl.volumes + } + { + field.booktitle " " * add.period$ + " " * volumes * "~" * bbl.volumes * + } + if$ + } + { + pages empty$ not + { + field.booktitle " " * + bbl.comma * " " * pages * + } + { + field.booktitle + } + if$ + } + if$ + } + if$ + } + { + "" + } + if$ +} + + + +FUNCTION {inproc.fields.series.number} +{ + author empty$ not + { + translator empty$ not + { #1 'field.series.emph := } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + } + { + edition empty$ not + { #1 } + { #0 } + if$ + impression empty$ not + { #1 } + { #0 } + if$ + + 'field.series.emph := + } + if$ + series empty$ not + { + field.series.emph #0 > + { + number empty$ not + { series emphasize " " * number * } + { series emphasize } + if$ + } + { + number empty$ not + { series " " * number * } + { series } + if$ + } + if$ + } + { + number empty$ not + { bbl.number capitalize "~" * number * } + { "" } + if$ + } + if$ +} + + + +FUNCTION {inproc.field.crossref} { incoll.field.crossref } + + + +FUNCTION {conf.fields.series.number.pages} +{ + series empty$ not + { + number empty$ not + { + pages empty$ not + { + series + bbl.comma * " " * bbl.number * "~" * number * + bbl.comma * " " * pages * + } + { + series + bbl.comma * " " * bbl.number * "~" * number * + } + if$ + } + { + pages empty$ not + { + series + bbl.comma * " " * pages * + } + { series } + if$ + } + if$ + } + { "" } + if$ +} + + + +FUNCTION {conf.fields.org.publisher.address} { proc.fields.org.publisher.address } + + + +FUNCTION {thesis.field.type} +{ + type duplicate$ empty$ + 'pop$ + { + swap$ pop$ + "t" change.case$ "type" bibinfo.check + } + if$ +} + + + +FUNCTION {thesis.fields.school.type.address} +{ + type empty$ + { + type$ "mastersthesis" = + { bbl.mthesis "t" change.case$ } + { + type$ "phdthesis" = + { bbl.phdthesis "t" change.case$ } + { bbl.thesis "t" change.case$ } + if$ + } + if$ + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + { + type "~" = + { + school empty$ not + { + address empty$ not + { school bbl.comma * " " * address * } + { school } + if$ + } + { + address empty$ not + { address } + { "" } + if$ + } + if$ + } + { + type + school empty$ not + { + address empty$ not + { bbl.comma * " " * school * bbl.comma * " " * address * } + { bbl.comma * " " * school * } + if$ + } + { + address empty$ not + { bbl.comma * address * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {unpub.field.title} +{ + title empty$ not + { title bbl.dquote } + 'skip$ + if$ +} + + + +FUNCTION {misc.field.title} +{ + title empty$ not + { title } + 'skip$ + if$ +} + + + + + +% Functions to format entries based on type (compatible entries) + +FUNCTION {book} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.editor.editedby output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + crossref missing$ + { + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.comment output + new.sentence field.by output + new.sentence book.fields.volume.series.number output + new.sentence field.collaboration output + new.sentence field.commentator output + new.sentence field.introduction output + new.sentence field.preface output + new.sentence field.afterword output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block book.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {incollection} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, and compiler fields are empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + crossref missing$ + { + new.sentence field.by output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence incoll.fields.series.number output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { %%% if author, compiler, and editor fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, compiler, editor, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence incoll.fields.chapter.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence incoll.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + new.block incoll.field.crossref output.nonnull + } + if$ + } + { + "author, compiler, editor, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {article} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with editor + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and editor are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.jour.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, editor, and translator are empty, proceeds with key + key empty$ not + { + article.field.journal output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence field.by output + crossref missing$ + { + new.sentence field.editor.editedby output + new.sentence article.fields.issn.vol.num.pp output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + article.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {proceedings} +{ + begin.bibitem + editor empty$ not + { + field.editor output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence field.compiler.compiledby output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor field is empty, proceeds with compiler + compiler empty$ not + { + field.compiler output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if editor, and compiler fields are empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.emph "title" output.check + new.sentence field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + key empty$ not + { + field.title.emph "title" output.check + name.or.dash + field.year extra.label * "year" output.check + new.block field.edition output + new.sentence field.impression output + new.sentence book.fields.volume.series.number output + new.sentence proc.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + "editor, compiler, translator, and key" output.check + } + if$ + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {inproceedings} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author field is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator fields are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence inproc.fields.booktitle.volume.pages output + new.sentence field.edition output + new.sentence field.impression output + new.sentence inproc.fields.series.number output + new.sentence field.compiler.compiledby output + new.sentence field.editor.editedby output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.isbn output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {conference} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute "title" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block field.title.dqoute "title" output.check + new.sentence field.by output + new.sentence field.year output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + crossref missing$ + { + new.sentence conf.fields.series.number.pages output + new.sentence field.editor.editedby output + new.sentence conf.fields.org.publisher.address output + new.sentence field.note output + new.sentence field.issn output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { + inproc.field.crossref output.nonnull + field.pages output + } + if$ + } + { + "author, translator, and key" output.check + } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {thesis} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block field.title.dqoute output + new.sentence field.comment output + new.sentence thesis.fields.school.type.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {mastersthesis} { thesis } + + + +FUNCTION {phdthesis} { thesis } + + + +FUNCTION {unpublished} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with translator + translator empty$ not + { + field.translator output.nonnull + name.or.dash + new.sentence field.translateyear extra.label * output + new.block unpub.field.title output + new.sentence field.comment output + new.sentence field.by output + new.sentence field.year output + new.sentence field.translator.translatedby output + new.sentence field.translateyear output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author, and translator are empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.comment output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, translator, and key" output.check } + if$ + } + if$ + } + if$ + end.bibitem +} + + + +FUNCTION {misc} +{ + begin.bibitem + author empty$ not + { + field.author output.nonnull + name.or.dash + field.year extra.label * "year" output.check + new.block misc.field.title output + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { %%% if author is empty, proceeds with key + key empty$ not + { + field.title.emph output + name.or.dash + field.year extra.label * "year" output.check + new.sentence field.by output + new.sentence field.howpublished output + new.sentence fields.publisher.address output + new.sentence field.note output + new.sentence field.doi output + new.sentence field.urldate output + new.sentence field.url output + } + { "author, and key" output.check } + if$ + } + if$ + end.bibitem +} + + + + + +% Functions to format entries based on type (incompatible entries) + +FUNCTION {booklet} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.title "title" output.check + new.block + howpublished "howpublished" bibinfo.check output + address "address" bibinfo.check output + field.isbn output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {inbook} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + author empty$ + { field.editor "author and editor" output.check + editor format.key output + name.or.dash + } + { field.author output.nonnull + name.or.dash + crossref missing$ + { "author and editor" editor either.or.check } + 'skip$ + if$ + } + if$ + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + crossref missing$ + { + field.bvolume output + fields.chapter.pages output%"chapter and pages" output.check + new.block + fields.number.series output + field.edition output + new.sentence + fields.publisher.address output + } + { + fields.chapter.pages "chapter and pages" output.check + new.block + book.field.crossref output.nonnull + } + if$ + crossref missing$ + { field.isbn output } + 'skip$ + if$ + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {manual} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author output + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle "title" output.check + organization address new.block.checkb + organization "organization" bibinfo.check output + address "address" bibinfo.check output + field.edition output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + +FUNCTION {techreport} % THIS ENTRY TYPE IS NOT COMPATIBLE WITH IRAN MANUAL OF STYLE +{ + begin.bibitem + field.author "author" output.check + author format.key output + name.or.dash + field.year extra.label * "year" output.check + date.block + field.btitle + "title" output.check + new.block + fields.tr.number output.nonnull + institution "institution" bibinfo.warn output + address "address" bibinfo.check output + field.doi output + new.block + field.note output + field.eprint output + field.url output + end.bibitem +} + + + + + +% Function to format entry if the type is not recognized + +FUNCTION {default.type} { misc } + + + + + + + + + + + + + + + + + + + + +% Reading bibliography database (.bib) file + +READ + + +% Function to generate a string that is suitable for sorting purposes + +FUNCTION {sortify} +{ + purify$ + "l" change.case$ +} + + + +% Length of the short name label of the entry + +INTEGERS { len } + +FUNCTION {chop.word} +{ + 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + + + + + +% Functions for sorting purposes + +FUNCTION {sort.format.names} +{ + 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { + namesleft #0 > + } + { + s nameptr + "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ + 't := + nameptr #1 > + { + " " * + namesleft #1 = + t "others" = + and + { "zzzzz" 't := } + 'skip$ + if$ + t sortify * + } + { + t sortify * + } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + + + +FUNCTION {sort.field.title} +{ + 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + + + +FUNCTION {author.sort} +{ + author empty$ + { + key empty$ + { + "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + + + + +FUNCTION {author.editor.sort} +{ + author empty$ + { + editor empty$ + { + key empty$ + { + "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + + + +FUNCTION {editor.sort} +{ + editor empty$ + { + key empty$ + { + "to sort, need editor or key in " cite$ * warning$ + "" + } + { + key sortify + } + if$ + } + { + editor sort.format.names + } + if$ +} + + + +FUNCTION {book.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {incoll.sort} +{ + author empty$ not + { + author sort.format.names + } + { + compiler empty$ not + { + compiler sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, compiler, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {article.sort} +{ + author empty$ not + { + author sort.format.names + } + { + editor empty$ not + { + editor sort.format.names + } + { + translator empty$ not + { + translator sort.format.names + } + { + key empty$ not + { + key sortify + } + { + "to sort, need author, editor, translator, or key in " cite$ * warning$ + "" + } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {proc.sort} +{ + editor empty$ not + { editor sort.format.names } + { + compiler empty$ not + { compiler sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {inproc.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {conf.sort} +{ + author empty$ not + { author sort.format.names } + { + translator empty$ not + { translator sort.format.names } + { + key empty$ not + 'key + { cite$ #1 #3 substring$ } + if$ + } + if$ + } + if$ +} + + + +FUNCTION {presort} +{ + calc.label + label sortify + " " + * + type$ "book" = + 'book.sort + { + type$ "incollection" = + 'incoll.sort + { + type$ "article" = + 'article.sort + { + type$ "proceedings" = + 'proc.sort + { + type$ "inproceedings" = + 'inproc.sort + { + type$ "conference" = + 'conf.sort + { + type$ "inbook" = + 'author.editor.sort + 'author.sort + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + #1 entry.max$ substring$ + 'sort.label := + sort.label + * + " " + * + title field.or.null sort.field.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + + + +% Sort process + +ITERATE {presort} + +SORT + + + +STRINGS { last.label next.extra } + +INTEGERS { last.extra.num last.extra.num.extended last.extra.num.blank number.label } + +FUNCTION {initialize.extra.label.stuff} +{ + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'last.extra.num := + "a" chr.to.int$ #1 - 'last.extra.num.blank := + last.extra.num.blank 'last.extra.num.extended := + #0 'number.label := +} + + + +FUNCTION {forward.pass} +{ + last.label label = + { + last.extra.num #1 + 'last.extra.num := + last.extra.num "z" chr.to.int$ > + { + "a" chr.to.int$ 'last.extra.num := + last.extra.num.extended #1 + 'last.extra.num.extended := + } + 'skip$ + if$ + last.extra.num.extended last.extra.num.blank > + { + last.extra.num.extended int.to.chr$ + last.extra.num int.to.chr$ + * 'extra.label := + } + { + last.extra.num int.to.chr$ 'extra.label := + } + if$ + } + { + "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + label 'last.label := + } + if$ + number.label #1 + 'number.label := +} + + + +FUNCTION {reverse.pass} +{ + next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label 'next.extra := + extra.label duplicate$ empty$ + 'skip$ + { + "{\extrayearlabelen{" swap$ * "}}" * + } + if$ + 'extra.label := + label extra.label * 'label := +} + + + +EXECUTE {initialize.extra.label.stuff} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + + + +FUNCTION {bib.sort.order} +{ + sort.label + " " + * + translateyear empty$ + { year field.or.null sortify } + { + author empty$ not + { year field.or.null sortify } + { + compiler empty$ not + { year field.or.null sortify } + { + editor empty$ not + { year field.or.null sortify } + { + translator empty$ not + { translateyear field.or.null sortify } + { year field.or.null sortify } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + * + " " + * + title field.or.null sort.field.title + * + #1 entry.max$ substring$ + 'sort.key$ := +} + + + +ITERATE {bib.sort.order} + +SORT + + + + +% Functions to create bibliography +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + "% Generated by `iranlatin.bst`." write$ + newline$ + "% This bibliography style is part of the `iran-bibtex` package." write$ + newline$ + "% Copyright (c) 2023-2024 Farshad Rasuli <farshad.rasuli@gmail.com>" write$ + newline$ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ + newline$ + newline$ + newline$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ + newline$ +} + + + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + + + +FUNCTION {end.bib} +{ + newline$ + "\end{thebibliography}" write$ + newline$ +} + + + +EXECUTE {end.bib} + + + +%% +%% End of file `iranlatin.bst'.
\ No newline at end of file diff --git a/Master/texmf-dist/bibtex/csf/iran-bibtex/iran-bibtex-cp1256fa.csf b/Master/texmf-dist/bibtex/csf/iran-bibtex/iran-bibtex-cp1256fa.csf index 33455ae16be..29b5500a3bd 100644 --- a/Master/texmf-dist/bibtex/csf/iran-bibtex/iran-bibtex-cp1256fa.csf +++ b/Master/texmf-dist/bibtex/csf/iran-bibtex/iran-bibtex-cp1256fa.csf @@ -1,9 +1,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% -%% FILE: $RCSfile: cp1256fa.csf,v $ -%% $Revision: 1.0 $ -%% $Date: 2023/12/8 $ +%% FILE: $RCSfile: iran-bibtex-cp1256fa.csf,v $ +%% $Revision: 1.0.1 $ +%% $Date: 2024/01/8 $ %% %% AUTHOR: Farshad Rasuli <farshad.rasuli@gmail.com> %% @@ -25,7 +25,11 @@ %% %% CHANGE LOG %% -%% $Log: cp1256fa.csf,v $ +%% $Log: iran-bibtex-cp1256fa.csf,v $ +%% +%% Revision 1.0.1 2024/01/8 rasuli +%% Add Arabic-indic digits +%% Shift English/Latin digits to top %% %% Revision 1.0 2023/12/8 rasuli %% Initial release @@ -37,20 +41,20 @@ %% SORTING ORDER %% %% The sorting order defined is the Persian language sorting order then the -%% natural English language sorting order (i.e. 0..9AaBb..YyZz). Any other +%% natural English language sorting order (i.e. 0...9AaBb...YyZz). Any other %% characters will be sorted after the characters in the \order section. %% \order{ - ۰ - ۱ - ۲ - ۳ - ۴ - ۵ - ۶ - ۷ - ۸ - ۹ + ۰ ٠ 0 + ۱ ١ 1 + ۲ ٢ 2 + ۳ ٣ 3 + ۴ ٤ 4 + ۵ ٥ 5 + ۶ ٦ 6 + ۷ ٧ 7 + ۸ ٨ 8 + ۹ ٩ 9 ء أ إ ئ ؤ آ ا @@ -85,16 +89,6 @@ و ه ی ي - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 A a B b C c diff --git a/Master/texmf-dist/doc/bibtex/iran-bibtex/LICENSE.txt b/Master/texmf-dist/doc/bibtex/iran-bibtex/LICENSE.txt new file mode 100644 index 00000000000..1b57559a832 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/iran-bibtex/LICENSE.txt @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2008 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % https://www.latex-project.org/lppl.txt + % and version 1.3c or later is part of all distributions of LaTeX + % version 2008 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/Master/texmf-dist/doc/bibtex/iran-bibtex/README.md b/Master/texmf-dist/doc/bibtex/iran-bibtex/README.md index 4bbe1c2355c..5c730faac68 100644 --- a/Master/texmf-dist/doc/bibtex/iran-bibtex/README.md +++ b/Master/texmf-dist/doc/bibtex/iran-bibtex/README.md @@ -1,63 +1,134 @@ # iran-bibtex — Iran Manual of Style Citation Guide for BibTeX -The iran-bibtex package is a LaTeX package that provides a BibTeX style based on the [Iran Manual of Style](https://imos.irandoc.ac.ir) (1st edn., 2016) guide to Persian, and English information sources. +The iran-bibtex package, designed for LaTeX, provides BibTeX styles in accordance with the guidelines outlined in the [Iran Manual of Style](https://imos.irandoc.ac.ir) (1st edn., 2016)—citation guide to Persian, and English information sources. -Numerous examples of the use of this package have been prepared and are available in [the package's GitHub repository](https://github.com/farshadrasuli/iran-bibtex). +A collection of illustrative examples showcasing the usage of this package has been meticulously prepared and is accessible in [the package's GitHub repository](https://github.com/farshadrasuli/iran-bibtex) under the `examples` sub-directory. -A file named `iran-bibtex-cp1256fa.csf` is prepared (based on the [ascii.csf](https://ctan.org/tex-archive/biblio/bibtex/bibtex-x/csf/ascii.csf) file) for this package to sort references alphabetically (to place Persian/Farsi items first, followed by English/Latin items). +To facilitate alphabetical sorting of references, prioritizing Persian/Farsi items ahead of English/Latin ones, a dedicated file named `iran-bibtex-cp1256fa.csf` is provided for use with this package. This file, derived from the [ascii.csf](https://ctan.org/tex-archive/biblio/bibtex/bibtex-x/csf/ascii.csf) file, serves the purpose of arranging references in the desired order. -This package relies on [natbib](https://ctan.org/pkg/natbib) and [xepersian](https://ctan.org/pkg/xepersian) packages. +It's important to note that this package relies on [natbib](https://ctan.org/pkg/natbib) package, and it is automatically loaded. ## Copyright -Copyright (c) 2023 Farshad Rasuli (<farshad.rasuli@gmail.com>). +Copyright (c) 2023-2024 Farshad Rasuli (<farshad.rasuli@gmail.com>). This package distributed under the LaTeX Project Public License. It may be distributed and/or modified under the LaTeX Project Public License, version 1.3c or higher. The latest version of this license is at: <http://www.latex-project.org/lppl.txt>. -This work is “author-maintained” (as per LPPL maintenance status) -by Farshad Rasuli. +This work is “author-maintained” (as per LPPL maintenance status) by Farshad Rasuli. -The package's catalogue page on CTAN is located at: <https://ctan.org/pkg/iran-bibtex>. +Catalog on CTAN: <https://ctan.org/pkg/iran-bibtex> -The package's archive on CTAN is located at : <https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex>. +Archive on CTAN: <https://ctan.org/tex-archive/biblio/bibtex/contrib/iran-bibtex> -The repository for the package is located at: <https://github.com/farshadrasuli/iran-bibtex> +Repository on GitHub: <https://github.com/farshadrasuli/iran-bibtex> ## How to use this package -The current version of this package (v0.3.0) supports ten types of entries: `@book`, `@incollection`, `@article`, `@proceedings`, `@inproceedings`, `@conference`, `@mastersthesis`, `@phdthesis`, `@unpublished`, and `@misc`. These types of entries meet the Iran Manual of Style requirements. Other types of entries have the default definition of the LaTeX standards and do not meet the requirements of the Iran Manual of Style. +The current version of this package (v0.3.0, and higher) supports ten types of entries: `@book`, `@incollection`, `@article`, `@proceedings`, `@inproceedings`, `@conference`, `@mastersthesis`, `@phdthesis`, `@unpublished`, and `@misc`. These types of entries meet the Iran Manual of Style requirements. Other types of entries have the default definition of the LaTeX standards and do not meet the requirements of the Iran Manual of Style. -Recall the package with the `\usepackage[<bibstyle>]{iran-bibtex}` in the preamble of the LaTeX file. The current available `bibstyle` option is `iran`, which uses `iran.bst` BibTeX bibligraphy style file. By recalling the `iran-bibtex` package, there is no need to determine the bibliography style with the `\bibligraphystayle{<bibstyle>}` command anymore. We suggest recalling this package before the `hyperref` package. At the end, recall the `xepersian` package. +### Load package -To sort Bibliography/References alphabetically, by using `bibtex` for compilation, English/Latin items will be placed first, followed by Persian items. If you want Persian items to be placed first, followed by English/Latin items, you must create a bibliography database (`bib` file) with `utf8` encryption and run `bibtex8 -W -c iran-bibtex-cp1256fa` for compilation. +Load the `iran-bibtex` package in your LaTeX file by using the `\usepackage[<bibstyle>]{iran-bibtex}` command in the preamble. With this package, there's no need to explicitly set the bibliography style using the `\bibliographystyle{<bibstyle>}` command anymore. It is recommended to load the `iran-bibtex` package before the `hyperref` package for optimal performance. -## Reporting issues +### Package's options as `<bibstyle>` -If you want to report any bugs or issues, please use [the issue tracker](https://github.com/farshadrasuli/iran-bibtex/issues). In doing so, please always explain your issue well enough and always include a minimal working example showing the issue. +The bibliography styles included in this package are organized into two distinct groups. One set, denoted by names commencing with `iran`, is specifically designed for Persian/Farsi documents and requires the [xepersian](https://ctan.org/pkg/xepersian) package for compilation. The other set, identified by names beginning with `iranlatin`, is customized for English/Latin documents. This set serves as the implementation of the [Iran Manual of Style](https://imos.irandoc.ac.ir) for English/Latin documents. -## Change log +There are five different type of `<bibstyle>` options as follows: + +| No. | Options | Description | +| :-: | :---------------------------------- | :---------- | +|1 |`iran`<br>`iranlatin` | Author-date citation format, with reference items are arranged in alphabetical order. | +|2 |`iran-plain`<br>`iranlatin-plain` | Numerical labeled citation format, with reference items are both alphabetically sorted and numerically labeled. These styles are closely resembling the standard `plain` style. | +|3 |`iran-year`<br>`iranlatin-year` | Author-date citation format, with reference items are arranged in chronological order by year. | +|4 |`iran-plainyr`<br>`iranlatin-plainyr`| Numerical labeled citation format, with reference items are both chronologically by year sorted and numerically labeled. | +|5 |`iran-unsrt`<br>`iranlatin-unsrt` | Numerical labeled citation format, with reference items are sorted by citation order and numerically labeled. These styles are closely resembling the standard `unsrt` style. | + +### Compilation + +During the compilation of a bibliography database file (`bib` file) using the `bibtex` engine, English/Latin items are initially sorted, followed by Persian/Farsi items. To ensure Persian/Farsi items are displayed first, users are advised to choose the `bibtex8` engine, create a bibliography database file (`bib` file) encrypted in `utf8`, and execute the `bibtex8 -W -c iran-bibtex-cp1256fa` command for compilation. + +### Citation commands + +According to the [natbib](https://ctan.org/pkg/natbib) package user manual, the following commands are provided for citation. The illustrations below apply to the `iranlatin` bibstyle option. + +> (Sechzer et al. 1996) +> +> **Bibliography** +> +> Sechzer, Jeri A, S M Pfaffilin, F L Denmark, A Griffin, and S J Blumenthal. 1996. *Women and Mental Health*. Baltimore: John Hopkins Univ Press. -First version (v0.1.0) release date: 2023/12/12. Current version (v0.3.0) release date: 2023/12/18. +#### Group 1: `\cite` command (parentetical citation) -* **v0.3.0 (2023/12/18)** +- `\cite{sechzer1996}`: (Sechzer et al. 1996) +- `\cite[Chap.~2]{sechzer1996}`: (Sechzer et al. 1996, Chap. 2) +- `\cite[see][p.~10]{sechzer1996}`: (see Sechzer et al. 1996, p. 10) +- `\cite*{sechzer1996}`: (Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996) +- `\cite*[Chap.~2]{sechzer1996}`: (Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996, Chap. 2) +- `\cite*[see][p.~10]{sechzer1996}`: (see Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996, p. 10) - 1. Made some improvements - 2. Fix minor bugs - 3. Support `@mastersthesis` entry was also added - 4. Support `@phdthesis` entry was also added - 5. Support `@unpublished` entry was also added - 6. Support `@misc` entry was also added +#### Group 2: `\citep` command (parentetical citation) -* **v0.2.0 (2023/12/15)** +- `\citep{sechzer1996}`: (Sechzer et al. 1996) +- `\citep[Chap.~2]{sechzer1996}`: (Sechzer et al. 1996, Chap. 2) +- `\citep[see][p.~10]{sechzer1996}`: (see Sechzer et al. 1996, p. 10) +- `\citep*{sechzer1996}`: (Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996) +- `\citep*[Chap.~2]{sechzer1996}`: (Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996, Chap. 2) +- `\citep*[see][p.~10]{sechzer1996}`: (see Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal 1996, p. 10) - 1. Made some improvements - 2. Support `@article` entry was also added - 3. Support `@incollection` entry was also added - 4. Support `@proceedings` entry was also added - 5. Support `@inproceedings` entry was also added - 6. Support `@conference` entry was also added +#### Group 3: `\citet` command (textual citation) + +- `\citet{sechzer1996}`: Sechzer et al. (1996) +- `\citet[Chap.~2]{sechzer1996}`: Sechzer et al. (1996, Chap. 2) +- `\citet*{sechzer1996}`: Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal (1996) +- `\citet*[Chap.~2]{sechzer1996}`: Sechzer, Pfaffilin, Denmark, Griffin, and Blumenthal (1996, Chap. 2) + +#### Group 4: Other citation commands + +All of the other commads provided by [natbib](https://ctan.org/pkg/natbib) package also work. + +## Reporting issues + +If you want to report any bugs or issues, please use [the issue tracker](https://github.com/farshadrasuli/iran-bibtex/issues). In doing so, please always explain your issue well enough and always include a minimal working example showing the issue. + +## Change log -* **v0.1.0 (2023/12/12)** +### Version 0.4.0 (2024/01/8) + + 1. Implemented several improvements. + 2. Enhanced code quality. + 3. Persian/Farsi items now display the year's extra label with Persian characters. + 4. Made some modifications to the `iran-bibtex-cp1256fa.csf` file. + 5. Introducing a new option: `iran-plain`. + 6. Introducing a new option: `iran-year`. + 7. Introducing a new option: `iran-plainyr`. + 8. Introducing a new option: `iran-unsrt`. + 9. Introducing a new option: `iranlatin`. + 10. Introducing a new option: `iranlatin-plain`. + 11. Introducing a new option: `iranlatin-year`. + 12. Introducing a new option: `iranlatin-plainyr`. + 13. Introducing a new option: `iranlatin-unsrt`. + +### Version 0.3.0 (2023/12/18) + + 1. Implemented several improvements. + 2. Minor bugs have been fixed. + 3. Added support for `@mastersthesis` entry. + 4. Added support for `@phdthesis` entry. + 5. Added support for `@unpublished` entry. + 6. Added support for `@misc` entry. + +### Version 0.2.0 (2023/12/15) + + 1. Implemented several improvements + 2. Added support for `@article` entry. + 3. Added support for `@incollection` entry. + 4. Added support for `@proceedings` entry. + 5. Added support for `@inproceedings` entry. + 6. Added support for `@conference` entry. + +### Version 0.1.0 (2023/12/12) 1. First release on CTAN, and GitHub. - 2. Support `@book` entry only + 2. Available option: `iran`. + 3. Support for `@book` entry only. diff --git a/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-bibtex-structure.pdf b/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-bibtex-structure.pdf Binary files differnew file mode 100644 index 00000000000..4c6f7cfd765 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-bibtex-structure.pdf diff --git a/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-structure.tex b/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-bibtex-structure.tex index c22db4c58d9..acfb59dce84 100644 --- a/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-structure.tex +++ b/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-bibtex-structure.tex @@ -16,9 +16,9 @@ \begin{document} -\title{خلاصهای از ساختار چیدمان مشخصهها در شیوهی استاددهی {\tt iran.bst}} +\title{خلاصهای از ساختار چیدمان پیادهشدهی مشخصهها در شیوهی استاددهی ایران} \author{فرشاد رسولی\thanks{رایانامه: \url{farshad.rasuli@gmail.com}}} -\date{نسخهی ۰٫۳٫۰ --- ۲۷ آذر ۱۴۰۲} +\date{نسخهی ۰٫۴٫۰ --- ۱۸ دی ۱۴۰۲} \maketitle diff --git a/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-structure.pdf b/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-structure.pdf Binary files differdeleted file mode 100644 index 5da90177525..00000000000 --- a/Master/texmf-dist/doc/bibtex/iran-bibtex/iran-structure.pdf +++ /dev/null diff --git a/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty b/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty index 462ba68f121..e84bb0f9357 100644 --- a/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty +++ b/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty @@ -1,8 +1,8 @@ %% -%% This is file “iran-bibtex.sty”, v0.3.0 (2023/12/18) +%% This is file “iran-bibtex.sty”, v0.4.0 (2024/01/8) %% %% __________________________________________________ -%% Copyright (c) 2023 Farshad Rasuli +%% Copyright (c) 2023-2024 Farshad Rasuli %% %% It may be distributed and/or modified under the LaTeX Project %% Public License version 1.3c or higher. The latest version of the @@ -26,8 +26,8 @@ % === Package structure: Identification \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{iran-bibtex} -\def\iranbibtex@version{0.3.0} -\def\iranbibtexdate{2023/12/18} % December 18th, 2023 +\def\iranbibtex@version{0.4.0} +\def\iranbibtexdate{2024/01/8} % January 8th, 2024 \def\iranbibtexfirstrelease{2023/12/12} % December 12th, 2023 \edef\@iranbibtex@info{% ****************************************************^^J% @@ -39,7 +39,7 @@ * citation guide to Persian and English information^^J% * sources in BibTeX.^^J% * ^^J% -* Copyright (c) 2023 Farshad Rasuli^^J% +* Copyright (c) 2023-2024 Farshad Rasuli^^J% * ^^J% ****************************************************^^J% } @@ -53,10 +53,10 @@ % === Package structures: Options -%% iran bibliography style: author-year style, ordered by authors' name +%% iran bibliography style: author-year style, sorted by authors' name \DeclareOption{iran} {% - \setcitestyle{authoryear,% citation mode + \setcitestyle{authoryear,% citation mode round,% braces aysep={},% between author and year }% @@ -65,6 +65,114 @@ +%% iran bibliography style: numbered style, sorted by authors' name +\DeclareOption{iran-plain} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iran}% +} + + + +%% iran bibliography style: author-year style, sorted by year +\DeclareOption{iran-year} +{% + \setcitestyle{authoryear,% citation mode + round,% braces + aysep={},% between author and year + }% + \bibliographystyle{iran-year}% +} + + + +%% iran bibliography style: numbered style, sorted by year +\DeclareOption{iran-plainyr} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iran-year}% +} + + + +%% iran bibliography style: numbered style, sorted by citation order +\DeclareOption{iran-unsrt} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iran-unsrt}% +} + + + +%% iran bibliography style for English/Latin document: author-year style, sorted by authors' name +\DeclareOption{iranlatin} +{% + \setcitestyle{authoryear,% citation mode + round,% braces + aysep={},% between author and year + }% + \bibliographystyle{iranlatin}% +} + + + +%% iran bibliography style for English/Latin document: numbered style, sorted by authors' name +\DeclareOption{iranlatin-plain} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iranlatin}% +} + + + +%% iran bibliography style for English/Latin document: author-year style, sorted by year +\DeclareOption{iranlatin-year} +{% + \setcitestyle{authoryear,% citation mode + round,% braces + aysep={},% between author and year + }% + \bibliographystyle{iranlatin-year}% +} + + + +%% iran bibliography style for English/Latin document: numbered style, sorted by year +\DeclareOption{iranlatin-plainyr} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iranlatin-year}% +} + + + +%% iran bibliography style for English/Latin document: numbered style, sorted by citation order +\DeclareOption{iranlatin-unsrt} +{% + \setcitestyle{numbers,% citation mode + square,% braces + sort&compress, % multiple numerical citations are compressed + }% + \bibliographystyle{iranlatin-unsrt}% +} + + + \ProcessOptions\relax @@ -83,20 +191,72 @@ -%% renew \cite command to behave like \citep in the netbib package -\renewcommand{\cite}% - {\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@partrue - \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}} +% renew \cite command to behave like \citep in the natbib package +\renewcommand{\cite}{% +\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@partrue +\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}% + } -% === Package structure: Extra label appended to year for one author in same year +% === Package structure: Modifying the extra label that is appended to the year for one author in the same year +% Modify extra label of Latin items ---------------------------------- \providecommand{\extrayearlabelen}[1]{#1} -\providecommand{\extrayearlabelfa}[1]{#1} + + +% Set the equivalent Persian character for the English character ----- + +% Implemeted by Bahman Mirzakhani (github.com/bahman-mirzakhani). +% Inspired from tex.stackexchange.com/questions/64131/implementing-switch-cases + +\newcommand\addcase[3]{\expandafter\def\csname\string#1@case@#2\endcsname{#3}} +\newcommand\makeswitch[2][]{% + \newcommand#2[1]{% + \ifcsname\string#2@case@##1\endcsname\csname\string#2@case@##1\endcsname\else#1\fi% + }% +} +\makeswitch[#1]\changealph +\addcase\changealph{a}{الف} +\addcase\changealph{b}{ب} +\addcase\changealph{c}{پ} +\addcase\changealph{d}{ت} +\addcase\changealph{e}{ث} +\addcase\changealph{f}{ج} +\addcase\changealph{g}{چ} +\addcase\changealph{h}{ح} +\addcase\changealph{i}{خ} +\addcase\changealph{j}{د} +\addcase\changealph{k}{ذ} +\addcase\changealph{l}{ر} +\addcase\changealph{m}{ز} +\addcase\changealph{n}{ژ} +\addcase\changealph{o}{س} +\addcase\changealph{p}{ش} +\addcase\changealph{q}{ص} +\addcase\changealph{r}{ض} +\addcase\changealph{s}{ط} +\addcase\changealph{t}{ظ} +\addcase\changealph{u}{ع} +\addcase\changealph{v}{غ} +\addcase\changealph{w}{ف} +\addcase\changealph{x}{ق} +\addcase\changealph{y}{ک} +\addcase\changealph{z}{گ} +\addcase\changealph{aa}{ل} +\addcase\changealph{ab}{م} +\addcase\changealph{ac}{ن} +\addcase\changealph{ad}{و} +\addcase\changealph{ae}{ه} +\addcase\changealph{af}{ی} + + + +% Modify extra label of Persian items -------------------------------- +\providecommand{\extrayearlabelfa}[1]{\changealph{#1}} |