summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/bibtex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-01-17 21:04:14 +0000
committerKarl Berry <karl@freefriends.org>2023-01-17 21:04:14 +0000
commitffd86237a94a078be6c6cf5f15511b0a329d1645 (patch)
tree9a17c2c7348b51380a8b6157aba9d2f27f3c5c78 /Master/texmf-dist/bibtex
parent513107f9ab13515e27059908624674b85f2259e6 (diff)
tugboat (17jan23)
git-svn-id: svn://tug.org/texlive/trunk@65569 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/bibtex')
-rw-r--r--Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst100
1 files changed, 85 insertions, 15 deletions
diff --git a/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst b/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst
index 1e28f2d8dda..a64d28fd17a 100644
--- a/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst
+++ b/Master/texmf-dist/bibtex/bst/tugboat/tugboat.bst
@@ -1,4 +1,4 @@
-%%% $Id: tugboat.bst 410 2021-11-24 17:46:03Z karl $
+%%% $Id: tugboat.bst 457 2023-01-16 18:43:54Z karl $
%%% TUGboat changes are public domain.
%%%
%%% Modified for TUGboat from abbrvurl.bst:
@@ -13,8 +13,12 @@
%%% Output "Ph.D." rather than "PhD".
%%% Output "No." and "no." for number field.
%%% Omit spaces between author initials, like "A.B. Smith".
-%%% Set urlintro="" and onlinestring="".
+%%% Set urlintro="" and onlinestring="" to omit labels from output.
+%%% Use \url instead of \href, so we don't require hyperref.
%%% Always use https://doi.org/ for the doi url; omit "doi:" from output.
+%%% If doi or howpublished is present, omit url, since in practice
+%%% they are usually all the same thing. Should check if
+%%% howpublished is in fact a url, though.
%%% Truncate long author lists in format.names (max.names, trunc.num);
%%% omit "and" from author lists, per Oren P.
%%% Use \emph instead of \em so we get automatic italic corrections.
@@ -25,7 +29,6 @@
%%% "prebibitem" - material output before \bibitem, with newline appended
%%% (for example, section headings).
%%% "urlnewline" - force line break before url value;
-%%%
%%% --karl, originally created 24jul18.
%%%
%%% Modification of BibTeX style file /usr/local/texlive/2009/texmf-dist/bibtex/bst/base/abbrv.bst
@@ -434,6 +437,7 @@ FUNCTION {emphasize}
if$
}
+% emacs-page
%%% 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:
@@ -871,7 +875,7 @@ FUNCTION {format.incoll.inproc.crossref}
" \cite{" * crossref * "}" *
}
-% urlbst...
+% emacs-page urlbst...
% Functions for making hypertext links.
% In all cases, the stack has (link-text href-url)
%
@@ -887,10 +891,12 @@ FUNCTION {make.href.hypertex}
swap$ * quote$ * "> }" * swap$ *
"\special {html:</a>}" *
}
-% make hyperref specials
+% make hyperref specials. Use \url rather than \href so that we don't
+% require loading hyperref (ltugboat provides \url in all cases),
+% thus we ignore one of the arguments.
FUNCTION {make.href.hyperref}
{
- "\href{" swap$ * "}{\path{" * swap$ * "}}" *
+ "\url{" swap$ * "}" * swap$ pop$
}
FUNCTION {make.href}
{ hrefform #2 =
@@ -906,7 +912,7 @@ FUNCTION {make.href}
% If inlinelinks is true, then format.url should be a no-op, since it's
% (a) redundant, and (b) could end up as a link-within-a-link.
% Likewise if the url is empty.
-% Likewise if doi is present, on the assumption that
+% Likewise if doi or howpublished is present, on the assumption that
% url most likely redundantly specifies the same info as those fields; this
% seems to be what people do in practice.
FUNCTION {format.url}
@@ -945,17 +951,78 @@ FUNCTION {format.eprint}
if$
}
-FUNCTION {format.doi}
-{ doi empty$
+FUNCTION {format.pubmed}
+{ pubmed empty$
{ "" }
- { doiprefix doi * doiurl doi * make.href }
+ { pubmedprefix pubmed * pubmedurl pubmed * make.href }
if$
}
-FUNCTION {format.pubmed}
-{ pubmed empty$
+% The original definition, left here for comparison.
+%FUNCTION {format.doi.orig}
+%{ doi empty$
+% { "" }
+% { doiprefix doi * doiurl doi * make.href }
+% if$
+%}
+
+% For the doi, sometimes people write doi = "10.x/y"
+% and sometimes they write doi ="https://doi.org/10.x/y".
+% So we check if the doi string starts with https://doi.org
+% (aka the doiurl variable), and only add it if needed.
+%
+% This code is from https://tex.stackexchange.com/questions/119237
+% (thank you, mafp).
+%
+% The "X Y contains" function checks if string Y is contained in X.
+% Although we only need to check if Y is at the beginning of X,
+% it makes no practical difference, so just use it as-is.
+%
+INTEGERS { strl }
+FUNCTION { string.length }
+{
+ #1 'strl :=
+ {duplicate$ duplicate$ #1 strl substring$ = not}
+ { strl #1 + 'strl :=}
+ while$
+ pop$ strl
+}
+
+INTEGERS {find.length search.start search.end done}
+STRINGS {find.string find.pattern}
+FUNCTION {contains}
+{
+ 'find.pattern :=
+ 'find.string :=
+ find.pattern string.length 'find.length :=
+ #1 'search.start :=
+ find.string string.length find.length - #2 + 'search.end :=
+ #0 'done :=
+ { search.start search.end < }
+ {
+ find.string search.start find.length substring$ find.pattern =
+ {
+ #1 'done :=
+ search.end 'search.start :=%% stop searching
+ }
+ { #1 search.start + 'search.start := }
+ if$
+ }
+ while$
+ done
+}
+
+FUNCTION {format.doi}
+{ doi empty$
{ "" }
- { pubmedprefix pubmed * pubmedurl pubmed * make.href }
+ { doiprefix doi *
+ doi doiurl contains
+ { "" }
+ { doiurl }
+ if$
+ doi *
+ make.href
+ }
if$
}
@@ -1035,6 +1102,7 @@ FUNCTION {fin.entry}
if$
}
+% emacs-page
% Webpage entry type.
% Title and url fields required;
% author, note, year, month, and lastchecked fields optional
@@ -1428,9 +1496,9 @@ FUNCTION {ctan}
new.block
format.title "title" output.check
format.version output
- format.date.direct "date" output.check
+ format.date.direct output
new.block
- note "note" output.check
+ note output
fin.entry
}
@@ -1505,6 +1573,8 @@ READ
EXECUTE {init.and.check.trunc.consts} % from trunc-auth.bst
+% emacs-page
+
FUNCTION {sortify}
{ purify$
"l" change.case$