From 9ab6cd6e1acc331b86f1a497026cb07261634c08 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 15 Nov 2020 22:21:52 +0000 Subject: tugboat (15nov20) git-svn-id: svn://tug.org/texlive/trunk@56942 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst | 180 +++++++++++++++++------ 1 file changed, 131 insertions(+), 49 deletions(-) (limited to 'Master/texmf-dist/bibtex') diff --git a/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst b/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst index 57831f4832d..d5ed32280ff 100644 --- a/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst +++ b/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst @@ -1,13 +1,19 @@ -%%% $Id: tugboat.bst 271 2020-01-13 19:13:12Z karl $ +%%% $Id: tugboat.bst 314 2020-11-15 02:06:03Z karl $ %%% TUGboat changes are public domain. %%% %%% Modified for TUGboat from abbrvurl.bst: %%% Abbreviate "page(s)" to "p(p).", %%% "volume" to "vol.", %%% "editor(s)" to "ed(s)". -%%% Set urlintro="". %%% Output "Ph.D." rather than "PhD". -%%% Reduce long author lists in format.names per Mico Loretan. +%%% Output "No." and "no." for number field. +%%% Set urlintro="". +%%% Always use https://doi.org/ for the doi url, and omit doi: prefix +%%% (incomplete: doi urls not linked correctly). +%%% Omit spaces between author initials, like "A.B. Smith". +%%% Truncate long author lists in format.names (max.names, trunc.num) +%%% and omit "and" from author lists, per Oren P. +%%% New field bookauthor for @incollection and @inproceedings. %%% New fields for editors: %%% "newpage" - force page break after entry; %%% "urlnewline" - force line break before url value; @@ -37,6 +43,7 @@ ENTRY { address author + bookauthor booktitle chapter edition @@ -97,7 +104,7 @@ FUNCTION {init.urlbst.variables} "[link]" 'linktextstring := % dummy link text; typically "[link]" "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref "arXiv:" 'eprintprefix := % text prefix printed before eprint ref; typically "arXiv:" - "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "https://doi.org/" 'doiurl := % prefix to make URL from DOI "doi:" 'doiprefix := % text prefix printed before DOI ref; typically "doi:" "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref; typically "PMID:" @@ -222,7 +229,7 @@ FUNCTION {possibly.setup.inlinelink} hrefform #1 = % hypertex { "\special {html: }{" * 'openinlinelink := "\special {html:}" 'closeinlinelink := } - { "\newline\href {" swap$ * "} {" * 'openinlinelink := % hrefform=#2 -- hyperref + { "\href {" swap$ * "} {" * 'openinlinelink := % hrefform=#2 -- hyperref % the space between "} {" matters: a URL of just the right length can cause "\% newline em" "}" 'closeinlinelink := } if$ @@ -392,44 +399,88 @@ FUNCTION {emphasize} if$ } -INTEGERS { nameptr namesleft numnames } +%%% from trunc-auth.bst: +%%% There are two constants that allow for the truncation of a list of author +%%% (or editor) names -- max.names and trunc.num. And here's how they work: +%%% If there are max.names of fewer in the list, there is no truncation; but +%%% if there are more than max.names, the list is truncated at the trunc.num +%%% name, which is replaced by trunc.string (such as "et~al.", and names later +%%% in the list are omitted). There's also a sanity check, making sure that: +%%% 2 <= trunc.num <= max.names + 1 + +INTEGERS { max.names trunc.num } + +STRINGS { trunc.string sort.trunc.string } % the two truncation-string versions + +FUNCTION {init.and.check.trunc.consts} % from trunc-auth.bst, +{ #3 'max.names := % the two relevant integer constants + #3 'trunc.num := + "et~al." 'trunc.string := % and string constants for printing + "et al" 'sort.trunc.string := % and sorting + trunc.num #2 < + { "trunc.num=" trunc.num int.to.str$ * " but should be at least 2" * + warning$ + } + 'skip$ + if$ + trunc.num max.names #1 + > + { "trunc.num=" trunc.num int.to.str$ * + " should be at most max.names + 1 = " * max.names #1 + int.to.str$ * + warning$ + } + 'skip$ + if$ +} + +INTEGERS { nameptr numnames } + +INTEGERS { finalnamenum } % from trunc-auth.bst -FUNCTION {format.names} +FUNCTION {format.names} % from trunc-auth.bst { 's := - #1 'nameptr := + #0 'nameptr := s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := - nameptr #1 > - % following lines implement printing only 2 author names (+ "et al.") - % whenever there are more than 4 authors. Thanks Mico. - % https://tex.stackexchange.com/questions/26575 - { nameptr #2 - #1 + = - numnames #3 - > and - { "others" 't := - #1 'namesleft := } - 'skip$ - if$ - namesleft #1 > - { ", " * t * } - { numnames #2 > - { "," * } - 'skip$ - if$ - t "others" = - { " et~al." * } - { " and " * t * } + numnames max.names > % from trunc-auth.bst + { trunc.num 'finalnamenum := } % truncate in this case + { numnames 'finalnamenum := } + if$ + { nameptr finalnamenum < } + { nameptr #1 + 'nameptr := + % original line: + %s nameptr "{f{.}.~}{vv~}{ll}{, jj}" format.name$ 't := + % + % But we want to avoid the space that BibTeX usually inserts + % between the abbreviations of the tokens, so we get "A.B." + % instead of "A. B.". + % + % So, the "f{.}.~~" here says that, for the first name part (say + % "Alex B.") output the abbreviation for the first token ("A"), a + % period ("."), the abbreviation for the second token ("B"), and + % another period ("."), omitting the normal intertoken space, + % as discussed at the very end of btxhak. + % + % The final ~~ forces a tilde in the output, since we never want a + % line break between the initials and the last name. + % + s nameptr "{f{.}.~~}{vv~}{ll}{, jj}" format.name$ 't := + % + nameptr #1 = + 't + { ", " * % comma but no "and" before final name + nameptr finalnamenum < + { t * } + { numnames max.names > + { trunc.string * } + { t "others" = + { "et~al." * } + { t * } + if$ + } if$ } if$ } - 't if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := } while$ } @@ -453,6 +504,20 @@ FUNCTION {format.editors} if$ } +% if editor is non-empty, format it. +% else if bookauthor is non-empty, format it. +% else nothing. +FUNCTION {format.editors.bookauthors} +{ editor empty$ + { bookauthor empty$ + { "" } + { bookauthor format.names } + if$ + } + { format.editors } + if$ +} + FUNCTION {format.title} { title empty$ { "" } @@ -539,8 +604,8 @@ FUNCTION {format.number.series} { number empty$ { series field.or.null } { output.state mid.sentence = - { "number" } - { "Number" } + { "no." } + { "No." } if$ number tie.or.space.connect series empty$ @@ -635,12 +700,17 @@ FUNCTION {format.chapter.pages} if$ } +% handle possible bookauthor. +% original line: { "In " format.editors * ", " * booktitle emphasize * } + FUNCTION {format.in.ed.booktitle} { booktitle empty$ { "" } { editor empty$ + bookauthor empty$ + and { "In~" booktitle emphasize * } - { "In " format.editors * ", " * booktitle emphasize * } + { "In " booktitle emphasize * ", " format.editors.bookauthors * * } if$ } if$ @@ -777,7 +847,7 @@ FUNCTION {make.href.hypertex} % make hyperref specials FUNCTION {make.href.hyperref} { - "\newline\href {" swap$ * "} {\path{" * swap$ * "}}" * + "\href{" swap$ * "}{\path{" * swap$ * "}}" * } FUNCTION {make.href} { hrefform #2 = @@ -820,7 +890,7 @@ FUNCTION {format.eprint} FUNCTION {format.doi} { doi empty$ { "" } - { doiprefix doi * doiurl doi * make.href } + { doi doiurl make.href } if$ } @@ -1336,6 +1406,8 @@ MACRO {tcs} {"Theoretical Comput. Sci."} READ +EXECUTE {init.and.check.trunc.consts} % from trunc-auth.bst + FUNCTION {sortify} { purify$ "l" change.case$ @@ -1352,24 +1424,34 @@ FUNCTION {chop.word} if$ } -FUNCTION {sort.format.names} +FUNCTION {sort.format.names} % from trunc-auth.bst { 's := - #1 'nameptr := + #0 'nameptr := "" s num.names$ 'numnames := - numnames 'namesleft := - { namesleft #0 > } - { nameptr #1 > + numnames max.names > % from trunc-auth.bst + { trunc.num 'finalnamenum := } % truncate in this case + { numnames 'finalnamenum := } + if$ + { nameptr finalnamenum < } + { nameptr #1 + 'nameptr := + nameptr #1 > { " " * } 'skip$ if$ s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := - nameptr numnames = t "others" = and - { "et al" * } + nameptr finalnamenum < { t sortify * } + { numnames max.names > + { sort.trunc.string * } + { t "others" = + { "et al" * } + { t sortify * } + if$ + } + if$ + } if$ - nameptr #1 + 'nameptr := - namesleft #1 - 'namesleft := } while$ } -- cgit v1.2.3