diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-08 21:45:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-08 21:45:55 +0000 |
commit | fdbf9f97daca4aa846c53f54ff42ab0368e02756 (patch) | |
tree | f5ed2b4fd3ef223c196a076232aa39c17b0013eb /Master/texmf-dist/bibtex/bst | |
parent | 8874dd436a6a1383dfca702d823abc3b32c38f52 (diff) |
iran-bibtex (8jan24)
git-svn-id: svn://tug.org/texlive/trunk@69347 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/bibtex/bst')
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iran-unsrt.bst | 4896 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iran-year.bst | 5078 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iran.bst | 4728 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-unsrt.bst | 4486 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin-year.bst | 4665 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/iran-bibtex/iranlatin.bst | 4637 |
6 files changed, 26289 insertions, 2201 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 |