diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-05 21:00:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-05 21:00:56 +0000 |
commit | 6f10523a75ddc7592e2c5e5db809908f864e9bd8 (patch) | |
tree | c8dff46188bd5e41d5129f092c74057fd1cca883 | |
parent | 330d068ca03414ccb3676e73f9b69f4365b9db9b (diff) |
gbt7714 (5aug18)
git-svn-id: svn://tug.org/texlive/trunk@48352 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-plain.bst | 1924 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-unsrt.bst | 1766 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-plain.bst | 1087 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-unsrt.bst | 1055 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/gbt7714/README.md | 78 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/gbt7714/gbt7714.pdf | bin | 127223 -> 315022 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx | 2441 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty | 73 |
8 files changed, 6401 insertions, 2023 deletions
diff --git a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-plain.bst b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-plain.bst new file mode 100644 index 00000000000..ef0e0e94c55 --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-plain.bst @@ -0,0 +1,1924 @@ +%% +%% This is file `gbt7714-2005-plain.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2005,authoryear') +%% Version: 2018/08/05 v1.0.9 +%% +%% Copyright (C) 2016-2018 by Zeping Lee <zepinglee AT gmail.com> +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% + +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + italic.jounal + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #3 'max.num.authors := + #0 'period.between.author.year := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #0 'italic.jounal := + #1 'show.missing.address.publisher := + #1 'show.url := + #0 'show.doi := + #0 'show.note := +} + +ENTRY + { address + author + booktitle + date + doi + edition + editor + howpublished + institution + journal + key + language + mark + medium + note + number + organization + pages + publisher + school + series + title + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic } + { label extra.label sort.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ lang.zh entry.lang = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} { "\ " } + +FUNCTION {bbl.et.al} +{ lang.zh entry.lang = + { "等" } + { lang.ja entry.lang = + { "他" } + { lang.ru entry.lang = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\ " } + +FUNCTION {bbl.slash} { "//\allowbreak{}" } + +FUNCTION {bbl.sine.loco} +{ lang.zh entry.lang = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ lang.zh entry.lang = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ lang.zh entry.lang = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { after.slash 'output.state := } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {italicize} +{ duplicate$ empty$ + { pop$ "" } + { "\textit{" swap$ * "}" * } + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + nameptr max.num.authors > + { bbl.et.al + #1 'namesleft := + } + { t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ + } + if$ + nameptr #1 > + { ", " swap$ * * } + 'skip$ + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ + { bbl.anonymous } + { author format.names } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + lang.zh entry.lang = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} + { url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ + } + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ + { "" } + { lang.zh entry.lang = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.number} +{ number empty$ + { "" } + { lang.zh entry.lang = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + * + } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { booktitle + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.journal} +{ journal + italic.jounal + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { lang.zh entry.lang = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." *} + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address + format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + "" + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\penalty0 (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.dash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.before.dash * ")" * } + 'skip$ + if$ + year contains.dash + { "--" * + year extract.after.dash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.dash empty$ not + { year extract.after.dash * } + { year extract.before.dash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { bbl.anonymous } + if$ + } + if$ + output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + format.authors "author" output.check + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.journal "journal" output.check + volume output + format.journal.number "" output.after + format.journal.pages "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.title + number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem + format.authors output + author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ + format.year "year" output.check + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + format.pages bbl.colon output.after + format.editdate "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ journal empty$ not + 'article + { booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { book } + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$} + { t #1 "{ll}{ff}" format.name$} + if$ + s num.names$ #1 > + { bbl.space * bbl.et.al * } + 'skip$ + if$ +} + +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 {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +FUNCTION {sort.language.label} +{ entry.lang lang.zh = + { "a zh " } + { entry.lang lang.ja = + { "b ja " } + { entry.lang lang.en = + { "c en " } + { entry.lang lang.ru = + { "d ru " } + { "e other " } + if$ + } + if$ + } + if$ + } + if$ +} + +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" * } + { numnames #2 > nameptr #2 = and + { "zz" * year field.or.null * " " * } + 'skip$ + if$ + t sortify * + } + if$ + } + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +FUNCTION {anonymous.sort} +{ lang.zh entry.lang = + { "yi4 ming2" } + { "anon" } + if$ +} + +FUNCTION {author.sort} +{ key empty$ + { entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ + author empty$ + { anonymous.sort } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {author.editor.sort} +{ key empty$ + { author empty$ + { editor empty$ + { anonymous.sort } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {author.organization.sort} +{ key empty$ + { author empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {editor.organization.sort} +{ key empty$ + { editor empty$ + { organization empty$ + { anonymous.sort } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ + } + { key sortify } + if$ +} + +FUNCTION {presort} +{ set.entry.lang + show.url show.doi check.electronic + calc.label + label sortify + " " + * + sort.language.label + type$ "book" = + type$ "inbook" = + or + 'author.editor.sort + { type$ "collection" = + type$ "proceedings" = + or + 'editor.organization.sort + 'author.sort + if$ + } + if$ + * + " " + * + year field.or.null sortify + * + " " + * + cite$ + * + #1 entry.max$ substring$ + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra } + +INTEGERS { longest.label.width last.extra.num number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := + #0 'number.label := +} + +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "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$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + show.url show.doi or + { "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + } + 'skip$ + if$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ +} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-unsrt.bst b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-unsrt.bst new file mode 100644 index 00000000000..d63c34aa9ce --- /dev/null +++ b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-2005-unsrt.bst @@ -0,0 +1,1766 @@ +%% +%% This is file `gbt7714-2005-unsrt.bst', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `2005,numerical') +%% Version: 2018/08/05 v1.0.9 +%% +%% Copyright (C) 2016-2018 by Zeping Lee <zepinglee AT gmail.com> +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% + +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + italic.jounal + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #3 'max.num.authors := + #0 'period.between.author.year := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #0 'italic.jounal := + #1 'show.missing.address.publisher := + #1 'show.url := + #0 'show.doi := + #0 'show.note := +} + +ENTRY + { address + author + booktitle + date + doi + edition + editor + howpublished + institution + journal + key + language + mark + medium + note + number + organization + pages + publisher + school + series + title + translator + url + urldate + volume + year + } + { entry.lang entry.is.electronic } + { label extra.label sort.label short.list entry.mark entry.url } + +INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } + +INTEGERS { lang.zh lang.ja lang.en lang.ru lang.other } + +INTEGERS { charptr len } + +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := + #4 'after.slash := + #3 'lang.zh := + #4 'lang.ja := + #1 'lang.en := + #2 'lang.ru := + #0 'lang.other := +} + +FUNCTION {bbl.anonymous} +{ lang.zh entry.lang = + { "佚名" } + { "Anon" } + if$ +} + +FUNCTION {bbl.space} { "\ " } + +FUNCTION {bbl.et.al} +{ lang.zh entry.lang = + { "等" } + { lang.ja entry.lang = + { "他" } + { lang.ru entry.lang = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ +} + +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\ " } + +FUNCTION {bbl.slash} { "//\allowbreak{}" } + +FUNCTION {bbl.sine.loco} +{ lang.zh entry.lang = + { "[出版地不详]" } + { "[S.l.]" } + if$ +} + +FUNCTION {bbl.sine.nomine} +{ lang.zh entry.lang = + { "[出版者不详]" } + { "[s.n.]" } + if$ +} + +FUNCTION {bbl.sine.loco.sine.nomine} +{ lang.zh entry.lang = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + +FUNCTION {output.nonnull} +{ 's := + output.state mid.sentence = + { ", " * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION {output} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION {output.after} +{ 't := + duplicate$ empty$ + 'pop$ + { 's := + output.state mid.sentence = + { t * write$ } + { output.state after.block = + { add.period$ write$ + newline$ + "\newblock " write$ + } + { output.state before.all = + 'write$ + { output.state after.slash = + { bbl.slash * write$ } + { add.period$ " " * write$ } + if$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s + } + if$ +} + +FUNCTION {output.check} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION {fin.entry} +{ add.period$ + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.block 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { output.state after.slash = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ + } + if$ +} + +FUNCTION {new.slash} +{ output.state before.all = + 'skip$ + { after.slash 'output.state := } + if$ +} + +FUNCTION {new.block.checka} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.block.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.block + if$ +} + +FUNCTION {new.sentence.checka} +{ empty$ + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {new.sentence.checkb} +{ empty$ + swap$ empty$ + and + 'skip$ + 'new.sentence + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +FUNCTION {italicize} +{ duplicate$ empty$ + { pop$ "" } + { "\textit{" swap$ * "}" * } + if$ +} + +INTEGERS { byte second.byte } + +INTEGERS { char.lang tmp.lang } + +STRINGS { tmp.str } + +FUNCTION {get.str.lang} +{ 'tmp.str := + lang.other 'tmp.lang := + #1 'charptr := + tmp.str text.length$ #1 + 'len := + { charptr len < } + { tmp.str charptr #1 substring$ chr.to.int$ 'byte := + byte #128 < + { charptr #1 + 'charptr := + byte #64 > byte #91 < and byte #96 > byte #123 < and or + { lang.en 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { tmp.str charptr #1 + #1 substring$ chr.to.int$ 'second.byte := + byte #224 < + { charptr #2 + 'charptr := + byte #207 > byte #212 < and + byte #212 = second.byte #176 < and or + { lang.ru 'char.lang := } + { lang.other 'char.lang := } + if$ + } + { byte #240 < + { charptr #3 + 'charptr := + byte #227 > byte #234 < and + { lang.zh 'char.lang := } + { byte #227 = + { second.byte #143 > + { lang.zh 'char.lang := } + { second.byte #128 > second.byte #132 < and + { lang.ja 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + { byte #239 = + second.byte #163 > second.byte #172 < and and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + { charptr #4 + 'charptr := + byte #240 = second.byte #159 > and + { lang.zh 'char.lang := } + { lang.other 'char.lang := } + if$ + } + if$ + } + if$ + } + if$ + char.lang tmp.lang > + { char.lang 'tmp.lang := } + 'skip$ + if$ + } + while$ + tmp.lang +} + +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang +} + +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + 'entry.lang := +} + +INTEGERS { nameptr namesleft numnames name.lang } + +FUNCTION {format.names} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + nameptr max.num.authors > + { bbl.et.al + #1 'namesleft := + } + { t "others" = + { bbl.et.al } + { t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ + t #1 "{, jj}" format.name$ * + } + { t #1 "{ll}{ff}" format.name$ } + if$ + } + if$ + } + if$ + nameptr #1 > + { ", " swap$ * * } + 'skip$ + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {format.key} +{ empty$ + { key field.or.null } + { "" } + if$ +} + +FUNCTION {format.authors} +{ author empty$ + { "" } + { author format.names } + if$ +} + +FUNCTION {format.editors} +{ editor empty$ + { "" } + { editor format.names } + if$ +} + +FUNCTION {format.translators} +{ translator empty$ + { "" } + { translator format.names + lang.zh entry.lang = + { translator num.names$ #3 > + { "译" * } + { ", 译" * } + if$ + } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.full.names} +{'s := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$ 't := } + { t #1 "{ll}{ff}" format.name$ 't := } + if$ + nameptr #1 > + { + namesleft #1 > + { ", " * t * } + { + numnames #2 > + { "," * } + 'skip$ + if$ + t "others" = + { " et~al." * } + { " and " * t * } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.editor.full} +{ author empty$ + { editor empty$ + { "" } + { editor format.full.names } + if$ + } + { author format.full.names } + if$ +} + +FUNCTION {author.full} +{ author empty$ + { "" } + { author format.full.names } + if$ +} + +FUNCTION {editor.full} +{ editor empty$ + { "" } + { editor format.full.names } + if$ +} + +FUNCTION {make.full.names} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.full + { type$ "collection" = + type$ "proceedings" = + or + 'editor.full + 'author.full + if$ + } + if$ +} + +FUNCTION {output.bibitem} +{ newline$ + "\bibitem[" write$ + label write$ + ")" make.full.names duplicate$ short.list = + { pop$ } + { * } + if$ + "]{" * write$ + cite$ write$ + "}" write$ + newline$ + "" + before.all 'output.state := +} + +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ + if$ +} + +FUNCTION {add.link} + { url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ + } + +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + link.title + 'add.link + 'skip$ + if$ + } + if$ +} + +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +FUNCTION {is.digit} +{ duplicate$ empty$ + { pop$ #0 } + { chr.to.int$ + duplicate$ "0" chr.to.int$ < + { pop$ #0 } + { "9" chr.to.int$ > + { #0 } + { #1 } + if$ + } + if$ + } + if$ +} + +FUNCTION {is.number} +{ 's := + s empty$ + { #0 } + { s text.length$ 'charptr := + { charptr #0 > + s charptr #1 substring$ is.digit + and + } + { charptr #1 - 'charptr := } + while$ + charptr not + } + if$ +} + +FUNCTION {format.volume} +{ volume empty$ + { "" } + { lang.zh entry.lang = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.number} +{ number empty$ + { "" } + { lang.zh entry.lang = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + if$ +} + +FUNCTION {format.volume.number} +{ volume empty$ not + { format.volume } + { format.number } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + * + } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ + link.title + 'add.link + 'skip$ + if$ +} + +FUNCTION {format.series.vol.num.booktitle} +{ format.volume.number 's := + series empty$ not + { series bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + booktitle * + } + { booktitle + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +FUNCTION {format.journal} +{ journal + italic.jounal + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +FUNCTION {num.to.ordinal} +{ duplicate$ text.length$ 'charptr := + duplicate$ charptr #1 substring$ 's := + s "1" = + { "st" * } + { s "2" = + { "nd" * } + { s "3" = + { "rd" * } + { "th" * } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.edition} +{ edition empty$ + { "" } + { edition is.number + { lang.zh entry.lang = + { edition " 版" * } + { edition num.to.ordinal " ed." * } + if$ + } + { entry.lang lang.en = + { edition change.sentence.case 's := + s "Revised" = s "Revised edition" = or + { "Rev. ed." } + { s " ed." *} + if$ + } + { edition } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.publisher} +{ publisher empty$ not + { publisher } + { school empty$ not + { school } + { organization empty$ not + { organization } + { institution empty$ not + { institution } + { "" } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {format.address.publisher} +{ address empty$ not + { address + format.publisher empty$ not + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } + 'skip$ + if$ + } + if$ + } + { entry.is.electronic not show.missing.address.publisher and + { format.publisher empty$ not + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } + if$ + } + { format.publisher empty$ not + { format.publisher } + { "" } + if$ + } + if$ + } + if$ +} + +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + "" + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages hyphenate } + if$ +} + +FUNCTION {format.journal.number} +{ number empty$ not + { "\penalty0 (" number * ")" * } + { "" } + if$ +} + +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + +FUNCTION {format.periodical.year.volume.number} +{ year empty$ not + { year extract.before.dash } + { "empty year in periodical " cite$ * warning$ } + if$ + volume empty$ not + { ", " * volume extract.before.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.before.dash * ")" * } + 'skip$ + if$ + year contains.dash + { "--" * + year extract.after.dash empty$ + volume extract.after.dash empty$ and + number extract.after.dash empty$ and not + { year extract.after.dash empty$ not + { year extract.after.dash * } + { year extract.before.dash * } + if$ + volume empty$ not + { ", " * volume extract.after.dash * } + 'skip$ + if$ + number empty$ not + { "\penalty0 (" * number extract.after.dash * ")" * } + 'skip$ + if$ + } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } + if$ + } + if$ +} + +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } + 'skip$ + if$ +} + +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr + } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := + } + { s tmp.str * 's := } + if$ + t #2 global.max$ substring$ 't := + } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ + if$ + } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {monograph} +{ output.bibitem + author empty$ not + { format.authors } + { editor empty$ not + { format.editors } + { "" } + if$ + } + if$ + output + new.block + format.series.vol.num.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.sentence + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check + author format.key output + new.block + format.title "title" output.check + "M" set.entry.mark + format.mark "" output.after + new.block + format.translators output + new.slash + format.editors output + new.block + format.series.vol.num.booktitle "booktitle" output.check + new.block + format.edition output + new.block + format.address.publisher output + format.year "year" output.check + format.pages bbl.colon output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {periodical} +{ output.bibitem + format.authors "author" output.check + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.periodical.year.volume.number output + new.block + format.address.publisher output + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check + author format.key output + new.block + format.title "title" output.check + "J" set.entry.mark + format.mark "" output.after + new.block + format.journal "journal" output.check + format.date "year" output.check + volume output + format.journal.number "" output.after + format.journal.pages "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {patent} +{ output.bibitem + format.authors output + author format.key output + new.block + format.title + number empty$ not + { bbl.colon * number * } + 'skip$ + if$ + "title" output.check + "P" set.entry.mark + format.mark "" output.after + new.block + format.date "year" output.check + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem + format.authors output + author format.key output + new.block + format.series.vol.num.title "title" output.check + "EB" set.entry.mark + format.mark "" output.after + new.block + format.address.publisher output + date empty$ + { format.date output } + 'skip$ + if$ + format.pages bbl.colon output.after + format.editdate "" output.after + format.urldate "" output.after + format.url output + format.doi output + new.block + format.note output + fin.entry +} + +FUNCTION {misc} +{ journal empty$ not + 'article + { booktitle empty$ not + 'incollection + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ + } + if$ + } + if$ + } + if$ + empty.misc.check +} + +FUNCTION {archive} +{ "A" set.entry.mark + misc +} + +FUNCTION {book} { monograph } + +FUNCTION {booklet} { book } + +FUNCTION {collection} +{ "G" set.entry.mark + monograph +} + +FUNCTION {database} +{ "DB" set.entry.mark + electronic +} + +FUNCTION {dataset} +{ "DS" set.entry.mark + electronic +} + +FUNCTION {inbook} { book } + +FUNCTION {inproceedings} +{ "C" set.entry.mark + incollection +} + +FUNCTION {conference} { inproceedings } + +FUNCTION {map} +{ "CM" set.entry.mark + misc +} + +FUNCTION {manual} { monograph } + +FUNCTION {mastersthesis} +{ "D" set.entry.mark + monograph +} + +FUNCTION {newspaper} +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic +} + +FUNCTION {phdthesis} { mastersthesis } + +FUNCTION {proceedings} +{ "C" set.entry.mark + monograph +} + +FUNCTION {software} +{ "CP" set.entry.mark + electronic +} + +FUNCTION {standard} +{ "S" set.entry.mark + misc +} + +FUNCTION {techreport} +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +FUNCTION {default.type} { misc } + +MACRO {jan} {"January"} + +MACRO {feb} {"February"} + +MACRO {mar} {"March"} + +MACRO {apr} {"April"} + +MACRO {may} {"May"} + +MACRO {jun} {"June"} + +MACRO {jul} {"July"} + +MACRO {aug} {"August"} + +MACRO {sep} {"September"} + +MACRO {oct} {"October"} + +MACRO {nov} {"November"} + +MACRO {dec} {"December"} + +MACRO {acmcs} {"ACM Computing Surveys"} + +MACRO {acta} {"Acta Informatica"} + +MACRO {cacm} {"Communications of the ACM"} + +MACRO {ibmjrd} {"IBM Journal of Research and Development"} + +MACRO {ibmsj} {"IBM Systems Journal"} + +MACRO {ieeese} {"IEEE Transactions on Software Engineering"} + +MACRO {ieeetc} {"IEEE Transactions on Computers"} + +MACRO {ieeetcad} + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} + +MACRO {ipl} {"Information Processing Letters"} + +MACRO {jacm} {"Journal of the ACM"} + +MACRO {jcss} {"Journal of Computer and System Sciences"} + +MACRO {scp} {"Science of Computer Programming"} + +MACRO {sicomp} {"SIAM Journal on Computing"} + +MACRO {tocs} {"ACM Transactions on Computer Systems"} + +MACRO {tods} {"ACM Transactions on Database Systems"} + +MACRO {tog} {"ACM Transactions on Graphics"} + +MACRO {toms} {"ACM Transactions on Mathematical Software"} + +MACRO {toois} {"ACM Transactions on Office Information Systems"} + +MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} + +MACRO {tcs} {"Theoretical Computer Science"} + +FUNCTION {sortify} +{ purify$ + "l" change.case$ +} + +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.lab.names} +{ 's := + s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := + t get.str.lang 'name.lang := + name.lang lang.en = + { t #1 "{vv~}{ll}" format.name$} + { t #1 "{ll}{ff}" format.name$} + if$ + s num.names$ #1 > + { bbl.space * bbl.et.al * } + 'skip$ + if$ +} + +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 {author.key.organization.label} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { author format.lab.names } + if$ +} + +FUNCTION {editor.key.organization.label} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + 'key + if$ + } + { editor format.lab.names } + if$ +} + +FUNCTION {calc.short.authors} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label + { type$ "collection" = + type$ "proceedings" = + or + { editor empty$ not + 'editor.key.organization.label + 'author.key.organization.label + if$ + } + 'author.key.label + if$ + } + if$ + 'short.list := +} + +FUNCTION {calc.label} +{ calc.short.authors + short.list + "(" + * + format.year duplicate$ empty$ + short.list key field.or.null = or + { pop$ "" } + 'skip$ + if$ + * + 'label := +} + +INTEGERS { seq.num } + +FUNCTION {init.seq} +{ #0 'seq.num :=} + +FUNCTION {int.to.fix} +{ "000000000" swap$ int.to.str$ * + #-1 #10 substring$ +} + +FUNCTION {presort} +{ set.entry.lang + show.url show.doi check.electronic + calc.label + label sortify + " " + * + seq.num #1 + 'seq.num := + seq.num int.to.fix + 'sort.label := + sort.label * + #1 entry.max$ substring$ + 'sort.key$ := +} + +STRINGS { longest.label last.label next.extra } + +INTEGERS { longest.label.width last.extra.num number.label } + +FUNCTION {initialize.longest.label} +{ "" 'longest.label := + #0 int.to.chr$ 'last.label := + "" 'next.extra := + #0 'longest.label.width := + #0 'last.extra.num := + #0 'number.label := +} + +FUNCTION {forward.pass} +{ last.label label = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "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$ + { "{\natexlab{" swap$ * "}}" * } + if$ + 'extra.label := + label extra.label * 'label := +} + +FUNCTION {bib.sort.order} +{ sort.label 'sort.key$ := +} + +FUNCTION {begin.bib} +{ preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + "\begin{thebibliography}{" number.label int.to.str$ * "}" * + write$ newline$ + "\providecommand{\natexlab}[1]{#1}" + write$ newline$ + show.url show.doi or + { "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + } + 'skip$ + if$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ +} + +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} + +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + +EXECUTE {end.bib} diff --git a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-plain.bst b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-plain.bst index 5d2a7976318..771d00425db 100644 --- a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-plain.bst +++ b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-plain.bst @@ -4,7 +4,8 @@ %% %% The original source files were: %% -%% gbt7714.dtx (with options: `authoryear') +%% gbt7714.dtx (with options: `2015,authoryear') +%% Version: 2018/08/05 v1.0.9 %% %% Copyright (C) 2016-2018 by Zeping Lee <zepinglee AT gmail.com> %% @@ -16,6 +17,36 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% + +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + italic.jounal + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #3 'max.num.authors := + #0 'period.between.author.year := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #0 'italic.jounal := + #1 'show.missing.address.publisher := + #1 'show.url := + #1 'show.doi := + #0 'show.note := +} + ENTRY { address author @@ -24,12 +55,14 @@ ENTRY doi edition editor + howpublished institution journal key language mark medium + note number organization pages @@ -43,8 +76,8 @@ ENTRY volume year } - { entry.lang } - { label extra.label sort.label short.list entry.mark } + { entry.lang entry.is.electronic } + { label extra.label sort.label short.list entry.mark entry.url } INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } @@ -65,36 +98,77 @@ FUNCTION {init.state.consts} #0 'lang.other := } -STRINGS { s t } +FUNCTION {bbl.anonymous} +{ lang.zh entry.lang = + { "佚名" } + { "Anon" } + if$ +} -FUNCTION {debug} -{ 's := - duplicate$ - "DEBUG: " s * " -> `" * - swap$ * "'" * - top$ +FUNCTION {bbl.space} { "\ " } + +FUNCTION {bbl.et.al} +{ lang.zh entry.lang = + { "等" } + { lang.ja entry.lang = + { "他" } + { lang.ru entry.lang = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ } -FUNCTION {debug.int} -{ 's := - duplicate$ int.to.str$ - "DEBUG: " s * " == " * - swap$ * - top$ +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak{}" } + +FUNCTION {bbl.sine.loco} +{ lang.zh entry.lang = + { "[出版地不详]" } + { "[S.l.]" } + if$ } -FUNCTION {punct.colon} -{ ": " +FUNCTION {bbl.sine.nomine} +{ lang.zh entry.lang = + { "[出版者不详]" } + { "[s.n.]" } + if$ } -FUNCTION {punct.slash} -{ "//\allowbreak{}" +FUNCTION {bbl.sine.loco.sine.nomine} +{ lang.zh entry.lang = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ } -FUNCTION {punct.space} -{ " " +FUNCTION {not} +{ { #0 } + { #1 } + if$ } +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + FUNCTION {output.nonnull} { 's := output.state mid.sentence = @@ -107,7 +181,7 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -142,7 +216,7 @@ FUNCTION {output.after} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -204,24 +278,6 @@ FUNCTION {new.slash} if$ } -FUNCTION {not} -{ { #0 } - { #1 } - if$ -} - -FUNCTION {and} -{ 'skip$ - { pop$ #0 } - if$ -} - -FUNCTION {or} -{ { pop$ #1 } - 'skip$ - if$ -} - FUNCTION {new.block.checka} { empty$ 'skip$ @@ -261,10 +317,10 @@ FUNCTION {field.or.null} if$ } -FUNCTION {emphasize} +FUNCTION {italicize} { duplicate$ empty$ { pop$ "" } - { "\emph{" swap$ * "}" * } + { "\textit{" swap$ * "}" * } if$ } @@ -341,22 +397,34 @@ FUNCTION {get.str.lang} tmp.lang } -FUNCTION {is.in.chinese} -{ entry.lang lang.zh = -} - -FUNCTION {format.et.al} -{ is.in.chinese - { "等"} - { "et~al." } - if$ +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang } -FUNCTION {format.anonymous} -{ is.in.chinese - { "佚名" } - { "Anon" } +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } if$ + 'entry.lang := } INTEGERS { nameptr namesleft numnames name.lang } @@ -368,15 +436,19 @@ FUNCTION {format.names} numnames 'namesleft := { namesleft #0 > } { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := - nameptr #4 = - { format.et.al + nameptr max.num.authors > + { bbl.et.al #1 'namesleft := } { t "others" = - { format.et.al } + { bbl.et.al } { t get.str.lang 'name.lang := name.lang lang.en = - { t #1 "{vv~}{ll}{ f{~}}" format.name$ "u" change.case$ + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ t #1 "{, jj}" format.name$ * } { t #1 "{ll}{ff}" format.name$ } @@ -404,7 +476,7 @@ FUNCTION {format.key} FUNCTION {format.authors} { author empty$ - { format.anonymous } + { bbl.anonymous } { author format.names } if$ } @@ -420,7 +492,7 @@ FUNCTION {format.translators} { translator empty$ { "" } { translator format.names - is.in.chinese + lang.zh entry.lang = { translator num.names$ #3 > { "译" * } { ", 译" * } @@ -432,108 +504,6 @@ FUNCTION {format.translators} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { new.block "\url{" url * "}" * } - if$ -} - -FUNCTION {is.doi.in.url} -{ 's := - s empty$ - { #1 } - { url empty$ - { #0 } - { s text.length$ 'len := - url text.length$ 'charptr := - { url charptr len substring$ s = not - charptr #0 > - and - } - { charptr #1 - 'charptr := } - while$ - charptr - } - if$ - } - if$ -} - -FUNCTION {format.doi} -{ "" - doi empty$ - 'skip$ - { "" 's := - doi 't := - #0 'numnames := - { t empty$ not} - { t #1 #1 substring$ 'tmp.str := - tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or - { t #2 #1 substring$ empty$ - { s tmp.str * 's := } - 'skip$ - if$ - s empty$ s is.doi.in.url or - 'skip$ - { numnames #1 + 'numnames := - numnames #1 > - { ", " * } - { "DOI: " * } - if$ - "\doi{" s * "}" * * - } - if$ - "" 's := - } - { s tmp.str * 's := } - if$ - t #2 global.max$ substring$ 't := - } - while$ - 's := - s empty$ not - { new.block s } - { "" } - if$ - } - if$ -} - -FUNCTION {format.title} -{ title empty$ - { "" } - { title - entry.lang lang.en = - { "t" change.case$ } - 'skip$ - if$ - } - if$ -} - -FUNCTION {set.mark} -{ entry.mark empty$ not - 'pop$ - { mark empty$ not - { pop$ mark 'entry.mark := } - { 'entry.mark := } - if$ - medium empty$ not - { entry.mark "/" * medium * 'entry.mark := } - { url empty$ not - { entry.mark "/OL" * 'entry.mark := } - 'skip$ - if$ - } - if$ - } - if$ -} - -FUNCTION {format.mark} -{ "\allowbreak[" entry.mark * "]" * } - FUNCTION {format.full.names} {'s := #1 'nameptr := @@ -626,120 +596,38 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {hyphenate} -{ 't := - "" - { t empty$ not } - { t #1 #1 substring$ "-" = - { "-" * - { t #1 #1 substring$ "-" = } - { t #2 global.max$ substring$ 't := } - while$ - } - { t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ -} - -FUNCTION {extract.before.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - s #1 charptr #1 - substring$ - } - if$ -} - -FUNCTION {extract.after.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - { charptr len < - s charptr #1 substring$ "-" = - and - } - { charptr #1 + 'charptr := } - while$ - s charptr global.max$ substring$ - } +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ if$ } -FUNCTION {contains.dash} -{ duplicate$ empty$ - { pop$ #0 } - { 's := - { s empty$ not - s #1 #1 substring$ "-" = not - and - } - { s #2 global.max$ substring$ 's := } - while$ - s empty$ not - } - if$ -} +FUNCTION {add.link} + { url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ + } -FUNCTION {format.year} -{ year empty$ not - { year extract.before.dash } - { date empty$ not - { date extract.before.dash } - { "empty year in " cite$ * warning$ - "" - } +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + link.title + 'add.link + 'skip$ if$ } if$ - extra.label * -} - -FUNCTION {format.date} -{ type$ "patent" = type$ "newspaper" = or - date empty$ not and - { date } - { year } - if$ -} - -FUNCTION {format.editdate} -{ date empty$ not - type$ "newspaper" = not and - url empty$ not doi empty$ not or - and - { "\allowbreak(" date * ")" * } - { "" } - if$ -} - -FUNCTION {format.urldate} -{ urldate empty$ not - { "\allowbreak[" urldate * "]" * } - { "" } - if$ -} - -FUNCTION {format.btitle} -{ title emphasize } FUNCTION {tie.or.space.connect} @@ -792,13 +680,9 @@ FUNCTION {is.number} FUNCTION {format.volume} { volume empty$ { "" } - { volume is.number - { is.in.chinese - { "第 " volume * " 卷" * } - { "volume" volume tie.or.space.connect } - if$ - } - { volume } + { lang.zh entry.lang = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } if$ } if$ @@ -807,13 +691,9 @@ FUNCTION {format.volume} FUNCTION {format.number} { number empty$ { "" } - { number is.number - { is.in.chinese - { "第 " number * " 册" * } - { "number" number tie.or.space.connect } - if$ - } - { number } + { lang.zh entry.lang = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } if$ } if$ @@ -829,22 +709,36 @@ FUNCTION {format.volume.number} FUNCTION {format.series.vol.num.title} { format.volume.number 's := series empty$ not - { series ": " * + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } + 'skip$ + if$ + title + sentence.case.title + 'change.sentence.case 'skip$ if$ - title * + * } { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ - entry.lang lang.en = - { "t" change.case$ } + link.title + 'add.link 'skip$ if$ } @@ -852,22 +746,57 @@ FUNCTION {format.series.vol.num.title} FUNCTION {format.series.vol.num.booktitle} { format.volume.number 's := series empty$ not - { series ": " * + { series bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } 'skip$ if$ booktitle * } { booktitle s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ } +FUNCTION {format.journal} +{ journal + italic.jounal + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + FUNCTION {num.to.ordinal} { duplicate$ text.length$ 'charptr := duplicate$ charptr #1 substring$ 's := @@ -889,13 +818,13 @@ FUNCTION {format.edition} { edition empty$ { "" } { edition is.number - { is.in.chinese + { lang.zh entry.lang = { edition " 版" * } { edition num.to.ordinal " ed." * } if$ } { entry.lang lang.en = - { edition "t" change.case$ 's := + { edition change.sentence.case 's := s "Revised" = s "Revised edition" = or { "Rev. ed." } { s " ed." *} @@ -909,20 +838,6 @@ FUNCTION {format.edition} if$ } -FUNCTION {format.sine.loco} -{ is.in.chinese - { "[出版地不详]" } - { "[S.l.]" } - if$ -} - -FUNCTION {format.sine.nomine} -{ is.in.chinese - { "[出版者不详]" } - { "[s.n.]" } - if$ -} - FUNCTION {format.publisher} { publisher empty$ not { publisher } @@ -942,29 +857,22 @@ FUNCTION {format.publisher} if$ } -FUNCTION {format.sine.loco.sine.nomine} -{ is.in.chinese - { "[出版地不详: 出版者不详]" } - { "[S.l.: s.n.]" } - if$ -} - FUNCTION {format.address.publisher} { address empty$ not { address format.publisher empty$ not - { ": " * format.publisher * } - { url empty$ doi empty$ and - { ": " * format.sine.nomine * } + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } 'skip$ if$ } if$ } - { url empty$ doi empty$ and + { entry.is.electronic not show.missing.address.publisher and { format.publisher empty$ not - { format.sine.loco ": " * format.publisher * } - { format.sine.loco.sine.nomine } + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } if$ } { format.publisher empty$ not @@ -977,6 +885,115 @@ FUNCTION {format.address.publisher} if$ } +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + "" + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + FUNCTION {format.pages} { pages empty$ { "" } @@ -984,9 +1001,6 @@ FUNCTION {format.pages} if$ } -FUNCTION {format.journal.volume} -{ volume } - FUNCTION {format.journal.number} { number empty$ not { "\penalty0 (" number * ")" * } @@ -994,10 +1008,17 @@ FUNCTION {format.journal.number} if$ } +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + FUNCTION {format.periodical.year.volume.number} { year empty$ not { year extract.before.dash } - { "No year in periodical " cite$ * warning$ } + { "empty year in periodical " cite$ * warning$ } if$ volume empty$ not { ", " * volume extract.before.dash * } @@ -1032,90 +1053,144 @@ FUNCTION {format.periodical.year.volume.number} if$ } -FUNCTION {format.in.ed.booktitle} -{ booktitle empty$ - { "" } - { editor empty$ - { "In " booktitle emphasize * } - { "In " format.editors * ", " * booktitle emphasize * } +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } if$ } if$ } -FUNCTION {empty.misc.check} -{ author empty$ title empty$ - year empty$ - and and - key empty$ not and - { "all relevant fields are empty in " cite$ * warning$ } +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } 'skip$ if$ } -FUNCTION {format.article.crossref} -{ key empty$ - { journal empty$ - { "need key or journal for " cite$ * " to crossref " * crossref * - warning$ - "" +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr } - { "In \emph{" journal * "}" * } if$ } - { "In " } if$ - " \citet{" * crossref * "}" * } -FUNCTION {format.book.crossref} -{ volume empty$ - { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - "In " - } - { "Volume" volume tie.or.space.connect - " of " * - } - if$ - editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { series empty$ - { "need editor, key, or series for " cite$ * " to crossref " * - crossref * warning$ - "" * +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := } - { "\emph{" * series * "}" * } + { s tmp.str * 's := } if$ + t #2 global.max$ substring$ 't := } - 'skip$ + while$ + 's := + s empty$ not + { new.block s } + { "" } if$ } 'skip$ if$ - " \citet{" * crossref * "}" * } -FUNCTION {format.incoll.inproc.crossref} -{ editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { booktitle empty$ - { "need editor, key, or booktitle for " cite$ * " to crossref " * - crossref * warning$ - "" - } - { "In \emph{" booktitle * "}" * } - if$ - } - { "In " } +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ if$ } - { "In " } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ if$ - " \citet{" * crossref * "}" * } FUNCTION {monograph} @@ -1124,15 +1199,19 @@ FUNCTION {monograph} { format.authors } { editor empty$ not { format.editors } - { format.anonymous } + { bbl.anonymous } if$ } if$ output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.series.vol.num.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -1140,10 +1219,12 @@ FUNCTION {monograph} format.edition output new.block format.address.publisher output - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1151,10 +1232,14 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -1166,10 +1251,12 @@ FUNCTION {incollection} format.edition output new.block format.address.publisher output - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1177,10 +1264,14 @@ FUNCTION {periodical} { output.bibitem format.authors "author" output.check author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block format.periodical.year.volume.number output @@ -1189,27 +1280,34 @@ FUNCTION {periodical} format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } -FUNCTION {article.in.journal} +FUNCTION {article} { output.bibitem format.authors "author" output.check author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block - journal "journal" output.check + format.journal "journal" output.check volume output format.journal.number "" output.after - format.pages punct.colon output.after - format.editdate "" output.after + format.journal.pages "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1217,52 +1315,70 @@ FUNCTION {patent} { output.bibitem format.authors output author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.title number empty$ not - { punct.colon * number * } + { bbl.colon * number * } 'skip$ if$ "title" output.check - "P" set.mark + "P" set.entry.mark format.mark "" output.after new.block format.date "year" output.check format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } -FUNCTION {online} -{ output.bibitem +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem format.authors output author format.key output + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check new.block format.series.vol.num.title "title" output.check - "EB" set.mark + "EB" set.entry.mark format.mark "" output.after new.block format.address.publisher output - format.pages punct.colon output.after + format.pages bbl.colon output.after format.editdate "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } FUNCTION {misc} { journal empty$ not - 'article.in.journal + 'article { booktitle empty$ not 'incollection - { url empty$ not - 'online - { "Z" set.mark - monograph + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ } if$ } @@ -1273,72 +1389,84 @@ FUNCTION {misc} } FUNCTION {archive} -{ "A" set.mark +{ "A" set.entry.mark misc } -FUNCTION {article} { misc } - FUNCTION {book} { monograph } +FUNCTION {booklet} { book } + FUNCTION {collection} -{ "G" set.mark +{ "G" set.entry.mark monograph } FUNCTION {database} -{ "DB" set.mark - misc +{ "DB" set.entry.mark + electronic } FUNCTION {dataset} -{ "DS" set.mark - misc +{ "DS" set.entry.mark + electronic } FUNCTION {inbook} { book } FUNCTION {inproceedings} -{ "C" set.mark +{ "C" set.entry.mark incollection } FUNCTION {conference} { inproceedings } FUNCTION {map} -{ "CM" set.mark +{ "CM" set.entry.mark misc } +FUNCTION {manual} { monograph } + FUNCTION {mastersthesis} -{ "D" set.mark +{ "D" set.entry.mark monograph } FUNCTION {newspaper} -{ "N" set.mark - article.in.journal +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic } FUNCTION {phdthesis} { mastersthesis } FUNCTION {proceedings} -{ "C" set.mark +{ "C" set.entry.mark monograph } FUNCTION {software} -{ "CP" set.mark - misc +{ "CP" set.entry.mark + electronic } FUNCTION {standard} -{ "S" set.mark +{ "S" set.entry.mark misc } FUNCTION {techreport} -{ "R" set.mark +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark misc } @@ -1409,34 +1537,6 @@ MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} MACRO {tcs} {"Theoretical Computer Science"} -READ - -EXECUTE {init.state.consts} - -FUNCTION {set.entry.lang} -{ language empty$ - { author field.or.null title field.or.null * get.str.lang } - { language "english" = language "american" = or language "british" = or - { lang.en } - { language "chinese" = - { lang.zh } - { language "japanese" = - { lang.ja } - { language "russian" = - { lang.ru } - { lang.other } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - 'entry.lang := -} - FUNCTION {sortify} { purify$ "l" change.case$ @@ -1460,7 +1560,7 @@ FUNCTION {format.lab.names} { t #1 "{ll}{ff}" format.name$} if$ s num.names$ #1 > - { "\ " * format.et.al * } + { bbl.space * bbl.et.al * } 'skip$ if$ } @@ -1616,7 +1716,7 @@ FUNCTION {sort.format.title} } FUNCTION {anonymous.sort} -{ is.in.chinese +{ lang.zh entry.lang = { "yi4 ming2" } { "anon" } if$ @@ -1624,7 +1724,11 @@ FUNCTION {anonymous.sort} FUNCTION {author.sort} { key empty$ - { author empty$ + { entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ + author empty$ { anonymous.sort } { author sort.format.names } if$ @@ -1680,6 +1784,7 @@ FUNCTION {editor.organization.sort} FUNCTION {presort} { set.entry.lang + show.url show.doi check.electronic calc.label label sortify " " @@ -1713,10 +1818,6 @@ FUNCTION {presort} 'sort.key$ := } -ITERATE {presort} - -SORT - STRINGS { longest.label last.label next.extra } INTEGERS { longest.label.width last.extra.num number.label } @@ -1758,20 +1859,10 @@ FUNCTION {reverse.pass} label extra.label * 'label := } -EXECUTE {initialize.longest.label} - -ITERATE {forward.pass} - -REVERSE {reverse.pass} - FUNCTION {bib.sort.order} { sort.label 'sort.key$ := } -ITERATE {bib.sort.order} - -SORT - FUNCTION {begin.bib} { preamble$ empty$ 'skip$ @@ -1781,25 +1872,53 @@ FUNCTION {begin.bib} write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ - "\providecommand{\url}[1]{#1}" - write$ newline$ - "\providecommand{\href}[2]{\url{#2}}" - write$ newline$ - "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" - write$ newline$ - "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" - write$ newline$ - " \urlstyle{same}\fi" - write$ newline$ + show.url show.doi or + { "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + } + 'skip$ + if$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ } -EXECUTE {begin.bib} - -ITERATE {call.type$} - FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ } +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + EXECUTE {end.bib} diff --git a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-unsrt.bst b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-unsrt.bst index 01dc40da2e5..1f2d35de4d8 100644 --- a/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-unsrt.bst +++ b/Master/texmf-dist/bibtex/bst/gbt7714/gbt7714-unsrt.bst @@ -4,7 +4,8 @@ %% %% The original source files were: %% -%% gbt7714.dtx (with options: `numerical') +%% gbt7714.dtx (with options: `2015,numerical') +%% Version: 2018/08/05 v1.0.9 %% %% Copyright (C) 2016-2018 by Zeping Lee <zepinglee AT gmail.com> %% @@ -16,6 +17,36 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% + +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + italic.jounal + show.missing.address.publisher + show.url + show.doi + show.note +} + +FUNCTION {load.config} +{ + #1 'uppercase.name := + #3 'max.num.authors := + #0 'period.between.author.year := + #1 'sentence.case.title := + #0 'link.title := + #1 'show.mark := + #0 'italic.jounal := + #1 'show.missing.address.publisher := + #1 'show.url := + #1 'show.doi := + #0 'show.note := +} + ENTRY { address author @@ -24,12 +55,14 @@ ENTRY doi edition editor + howpublished institution journal key language mark medium + note number organization pages @@ -43,8 +76,8 @@ ENTRY volume year } - { entry.lang } - { label extra.label sort.label short.list entry.mark } + { entry.lang entry.is.electronic } + { label extra.label sort.label short.list entry.mark entry.url } INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } @@ -65,36 +98,77 @@ FUNCTION {init.state.consts} #0 'lang.other := } -STRINGS { s t } +FUNCTION {bbl.anonymous} +{ lang.zh entry.lang = + { "佚名" } + { "Anon" } + if$ +} -FUNCTION {debug} -{ 's := - duplicate$ - "DEBUG: " s * " -> `" * - swap$ * "'" * - top$ +FUNCTION {bbl.space} { "\ " } + +FUNCTION {bbl.et.al} +{ lang.zh entry.lang = + { "等" } + { lang.ja entry.lang = + { "他" } + { lang.ru entry.lang = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ } -FUNCTION {debug.int} -{ 's := - duplicate$ int.to.str$ - "DEBUG: " s * " == " * - swap$ * - top$ +FUNCTION {bbl.colon} { ": " } + +FUNCTION {bbl.wide.space} { "\quad " } + +FUNCTION {bbl.slash} { "//\allowbreak{}" } + +FUNCTION {bbl.sine.loco} +{ lang.zh entry.lang = + { "[出版地不详]" } + { "[S.l.]" } + if$ } -FUNCTION {punct.colon} -{ ": " +FUNCTION {bbl.sine.nomine} +{ lang.zh entry.lang = + { "[出版者不详]" } + { "[s.n.]" } + if$ } -FUNCTION {punct.slash} -{ "//\allowbreak{}" +FUNCTION {bbl.sine.loco.sine.nomine} +{ lang.zh entry.lang = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ } -FUNCTION {punct.space} -{ " " +FUNCTION {not} +{ { #0 } + { #1 } + if$ } +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +STRINGS { s t } + FUNCTION {output.nonnull} { 's := output.state mid.sentence = @@ -107,7 +181,7 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -142,7 +216,7 @@ FUNCTION {output.after} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -204,24 +278,6 @@ FUNCTION {new.slash} if$ } -FUNCTION {not} -{ { #0 } - { #1 } - if$ -} - -FUNCTION {and} -{ 'skip$ - { pop$ #0 } - if$ -} - -FUNCTION {or} -{ { pop$ #1 } - 'skip$ - if$ -} - FUNCTION {new.block.checka} { empty$ 'skip$ @@ -261,10 +317,10 @@ FUNCTION {field.or.null} if$ } -FUNCTION {emphasize} +FUNCTION {italicize} { duplicate$ empty$ { pop$ "" } - { "\emph{" swap$ * "}" * } + { "\textit{" swap$ * "}" * } if$ } @@ -341,22 +397,34 @@ FUNCTION {get.str.lang} tmp.lang } -FUNCTION {is.in.chinese} -{ entry.lang lang.zh = +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang } -FUNCTION {format.et.al} -{ is.in.chinese - { "等"} - { "et~al." } - if$ -} - -FUNCTION {format.anonymous} -{ is.in.chinese - { "佚名" } - { "Anon" } +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } if$ + 'entry.lang := } INTEGERS { nameptr namesleft numnames name.lang } @@ -368,15 +436,19 @@ FUNCTION {format.names} numnames 'namesleft := { namesleft #0 > } { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := - nameptr #4 = - { format.et.al + nameptr max.num.authors > + { bbl.et.al #1 'namesleft := } { t "others" = - { format.et.al } + { bbl.et.al } { t get.str.lang 'name.lang := name.lang lang.en = - { t #1 "{vv~}{ll}{ f{~}}" format.name$ "u" change.case$ + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ t #1 "{, jj}" format.name$ * } { t #1 "{ll}{ff}" format.name$ } @@ -420,7 +492,7 @@ FUNCTION {format.translators} { translator empty$ { "" } { translator format.names - is.in.chinese + lang.zh entry.lang = { translator num.names$ #3 > { "译" * } { ", 译" * } @@ -432,108 +504,6 @@ FUNCTION {format.translators} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { new.block "\url{" url * "}" * } - if$ -} - -FUNCTION {is.doi.in.url} -{ 's := - s empty$ - { #1 } - { url empty$ - { #0 } - { s text.length$ 'len := - url text.length$ 'charptr := - { url charptr len substring$ s = not - charptr #0 > - and - } - { charptr #1 - 'charptr := } - while$ - charptr - } - if$ - } - if$ -} - -FUNCTION {format.doi} -{ "" - doi empty$ - 'skip$ - { "" 's := - doi 't := - #0 'numnames := - { t empty$ not} - { t #1 #1 substring$ 'tmp.str := - tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or - { t #2 #1 substring$ empty$ - { s tmp.str * 's := } - 'skip$ - if$ - s empty$ s is.doi.in.url or - 'skip$ - { numnames #1 + 'numnames := - numnames #1 > - { ", " * } - { "DOI: " * } - if$ - "\doi{" s * "}" * * - } - if$ - "" 's := - } - { s tmp.str * 's := } - if$ - t #2 global.max$ substring$ 't := - } - while$ - 's := - s empty$ not - { new.block s } - { "" } - if$ - } - if$ -} - -FUNCTION {format.title} -{ title empty$ - { "" } - { title - entry.lang lang.en = - { "t" change.case$ } - 'skip$ - if$ - } - if$ -} - -FUNCTION {set.mark} -{ entry.mark empty$ not - 'pop$ - { mark empty$ not - { pop$ mark 'entry.mark := } - { 'entry.mark := } - if$ - medium empty$ not - { entry.mark "/" * medium * 'entry.mark := } - { url empty$ not - { entry.mark "/OL" * 'entry.mark := } - 'skip$ - if$ - } - if$ - } - if$ -} - -FUNCTION {format.mark} -{ "\allowbreak[" entry.mark * "]" * } - FUNCTION {format.full.names} {'s := #1 'nameptr := @@ -626,120 +596,38 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {hyphenate} -{ 't := - "" - { t empty$ not } - { t #1 #1 substring$ "-" = - { "-" * - { t #1 #1 substring$ "-" = } - { t #2 global.max$ substring$ 't := } - while$ - } - { t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ -} - -FUNCTION {extract.before.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - s #1 charptr #1 - substring$ - } - if$ -} - -FUNCTION {extract.after.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - { charptr len < - s charptr #1 substring$ "-" = - and - } - { charptr #1 + 'charptr := } - while$ - s charptr global.max$ substring$ - } +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ if$ } -FUNCTION {contains.dash} -{ duplicate$ empty$ - { pop$ #0 } - { 's := - { s empty$ not - s #1 #1 substring$ "-" = not - and - } - { s #2 global.max$ substring$ 's := } - while$ - s empty$ not - } - if$ -} +FUNCTION {add.link} + { url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ + } -FUNCTION {format.year} -{ year empty$ not - { year extract.before.dash } - { date empty$ not - { date extract.before.dash } - { "empty year in " cite$ * warning$ - "" - } +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + link.title + 'add.link + 'skip$ if$ } if$ - extra.label * -} - -FUNCTION {format.date} -{ type$ "patent" = type$ "newspaper" = or - date empty$ not and - { date } - { year } - if$ -} - -FUNCTION {format.editdate} -{ date empty$ not - type$ "newspaper" = not and - url empty$ not doi empty$ not or - and - { "\allowbreak(" date * ")" * } - { "" } - if$ -} - -FUNCTION {format.urldate} -{ urldate empty$ not - { "\allowbreak[" urldate * "]" * } - { "" } - if$ -} - -FUNCTION {format.btitle} -{ title emphasize } FUNCTION {tie.or.space.connect} @@ -792,13 +680,9 @@ FUNCTION {is.number} FUNCTION {format.volume} { volume empty$ { "" } - { volume is.number - { is.in.chinese - { "第 " volume * " 卷" * } - { "volume" volume tie.or.space.connect } - if$ - } - { volume } + { lang.zh entry.lang = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } if$ } if$ @@ -807,13 +691,9 @@ FUNCTION {format.volume} FUNCTION {format.number} { number empty$ { "" } - { number is.number - { is.in.chinese - { "第 " number * " 册" * } - { "number" number tie.or.space.connect } - if$ - } - { number } + { lang.zh entry.lang = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } if$ } if$ @@ -829,22 +709,36 @@ FUNCTION {format.volume.number} FUNCTION {format.series.vol.num.title} { format.volume.number 's := series empty$ not - { series ": " * + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } 'skip$ if$ - title * + title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + * } { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ - entry.lang lang.en = - { "t" change.case$ } + link.title + 'add.link 'skip$ if$ } @@ -852,22 +746,57 @@ FUNCTION {format.series.vol.num.title} FUNCTION {format.series.vol.num.booktitle} { format.volume.number 's := series empty$ not - { series ": " * + { series bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } 'skip$ if$ booktitle * } { booktitle s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ } +FUNCTION {format.journal} +{ journal + italic.jounal + 'italicize + 'skip$ + if$ +} + +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + FUNCTION {num.to.ordinal} { duplicate$ text.length$ 'charptr := duplicate$ charptr #1 substring$ 's := @@ -889,13 +818,13 @@ FUNCTION {format.edition} { edition empty$ { "" } { edition is.number - { is.in.chinese + { lang.zh entry.lang = { edition " 版" * } { edition num.to.ordinal " ed." * } if$ } { entry.lang lang.en = - { edition "t" change.case$ 's := + { edition change.sentence.case 's := s "Revised" = s "Revised edition" = or { "Rev. ed." } { s " ed." *} @@ -909,20 +838,6 @@ FUNCTION {format.edition} if$ } -FUNCTION {format.sine.loco} -{ is.in.chinese - { "[出版地不详]" } - { "[S.l.]" } - if$ -} - -FUNCTION {format.sine.nomine} -{ is.in.chinese - { "[出版者不详]" } - { "[s.n.]" } - if$ -} - FUNCTION {format.publisher} { publisher empty$ not { publisher } @@ -942,29 +857,22 @@ FUNCTION {format.publisher} if$ } -FUNCTION {format.sine.loco.sine.nomine} -{ is.in.chinese - { "[出版地不详: 出版者不详]" } - { "[S.l.: s.n.]" } - if$ -} - FUNCTION {format.address.publisher} { address empty$ not { address format.publisher empty$ not - { ": " * format.publisher * } - { url empty$ doi empty$ and - { ": " * format.sine.nomine * } + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } 'skip$ if$ } if$ } - { url empty$ doi empty$ and + { entry.is.electronic not show.missing.address.publisher and { format.publisher empty$ not - { format.sine.loco ": " * format.publisher * } - { format.sine.loco.sine.nomine } + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } if$ } { format.publisher empty$ not @@ -977,6 +885,115 @@ FUNCTION {format.address.publisher} if$ } +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + "" + } + if$ + } + if$ + extra.label * +} + +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + FUNCTION {format.pages} { pages empty$ { "" } @@ -984,9 +1001,6 @@ FUNCTION {format.pages} if$ } -FUNCTION {format.journal.volume} -{ volume } - FUNCTION {format.journal.number} { number empty$ not { "\penalty0 (" number * ")" * } @@ -994,10 +1008,17 @@ FUNCTION {format.journal.number} if$ } +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + FUNCTION {format.periodical.year.volume.number} { year empty$ not { year extract.before.dash } - { "No year in periodical " cite$ * warning$ } + { "empty year in periodical " cite$ * warning$ } if$ volume empty$ not { ", " * volume extract.before.dash * } @@ -1032,90 +1053,144 @@ FUNCTION {format.periodical.year.volume.number} if$ } -FUNCTION {format.in.ed.booktitle} -{ booktitle empty$ - { "" } - { editor empty$ - { "In " booktitle emphasize * } - { "In " format.editors * ", " * booktitle emphasize * } +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } if$ } if$ } -FUNCTION {empty.misc.check} -{ author empty$ title empty$ - year empty$ - and and - key empty$ not and - { "all relevant fields are empty in " cite$ * warning$ } +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } 'skip$ if$ } -FUNCTION {format.article.crossref} -{ key empty$ - { journal empty$ - { "need key or journal for " cite$ * " to crossref " * crossref * - warning$ - "" +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr } - { "In \emph{" journal * "}" * } if$ } - { "In " } if$ - " \citet{" * crossref * "}" * } -FUNCTION {format.book.crossref} -{ volume empty$ - { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - "In " - } - { "Volume" volume tie.or.space.connect - " of " * - } - if$ - editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { series empty$ - { "need editor, key, or series for " cite$ * " to crossref " * - crossref * warning$ - "" * +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := } - { "\emph{" * series * "}" * } + { s tmp.str * 's := } if$ + t #2 global.max$ substring$ 't := } - 'skip$ + while$ + 's := + s empty$ not + { new.block s } + { "" } if$ } 'skip$ if$ - " \citet{" * crossref * "}" * } -FUNCTION {format.incoll.inproc.crossref} -{ editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { booktitle empty$ - { "need editor, key, or booktitle for " cite$ * " to crossref " * - crossref * warning$ - "" - } - { "In \emph{" booktitle * "}" * } - if$ - } - { "In " } +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } + 'skip$ if$ } - { "In " } + 'skip$ + if$ +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ +} + +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ if$ - " \citet{" * crossref * "}" * } FUNCTION {monograph} @@ -1131,7 +1206,7 @@ FUNCTION {monograph} output new.block format.series.vol.num.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -1140,10 +1215,12 @@ FUNCTION {monograph} new.block format.address.publisher output format.year "year" output.check - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1153,7 +1230,7 @@ FUNCTION {incollection} author format.key output new.block format.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -1166,10 +1243,12 @@ FUNCTION {incollection} new.block format.address.publisher output format.year "year" output.check - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1179,7 +1258,7 @@ FUNCTION {periodical} author format.key output new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block format.periodical.year.volume.number output @@ -1189,27 +1268,30 @@ FUNCTION {periodical} format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } -FUNCTION {article.in.journal} +FUNCTION {article} { output.bibitem format.authors "author" output.check author format.key output new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block - journal "journal" output.check + format.journal "journal" output.check format.date "year" output.check volume output format.journal.number "" output.after - format.pages punct.colon output.after - format.editdate "" output.after + format.journal.pages "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } @@ -1220,27 +1302,31 @@ FUNCTION {patent} new.block format.title number empty$ not - { punct.colon * number * } + { bbl.colon * number * } 'skip$ if$ "title" output.check - "P" set.mark + "P" set.entry.mark format.mark "" output.after new.block format.date "year" output.check format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } -FUNCTION {online} -{ output.bibitem +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem format.authors output author format.key output new.block format.series.vol.num.title "title" output.check - "EB" set.mark + "EB" set.entry.mark format.mark "" output.after new.block format.address.publisher output @@ -1248,23 +1334,29 @@ FUNCTION {online} { format.date output } 'skip$ if$ - format.pages punct.colon output.after + format.pages bbl.colon output.after format.editdate "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } FUNCTION {misc} { journal empty$ not - 'article.in.journal + 'article { booktitle empty$ not 'incollection - { url empty$ not - 'online - { "Z" set.mark - monograph + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ } if$ } @@ -1275,72 +1367,84 @@ FUNCTION {misc} } FUNCTION {archive} -{ "A" set.mark +{ "A" set.entry.mark misc } -FUNCTION {article} { misc } - FUNCTION {book} { monograph } +FUNCTION {booklet} { book } + FUNCTION {collection} -{ "G" set.mark +{ "G" set.entry.mark monograph } FUNCTION {database} -{ "DB" set.mark - misc +{ "DB" set.entry.mark + electronic } FUNCTION {dataset} -{ "DS" set.mark - misc +{ "DS" set.entry.mark + electronic } FUNCTION {inbook} { book } FUNCTION {inproceedings} -{ "C" set.mark +{ "C" set.entry.mark incollection } FUNCTION {conference} { inproceedings } FUNCTION {map} -{ "CM" set.mark +{ "CM" set.entry.mark misc } +FUNCTION {manual} { monograph } + FUNCTION {mastersthesis} -{ "D" set.mark +{ "D" set.entry.mark monograph } FUNCTION {newspaper} -{ "N" set.mark - article.in.journal +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic } FUNCTION {phdthesis} { mastersthesis } FUNCTION {proceedings} -{ "C" set.mark +{ "C" set.entry.mark monograph } FUNCTION {software} -{ "CP" set.mark - misc +{ "CP" set.entry.mark + electronic } FUNCTION {standard} -{ "S" set.mark +{ "S" set.entry.mark misc } FUNCTION {techreport} -{ "R" set.mark +{ "R" set.entry.mark + misc +} + +FUNCTION {unpublished} +{ "Z" set.entry.mark misc } @@ -1411,34 +1515,6 @@ MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} MACRO {tcs} {"Theoretical Computer Science"} -READ - -EXECUTE {init.state.consts} - -FUNCTION {set.entry.lang} -{ language empty$ - { author field.or.null title field.or.null * get.str.lang } - { language "english" = language "american" = or language "british" = or - { lang.en } - { language "chinese" = - { lang.zh } - { language "japanese" = - { lang.ja } - { language "russian" = - { lang.ru } - { lang.other } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - 'entry.lang := -} - FUNCTION {sortify} { purify$ "l" change.case$ @@ -1462,7 +1538,7 @@ FUNCTION {format.lab.names} { t #1 "{ll}{ff}" format.name$} if$ s num.names$ #1 > - { "\ " * format.et.al * } + { bbl.space * bbl.et.al * } 'skip$ if$ } @@ -1562,8 +1638,6 @@ INTEGERS { seq.num } FUNCTION {init.seq} { #0 'seq.num :=} -EXECUTE {init.seq} - FUNCTION {int.to.fix} { "000000000" swap$ int.to.str$ * #-1 #10 substring$ @@ -1571,6 +1645,7 @@ FUNCTION {int.to.fix} FUNCTION {presort} { set.entry.lang + show.url show.doi check.electronic calc.label label sortify " " @@ -1583,10 +1658,6 @@ FUNCTION {presort} 'sort.key$ := } -ITERATE {presort} - -SORT - STRINGS { longest.label last.label next.extra } INTEGERS { longest.label.width last.extra.num number.label } @@ -1628,20 +1699,10 @@ FUNCTION {reverse.pass} label extra.label * 'label := } -EXECUTE {initialize.longest.label} - -ITERATE {forward.pass} - -REVERSE {reverse.pass} - FUNCTION {bib.sort.order} { sort.label 'sort.key$ := } -ITERATE {bib.sort.order} - -SORT - FUNCTION {begin.bib} { preamble$ empty$ 'skip$ @@ -1651,25 +1712,55 @@ FUNCTION {begin.bib} write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ - "\providecommand{\url}[1]{#1}" - write$ newline$ - "\providecommand{\href}[2]{\url{#2}}" - write$ newline$ - "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" - write$ newline$ - "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" - write$ newline$ - " \urlstyle{same}\fi" - write$ newline$ + show.url show.doi or + { "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + } + 'skip$ + if$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ } -EXECUTE {begin.bib} - -ITERATE {call.type$} - FUNCTION {end.bib} { newline$ "\end{thebibliography}" write$ newline$ } +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +EXECUTE {init.seq} + +ITERATE {presort} + +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +ITERATE {call.type$} + EXECUTE {end.bib} diff --git a/Master/texmf-dist/doc/bibtex/gbt7714/README.md b/Master/texmf-dist/doc/bibtex/gbt7714/README.md index 694d67d0a03..58ed09b8a69 100644 --- a/Master/texmf-dist/doc/bibtex/gbt7714/README.md +++ b/Master/texmf-dist/doc/bibtex/gbt7714/README.md @@ -1,48 +1,91 @@ # GB/T 7714-2015 BibTeX Style -[![Travis build](https://travis-ci.org/zepinglee/gbt7714-bibtex-style.svg?branch=master)](https://travis-ci.org/zepinglee/gbt7714-bibtex-style) + +[![CTAN](https://img.shields.io/ctan/v/gbt7714.svg)](https://ctan.org/pkg/gbt7714) [![GitHub release](https://img.shields.io/github/release/zepinglee/gbt7714-bibtex-style/all.svg)](https://github.com/zepinglee/gbt7714-bibtex-style/releases/latest) [![GitHub commits](https://img.shields.io/github/commits-since/zepinglee/gbt7714-bibtex-style/latest.svg)](https://github.com/zepinglee/gbt7714-bibtex-style/commits/master) +[![Travis build](https://travis-ci.org/zepinglee/gbt7714-bibtex-style.svg?branch=master)](https://travis-ci.org/zepinglee/gbt7714-bibtex-style) + + +## Introduction + +The `gbt7714` package provides a BibTEX implementation for the China's +bibliography style standard GB/T 7714-2015. +It consists of two bst files for numerical and authoryear styles as well as a +LaTeX package which provides the citation style defined in the standard. +It is compatible with `natbib` and supports language detection (Chinese +and English) for each biblilography entry. ## 新特性 -- 兼容 natbib +- 兼容 `natbib` - 支持顺序编码制和著者-出版年制两种风格 -- 自动识别语言 +- 自动识别语言并进行相应处理 +- 提供了简单的接口供用户修改样式 ## 使用方法 -1. 将 bst 文件和 sty 文件复制到工作目录。 -2. 调用宏包 `\usepackage[authoryear]{gbt7714}`。 -3. **不再**需要调用 `\bibliographystyle` 命令。 +1. 将 `bst` 文件和 `sty` 文件复制到工作目录。 + +2. 在导言区调用宏包 `gbt7714`,可选的参数如下表。 + 默认的参数是 `super`,额外的参数会传递给 `natbib` 宏包。 + +可选参数 | 引用标注 | 参考文献列表 +--- | --- | --- +`super`(默认) | 角标数字 | 顺序编码 +`numbers` | 数字 | 顺序编码 +`authoryear` | 著者-出版年 | 著者-出版年 +`2015`(默认) | - | GB/T 7714-2015 版 +`2005` | - | GB/T 7714-2005 版 + +比如: `\usepackage[authoryear]{gbt7714}` + +3. 在正文中 `\cite` 文献。 + +4. 使用 `\bibliography` 命令生成参考文献表。 ## 注意事项 -1. bib 数据库应使用 UTF-8 编码。 -2. 中文文献使用 author-year 式参考文献表时,必须在 `key` 域填写作者姓名的拼音, -才能使得文献列表按照拼音排序,比如: +2. **不再**需要调用 `\bibliographystyle` 命令。 +1. `bib` 数据库应使用 UTF-8 编码。 +3. 使用著者-出版年制参考文献表时,中文的文献**必须**在 `key` 域填写 +著者姓名的拼音,才能按照拼音排序,比如: ``` @book{capital, author = {马克思 and 恩格斯}, key = {ma3 ke4 si1 en1 ge2 si1}, ... ``` -3. 默认可以自动处理 `language`, `mark`, `medium`,用户也可以指定,比如: + +同一处引用多篇文献时,应将各篇文献的 key 一同写在 `\cite` 命令中, +如 `\cite{knuth84,lamport94,mittelbach04}`。 +如遇连续编号,可以自动转为起讫序号并用短横线连接。 +它可以自动排序并用处理连续编号。 + +若需要标出引文的页码,可以标在 `\cite` 的可选参数中,如 `\cite[42]{knuth84}`。 + +更多的引用标注方法可以参考 `natbib` 宏包的使用说明。 + +本宏包默认情况下可以自动识别文献语言,并自动处理文献类型和载体类型标识, +但是在少数情况下需要用户手动指定,如: ``` -language = {japanese}, -mark = {M}, -medium = {CD}, +@misc{citekey, + language = {japanese}, + mark = {Z}, + medium = {DK}, + ... ``` +可选的语言有 `english`, `chinese`, `japanese`, `russian`。 ## 文献类型 文献类型 | 标识代码 | Entry Type --- | :---: | --- -普通图书 | M | `book` 或 `inbook` +普通图书 | M | `book` 图书的析出文献 | M | `incollection` 会议录 | C | `proceedings` 会议录的析出文献 | C | `inproceedings` 或 `conference` @@ -63,10 +106,9 @@ medium = {CD}, 注: - 带 “\*” 的类型不是 BibTeX 的标准文献类型。 -- 不支持的 BibTeX 标准类型有:`booklet`, `manual`, `unpublished`。 -## 支持的著录项目 +## 著录项目 著录项目(域) | Entry Field --- | --- @@ -98,8 +140,8 @@ medium = {CD}, 注: - 其中带星号的不是 BibTeX/natbib 的标准著录项目。 -- 不支持的 BibTeX 标准著录项目有 annote, chapter, crossref, howpublished, -month, note, type。 +- 不支持的 BibTeX 标准著录项目有 `annote`, `chapter`, `crossref`, `month`, +`type`。 ## 参考文献著录标准 diff --git a/Master/texmf-dist/doc/bibtex/gbt7714/gbt7714.pdf b/Master/texmf-dist/doc/bibtex/gbt7714/gbt7714.pdf Binary files differindex c83c5cd1e30..fc61f3ef6ca 100644 --- a/Master/texmf-dist/doc/bibtex/gbt7714/gbt7714.pdf +++ b/Master/texmf-dist/doc/bibtex/gbt7714/gbt7714.pdf diff --git a/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx b/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx index d2003e067ad..2012af01124 100644 --- a/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx +++ b/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx @@ -21,6 +21,7 @@ %<*install> \input docstrip.tex \preamble +Version: 2018/08/05 v1.0.9 Copyright (C) 2016-\the\year by Zeping Lee <zepinglee AT gmail.com> @@ -38,8 +39,10 @@ version 2005/12/01 or later. \nopostamble \generate{ \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{\jobname-plain.bst}{\from{\jobname.dtx}{authoryear}} - \file{\jobname-unsrt.bst}{\from{\jobname.dtx}{numerical}} + \file{\jobname-plain.bst}{\from{\jobname.dtx}{2015,authoryear}} + \file{\jobname-unsrt.bst}{\from{\jobname.dtx}{2015,numerical}} + \file{\jobname-2005-plain.bst}{\from{\jobname.dtx}{2005,authoryear}} + \file{\jobname-2005-unsrt.bst}{\from{\jobname.dtx}{2005,numerical}} } \endbatchfile %</install> @@ -52,43 +55,58 @@ version 2005/12/01 or later. %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{gbt7714} %<*package> - [2018/05/12 v1.0.7 GB/T 7714-2015 BibTeX Style] + [2018/08/05 v1.0.9 GB/T 7714-2015 BibTeX Style] %</package> % %<*driver> \documentclass[a4paper]{ltxdoc} -\usepackage[paper=a4paper,margin=1in]{geometry} +\usepackage[paper=a4paper,margin=1in,left=1.25in]{geometry} \usepackage{hypdoc} \hypersetup{allcolors=blue} \usepackage[UTF8]{ctex} -\IfFileExists{/System/Library/Fonts/Times.ttc}{% +\IfFileExists{/System/Library/Fonts/Times.ttc}{ \setmainfont{Times} \setsansfont[Scale=MatchLowercase]{Helvetica} \setmonofont[Scale=MatchLowercase]{Menlo} -}{\relax} +}{} +\usepackage{caption} \usepackage{booktabs} +\usepackage{gbt7714} \usepackage{listings} \lstnewenvironment{latex}{% \lstset{% - basicstyle = \small\ttfamily, + basicstyle = \ttfamily\small, language = [LaTeX]TeX, gobble = 2, frame = single,}}{} \lstnewenvironment{pseudocode}{% \lstset{% - basicstyle=\ttfamily, + basicstyle=\ttfamily\small, language=bash, gobble=2, frame=single,}}{} +\makeatletter +\def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters + \Describe@Option} +\def\Describe@Option#1{\endgroup + \marginpar{\raggedleft\PrintDescribeOption{#1}}% + \SpecialEnvIndex{#1}\@esphack\ignorespaces} +\@ifundefined{PrintDescribeOption} + {\def\PrintDescribeOption#1{\strut \MacroFont #1\ }}{} \DeclareRobustCommand\file{\nolinkurl} \DeclareRobustCommand\env{\texttt} \DeclareRobustCommand\pkg{\textsf} \DeclareRobustCommand\cls{\textsf} \DeclareRobustCommand\opt{\texttt} +\setlength\partopsep{\z@} +\def\@listi{\leftmargin\leftmargini + \parsep \z@ + \topsep 5\p@ \@plus2\p@ \@minus3\p@ + \itemsep\z@} +\let\@listI\@listi +\@listi \renewcommand\glossaryname{版本历史} \GlossaryPrologue{\section*{\glossaryname}} -\renewcommand\indexname{命令索引} -\makeatletter \renewcommand*{\changes@}[3]{% \protected@edef\@tempa{% \noexpand\glossary{#1 (#2)\levelchar @@ -108,34 +126,14 @@ version 2005/12/01 or later. \EnableCrossrefs \CodelineIndex \RecordChanges -\OnlyDescription +% \OnlyDescription \begin{document} \DocInput{\jobname.dtx} - \PrintChanges - \PrintIndex \end{document} %</driver> % \fi % -% \CheckSum{0} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% % % % \GetFileInfo{\jobname.dtx} @@ -146,166 +144,165 @@ version 2005/12/01 or later. % \maketitle % % \changes{v1.0}{2018/01/01}{Initial release.} -% \changes{v1.0.1}{2018/03/09}{著者出版年制的文献引用不再排序} -% \changes{v1.0.2}{2017/03/16}{正确识别姓名中的“others”} -% \changes{v1.0.3}{2018/03/29}{顺序编码制连续两个文献引用之间使用连接号} -% \changes{v1.0.4}{2018/04/12}{页码的连接号由 en dash 改为 hyphen} -% \changes{v1.0.5}{2018/04/18}{允许著录多个 DOI} -% \changes{v1.0.6}{2018/05/10}{不再处理中文标题的英文单词的大小写} -% \changes{v1.0.6}{2018/05/10}{文献列表的数字标签左对齐} -% \changes{v1.0.7}{2018/05/12}{修正了检测 Unicode 语言} % % +% \begin{abstract} +% The \pkg{gbt7714} package provides a \BibTeX{} implementation for the China's +% bibliography style standard GB/T 7714-2015. +% It consists of two bst files for numerical and authoryear styles as well as a +% \LaTeX{} package which provides the citation style defined in the standard. +% It is compatible with \pkg{natbib} and supports language detection (Chinese +% and English) for each biblilography entry. +% \end{abstract} + % \section{简介} % -% 《GB/T 7714-2015 信息与文献\ 参考文献著录规则》(以下简称《规则》)是我国关于 -% 参考文献的推荐标准。 -% 本宏包是《规则》的 \BibTeX{} 实现,具有以下特性: +% GB/T 7714-2015 《信息与文献\quad 参考文献著录规则》\cite{gbt77142015} +% (以下简称“国标”)是中国的参考文献推荐标准。 +% 本宏包是国标的 \BibTeX{}\cite{bibtex} 实现,具有以下特性: % \begin{itemize} -% \item 兼容 \pkg{natbib} -% \item 支持了顺序编码制和著者-出版年制两种风格 +% \item 兼容 \pkg{natbib} 宏包\cite{natbib} +% \item 支持顺序编码制和著者-出版年制两种风格 % \item 自动识别语言并进行相应处理 +% \item 提供了简单的接口供用户修改样式 % \end{itemize} +% 本宏包的主页:\url{https://github.com/zepinglee/gbt7714-bibtex-style}。 % % % \section{使用方法} % -% 首先应在导言区调用宏包 \pkg{gbt7714} ,可以选择的参数如 -% 表~\ref{tab:options}。 -% -% \begin{table}[htbp] -% \centering -% \begin{tabular}{lll} -% \toprule -% 参数 & 参考文献列表 & 引用标注 \\ -% \midrule -% \opt{super} (默认) & 顺序编码 & 角标数字 \\ -% \opt{numbers} & 顺序编码 & 数字 \\ -% \opt{authoryear} & 著者-出版年 & 著者-出版年 \\ -% \bottomrule -% \end{tabular} -% \caption{参考文献风格的参数} -% \label{tab:options} -% \end{table} +% \DescribeOption{super} +% \DescribeOption{numbers} +% \DescribeOption{authoryear} +% 按照国标的规定,参考文献的标注体系分为“顺序编码制”和 +% “著者-出版年制”(\opt{authoryear}), +% 其中顺序编码制根据引用标注样式的不同分为角标数字式(\opt{super})和 +% 与正文平排的数字式(\opt{numbers})。 % -% 举个例子: +% 用户应在导言区调用宏包 \pkg{gbt7714},并在参数中选择参考文献的标注样式。 +% 默认的参数是 \opt{super},额外的参数会传递给 \pkg{natbib} 宏包,比如: % \begin{latex} % \usepackage[authoryear]{gbt7714} % \end{latex} % 然后\emph{不再}需要调用 \cs{bibliographystyle} 命令设置参考文献列表风格。 % -% 使用时需要注意以下两点: +% 使用时需要注意以下几点: % \begin{itemize} -% \item 使用的 bib 数据库应使用 UTF-8 编码。 -% \item 使用著者-出版年制参考文献表时,中文文献需要在 key 域填写作者姓名 -% 的拼音,才能使得文献列表按照拼音排序。 +% \item \emph{不}再需要调用 \cs{bibliographystyle} 命令选择参考文献表的格式。 +% \item bib 数据库应使用 UTF-8 编码。 +% \item 使用著者-出版年制参考文献表时,中文的文献\emph{必须} +% 在 key 域填写作者姓名的拼音,才能按照拼音排序, +% 详见第~\ref{sec:sort}~节。 % \end{itemize} % +% \DescribeMacro{\cite} +% 在正文中引用文献时应使用 \cs{cite} 命令。 +% 同一处引用多篇文献时,应将各篇文献的 key 一同写在 \cs{cite} 命令中, +% 如 |\cite{knuth84,lamport94,mittelbach04}|。 +% 如遇连续编号,可以自动转为起讫序号并用短横线连接。 +% 它可以自动排序并用处理连续编号。 +% 若需要标出引文的页码,可以标在 \cs{cite} 的可选参数中,如 +% |\cite[42]{knuth84}|。 +% 更多的引用标注方法可以参考 \pkg{natbib} 宏包的使用说明\cite{natbib}。 +% +% \DescribeMacro{\bibliography} +% 参考文献表可以在文中使用 \cs{bibliography} 命令调用。 +% 注意文献列表的样式已经在模板中根据选项设置, +% 用户\emph{不再}需要使用 \cs{bibliographystyle} 命令。 +% % % \section{文献类型} % -% 《规则》中列举了 16 种参考文献类型, +% 国标中规定了 16 种参考文献类型, % 表~\ref{tab:entry-types} 列举了 \file{bib} 数据库中对应的文献类型。 -% 这些都尽可能地兼容 \BibTeX{} 的标准类型,但是新增了若干文献类型(带星号的)。 +% 这些尽可能兼容 \BibTeX{} 的标准类型,但是新增了若干文献类型(带 * 号)。 % % \begin{table}[htbp] -% \centering +% \centering\small +% \caption{全部文献类型} +% \label{tab:entry-types} % \begin{tabular}{lcl} % \toprule -% 文献类型 & 标识代码 & Entry Type \\ +% 文献类型 & 标识代码 & Entry Type \\ % \midrule -% 普通图书 & M & book 或 inbook \\ -% 图书的析出文献 & M & incollection \\ -% 会议录 & C & proceedings \\ +% 普通图书 & M & book \\ +% 图书的析出文献 & M & incollection \\ +% 会议录 & C & proceedings \\ % 会议录的析出文献 & C & inproceedings 或 conference \\ -% 汇编 & G & collection* \\ -% 报纸 & N & newspaper* \\ -% 期刊的析出文献 & J & article \\ -% 学位论文 & D & mastersthesis 或 phdthesis \\ -% 报告 & R & techreport \\ -% 标准 & S & standard* \\ -% 专利 & P & patent* \\ -% 数据库 & DB & database* \\ -% 计算机程序 & CP & software* \\ -% 电子公告 & EB & online* \\ -% 档案 & A & archive* \\ -% 舆图 & CM & map* \\ -% 数据集 & DS & dataset* \\ -% 其他 & Z & misc \\ +% 汇编 & G & collection* \\ +% 报纸 & N & newspaper* \\ +% 期刊的析出文献 & J & article \\ +% 学位论文 & D & mastersthesis 或 phdthesis \\ +% 报告 & R & techreport \\ +% 标准 & S & standard* \\ +% 专利 & P & patent* \\ +% 数据库 & DB & database* \\ +% 计算机程序 & CP & software* \\ +% 电子公告 & EB & online* \\ +% 档案 & A & archive* \\ +% 舆图 & CM & map* \\ +% 数据集 & DS & dataset* \\ +% 其他 & Z & misc \\ % \bottomrule % \end{tabular} -% \caption{全部文献类型,其中带星号的不是 \BibTeX{} 标准类型} -% \label{tab:entry-types} % \end{table} % -% 注意,不支持的 \BibTeX{} 标准类型有 booklet, manual, unpublished。 -% % % \section{著录项目} % -% 表~\ref{tab:fields} 列出了本宏包支持的全部著录项目。 -% -% \begin{table}[htbp] -% \centering -% \begin{tabular}{ll} -% \toprule -% 著录项目(域) & Field \\ -% \midrule -% 主要责任者 & author \\ -% 题名 & title \\ -% 文献类型标识 & mark* \\ -% 载体类型标识 & medium* \\ -% 译者 & translator* \\ -% 编辑 & editor \\ -% 组织(用于会议) & organization \\ -% 图书题名 & booktitle \\ -% 系列 & series \\ -% 期刊题名 & journal \\ -% 版本 & edition \\ -% 出版地 & address \\ -% 出版者 & publisher \\ -% 学校(用于phdthesis) & school \\ -% 机构(用于techreport) & institution \\ -% 出版年 & year \\ -% 卷 & volume \\ -% 期(或者专利号) & number \\ -% 引文页码 & pages \\ -% 更新或修改日期 & date* \\ -% 引用日期 & urldate* \\ -% 获取和访问路径 & url \\ -% 数字对象唯一标识符 & doi \\ -% 语言 & language* \\ -% 拼音(用于排序) & key \\ -% \bottomrule -% \end{tabular} -% \caption{全部著录项目,其中带星号的不是 \BibTeX{}/natbib 的标准著录项目。 -% 不支持的 \BibTeX{} 标准著录项目有 annote, chapter, crossref, -% howpublished, month, note, type。} -% \label{tab:fields} -% \end{table} -% -% 由于《规则》中要求的著录项目比 \BibTeX{} 支持的要多,必须新增一些著录项目, +% 由于国标中规定的著录项目多于 \BibTeX{} 的标准域, +% 必须新增一些著录项目(带 * 号), % 这些新增的类型在设计时参考了 BibLaTeX,如 date 和 urldate。 +% 本宏包支持的全部域如下: +% \begin{description} +% \item[author] 主要责任者 +% \item[title] 题名 +% \item[mark*] 文献类型标识 +% \item[medium*] 载体类型标识 +% \item[translator*] 译者 +% \item[editor] 编辑 +% \item[organization] 组织(用于会议) +% \item[booktitle] 图书题名 +% \item[series] 系列 +% \item[journal] 期刊题名 +% \item[edition] 版本 +% \item[address] 出版地 +% \item[publisher] 出版者 +% \item[school] 学校(用于phdthesis) +% \item[institution] 机构(用于techreport) +% \item[year] 出版年 +% \item[volume] 卷 +% \item[number] 期(或者专利号) +% \item[pages] 引文页码 +% \item[date*] 更新或修改日期 +% \item[urldate*] 引用日期 +% \item[url] 获取和访问路径 +% \item[doi] 数字对象唯一标识符 +% \item[language*] 语言 +% \item[key] 拼音(用于排序) +% \end{description} +% 不支持的 \BibTeX{} 标准著录项目有 annote, chapter, crossref, month, type。 % % 本宏包默认情况下可以自动识别文献语言,并自动处理文献类型和载体类型标识, % 但是在少数情况下需要用户手动指定,如: % \begin{latex} -% @article{citekey, +% @misc{citekey, % language = {japanese}, -% mark = {M}, -% medium = {CD}, +% mark = {Z}, +% medium = {DK}, % ... % \end{latex} -% 可选的语言有 english, chinese, japanese, russian, -% 目前对日语和俄语的支持较为有限。 +% 可选的语言有 english, chinese, japanese, russian。 % % -% \section{参考文献列表的排序} +% \section{文献列表的排序} +% \label{sec:sort} % -% 在使用著者-出版年制时,需要将中文参考文献按照拼音或者笔画排序,然而 Unicode -% 中汉字是根据康熙字典排序的,而且由于 \BibTeX{} 功能的局限性,我们无法根据著 -% 者姓名读取拼音,所以只能手动处理:在 key 域手动添加著者姓名拼音, -% 如: +% 国标规定参考文献表采用著者-出版年制组织时,各篇文献首先按文种集中, +% 然后按著者字顺和出版年排列; +% 中文文献可以按著者汉语拼音字顺排列,也可以按著者的笔画笔顺排列。 +% 然而由于 \BibTeX{} 功能的局限性,无法自动获取著者姓名的拼音或笔画笔顺, +% 所以\emph{必须}在 bib 数据库中的 key 域手动录入著者姓名的拼音,如: % \begin{latex} % @book{capital, % author = {马克思 and 恩格斯}, @@ -314,32 +311,186 @@ version 2005/12/01 or later. % \end{latex} % % +% \section{自定义样式} +% +% \BibTeX{} 对自定义样式的支持比较有限, +% 所以用户只能通过修改 \file{bst} 文件来修改文献列表的格式。 +% 本宏包提供了一些接口供用户更方便地修改。 +% +% 在 \file{bst} 文件开始处的 |load.config| 函数中, +% 有一组配置参数用来控制样式,表~\ref{tab:config} 列出了每一项的默认值和功能。 +% 若变量被设为 |#1| 则表示该项被启用,设为 |#0| 则不启用。 +% 默认的值是严格遵循国标的配置。 +% +% \begin{table} +% \centering\small +% \caption{参考文献表样式的配置参数} +% \label{tab:config} +% \begin{tabular}{lcl} +% \toprule +% 参数值 & 默认值 & 功能 \\ +% \midrule +% uppercase.name & |#1| & 将著者姓名转为大写 \\ +% max.num.authors & |#3| & 输出著者的最多数量 \\ +% period.between.author.year & |#0| & 著者和年份之间使用句点连接 \\ +% sentence.case.title & |#1| & 将西文的题名转为 sentence case \\ +% link.title & |#0| & 在题名上添加 url 的超链接 \\ +% show.mark & |#1| & 显示文献类型标识 \\ +% italic.jounal & |#0| & 西文期刊名使用斜体 \\ +% show.missing.address.publisher & |#1| & 出版项缺失时显示“出版者不详” \\ +% show.url & |#1| & 显示 url \\ +% show.doi & |#1| & 显示 doi \\ +% show.note & |#0| & 显示 note 域的信息 \\ +% \bottomrule +% \end{tabular} +% \end{table} % +% 若用户需要定制更多内容,可以学习 \file{bst} 文件的语法并修改 +% \cite{btxhak,ttb,tlc2},或者联系作者。 +% +% +% \section{相关工作} +% +% TeX 社区也有其他关于 GB/T 7714 系列参考文献标准的工作。 +% 2005 年吴凯\cite{wk2006}发布了基于 GB/T 7714-2005 的 \BibTeX{} 样式, +% 支持顺序编码制和著者出版年制两种风格。 +% 李志奇\cite{lqz2013}发布了严格遵循 GB/T 7714-2005 的 BibLaTeX 的样式。 +% 胡海星\cite{hhx2013}提供了另一个 \BibTeX{} 实现, +% 还给每行 bst 代码写了 java 语言注释。 +% 沈周\cite{sz2016}基于 \pkg{biblatex-caspervector}\cite{vector2012} 进行修改, +% 以符合国标的格式。 +% 胡振震发布了符合 GB/T 7714-2015 标准的 BibLaTeX 参考文献样式\cite{hzz2016}, +% 并进行了比较完善的持续维护。 +% +% +% \begin{thebibliography}{12} +% \providecommand{\natexlab}[1]{#1} +% \providecommand{\url}[1]{#1} +% \expandafter\ifx\csname urlstyle\endcsname\relax\relax\else +% \urlstyle{same}\fi +% \providecommand{\href}[2]{\url{#2}} +% \providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}} +% +% \bibitem[{中国国家标准化委员会}(2015)]{gbt77142015} +% {中国国家标准化委员会}. +% \newblock 信息与文献\quad 参考文献著录规则: GB/T +% 7714--2015\allowbreak[S]. +% \newblock 北京: 中国标准出版社, 2015. +% +% \bibitem[Patashnik(1988{\natexlab{a}})]{bibtex} +% PATASHNIK~O. +% \newblock {\BibTeX}ing\allowbreak[M/OL]. +% \newblock 1988{\natexlab{a}}. +% \newblock \url{http://mirrors.ctan.org/biblio/bibtex/base/btxdoc.pdf}. +% +% \bibitem[Daly(1999)]{natbib} +% DALY~P~W. +% \newblock Natural sciences citations and references\allowbreak[M/OL]. +% \newblock 1999. +% \newblock \url{http://mirrors.ctan.org/macros/latex/contrib/natbib/natbib.pdf}. +% +% \bibitem[Patashnik(1988{\natexlab{b}})]{btxhak} +% PATASHNIK~O. +% \newblock Designing {\BibTeX} styles\allowbreak[M/OL]. +% \newblock 1988{\natexlab{b}}. +% \newblock \url{http://mirrors.ctan.org/biblio/bibtex/base/btxhak.pdf}. +% +% \bibitem[Markey(2003)]{ttb} +% MARKEY~N. +% \newblock Tame the beast\allowbreak[M/OL]. +% \newblock 2003. +% \newblock \url{http://mirrors.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf}. +% +% \bibitem[Mittelbach\ et~al.(2004)Mittelbach, Goossens, Braams, Carlisle, and +% Rowley]{tlc2} +% MITTELBACH~F, GOOSSENS~M, BRAAMS~J, et~al. +% \newblock The {\LaTeX} companion\allowbreak[M]. +% \newblock 2nd ed. +% \newblock Reading, MA, USA: Addison-Wesley, 2004. +% +% \bibitem[吴凯(2006)]{wk2006} +% 吴凯. +% \newblock 发布GBT7714-2005.bst version1 Beta版\allowbreak[EB/OL]. +% \newblock 2006. +% \newblock \url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=33591}. +% +% \bibitem[李志奇(2013)]{lqz2013} +% 李志奇. +% \newblock +% 基于biblatex的符合GBT7714-2005的中文文献生成工具\allowbreak[EB/OL]. +% \newblock 2013. +% \newblock \url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=74474}. +% +% \bibitem[胡海星(2013)]{hhx2013} +% 胡海星. +% \newblock A GB/T 7714-2005 national standard compliant BibTeX +% style\allowbreak[EB/OL]. +% \newblock 2013. +% \newblock \url{https://github.com/Haixing-Hu/GBT7714-2005-BibTeX-Style}. +% +% \bibitem[沈周(2016)]{sz2016} +% 沈周. +% \newblock 基于caspervector改写的符合GB/T +% 7714-2005标准的参考文献格式\allowbreak[EB/OL]. +% \newblock 2016. +% \newblock \url{https://github.com/szsdk/biblatex-gbt77142005}. +% +% \bibitem[Vector(2012)]{vector2012} +% VECTOR~C~T. +% \newblock biblatex 参考文献和引用样式: caspervector\allowbreak[M/OL]. +% \newblock 2012. +% \newblock +% \url{http://mirrors.ctan.org/macros/latex/contrib/biblatex-contrib/biblatex-caspervector/doc/caspervector.pdf}. +% +% \bibitem[胡振震(2016)]{hzz2016} +% 胡振震. +% \newblock 符合 GB/T 7714-2015 标准的 biblatex +% 参考文献样式\allowbreak[M/OL]. +% \newblock 2016. +% \newblock +% \url{http://mirrors.ctan.org/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf}. +% +% \end{thebibliography} +% +% +% \linespread{1.3} +% \PrintChanges +% +% +% \clearpage +% \appendix % \StopEventually{} % -% \section{Package} +% \section{宏包的代码实现} % % 下面声明和处理宏包的选项,有 \opt{authoryear} 和 \opt{numbers}。 % \begin{macrocode} %<*package> +\newif\if@gbt@mmxv \newif\if@gbt@numerical \newif\if@gbt@super +\DeclareOption{2015}{\@gbt@mmxvtrue} +\DeclareOption{2005}{\@gbt@mmxvfalse} \DeclareOption{super}{\@gbt@numericaltrue\@gbt@supertrue} \DeclareOption{numbers}{\@gbt@numericaltrue\@gbt@superfalse} \DeclareOption{authoryear}{\@gbt@numericalfalse} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}} -\ExecuteOptions{super} +\ExecuteOptions{2015,super} \ProcessOptions\relax % \end{macrocode} % % 只在顺序编码时使用 \opt{sort\&compress}。 +% \changes{v1.0.1}{2018/03/09}{著者出版年制的文献引用不再排序} % \begin{macrocode} \if@gbt@numerical \PassOptionsToPackage{sort&compress}{natbib} \fi \RequirePackage{natbib} +\RequirePackage{etoolbox} +\RequirePackage{url} % \end{macrocode} % +% \begin{macro}{\citestyle} % 定义接口切换引用文献的标注法,可用 \cs{citestyle} 调用 \opt{numerical} % 或 \opt{authoryear},参见 \pkg{natbib}。 % \begin{macrocode} @@ -347,25 +498,31 @@ version 2005/12/01 or later. \newcommand\bibstyle@numbers{\bibpunct{[}{]}{,}{n}{,}{,}} \newcommand\bibstyle@authoryear{\bibpunct{(}{)}{;}{a}{,}{,}} % \end{macrocode} +% \end{macro} % % \begin{macro}{\gbtbibstyle} % 定义接口切换参考文献表的风格,可选 \opt{authoryear} 和 \opt{numerical}, % 这个仅用于\pkg{chapterbib}。 % \begin{macrocode} -\def\tmp@numerical{numerical} -\def\tmp@authoryear{authoryear} \newcommand\gbtbibstyle[1]{% - \def\tmp@gbt{#1}% - \ifx\tmp@gbt\tmp@numerical% - \bibliographystyle{gbt7714-unsrt}% - \else% - \ifx\tmp@gbt\tmp@authoryear% - \bibliographystyle{gbt7714-plain}% - \else% - \PackageError{gbt7714}{Unknown argument #1.} - {It should be `numerical' or `authoryear'.} - \fi% - \fi% + \ifstrequal{#1}{numerical}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-unsrt}% + \else + \bibliographystyle{gbt7714-2005-unsrt}% + \fi + }{% + \ifstrequal{#1}{authoryear}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-plain}% + \else + \bibliographystyle{gbt7714-2005-plain}% + \fi + }{% + \PackageError{gbt7714}{Unknown argument #1.}% + {It should be `numerical' or `authoryear'.}% + }% + }% } % \end{macrocode} % \end{macro} @@ -386,10 +543,15 @@ version 2005/12/01 or later. \fi % \end{macrocode} % +% \begin{macro}{\cite} % 下面修改 \pkg{natbib} 的引用格式,主要是将页码写在上标位置。 % Numerical 模式的 \cs{citet} 的页码: % \begin{macrocode} -\RequirePackage{etoolbox} +\newcommand\gbt@patchfailure[1]{% + \ClassError{ustcthesis}{Failed to patch command \protect#1.\MessageBreak + Please contact the template author.% + }{}% +} \patchcmd{\NAT@citexnum}{% \@ifnum{\NAT@ctype=\z@}{% \if*#2*\else\NAT@cmt#2\fi @@ -400,7 +562,7 @@ version 2005/12/01 or later. \@ifnum{\NAT@ctype=\z@}{% \if*#2*\else\textsuperscript{#2}\fi }{}% -}{}{} +}{}{\gbt@patchfailure{\NAT@citexnum}} % \end{macrocode} % % Numerical 模式的 \cs{citep} 的页码: @@ -419,7 +581,7 @@ version 2005/12/01 or later. }{% \if\relax\NAT@date\relax\else\NAT@@close\fi \if*#2*\else\textsuperscript{#2}\fi -}{}{} +}{}{\gbt@patchfailure{\NAT@citex}} % \end{macrocode} % % Author-year 模式的 \cs{citep} 的页码: @@ -431,6 +593,8 @@ version 2005/12/01 or later. % % 在顺序编码制下,\pkg{natbib} 只有在三个以上连续文献引用才会使用连接号, % 这里修改为允许两个引用使用连接号。 +% \changes{v1.0.3}{2018/03/29}{顺序编码制连续两个文献引用之间使用连接号} +% \changes{v1.0.4}{2018/04/12}{页码的连接号由 en dash 改为 hyphen} % \begin{macrocode} \patchcmd{\NAT@citexnum}{% \ifx\NAT@last@yr\relax @@ -440,40 +604,144 @@ version 2005/12/01 or later. \fi }{% \def@NAT@last@yr{-\NAT@penalty}% -}{}{} +}{}{\gbt@patchfailure{\NAT@citexnum}} % \end{macrocode} +% \end{macro} % +% \begin{environment}{thebibliography} % 参考文献列表的标签左对齐 +% \changes{v1.0.6}{2018/05/10}{文献列表的数字标签左对齐} % \begin{macrocode} \renewcommand\@biblabel[1]{[#1]\hfill} % \end{macrocode} +% \end{environment} +% +% \begin{macro}{\url} +% 使用 \pkg{xurl} 宏包的方法,增加 URL 可断行的位置。 +% \changes{v1.0.8}{2018/06/23}{使用 \pkg{xurl} 的方法改进 URL 断行} +% \begin{macrocode} +\def\UrlBreaks{% + \do\/% + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l% + \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L% + \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:% + \do\*\do\-\do\~\do\'\do\"\do\-} +\Urlmuskip=0mu plus 0.1mu +%</package> +% \end{macrocode} +% \end{macro} +% +% +% +% \section{BibTeX 样式的代码实现} +% \label{bst-implementation} +% \linespread{1} % -% 需要 \pkg{url} 宏包显示 URL。 +% \subsection{自定义选项} +% \label{sec:options} +% +% \begin{environment}{bst} +% 这里定义了一些变量用于定制样式, +% 可以在下面的 |load.config| 函数中选择是否启用。 +% \changes{v1.0.8}{2018/06/23}{新增接口供用户自定义样式} % \begin{macrocode} -\RequirePackage{url} +%<*authoryear|numerical> +INTEGERS { + uppercase.name + max.num.authors + period.between.author.year + sentence.case.title + link.title + show.mark + italic.jounal + show.missing.address.publisher + show.url + show.doi + show.note +} + % \end{macrocode} % -% 增加 URL 可断行的位置。 +% 下面每个变量若被设为 |#1| 则启用该项,若被设为 |#0| 则不启用。 +% 默认的值是严格遵循国标的配置。 % \begin{macrocode} -\g@addto@macro\UrlBreaks{% - \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j% - \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t% - \do\u\do\v\do\w\do\x\do\y\do\z% - \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J% - \do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T% - \do\U\do\V\do\W\do\X\do\Y\do\Z% - \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0% -} -%</package> +FUNCTION {load.config} +{ % \end{macrocode} % +% 英文姓名转为全大写: +% \begin{macrocode} + #1 'uppercase.name := +% \end{macrocode} % -% \section{BibTeX style implementation} +% 最多显示的作者数量: +% \begin{macrocode} + #3 'max.num.authors := +% \end{macrocode} % -% \subsection{Fields and entry strings} +% 采用著者-出版年制时,作者姓名与年份之间使用句点连接: +% \begin{macrocode} + #0 'period.between.author.year := +% \end{macrocode} % +% 英文标题转为 sentence case (句首字母大写,其余小写): +% \begin{macrocode} + #1 'sentence.case.title := +% \end{macrocode} +% +% 在标题添加超链接: +% \begin{macrocode} + #0 'link.title := +% \end{macrocode} +% +% 著录文献类型标识(比如“[M/OL]“): +% \begin{macrocode} + #1 'show.mark := +% \end{macrocode} +% +% 期刊名使用斜体: +% \begin{macrocode} + #0 'italic.jounal := +% \end{macrocode} +% +% 无出版地或出版者时,著录“出版地不详”,“出版者不详”,“S.l.” 或 “s.n.”: +% \begin{macrocode} + #1 'show.missing.address.publisher := +% \end{macrocode} +% +% 是否著录 URL: +% \begin{macrocode} + #1 'show.url := +% \end{macrocode} +% +% 是否著录 DOI: +% \begin{macrocode} +%<*2015> + #1 'show.doi := +%</2015> +%<*2005> + #0 'show.doi := +%</2005> +% \end{macrocode} +% +% 在每一条文献最后输出注释(note)的内容: +% \begin{macrocode} + #0 'show.note := +} + +% \end{macrocode} +% +% +% \subsection{The ENTRY declaration} +% +% Like Scribe's (according to pages 231-2 of the April '84 edition), +% but no fullauthor or editors fields because BibTeX does name handling. +% The annote field is commented out here because this family doesn't +% include an annotated bibliography style. And in addition to the fields +% listed here, BibTeX has a built-in crossref field, explained later. % \begin{macrocode} -%<*authoryear|numerical> ENTRY { address author @@ -482,12 +750,14 @@ ENTRY doi edition editor + howpublished institution journal key language mark medium + note number organization pages @@ -501,18 +771,19 @@ ENTRY volume year } - { entry.lang } + { entry.lang entry.is.electronic } % \end{macrocode} % % These string entry variables are used to form the citation label. % In a storage pinch, sort.label can be easily computed on the fly. -% % \begin{macrocode} - { label extra.label sort.label short.list entry.mark } + { label extra.label sort.label short.list entry.mark entry.url } % \end{macrocode} % +% % \subsection{Entry functions} +% % Each entry function starts by calling output.bibitem, to write the % |\bibitem| and its arguments to the .BBL file. Then the various fields % are formatted and printed by output or output.check. Those functions @@ -667,7 +938,6 @@ ENTRY % fi % END % \end{pseudocode} -% % \begin{macrocode} INTEGERS { output.state before.all mid.sentence after.sentence after.block after.slash } @@ -690,39 +960,95 @@ FUNCTION {init.state.consts} % \end{macrocode} % -% the variables s and t are temporary string holders -% +% 下面是一些常量的定义 % \begin{macrocode} -STRINGS { s t } +FUNCTION {bbl.anonymous} +{ lang.zh entry.lang = + { "佚名" } + { "Anon" } + if$ +} -FUNCTION {debug} -{ 's := - duplicate$ - "DEBUG: " s * " -> `" * - swap$ * "'" * - top$ +FUNCTION {bbl.space} { "\ " } + +FUNCTION {bbl.et.al} +{ lang.zh entry.lang = + { "等" } + { lang.ja entry.lang = + { "他" } + { lang.ru entry.lang = + { "идр" } + { "et~al." } + if$ + } + if$ + } + if$ } -FUNCTION {debug.int} -{ 's := - duplicate$ int.to.str$ - "DEBUG: " s * " == " * - swap$ * - top$ +FUNCTION {bbl.colon} { ": " } + +%<*2015> +FUNCTION {bbl.wide.space} { "\quad " } +%</2015> +%<*2005> +FUNCTION {bbl.wide.space} { "\ " } +%</2005> + +FUNCTION {bbl.slash} { "//\allowbreak{}" } + +FUNCTION {bbl.sine.loco} +{ lang.zh entry.lang = + { "[出版地不详]" } + { "[S.l.]" } + if$ } -FUNCTION {punct.colon} -{ ": " +FUNCTION {bbl.sine.nomine} +{ lang.zh entry.lang = + { "[出版者不详]" } + { "[s.n.]" } + if$ } -FUNCTION {punct.slash} -{ "//\allowbreak{}" +FUNCTION {bbl.sine.loco.sine.nomine} +{ lang.zh entry.lang = + { "[出版地不详: 出版者不详]" } + { "[S.l.: s.n.]" } + if$ +} + +% \end{macrocode} +% +% These three functions pop one or two (integer) arguments from the stack +% and push a single one, either 0 or 1. +% The |'skip$| in the `and' and `or' functions are used because +% the corresponding |if$| would be idempotent +% \begin{macrocode} +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ } -FUNCTION {punct.space} -{ " " +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ } +% \end{macrocode} +% +% the variables s and t are temporary string holders +% \begin{macrocode} +STRINGS { s t } + FUNCTION {output.nonnull} { 's := output.state mid.sentence = @@ -735,7 +1061,7 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -770,7 +1096,7 @@ FUNCTION {output.after} { output.state before.all = 'write$ { output.state after.slash = - { punct.slash * write$ } + { bbl.slash * write$ } { add.period$ " " * write$ } if$ } @@ -796,7 +1122,6 @@ FUNCTION {output.check} % \end{macrocode} % % This function finishes all entries. -% % \begin{macrocode} FUNCTION {fin.entry} { add.period$ @@ -839,36 +1164,9 @@ FUNCTION {new.slash} % \end{macrocode} % -% These three functions pop one or two (integer) arguments from the stack -% and push a single one, either 0 or 1. -% The |'skip$| in the `and' and `or' functions are used because -% the corresponding |if$| would be idempotent -% -% \begin{macrocode} -FUNCTION {not} -{ { #0 } - { #1 } - if$ -} - -FUNCTION {and} -{ 'skip$ - { pop$ #0 } - if$ -} - -FUNCTION {or} -{ { pop$ #1 } - 'skip$ - if$ -} - -% \end{macrocode} -% % Sometimes we begin a new block only if the block will be big enough. The % new.block.checka function issues a new.block if its argument is nonempty; % new.block.checkb does the same if either of its TWO arguments is nonempty. -% % \begin{macrocode} FUNCTION {new.block.checka} { empty$ @@ -889,7 +1187,6 @@ FUNCTION {new.block.checkb} % \end{macrocode} % % The new.sentence.check functions are analogous. -% % \begin{macrocode} FUNCTION {new.sentence.checka} { empty$ @@ -909,7 +1206,9 @@ FUNCTION {new.sentence.checkb} % \end{macrocode} % +% % \subsection{Formatting chunks} +% % Here are some functions for formatting chunks of an entry. % By convention they either produce a string that can be followed by % a comma or period (using |add.period$|, so it is OK to end in a period), @@ -941,83 +1240,10 @@ FUNCTION {new.sentence.checkb} % BEGIN % if empty$(s) then return "" % else return "{\em " * s * "}" -% \begin{pseudocode} -% -% The format.names function formats the argument (which should be in -% BibTeX name format) into "First Von Last, Junior", separated by commas -% and with an "and" before the last (but ending with "et~al." if the last -% of multiple authors is "others"). This function's argument should always -% contain at least one name. -% -% VAR: nameptr, namesleft, numnames: INTEGER -% pseudoVAR: nameresult: STRING (it's what's accumulated on the stack) -% -% \begin{pseudocode} -% format.names(s) == -% BEGIN -% nameptr := 1 -% numnames := num.names$(s) -% namesleft := numnames -% while namesleft > 0 -% do -% % for full names: -% t := format.name$(s, nameptr, "{ff~}{vv~}{ll}{, jj}") -% % for abbreviated first names: -% t := format.name$(s, nameptr, "{f.~}{vv~}{ll}{, jj}") -% if nameptr > 1 then -% if namesleft > 1 then nameresult := nameresult * ", " * t -% else if numnames > 2 -% then nameresult := nameresult * "," -% fi -% if t = "others" -% then nameresult := nameresult * " et~al." -% else nameresult := nameresult * " and " * t -% fi -% fi -% else nameresult := t -% fi -% nameptr := nameptr + 1 -% namesleft := namesleft - 1 -% od -% return nameresult -% END -% \end{pseudocode} -% -% The format.authors function returns the result of format.names(author) -% if the author is present, or else it returns the null string -% -% \begin{pseudocode} -% format.authors == -% BEGIN -% if empty$(author) then return "" -% else return format.names(author) -% fi -% END -% \end{pseudocode} -% -% Format.editors is like format.authors, but it uses the editor field, -% and appends ", editor" or ", editors" -% -% \begin{pseudocode} -% format.editors == -% BEGIN -% if empty$(editor) then return "" -% else -% if num.names$(editor) > 1 then -% return format.names(editor) * ", editors" -% else -% return format.names(editor) * ", editor" -% fi -% fi -% END % \end{pseudocode} % -% Other formatting functions are similar, so no "comment version" will be -% given for them. -% % The `pop\$' in this function gets rid of the duplicate `empty' value and % the `skip\$' returns the duplicate field value -% % \begin{macrocode} FUNCTION {field.or.null} { duplicate$ empty$ @@ -1026,13 +1252,18 @@ FUNCTION {field.or.null} if$ } -FUNCTION {emphasize} +FUNCTION {italicize} { duplicate$ empty$ { pop$ "" } - { "\emph{" swap$ * "}" * } + { "\textit{" swap$ * "}" * } if$ } +% \end{macrocode} +% +% \subsubsection{Detect Language} +% \changes{v1.0.7}{2018/05/12}{修正了检测 Unicode 语言} +% \begin{macrocode} INTEGERS { byte second.byte } INTEGERS { char.lang tmp.lang } @@ -1127,24 +1358,114 @@ FUNCTION {get.str.lang} tmp.lang } -FUNCTION {is.in.chinese} -{ entry.lang lang.zh = +FUNCTION {check.entry.lang} +{ author field.or.null + title field.or.null * + get.str.lang } -FUNCTION {format.et.al} -{ is.in.chinese - { "等"} - { "et~al." } - if$ -} - -FUNCTION {format.anonymous} -{ is.in.chinese - { "佚名" } - { "Anon" } +FUNCTION {set.entry.lang} +{ language empty$ + { check.entry.lang } + { language "english" = language "american" = or language "british" = or + { lang.en } + { language "chinese" = + { lang.zh } + { language "japanese" = + { lang.ja } + { language "russian" = + { lang.ru } + { check.entry.lang } + if$ + } + if$ + } + if$ + } + if$ + } if$ + 'entry.lang := } +% \end{macrocode} +% +% \subsubsection{Format names} +% +% The format.names function formats the argument (which should be in +% BibTeX name format) into "First Von Last, Junior", separated by commas +% and with an "and" before the last (but ending with "et~al." if the last +% of multiple authors is "others"). This function's argument should always +% contain at least one name. +% +% \begin{pseudocode} +% VAR: nameptr, namesleft, numnames: INTEGER +% pseudoVAR: nameresult: STRING (it's what's accumulated on the stack) +% +% format.names(s) == +% BEGIN +% nameptr := 1 +% numnames := num.names$(s) +% namesleft := numnames +% while namesleft > 0 +% do +% % for full names: +% t := format.name$(s, nameptr, "{ff~}{vv~}{ll}{, jj}") +% % for abbreviated first names: +% t := format.name$(s, nameptr, "{f.~}{vv~}{ll}{, jj}") +% if nameptr > 1 then +% if namesleft > 1 then nameresult := nameresult * ", " * t +% else if numnames > 2 +% then nameresult := nameresult * "," +% fi +% if t = "others" +% then nameresult := nameresult * " et~al." +% else nameresult := nameresult * " and " * t +% fi +% fi +% else nameresult := t +% fi +% nameptr := nameptr + 1 +% namesleft := namesleft - 1 +% od +% return nameresult +% END +% \end{pseudocode} +% +% The format.authors function returns the result of format.names(author) +% if the author is present, or else it returns the null string +% +% \begin{pseudocode} +% format.authors == +% BEGIN +% if empty$(author) then return "" +% else return format.names(author) +% fi +% END +% \end{pseudocode} +% +% Format.editors is like format.authors, but it uses the editor field, +% and appends ", editor" or ", editors" +% +% \begin{pseudocode} +% format.editors == +% BEGIN +% if empty$(editor) then return "" +% else +% if num.names$(editor) > 1 then +% return format.names(editor) * ", editors" +% else +% return format.names(editor) * ", editor" +% fi +% fi +% END +% \end{pseudocode} +% +% Other formatting functions are similar, so no "comment version" will be +% given for them. +% \changes{v1.0.2}{2018/03/16}{正确识别姓名中的“others”} +% \changes{v1.0.8}{2018/06/23}{使用“\textasciitilde”连接英文姓名} +% \begin{macrocode} INTEGERS { nameptr namesleft numnames name.lang } FUNCTION {format.names} @@ -1154,15 +1475,19 @@ FUNCTION {format.names} numnames 'namesleft := { namesleft #0 > } { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := - nameptr #4 = - { format.et.al + nameptr max.num.authors > + { bbl.et.al #1 'namesleft := } { t "others" = - { format.et.al } + { bbl.et.al } { t get.str.lang 'name.lang := name.lang lang.en = - { t #1 "{vv~}{ll}{ f{~}}" format.name$ "u" change.case$ + { t #1 "{vv~}{ll}{~f{~}}" format.name$ + uppercase.name + { "u" change.case$ } + 'skip$ + if$ t #1 "{, jj}" format.name$ * } { t #1 "{ll}{ff}" format.name$ } @@ -1191,7 +1516,7 @@ FUNCTION {format.key} FUNCTION {format.authors} { author empty$ %<*authoryear> - { format.anonymous } + { bbl.anonymous } %</authoryear> %<*numerical> { "" } @@ -1211,7 +1536,7 @@ FUNCTION {format.translators} { translator empty$ { "" } { translator format.names - is.in.chinese + lang.zh entry.lang = { translator num.names$ #3 > { "译" * } { ", 译" * } @@ -1223,122 +1548,6 @@ FUNCTION {format.translators} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { new.block "\url{" url * "}" * } - if$ -} - -% \end{macrocode} -% -% 需要检测 DOI 是否已经包含在 URL 中。 -% -% \begin{macrocode} -FUNCTION {is.doi.in.url} -{ 's := - s empty$ - { #1 } - { url empty$ - { #0 } - { s text.length$ 'len := - url text.length$ 'charptr := - { url charptr len substring$ s = not - charptr #0 > - and - } - { charptr #1 - 'charptr := } - while$ - charptr - } - if$ - } - if$ -} - -FUNCTION {format.doi} -{ "" - doi empty$ - 'skip$ - { "" 's := - doi 't := - #0 'numnames := - { t empty$ not} - { t #1 #1 substring$ 'tmp.str := - tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or - { t #2 #1 substring$ empty$ - { s tmp.str * 's := } - 'skip$ - if$ - s empty$ s is.doi.in.url or - 'skip$ - { numnames #1 + 'numnames := - numnames #1 > - { ", " * } - { "DOI: " * } - if$ - "\doi{" s * "}" * * - } - if$ - "" 's := - } - { s tmp.str * 's := } - if$ - t #2 global.max$ substring$ 't := - } - while$ - 's := - s empty$ not - { new.block s } - { "" } - if$ - } - if$ -} - -% \end{macrocode} -% -% The format.title function is used for non-book-like titles. -% For most styles we convert to lowercase (except for the very first letter, -% and except for the first one after a colon (followed by whitespace)), -% and hope the user has brace-surrounded words that need to stay capitilized; -% for some styles, however, we leave it as it is in the database. -% -% \begin{macrocode} -FUNCTION {format.title} -{ title empty$ - { "" } - { title - entry.lang lang.en = - { "t" change.case$ } - 'skip$ - if$ - } - if$ -} - -FUNCTION {set.mark} -{ entry.mark empty$ not - 'pop$ - { mark empty$ not - { pop$ mark 'entry.mark := } - { 'entry.mark := } - if$ - medium empty$ not - { entry.mark "/" * medium * 'entry.mark := } - { url empty$ not - { entry.mark "/OL" * 'entry.mark := } - 'skip$ - if$ - } - if$ - } - if$ -} - -FUNCTION {format.mark} -{ "\allowbreak[" entry.mark * "]" * } - FUNCTION {format.full.names} {'s := #1 'nameptr := @@ -1433,191 +1642,55 @@ FUNCTION {output.bibitem} % \end{macrocode} % -% By default, BibTeX sets the global integer variable |global.max$| to the BibTeX -% constant |glob_str_size|, the maximum length of a global string variable. -% Analogously, BibTeX sets the global integer variable |entry.max$| to -% |ent_str_size|, the maximum length of an entry string variable. -% The style designer may change these if necessary (but this is unlikely) -% -% The n.dashify function makes each single |`-'| in a string a double |`--'| -% if it's not already -% -% \begin{pseudocode} -% pseudoVAR: pageresult: STRING (it's what's accumulated on the stack) -% -% n.dashify(s) == -% BEGIN -% t := s -% pageresult := "" -% while (not empty$(t)) -% do -% if (first character of t = "-") -% then -% if (next character isn't) -% then -% pageresult := pageresult * "--" -% t := t with the "-" removed -% else -% while (first character of t = "-") -% do -% pageresult := pageresult * "-" -% t := t with the "-" removed -% od -% fi -% else -% pageresult := pageresult * the first character -% t := t with the first character removed -% fi -% od -% return pageresult -% END -% \end{pseudocode} -% -% 《规则》里页码范围的连接号使用 hyphen,需要将 dash 转为 hyphen。 -% -% \begin{macrocode} -FUNCTION {hyphenate} -{ 't := - "" - { t empty$ not } - { t #1 #1 substring$ "-" = - { "-" * - { t #1 #1 substring$ "-" = } - { t #2 global.max$ substring$ 't := } - while$ - } - { t #1 #1 substring$ * - t #2 global.max$ substring$ 't := - } - if$ - } - while$ -} - -% \end{macrocode} -% -% The format.date function is for the month and year, but we give a warning if -% there's an empty year but the month is there, and we return the empty string -% if they're both empty. -% -% Newspaer 和 paptent 要显示完整的日期,同时不再显示修改日期。 -% 但是在 author-year 模式下,需要单独设置 format.year。 +% \subsubsection{Format title} % +% The |format.title| function is used for non-book-like titles. +% For most styles we convert to lowercase (except for the very first letter, +% and except for the first one after a colon (followed by whitespace)), +% and hope the user has brace-surrounded words that need to stay capitilized; +% for some styles, however, we leave it as it is in the database. +% \changes{v1.0.6}{2018/05/10}{不再处理中文标题的英文单词的大小写} +% \changes{v1.0.9}{2018/08/05}{不再转换题名 volume 的大小写} +% \changes{v1.0.9}{2018/08/05}{增加选项在题名添加超链接} % \begin{macrocode} -FUNCTION {extract.before.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - s #1 charptr #1 - substring$ - } - if$ -} - -FUNCTION {extract.after.dash} -{ duplicate$ empty$ - { pop$ "" } - { 's := - #1 'charptr := - s text.length$ #1 + 'len := - { charptr len < - s charptr #1 substring$ "-" = not - and - } - { charptr #1 + 'charptr := } - while$ - { charptr len < - s charptr #1 substring$ "-" = - and - } - { charptr #1 + 'charptr := } - while$ - s charptr global.max$ substring$ - } +FUNCTION {change.sentence.case} +{ entry.lang lang.en = + { "t" change.case$ } + 'skip$ if$ } -FUNCTION {contains.dash} -{ duplicate$ empty$ - { pop$ #0 } - { 's := - { s empty$ not - s #1 #1 substring$ "-" = not - and - } - { s #2 global.max$ substring$ 's := } - while$ - s empty$ not - } - if$ -} +FUNCTION {add.link} + { url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ + } -FUNCTION {format.year} -{ year empty$ not - { year extract.before.dash } - { date empty$ not - { date extract.before.dash } - { "empty year in " cite$ * warning$ - "" - } +FUNCTION {format.title} +{ title empty$ + { "" } + { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + link.title + 'add.link + 'skip$ if$ } if$ - extra.label * -} - -FUNCTION {format.date} -{ type$ "patent" = type$ "newspaper" = or - date empty$ not and - { date } - { year } - if$ -} - -FUNCTION {format.editdate} -{ date empty$ not - type$ "newspaper" = not and - url empty$ not doi empty$ not or - and - { "\allowbreak(" date * ")" * } - { "" } - if$ -} - -% \end{macrocode} -% -% 《著录规则》中的“引用日期”都是与 URL 同时出现的,所以其实为 urldate,这个虽然 -% 不是 \BibTeX{} 标准的域,但是实际中很常见。 -% -% \begin{macrocode} -FUNCTION {format.urldate} -{ urldate empty$ not - { "\allowbreak[" urldate * "]" * } - { "" } - if$ -} - -% \end{macrocode} -% -% The format.btitle is for formatting the title field when it is a book-like -% entry---the style used here keeps it in uppers-and-lowers and emphasizes it. -% -% \begin{macrocode} -FUNCTION {format.btitle} -{ title emphasize } % \end{macrocode} % % For several functions we'll need to connect two strings with a -% tie (~) if the second one isn't very long (fewer than 3 characters). +% tie (|~|) if the second one isn't very long (fewer than 3 characters). % The tie.or.space.connect function does that. It concatenates the two % strings on top of the stack, along with either a tie or space between % them, and puts this concatenation back onto the stack: @@ -1630,7 +1703,6 @@ FUNCTION {format.btitle} % else return the concatenation of str1, " ", and str2 % END % \end{pseudocode} -% % \begin{macrocode} FUNCTION {tie.or.space.connect} { duplicate$ text.length$ #3 < @@ -1653,7 +1725,6 @@ FUNCTION {tie.or.space.connect} % fi % END % \end{pseudocode} -% % \begin{macrocode} FUNCTION {either.or.check} { empty$ @@ -1679,7 +1750,6 @@ FUNCTION {either.or.check} % gives the name of the whole series (the title field should be the title % of the work being one referred to), and we add an "in <series>". % We capitilize Number when this function is used at the beginning of a block. -% % \begin{macrocode} FUNCTION {is.digit} { duplicate$ empty$ @@ -1716,13 +1786,9 @@ FUNCTION {is.number} FUNCTION {format.volume} { volume empty$ { "" } - { volume is.number - { is.in.chinese - { "第 " volume * " 卷" * } - { "volume" volume tie.or.space.connect } - if$ - } - { volume } + { lang.zh entry.lang = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } if$ } if$ @@ -1731,13 +1797,9 @@ FUNCTION {format.volume} FUNCTION {format.number} { number empty$ { "" } - { number is.number - { is.in.chinese - { "第 " number * " 册" * } - { "number" number tie.or.space.connect } - if$ - } - { number } + { lang.zh entry.lang = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } if$ } if$ @@ -1753,22 +1815,36 @@ FUNCTION {format.volume.number} FUNCTION {format.series.vol.num.title} { format.volume.number 's := series empty$ not - { series ": " * + { series + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } 'skip$ if$ - title * + title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + * } { title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ - entry.lang lang.en = - { "t" change.case$ } + link.title + 'add.link 'skip$ if$ } @@ -1776,28 +1852,69 @@ FUNCTION {format.series.vol.num.title} FUNCTION {format.series.vol.num.booktitle} { format.volume.number 's := series empty$ not - { series ": " * + { series bbl.colon * s empty$ not - { s * "\quad " * } + { s * bbl.wide.space * } 'skip$ if$ booktitle * } { booktitle s empty$ not - { ": " * s * } + { bbl.colon * s * } 'skip$ if$ } if$ } +FUNCTION {format.journal} +{ journal + italic.jounal + 'italicize + 'skip$ + if$ +} + % \end{macrocode} % +% \subsubsection{Format entry type mark} +% +% \begin{macrocode} +FUNCTION {set.entry.mark} +{ entry.mark empty$ not + 'pop$ + { mark empty$ not + { pop$ mark 'entry.mark := } + { 'entry.mark := } + if$ + } + if$ +} + +FUNCTION {format.mark} +{ show.mark + { medium empty$ not + { entry.mark "/" * medium * 'entry.mark := } + { entry.is.electronic + { entry.mark "/OL" * 'entry.mark := } + 'skip$ + if$ + } + if$ + "\allowbreak[" entry.mark * "]" * + } + { "" } + if$ +} + +% \end{macrocode} +% +% \subsubsection{Format edition} +% % The format.edition function appends " edition" to the edition, if present. % We lowercase the edition (it should be something like "Third"), because % this doesn't start a sentence. -% % \begin{macrocode} FUNCTION {num.to.ordinal} { duplicate$ text.length$ 'charptr := @@ -1820,13 +1937,13 @@ FUNCTION {format.edition} { edition empty$ { "" } { edition is.number - { is.in.chinese + { lang.zh entry.lang = { edition " 版" * } { edition num.to.ordinal " ed." * } if$ } { entry.lang lang.en = - { edition "t" change.case$ 's := + { edition change.sentence.case 's := s "Revised" = s "Revised edition" = or { "Rev. ed." } { s " ed." *} @@ -1842,23 +1959,10 @@ FUNCTION {format.edition} % \end{macrocode} % -% 出版地址和出版社会有 “[S.l.: s.n.]” 的情况,所以必须一起处理。 +% \subsubsection{Format publishing items} % +% 出版地址和出版社会有 “[S.l.: s.n.]” 的情况,所以必须一起处理。 % \begin{macrocode} -FUNCTION {format.sine.loco} -{ is.in.chinese - { "[出版地不详]" } - { "[S.l.]" } - if$ -} - -FUNCTION {format.sine.nomine} -{ is.in.chinese - { "[出版者不详]" } - { "[s.n.]" } - if$ -} - FUNCTION {format.publisher} { publisher empty$ not { publisher } @@ -1878,29 +1982,22 @@ FUNCTION {format.publisher} if$ } -FUNCTION {format.sine.loco.sine.nomine} -{ is.in.chinese - { "[出版地不详: 出版者不详]" } - { "[S.l.: s.n.]" } - if$ -} - FUNCTION {format.address.publisher} { address empty$ not { address format.publisher empty$ not - { ": " * format.publisher * } - { url empty$ doi empty$ and - { ": " * format.sine.nomine * } + { bbl.colon * format.publisher * } + { entry.is.electronic not show.missing.address.publisher and + { bbl.colon * bbl.sine.nomine * } 'skip$ if$ } if$ } - { url empty$ doi empty$ and + { entry.is.electronic not show.missing.address.publisher and { format.publisher empty$ not - { format.sine.loco ": " * format.publisher * } - { format.sine.loco.sine.nomine } + { bbl.sine.loco bbl.colon * format.publisher * } + { bbl.sine.loco.sine.nomine } if$ } { format.publisher empty$ not @@ -1915,9 +2012,191 @@ FUNCTION {format.address.publisher} % \end{macrocode} % +% \subsubsection{Format date} +% +% The format.date function is for the month and year, but we give a warning if +% there's an empty year but the month is there, and we return the empty string +% if they're both empty. +% +% Newspaer 和 paptent 要显示完整的日期,同时不再显示修改日期。 +% 但是在 author-year 模式下,需要单独设置 format.year。 +% \begin{macrocode} +FUNCTION {extract.before.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + s #1 charptr #1 - substring$ + } + if$ +} + +FUNCTION {extract.after.dash} +{ duplicate$ empty$ + { pop$ "" } + { 's := + #1 'charptr := + s text.length$ #1 + 'len := + { charptr len < + s charptr #1 substring$ "-" = not + and + } + { charptr #1 + 'charptr := } + while$ + { charptr len < + s charptr #1 substring$ "-" = + and + } + { charptr #1 + 'charptr := } + while$ + s charptr global.max$ substring$ + } + if$ +} + +FUNCTION {contains.dash} +{ duplicate$ empty$ + { pop$ #0 } + { 's := + { s empty$ not + s #1 #1 substring$ "-" = not + and + } + { s #2 global.max$ substring$ 's := } + while$ + s empty$ not + } + if$ +} + +% \end{macrocode} +% +% 著者-出版年制必须提取出年份 +% \begin{macrocode} +FUNCTION {format.year} +{ year empty$ not + { year extract.before.dash } + { date empty$ not + { date extract.before.dash } + { "empty year in " cite$ * warning$ + "" + } + if$ + } + if$ + extra.label * +} + +% \end{macrocode} +% +% 专利和报纸都是使用日期而不是年 +% \begin{macrocode} +FUNCTION {format.date} +{ type$ "patent" = type$ "newspaper" = or + date empty$ not and + { date } + { year } + if$ +} + +% \end{macrocode} +% +% 更新、修改日期只用于电子资源 elctronic +% \begin{macrocode} +FUNCTION {format.editdate} +{ date empty$ not + { "\allowbreak(" date * ")" * } + { "" } + if$ +} + +% \end{macrocode} +% +% 国标中的“引用日期”都是与 URL 同时出现的,所以其实为 urldate,这个虽然 +% 不是 \BibTeX{} 标准的域,但是实际中很常见。 +% \begin{macrocode} +FUNCTION {format.urldate} +{ urldate empty$ not entry.is.electronic and + { "\allowbreak[" urldate * "]" * } + { "" } + if$ +} + +% \end{macrocode} +% +% \subsubsection{Format pages} +% +% By default, BibTeX sets the global integer variable |global.max$| to the BibTeX +% constant |glob_str_size|, the maximum length of a global string variable. +% Analogously, BibTeX sets the global integer variable |entry.max$| to +% |ent_str_size|, the maximum length of an entry string variable. +% The style designer may change these if necessary (but this is unlikely) +% +% The n.dashify function makes each single |`-'| in a string a double |`--'| +% if it's not already +% +% \begin{pseudocode} +% pseudoVAR: pageresult: STRING (it's what's accumulated on the stack) +% +% n.dashify(s) == +% BEGIN +% t := s +% pageresult := "" +% while (not empty$(t)) +% do +% if (first character of t = "-") +% then +% if (next character isn't) +% then +% pageresult := pageresult * "--" +% t := t with the "-" removed +% else +% while (first character of t = "-") +% do +% pageresult := pageresult * "-" +% t := t with the "-" removed +% od +% fi +% else +% pageresult := pageresult * the first character +% t := t with the first character removed +% fi +% od +% return pageresult +% END +% \end{pseudocode} +% +% 国标里页码范围的连接号使用 hyphen,需要将 dash 转为 hyphen。 +% \begin{macrocode} +FUNCTION {hyphenate} +{ 't := + "" + { t empty$ not } + { t #1 #1 substring$ "-" = + { "-" * + { t #1 #1 substring$ "-" = } + { t #2 global.max$ substring$ 't := } + while$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +% \end{macrocode} +% % This function doesn't begin a sentence so "pages" isn't capitalized. % Other functions that use this should keep that in mind. -% % \begin{macrocode} FUNCTION {format.pages} { pages empty$ @@ -1926,9 +2205,14 @@ FUNCTION {format.pages} if$ } -FUNCTION {format.journal.volume} -{ volume } - +% \end{macrocode} +% +% The |format.vol.num.pages| function is for the volume, number, and page range +% of a journal article. We use the format: vol(number):pages, with some +% variations for empty fields. This doesn't begin a sentence. +% +% 报纸在卷号缺失时,期号与前面的日期直接相连,所以必须拆开输出。 +% \begin{macrocode} FUNCTION {format.journal.number} { number empty$ not { "\penalty0 (" number * ")" * } @@ -1936,6 +2220,13 @@ FUNCTION {format.journal.number} if$ } +FUNCTION {format.journal.pages} +{ pages empty$ + { "" } + { ":\penalty0 " pages hyphenate * } + if$ +} + % \end{macrocode} % % 连续出版物的年卷期有起止范围,需要特殊处理 @@ -1943,7 +2234,7 @@ FUNCTION {format.journal.number} FUNCTION {format.periodical.year.volume.number} { year empty$ not { year extract.before.dash } - { "No year in periodical " cite$ * warning$ } + { "empty year in periodical " cite$ * warning$ } if$ volume empty$ not { ", " * volume extract.before.dash * } @@ -1980,162 +2271,164 @@ FUNCTION {format.periodical.year.volume.number} % \end{macrocode} % -% The format.in.ed.booktitle function is used for starting out a sentence -% that begins "In <booktitle>", putting an editor before the title if one -% exists. +% \subsubsection{Format url and doi} % +% 传统的 \BibTeX{} 习惯使用 howpublished 著录 url,这里提供支持。 +% \changes{v1.0.8}{2018/06/23}{支持 howpublished 中的 url} % \begin{macrocode} -FUNCTION {format.in.ed.booktitle} -{ booktitle empty$ - { "" } - { editor empty$ - { "In " booktitle emphasize * } - { "In " format.editors * ", " * booktitle emphasize * } +FUNCTION {check.url} +{ url empty$ not + { "\url{" url * "}" * 'entry.url := + #1 'entry.is.electronic := + } + { howpublished empty$ not + { howpublished #1 #5 substring$ "\url{" = + { howpublished 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + { note empty$ not + { note #1 #5 substring$ "\url{" = + { note 'entry.url := + #1 'entry.is.electronic := + } + 'skip$ + if$ + } + 'skip$ + if$ + } if$ } if$ } +FUNCTION {format.url} +{ entry.url empty$ not + { new.block entry.url } + { "" } + if$ +} + % \end{macrocode} % -% The function empty.misc.check complains if all six fields are empty, and -% if there's been no sorting or alphabetic-label complaint. -% +% 需要检测 DOI 是否已经包含在 URL 中。 +% \changes{v1.0.5}{2018/04/18}{允许著录多个 DOI} % \begin{macrocode} -FUNCTION {empty.misc.check} -{ author empty$ title empty$ - year empty$ - and and - key empty$ not and - { "all relevant fields are empty in " cite$ * warning$ } +FUNCTION {check.doi} +{ doi empty$ not + { #1 'entry.is.electronic := } 'skip$ if$ } -% \end{macrocode} -% -% Now come the cross-referencing functions (these are invoked because -% one entry in the database file(s) cross-references another, by giving -% the other entry's database key in a `crossref' field). This feature -% allows one or more titled things that are part of a larger titled -% thing to cross-reference the larger thing. These styles allow for -% five posibilities: (1) an ARTICLE may cross-reference an ARTICLE; -% (2) a BOOK, (3) INBOOK, or (4) INCOLLECTION may cross-reference a BOOK; -% or (5) an INPROCEEDINGS may cross-reference a PROCEEDINGS. -% Each of these is explained in more detail later. -% -% An ARTICLE entry type may cross reference another ARTICLE (this is -% intended for when an entire journal is devoted to a single topic--- -% but since there is no JOURNAL entry type, the journal, too, should be -% classified as an ARTICLE but without the author and title fields). -% This will result in two warning messages for the journal's entry -% if it's included in the reference list, but such is life. -% -% format.article.crossref == -% BEGIN -% if empty$(key) then -% if empty$(journal) then -% warning$("need key or journal for " * cite$ * -% " to crossref " * crossref) -% return(" \cite{" * crossref * "}") -% else -% return("In " * emphazise.correct (journal) * -% " \cite{" * crossref * "}") -% fi -% else -% return("In " * key * " \cite{" * crossref * "}") -% fi -% END -% -% The other cross-referencing functions are similar, so no "comment version" -% will be given for them. -% -% \begin{macrocode} -FUNCTION {format.article.crossref} -{ key empty$ - { journal empty$ - { "need key or journal for " cite$ * " to crossref " * crossref * - warning$ - "" +FUNCTION {is.in.url} +{ 's := + s empty$ + { #1 } + { entry.url empty$ + { #0 } + { s text.length$ 'len := + entry.url text.length$ 'charptr := + { entry.url charptr len substring$ s = not + charptr #0 > + and + } + { charptr #1 - 'charptr := } + while$ + charptr } - { "In \emph{" journal * "}" * } if$ } - { "In " } if$ - " \citet{" * crossref * "}" * } -% \end{macrocode} -% -% A BOOK (or INBOOK) entry type (assumed to be for a single volume in a -% multivolume work) may cross reference another BOOK (the entire multivolume). -% Usually there will be an editor, in which case we use that to construct the -% cross reference; otherwise we use a nonempty key field or else the series -% field (since the series gives the title of the multivolume work). -% -% \begin{macrocode} -FUNCTION {format.book.crossref} -{ volume empty$ - { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ - "In " - } - { "Volume" volume tie.or.space.connect - " of " * - } - if$ - editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { series empty$ - { "need editor, key, or series for " cite$ * " to crossref " * - crossref * warning$ - "" * +FUNCTION {format.doi} +{ "" + doi empty$ not show.doi and + { "" 's := + doi 't := + #0 'numnames := + { t empty$ not} + { t #1 #1 substring$ 'tmp.str := + tmp.str "," = tmp.str " " = or t #2 #1 substring$ empty$ or + { t #2 #1 substring$ empty$ + { s tmp.str * 's := } + 'skip$ + if$ + s empty$ s is.in.url or + 'skip$ + { numnames #1 + 'numnames := + numnames #1 > + { ", " * } + { "DOI: " * } + if$ + "\doi{" s * "}" * * + } + if$ + "" 's := } - { "\emph{" * series * "}" * } + { s tmp.str * 's := } if$ + t #2 global.max$ substring$ 't := } + while$ + 's := + s empty$ not + { new.block s } + { "" } + if$ + } + 'skip$ + if$ +} + +FUNCTION {check.electronic} +{ "" 'entry.url := + #0 'entry.is.electronic := + 'check.doi + 'skip$ + if$ + 'check.url + 'skip$ + if$ + medium empty$ not + { medium "MT" = medium "DK" = or medium "CD" = or medium "OL" = or + { #1 'entry.is.electronic := } 'skip$ if$ } 'skip$ if$ - " \citet{" * crossref * "}" * +} + +FUNCTION {format.note} +{ note empty$ not show.note and + { note } + { "" } + if$ } % \end{macrocode} % -% An INCOLLECTION entry type may cross reference a BOOK (assumed to be the -% collection), or an INPROCEEDINGS may cross reference a PROCEEDINGS. -% Often there will be an editor, in which case we use that to construct -% the cross reference; otherwise we use a nonempty key field or else -% the booktitle field (which gives the cross-referenced work's title). -% +% The function empty.misc.check complains if all six fields are empty, and +% if there's been no sorting or alphabetic-label complaint. % \begin{macrocode} -FUNCTION {format.incoll.inproc.crossref} -{ editor empty$ - editor field.or.null author field.or.null = - or - { key empty$ - { booktitle empty$ - { "need editor, key, or booktitle for " cite$ * " to crossref " * - crossref * warning$ - "" - } - { "In \emph{" booktitle * "}" * } - if$ - } - { "In " } - if$ - } - { "In " } +FUNCTION {empty.misc.check} +{ author empty$ title empty$ + year empty$ + and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ if$ - " \citet{" * crossref * "}" * } % \end{macrocode} % +% % \subsection{Functions for all entry types} % % Now we define the type functions for all entry types that may appear @@ -2146,72 +2439,7 @@ FUNCTION {format.incoll.inproc.crossref} % Note: The fields (within each list) are listed in order of appearance, % except as described for an `inbook' or a `proceedings'. % -% The article function is for an article in a journal. An article may -% CROSSREF another article. -% Required fields: author, title, journal, year -% Optional fields: volume, number, pages, month, note -% -% \begin{pseudocode} -% article == -% BEGIN -% output.bibitem -% output.check(format.authors,"author") -% new.block -% output.check(format.title,"title") -% new.block -% if missing$(crossref) then -% output.check(emphasize(journal),"journal") -% output(format.vol.num.pages) -% output.check(format.date,"year") -% else -% output.nonnull(format.article.crossref) -% output(format.pages) -% fi -% new.block -% output(note) -% fin.entry -% END -% \end{pseudocode} -% -% The book function is for a whole book. A book may CROSSREF another book. -% Required fields: author or editor, title, publisher, year -% Optional fields: volume or number, series, address, edition, month, -% note -% -% \begin{pseudocode} -% book == -% BEGIN -% if empty$(author) then output.check(format.editors,"author and editor") -% else output.check(format.authors,"author") -% if missing$(crossref) then -% either.or.check("author and editor",editor) -% fi -% fi -% new.block -% output.check(format.btitle,"title") -% if missing$(crossref) then -% output(format.bvolume) -% new.block -% output(format.number.series) -% new.sentence -% output.check(publisher,"publisher") -% output(address) -% else -% new.block -% output.nonnull(format.book.crossref) -% fi -% output(format.edition) -% output.check(format.date,"year") -% new.block -% output(note) -% fin.entry -% END -% \end{pseudocode} -% -% The other entry functions are all quite similar, so no "comment version" -% will be given for them. -% -% \subsection{专著} +% \subsubsection{专著} % % \begin{macrocode} FUNCTION {monograph} @@ -2221,7 +2449,7 @@ FUNCTION {monograph} { editor empty$ not { format.editors } %<*authoryear> - { format.anonymous } + { bbl.anonymous } %</authoryear> %<*numerical> { "" } @@ -2231,11 +2459,15 @@ FUNCTION {monograph} if$ output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.series.vol.num.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -2246,35 +2478,42 @@ FUNCTION {monograph} %<*numerical> format.year "year" output.check %</numerical> - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % -% \subsection{专著中的析出文献} +% \subsubsection{专著中的析出文献} % % An incollection is like inbook, but where there is a separate title % for the referenced thing (and perhaps an editor for the whole). % An incollection may CROSSREF a book. +% % Required: author, title, booktitle, publisher, year +% % Optional: editor, volume or number, series, type, chapter, pages, % address, edition, month, note -% % \begin{macrocode} FUNCTION {incollection} { output.bibitem format.authors "author" output.check author format.key output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.title "title" output.check - "M" set.mark + "M" set.entry.mark format.mark "" output.after new.block format.translators output @@ -2289,16 +2528,18 @@ FUNCTION {incollection} %<*numerical> format.year "year" output.check %</numerical> - format.pages punct.colon output.after + format.pages bbl.colon output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % -% \subsection{连续出版物} +% \subsubsection{连续出版物} % % \begin{macrocode} FUNCTION {periodical} @@ -2306,11 +2547,15 @@ FUNCTION {periodical} format.authors "author" output.check author format.key output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block format.periodical.year.volume.number output @@ -2322,86 +2567,112 @@ FUNCTION {periodical} format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % -% \subsection{连续出版物中的析出文献} +% \subsubsection{连续出版物中的析出文献} +% +% The article function is for an article in a journal. An article may +% CROSSREF another article. +% +% Required fields: author, title, journal, year % +% Optional fields: volume, number, pages, month, note +% +% The other entry functions are all quite similar, so no "comment version" +% will be given for them. % \begin{macrocode} -FUNCTION {article.in.journal} +FUNCTION {article} { output.bibitem format.authors "author" output.check author format.key output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.title "title" output.check - "J" set.mark + "J" set.entry.mark format.mark "" output.after new.block - journal "journal" output.check + format.journal "journal" output.check %<*numerical> format.date "year" output.check %</numerical> volume output format.journal.number "" output.after - format.pages punct.colon output.after - format.editdate "" output.after + format.journal.pages "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % -% \subsection{专利文献} +% \subsubsection{专利文献} % % number 域也可以用来表示专利号。 -% % \begin{macrocode} FUNCTION {patent} { output.bibitem format.authors output author format.key output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.title number empty$ not - { punct.colon * number * } + { bbl.colon * number * } 'skip$ if$ "title" output.check - "P" set.mark + "P" set.entry.mark format.mark "" output.after new.block format.date "year" output.check format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % -% \subsection{电子资源} -% +% \subsubsection{电子资源} % \begin{macrocode} -FUNCTION {online} -{ output.bibitem +FUNCTION {electronic} +{ #1 #1 check.electronic + #1 'entry.is.electronic := + output.bibitem format.authors output author format.key output %<*authoryear> + period.between.author.year + 'new.sentence + 'skip$ + if$ format.year "year" output.check %</authoryear> new.block format.series.vol.num.title "title" output.check - "EB" set.mark + "EB" set.entry.mark format.mark "" output.after new.block format.address.publisher output @@ -2411,31 +2682,42 @@ FUNCTION {online} 'skip$ if$ %</numerical> - format.pages punct.colon output.after + format.pages bbl.colon output.after format.editdate "" output.after format.urldate "" output.after format.url output format.doi output + new.block + format.note output fin.entry } % \end{macrocode} % +% \subsubsection{其他文献类型} +% % A misc is something that doesn't fit elsewhere. +% % Required: at least one of the `optional' fields +% % Optional: author, title, howpublished, month, year, note % % Misc 用来自动判断类型。 +% \changes{v1.0.9}{2018/08/05}{修正不显示 url 的选项} % \begin{macrocode} FUNCTION {misc} { journal empty$ not - 'article.in.journal + 'article { booktitle empty$ not 'incollection - { url empty$ not - 'online - { "Z" set.mark - monograph + { publisher empty$ not + 'monograph + { entry.is.electronic + 'electronic + { "Z" set.entry.mark + monograph + } + if$ } if$ } @@ -2446,27 +2728,44 @@ FUNCTION {misc} } FUNCTION {archive} -{ "A" set.mark +{ "A" set.entry.mark misc } -FUNCTION {article} { misc } - +% \end{macrocode} +% +% The book function is for a whole book. A book may CROSSREF another book. +% +% Required fields: author or editor, title, publisher, year +% +% Optional fields: volume or number, series, address, edition, month, +% note +% \begin{macrocode} FUNCTION {book} { monograph } +% \end{macrocode} +% +% A booklet is a bound thing without a publisher or sponsoring institution. +% +% Required: title +% +% Optional: author, howpublished, address, month, year, note +% \begin{macrocode} +FUNCTION {booklet} { book } + FUNCTION {collection} -{ "G" set.mark +{ "G" set.entry.mark monograph } FUNCTION {database} -{ "DB" set.mark - misc +{ "DB" set.entry.mark + electronic } FUNCTION {dataset} -{ "DS" set.mark - misc +{ "DS" set.entry.mark + electronic } % \end{macrocode} @@ -2481,7 +2780,6 @@ FUNCTION {dataset} % % inbook 类是不含 booktitle 域的,所以不应该适用于“专著中的析出文献”,而应该是专 % 著,即 book 类。 -% % \begin{macrocode} FUNCTION {inbook} { book } @@ -2490,51 +2788,68 @@ FUNCTION {inbook} { book } % An inproceedings is an article in a conference proceedings, and it may % CROSSREF a proceedings. If there's no address field, the month (\& year) % will appear just before note. +% % Required: author, title, booktitle, year +% % Optional: editor, volume or number, series, pages, address, month, % organization, publisher, note -% % \begin{macrocode} FUNCTION {inproceedings} -{ "C" set.mark +{ "C" set.entry.mark incollection } % \end{macrocode} % % The conference function is included for Scribe compatibility. -% % \begin{macrocode} FUNCTION {conference} { inproceedings } FUNCTION {map} -{ "CM" set.mark +{ "CM" set.entry.mark misc } % \end{macrocode} % +% A manual is technical documentation. +% +% Required: title +% +% Optional: author, organization, address, edition, month, year, note +% \begin{macrocode} +FUNCTION {manual} { monograph } + +% \end{macrocode} +% % A mastersthesis is a Master's thesis. +% % Required: author, title, school, year -% Optional: type, address, month, note % +% Optional: type, address, month, note % \begin{macrocode} FUNCTION {mastersthesis} -{ "D" set.mark +{ "D" set.entry.mark monograph } FUNCTION {newspaper} -{ "N" set.mark - article.in.journal +{ "N" set.entry.mark + article +} + +FUNCTION {online} +{ "EB" set.entry.mark + electronic } % \end{macrocode} % % A phdthesis is like a mastersthesis. +% % Required: author, title, school, year -% Optional: type, address, month, note % +% Optional: type, address, month, note % \begin{macrocode} FUNCTION {phdthesis} { mastersthesis } @@ -2544,54 +2859,68 @@ FUNCTION {phdthesis} { mastersthesis } % If there is an organization but no editor field, the organization will % appear as the first optional field (we try to make the first block nonempty); % if there's no address field, the month (\& year) will appear just before note. +% % Required: title, year +% % Optional: editor, volume or number, series, address, month, % organization, publisher, note -% % \begin{macrocode} FUNCTION {proceedings} -{ "C" set.mark +{ "C" set.entry.mark monograph } FUNCTION {software} -{ "CP" set.mark - misc +{ "CP" set.entry.mark + electronic } FUNCTION {standard} -{ "S" set.mark +{ "S" set.entry.mark misc } % \end{macrocode} % % A techreport is a technical report. +% % Required: author, title, institution, year -% Optional: type, number, address, month, note % +% Optional: type, number, address, month, note % \begin{macrocode} FUNCTION {techreport} -{ "R" set.mark +{ "R" set.entry.mark misc } % \end{macrocode} % -% We use entry type `misc' for an unknown type; BibTeX gives a warning. +% An unpublished is something that hasn't been published. +% +% Required: author, title, note % +% Optional: month, year +% \begin{macrocode} +FUNCTION {unpublished} +{ "Z" set.entry.mark + misc +} + +% \end{macrocode} +% +% We use entry type `misc' for an unknown type; BibTeX gives a warning. % \begin{macrocode} FUNCTION {default.type} { misc } % \end{macrocode} % +% % \subsection{Common macros} % % Here are macros for common things that may vary from style to style. % Users are encouraged to use these macros. % % Months are either written out in full or abbreviated -% % \begin{macrocode} MACRO {jan} {"January"} @@ -2624,8 +2953,7 @@ MACRO {dec} {"December"} % % To get a completely different set of abbreviations, it may be best to make % a separate .bib file with nothing but those abbreviations; users could then -% include that file name as the first argument to the \bibliography command -% +% include that file name as the first argument to the \cs{bibliography} command % \begin{macrocode} MACRO {acmcs} {"ACM Computing Surveys"} @@ -2670,40 +2998,8 @@ MACRO {tcs} {"Theoretical Computer Science"} % \end{macrocode} % -% \subsection{Read bib entries and execute} % -% Now we read in the .BIB entries. -% -% \begin{macrocode} -READ - -EXECUTE {init.state.consts} - -FUNCTION {set.entry.lang} -{ language empty$ - { author field.or.null title field.or.null * get.str.lang } - { language "english" = language "american" = or language "british" = or - { lang.en } - { language "chinese" = - { lang.zh } - { language "japanese" = - { lang.ja } - { language "russian" = - { lang.ru } - { lang.other } - if$ - } - if$ - } - if$ - } - if$ - } - if$ - 'entry.lang := -} - -% \end{macrocode} +% \subsection{Format labels} % % The sortify function converts to lower case after |purify$|ing; it's % used in sorting and in computing alphabetic labels after sorting @@ -2711,7 +3007,6 @@ FUNCTION {set.entry.lang} % The chop.word(w,len,s) function returns either s or, if the first len % letters of s equals w (this comparison is done in the third line of the % function's definition), it returns that part of s after w. -% % \begin{macrocode} FUNCTION {sortify} { purify$ @@ -2721,7 +3016,6 @@ FUNCTION {sortify} % \end{macrocode} % % We need the chop.word stuff for the dubious unsorted-list-with-labels case. -% % \begin{macrocode} FUNCTION {chop.word} { 's := @@ -2732,6 +3026,102 @@ FUNCTION {chop.word} if$ } +% \end{macrocode} +% +% The |format.lab.names| function makes a short label by using the initials of +% the von and Last parts of the names (but if there are more than four names, +% (i.e., people) it truncates after three and adds a superscripted "+"; +% it also adds such a "+" if the last of multiple authors is "others"). +% If there is only one name, and its von and Last parts combined have just +% a single name-token ("Knuth" has a single token, "Brinch Hansen" has two), +% we take the first three letters of the last name. The boolean +% et.al.char.used tells whether we've used a superscripted "+", so that we +% know whether to include a LaTeX macro for it. +% +% \begin{pseudocode} +% format.lab.names(s) == +% BEGIN +% numnames := num.names$(s) +% if numnames > 1 then +% if numnames > 4 then +% namesleft := 3 +% else +% namesleft := numnames +% nameptr := 1 +% nameresult := "" +% while namesleft > 0 +% do +% if (name_ptr = numnames) and +% format.name$(s, nameptr, "{ff }{vv }{ll}{ jj}") = "others" +% then nameresult := nameresult * "{\etalchar{+}}" +% et.al.char.used := true +% else nameresult := nameresult * +% format.name$(s, nameptr, "{v{}}{l{}}") +% nameptr := nameptr + 1 +% namesleft := namesleft - 1 +% od +% if numnames > 4 then +% nameresult := nameresult * "{\etalchar{+}}" +% et.al.char.used := true +% else +% t := format.name$(s, 1, "{v{}}{l{}}") +% if text.length$(t) < 2 then % there's just one name-token +% nameresult := text.prefix$(format.name$(s,1,"{ll}"),3) +% else +% nameresult := t +% fi +% fi +% return nameresult +% END +% \end{pseudocode} +% +% Exactly what fields we look at in constructing the primary part of the label +% depends on the entry type; this selectivity (as opposed to, say, always +% looking at author, then editor, then key) helps ensure that "ignored" fields, +% as described in the LaTeX book, really are ignored. Note that MISC is part +% of the deepest `else' clause in the nested part of calc.label; thus, any +% unrecognized entry type in the database is handled correctly. +% +% There is one auxiliary function for each of the four different sequences of +% fields we use. The first of these functions looks at the author field, and +% then, if necessary, the key field. The other three functions, which might +% look at two fields and the key field, are similar, except that the key field +% takes precedence over the organization field (for labels---not for sorting). +% +% The calc.label function calculates the preliminary label of an entry, which +% is formed by taking three letters of information from the author or editor or +% key or organization field (depending on the entry type and on what's empty, +% but ignoring a leading "The " in the organization), and appending the last +% two characters (digits) of the year. It is an error if the appropriate fields +% among author, editor, organization, and key are missing, and we use +% the first three letters of the |cite$| in desperation when this happens. +% The resulting label has the year part, but not the name part, |purify$|ed +% (|purify$|ing the year allows some sorting shenanigans by the user). +% +% This function also calculates the version of the label to be used in sorting. +% +% The final label may need a trailing 'a', 'b', etc., to distinguish it from +% otherwise identical labels, but we can't calculated those "extra.label"s +% until after sorting. +% +% \begin{pseudocode} +% calc.label == +% BEGIN +% if type$ = "book" or "inbook" then +% author.editor.key.label +% else if type$ = "proceedings" then +% editor.key.organization.label +% else if type$ = "manual" then +% author.key.organization.label +% else +% author.key.label +% fi fi fi +% label := label * substring$(purify$(field.or.null(year)), -1, 2) +% % assuming we will also sort, we calculate a sort.label +% sort.label := sortify(label), but use the last four, not two, digits +% END +% \end{pseudocode} +% \begin{macrocode} FUNCTION {format.lab.names} { 's := s #1 "{vv~}{ll}{, jj}{, ff}" format.name$ 't := @@ -2741,7 +3131,7 @@ FUNCTION {format.lab.names} { t #1 "{ll}{ff}" format.name$} if$ s num.names$ #1 > - { "\ " * format.et.al * } + { bbl.space * bbl.et.al * } 'skip$ if$ } @@ -2838,13 +3228,16 @@ FUNCTION {calc.label} % \end{macrocode} % +% +% \subsection{Sorting} +% % When sorting, we compute the sortkey by executing "presort" on each entry. % The presort key contains a number of "sortify"ed strings, concatenated % with multiple blanks between them. This makes things like "brinch per" % come before "brinch hansen per". % % The fields used here are: the sort.label for alphabetic labels (as set by -% calc.label), followed by the author names (or editor names or organization +% |calc.label|), followed by the author names (or editor names or organization % (with a leading "The " removed) or key field, depending on entry type and on % what's empty), followed by year, followed by the first bit of the title % (chopping off a leading "The ", "A ", or "An "). @@ -2855,11 +3248,10 @@ FUNCTION {calc.label} % four will separate the names from year (and from label, if alphabetic), % and four will separate year from title. % -% The sort.format.names function takes an argument that should be in +% The |sort.format.names| function takes an argument that should be in % BibTeX name format, and returns a string containing " "-separated % names in the format described above. The function is almost the same % as format.names. -% % \begin{macrocode} %<*authoryear> FUNCTION {sort.language.label} @@ -2916,7 +3308,6 @@ FUNCTION {sort.format.names} % The sort.format.title function returns the argument, % but first any leading "A "'s, "An "'s, or "The "'s are removed. % The chop.word function uses s, so we need another string variable, t -% % \begin{macrocode} FUNCTION {sort.format.title} { 't := @@ -2935,10 +3326,9 @@ FUNCTION {sort.format.title} % the ones for calc.label; the same comments apply, except that the % organization field takes precedence here over the key field. For sorting % purposes, we still remove a leading "The " from the organization field. -% % \begin{macrocode} FUNCTION {anonymous.sort} -{ is.in.chinese +{ lang.zh entry.lang = { "yi4 ming2" } { "anon" } if$ @@ -2946,7 +3336,11 @@ FUNCTION {anonymous.sort} FUNCTION {author.sort} { key empty$ - { author empty$ + { entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ + author empty$ { anonymous.sort } { author sort.format.names } if$ @@ -3001,14 +3395,16 @@ FUNCTION {editor.organization.sort} } %</authoryear> +% \end{macrocode} +% +% 顺序编码制的排序要简单得多 +% \begin{macrocode} %<*numerical> INTEGERS { seq.num } FUNCTION {init.seq} { #0 'seq.num :=} -EXECUTE {init.seq} - FUNCTION {int.to.fix} { "000000000" swap$ int.to.str$ * #-1 #10 substring$ @@ -3017,14 +3413,14 @@ FUNCTION {int.to.fix} %</numerical> % \end{macrocode} % -% There is a limit, entry.max$, on the length of an entry string variable -% (which is what its sort.key$ is), so we take at most that many characters +% There is a limit, |entry.max$|, on the length of an entry string variable +% (which is what its |sort.key$| is), so we take at most that many characters % of the constructed key, and hope there aren't many references that match % to that many characters! -% % \begin{macrocode} FUNCTION {presort} { set.entry.lang + show.url show.doi check.electronic calc.label label sortify " " @@ -3064,15 +3460,6 @@ FUNCTION {presort} 'sort.key$ := } -ITERATE {presort} - -% \end{macrocode} -% -% And now we can sort -% -% \begin{macrocode} -SORT - % \end{macrocode} % % Now comes the final computation for alphabetic labels, putting in the 'a's @@ -3121,7 +3508,6 @@ SORT % next.extra := extra.label % END % \end{pseudocode} -% % \begin{macrocode} STRINGS { longest.label last.label next.extra } @@ -3164,31 +3550,23 @@ FUNCTION {reverse.pass} label extra.label * 'label := } -EXECUTE {initialize.longest.label} - -ITERATE {forward.pass} - -REVERSE {reverse.pass} - FUNCTION {bib.sort.order} { sort.label 'sort.key$ := } -ITERATE {bib.sort.order} - -SORT - % \end{macrocode} % +% +% \subsection{Write bbl file} +% % Now we're ready to start writing the .BBL file. -% We begin, if necessary, with a LaTeX macro for unnamed names in an alphabetic -% label; next comes stuff from the `preamble' command in the database files. -% Then we give an incantation containing the command +% We begin, if necessary, with a \LaTeX{} macro for unnamed names in an +% alphabetic label; next comes stuff from the `preamble' command in the +% database files. Then we give an incantation containing the command % |\begin{thebibliography}{...}| % where the `...' is the longest label. % % We also call init.state.consts, for use by the output routines. -% % \begin{macrocode} FUNCTION {begin.bib} { preamble$ empty$ @@ -3199,40 +3577,83 @@ FUNCTION {begin.bib} write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ - "\providecommand{\url}[1]{#1}" - write$ newline$ - "\providecommand{\href}[2]{\url{#2}}" - write$ newline$ - "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" - write$ newline$ - "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" - write$ newline$ - " \urlstyle{same}\fi" - write$ newline$ + show.url show.doi or + { "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ + } + 'skip$ + if$ + show.doi + { "\providecommand{\href}[2]{\url{#2}}" + write$ newline$ + "\providecommand{\doi}[1]{\href{https://doi.org/#1}{#1}}" + write$ newline$ + } + 'skip$ + if$ } -EXECUTE {begin.bib} +% \end{macrocode} +% +% Finally, we finish up by writing the `|\end{thebibliography}|' command. +% \begin{macrocode} +FUNCTION {end.bib} +{ newline$ + "\end{thebibliography}" write$ newline$ +} % \end{macrocode} % -% Now we produce the output for all the entries % +% \subsection{Main execution} +% +% Now we read in the .BIB entries. % \begin{macrocode} -ITERATE {call.type$} +READ + +EXECUTE {init.state.consts} + +EXECUTE {load.config} + +%<*numerical> +EXECUTE {init.seq} + +%</numerical> +ITERATE {presort} % \end{macrocode} % -% Finally, we finish up by writing the `|\end{thebibliography}|' command. +% And now we can sort +% \begin{macrocode} +SORT + +EXECUTE {initialize.longest.label} + +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +ITERATE {bib.sort.order} + +SORT + +EXECUTE {begin.bib} + +% \end{macrocode} % +% Now we produce the output for all the entries % \begin{macrocode} -FUNCTION {end.bib} -{ newline$ - "\end{thebibliography}" write$ newline$ -} +ITERATE {call.type$} EXECUTE {end.bib} %</authoryear|numerical> % \end{macrocode} +% \end{environment} % % \Finale \endinput +所以只能在 bib 数据库中的 key 域手动录入作者姓名的拼音,如: diff --git a/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty b/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty index 266ac210a18..6c4ec742c0e 100644 --- a/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty +++ b/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty @@ -5,6 +5,7 @@ %% The original source files were: %% %% gbt7714.dtx (with options: `package') +%% Version: 2018/08/05 v1.0.9 %% %% Copyright (C) 2016-2018 by Zeping Lee <zepinglee AT gmail.com> %% @@ -18,36 +19,47 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{gbt7714} - [2018/05/12 v1.0.7 GB/T 7714-2015 BibTeX Style] + [2018/08/05 v1.0.9 GB/T 7714-2015 BibTeX Style] + +\newif\if@gbt@mmxv \newif\if@gbt@numerical \newif\if@gbt@super +\DeclareOption{2015}{\@gbt@mmxvtrue} +\DeclareOption{2005}{\@gbt@mmxvfalse} \DeclareOption{super}{\@gbt@numericaltrue\@gbt@supertrue} \DeclareOption{numbers}{\@gbt@numericaltrue\@gbt@superfalse} \DeclareOption{authoryear}{\@gbt@numericalfalse} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}} -\ExecuteOptions{super} +\ExecuteOptions{2015,super} \ProcessOptions\relax \if@gbt@numerical \PassOptionsToPackage{sort&compress}{natbib} \fi \RequirePackage{natbib} +\RequirePackage{etoolbox} +\RequirePackage{url} \newcommand\bibstyle@super{\bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} \newcommand\bibstyle@numbers{\bibpunct{[}{]}{,}{n}{,}{,}} \newcommand\bibstyle@authoryear{\bibpunct{(}{)}{;}{a}{,}{,}} -\def\tmp@numerical{numerical} -\def\tmp@authoryear{authoryear} \newcommand\gbtbibstyle[1]{% - \def\tmp@gbt{#1}% - \ifx\tmp@gbt\tmp@numerical% - \bibliographystyle{gbt7714-unsrt}% - \else% - \ifx\tmp@gbt\tmp@authoryear% - \bibliographystyle{gbt7714-plain}% - \else% - \PackageError{gbt7714}{Unknown argument #1.} - {It should be `numerical' or `authoryear'.} - \fi% - \fi% + \ifstrequal{#1}{numerical}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-unsrt}% + \else + \bibliographystyle{gbt7714-2005-unsrt}% + \fi + }{% + \ifstrequal{#1}{authoryear}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-plain}% + \else + \bibliographystyle{gbt7714-2005-plain}% + \fi + }{% + \PackageError{gbt7714}{Unknown argument #1.}% + {It should be `numerical' or `authoryear'.}% + }% + }% } \if@gbt@numerical \if@gbt@super @@ -61,7 +73,11 @@ \citestyle{authoryear} \gbtbibstyle{authoryear}% \fi -\RequirePackage{etoolbox} +\newcommand\gbt@patchfailure[1]{% + \ClassError{ustcthesis}{Failed to patch command \protect#1.\MessageBreak + Please contact the template author.% + }{}% +} \patchcmd{\NAT@citexnum}{% \@ifnum{\NAT@ctype=\z@}{% \if*#2*\else\NAT@cmt#2\fi @@ -72,7 +88,7 @@ \@ifnum{\NAT@ctype=\z@}{% \if*#2*\else\textsuperscript{#2}\fi }{}% -}{}{} +}{}{\gbt@patchfailure{\NAT@citexnum}} \renewcommand\NAT@citesuper[3]{\ifNAT@swa \if*#2*\else#2\NAT@spacechar\fi \unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close\if*#3*\else#3\fi}% @@ -83,7 +99,7 @@ }{% \if\relax\NAT@date\relax\else\NAT@@close\fi \if*#2*\else\textsuperscript{#2}\fi -}{}{} +}{}{\gbt@patchfailure{\NAT@citex}} \renewcommand\NAT@cite% [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup} @@ -95,15 +111,14 @@ \fi }{% \def@NAT@last@yr{-\NAT@penalty}% -}{}{} +}{}{\gbt@patchfailure{\NAT@citexnum}} \renewcommand\@biblabel[1]{[#1]\hfill} -\RequirePackage{url} -\g@addto@macro\UrlBreaks{% - \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j% - \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t% - \do\u\do\v\do\w\do\x\do\y\do\z% - \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J% - \do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T% - \do\U\do\V\do\W\do\X\do\Y\do\Z% - \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0% -} +\def\UrlBreaks{% + \do\/% + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l% + \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L% + \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:% + \do\*\do\-\do\~\do\'\do\"\do\-} +\Urlmuskip=0mu plus 0.1mu |