diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-18 18:55:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-18 18:55:13 +0000 |
commit | ba68b87b140dbb977245265756c4872e375173e2 (patch) | |
tree | e26d7f0abfc99e203f971cc683985ef7c6093941 /Master/texmf-dist/bibtex | |
parent | 35bf49efe29bec63bd2bd90993121c549a4abaa7 (diff) |
urlbst update (16jun08)
git-svn-id: svn://tug.org/texlive/trunk@8847 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/bibtex')
-rw-r--r-- | Master/texmf-dist/bibtex/bib/urlbst/urlbst.bib | 178 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/abbrvurl.bst | 303 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst | 303 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/plainurl.bst | 303 | ||||
-rw-r--r-- | Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst | 303 |
5 files changed, 1110 insertions, 280 deletions
diff --git a/Master/texmf-dist/bibtex/bib/urlbst/urlbst.bib b/Master/texmf-dist/bibtex/bib/urlbst/urlbst.bib index 6b4946d8142..d981b820df0 100644 --- a/Master/texmf-dist/bibtex/bib/urlbst/urlbst.bib +++ b/Master/texmf-dist/bibtex/bib/urlbst/urlbst.bib @@ -1,23 +1,31 @@ % Webpage with lastchecked and date -@webpage{url:latex, - author = {Barbara Beeton}, - year = 2001, - month = may, - url = {http://www.tug.org/docs/html/ptr-faq.html}, - title = {What is {\TeX}?}, - lastchecked = {20 August 2001} +@webpage{url:weapas, + url = {http://www.beadsland.com/weapas/}, + title = {Web Extension to {American Psychological Association} Style ({WEAPAS}) (Rev.2.0)}, + author = {B Land}, + year = 2001, + month = jul, + lastchecked = {23 October 2002} +} + +@Webpage{apastyle, + url = {http://www.apastyle.org/elecref.html}, + author = {{American Psychological Association}}, + title = {Electronic References}, + year = 2001, + lastchecked = {23 October 2002}, + note = {Excerpted from 5th edition of the APA Publication Manual} } -% Webpage with lastchecked but no date @webpage{url:iso690, author = {{International Standards Organisation}}, title = {{ISO 690-2}}, - url = {http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm}, + url = {http://www.collectionscanada.gc.ca/iso/tc46sc9/standard/690-2e.htm}, lastchecked = {20 August 2001} } -% Webpage with date but no lastchecked -@Webpage{classroom96, +% This one appears to be dead +@Webpage{gone:classroom96, title = {Citing Internet Addresses: how students should reference online sources in their bibliographies}, year = 1996, @@ -26,15 +34,57 @@ url = "http://www.classroom.net/classroom/CitingNetResources.html" } -% Webpage with neither date nor lastchecked @Webpage{emory95, author = "libsf@web.cc.emory.edu", title = "Citation Formats", - url = "http://www.cc.emory.edu/WHSCL/citation.formats.html" + date = {1997}, + lastchecked = {23 October 2002}, + url = {http://business.library.emory.edu/eresources/citing.html} +} + +@Book{walker, + author = {Janice R. Walker and Todd Taylor}, + title = {The Columbia Guide to Online Style}, + publisher = {Columbia University Press}, + year = 2006, + DEADurl = {http://www.columbia.edu/cu/cup/cgos/}, + edition = {2nd}, + isbn = {978-0-231-13211-4}, + DEADlastchecked = {23 October 2002} +} + +@Webpage{walker-orig, + title = {{MLA}-Style Citations of Electronic Sources}, + author = {Janice R. Walker}, + url = {http://www.cas.usf.edu/english/walker/mla.html}, + year = 1995, + lastchecked = {23 October 2002}, + note = {Updated and superceded by \cite{walker}} +} + +@Webpage{texfaq, + url = {http://www.tex.ac.uk/cgi-bin/texfaq2html?label=citeURL}, + title = {{UK \TeX\ FAQ: URLs in \BibTeX\ bibliographies}}, + key = {UK TeX FAQ}, + editor = {Robin Fairbairns}, + year = 2002, + lastchecked = {23 October 2002} } + + +@Webpage{url:daly, + url = {http://www.tex.ac.uk/tex-archive/macros/latex/contrib/custom-bib/}, + title = {Index of custom-bib}, + author = {Patrick W Daly}, + year = 2003, + lastchecked = {4 June 2003} +} + +% Following are test entries + % Article with URL and lastchecked -@article{url:towell, +@article{test:towell, title = {Presence in Text-Based Networked Virtual Environments or `{MUDs}'}, author = {John Towell and Elizabeth Towell}, @@ -48,7 +98,7 @@ } % Book with URL, lastchecked, and note. -@Book{raymond99, +@Book{test:raymond99, author = {Eric S Raymond}, title = {The Cathedral and the Bazaar}, publisher = {O'Reilly}, @@ -60,12 +110,108 @@ } % Plain book, no URLs at all -@book{laurillard93, +@book{test:laurillard93, author = {Diana Laurillard}, title = {Rethinking University Teaching}, publisher = {Routledge}, year = 1993 } +% Webpage with lastchecked but no date +@webpage{test:iso690, + author = {{International Standards Organisation}}, + title = {{ISO 690-2}}, + url = {http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm}, + lastchecked = {20 August 2001} +} + +% Webpage with date but no lastchecked +@Webpage{test:classroom96, + title = {Citing Internet Addresses: how students should + reference online sources in their bibliographies}, + year = 1996, + month = mar, + key = {Classroom}, + url = "http://www.classroom.net/classroom/CitingNetResources.html" +} + +% Webpage with neither date nor lastchecked +@Webpage{test:emory95, + author = "libsf@web.cc.emory.edu", + title = "Citation Formats", + url = "http://www.emory.edu/WHSCL/citation.formats.html" +} + +% The same, but with no title either +@Webpage{test:emory95x, + author = "libsf@web.cc.emory.edu", + url = "http://www.emory.edu/WHSCL/citation.formats.html" +} + +% Article with eprint number +@techreport{test:simkin, + author = {Mikhail Simkin and V. P. Roychowdhury}, + title = {Read before you cite!}, + year = 2002, + institution = {UCLA}, + eprint = {cond-mat/0212043} +} + +% Article with a DOI +% an underscore +@article{test:gray00c, + author = "Norman Gray", + title = "Automatic Reduction of Elliptic Integrals using + {Carlson's} Relations", + journal = {Mathematics of Computation}, + volume = 71, + pages = {311-318}, + year = 2002, + doi = {10.1090/S0025-5718-01-01333-3} +} + +% Article with a PUBMED reference +@Article{test:giffin03, + author = {M J Giffin and J C Stroud and D L Bates and von Koenig, K D and J Hardin and L Chen}, + title = {Structure of {NFAT1} Bound as a Dimer to the {HIV-1 LTR} kappa {B} element}, + journal = {Nature Structural Biology}, + year = {2003}, + volume = {10}, + number = {10}, + pages = {800-6}, + month = oct, + pubmed = {12949493} +} + +@ARTICLE{test:nastydoi, + author = {Zemla, Adam and Venclovas, Ceslovas and Moult, John and + Fidelis, Krzysztof}, + title = {{P}rocessing and analysis of {CASP}3 protein structure predictions}, + journal = {Proteins: Structure, Function, and Genetics}, + year = {1999}, + volume = {37}, + pages = {22--29}, + number = {S3}, + month = jan, + comment = {Description of GDT measure.}, + doi = {10.1002/(SICI)1097-0134(1999)37:3+<22::AID-PROT5>3.0.CO;2-W}, + keywords = {CASP}, + timestamp = {2007-03-13} +} + +% Example from Jason Eisner, by mail (nothing special about the entry, +% but he seemed to be having formatting problems with unsrturl and proceedings +% entries. +@InProceedings{test:eisner-sample, + author = {Damianos Karakos and Sanjeev Khudanpur and Jason + Eisner and Carey~E. Priebe}, + title = {Iterative denoising using {J}ensen-{R}eny\'{\i} + divergences with an application to unsupervised + document categorization}, + booktitle = {Proceedings of ICASSP}, + year = 2007, + url = {http://cs.jhu.edu/~jason/papers/#icassp07} +} + diff --git a/Master/texmf-dist/bibtex/bst/urlbst/abbrvurl.bst b/Master/texmf-dist/bibtex/bst/urlbst/abbrvurl.bst index 1a99ffbd620..aefda0e00f9 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/abbrvurl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/abbrvurl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/abbrv.bst -%%% to add webpage entry type, and url and lastchecked fields -%%% Edits by urlbst.pl, version 0.1 -%%% (marked with % urlbst.pl) +%%% Modification of BibTeX style file /usr/local/texlive/2007/texmf-dist/bibtex/bst/base/abbrv.bst +%%% ... by urlbst, version 0.6-1 (marked with "% urlbst") +%%% See <http://purl.org/nxg/dist/urlbst> +%%% Added webpage entry type, and url and lastchecked fields. +%%% Added eprint support. +%%% Added DOI support. +%%% Added PUBMED support. +%%% Added hyperref support. %%% Original headers follow... + % BibTeX standard bibliography style `abbrv' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -36,22 +41,54 @@ ENTRY type volume year - url % urlbst.pl - lastchecked + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } -INTEGERS { bracket.state outside.brackets open.brackets within.brackets close.brackets } % urlbst.pl +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver } +% Following constants may be adjusted by hand, if desired +FUNCTION {init.urlbst.variables} +{ + "Available from: " 'urlintro := % prefix before URL + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref + "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "doi:" 'doiprefix := % text prefix printed before DOI ref + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref + #1 'addeprints := % 0=no eprints; 1=include eprints + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it + #2 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'outside.brackets := % urlbst.pl +{ #0 'outside.brackets := % urlbst #1 'open.brackets := #2 'within.brackets := #3 'close.brackets := - #0 'before.all := + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := @@ -59,7 +96,7 @@ FUNCTION {init.state.consts} STRINGS { s t } -% urlbst.pl +% urlbst FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = @@ -81,12 +118,50 @@ FUNCTION {output.nonnull.original} s } -% urlbst.pl... +% urlbst... +% The following three functions are for handling inlinelink. They wrap +% a block of text which is potentially output with write$ by multiple +% other functions, so we don't know the content a priori. +% They communicate between each other using the variables makeinlinelink +% (which is true if a link should be made), and closeinlinelink (which holds +% the string which should close any current link. They can be called +% at any time, but start.inlinelink will be a no-op unless something has +% previously set makeinlinelink true, and the two ...end.inlinelink functions +% will only do their stuff if start.inlinelink has previously set +% closeinlinelink to be non-empty. +FUNCTION {setup.inlinelink} +{ makeinlinelink + { hrefform #1 = % hypertex + { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink := + "\special {html:</a>}" 'closeinlinelink := + } + { hrefform #2 = % hyperref + { "\href{" url * "}{" * 'openinlinelink := + "}" 'closeinlinelink := + } + 'skip$ + if$ % hrefform #2 = + } + if$ % hrefform #1 = + #0 'makeinlinelink := + } + 'skip$ + if$ % makeinlinelink +} +FUNCTION {add.inlinelink} +{ openinlinelink empty$ + 'skip$ + { openinlinelink swap$ * closeinlinelink * + "" 'openinlinelink := + } + if$ +} FUNCTION {output.nonnull} { % Save the thing we've been asked to output 's := - % If the bracket-state is close.brackets, then add a close-bracket to what's - % currently at the top of the stack, and set bracket.state to outside.brackets + % If the bracket-state is close.brackets, then add a close-bracket to + % what is currently at the top of the stack, and set bracket.state + % to outside.brackets bracket.state close.brackets = { "]" * outside.brackets 'bracket.state := @@ -98,7 +173,8 @@ FUNCTION {output.nonnull} % Write out what's currently at the top of the stack, using the % original output.nonnull function. s - output.nonnull.original + add.inlinelink + output.nonnull.original % invoke the original output.nonnull } { % Still in brackets. Add open-bracket or (continuation) comma, add the % new text (in s) to the top of the stack, and move to the close-brackets @@ -123,20 +199,13 @@ FUNCTION {inbrackets} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { "Available from World Wide Web: \url{" url * "}" * } - if$ -} - FUNCTION {format.lastchecked} { lastchecked empty$ { "" } { inbrackets "cited " lastchecked * } if$ } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {output} { duplicate$ empty$ @@ -153,9 +222,8 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} -{ outside.brackets 'bracket.state := % urlbst.pl - newline$ +FUNCTION {output.bibitem.original} +{ newline$ "\bibitem{" write$ cite$ write$ "}" write$ @@ -164,13 +232,8 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {fin.entry} -{ - bracket.state close.brackets = % urlbst.pl - { "]" * } - 'skip$ - if$ - add.period$ +FUNCTION {fin.entry.original} +{ add.period$ write$ newline$ } @@ -612,7 +675,73 @@ FUNCTION {format.incoll.inproc.crossref} " \cite{" * crossref * "}" * } -% urlbst.pl... +% urlbst... +% Functions for making hypertext links. +% In all cases, the stack has (link-text href-url) +% +% make 'null' specials +FUNCTION {make.href.null} +{ + pop$ +} +% make hypertex specials +FUNCTION {make.href.hypertex} +{ + "\special {html:<a href=" quote$ * + swap$ * quote$ * "> }" * swap$ * + "\special {html:</a>}" * +} +% make hyperref specials +FUNCTION {make.href.hyperref} +{ + "\href {" swap$ * "} {\path{" * swap$ * "}}" * +} +FUNCTION {make.href} +{ hrefform #2 = + 'make.href.hyperref % hrefform = 2 + { hrefform #1 = + 'make.href.hypertex % hrefform = 1 + 'make.href.null % hrefform = 0 (or anything else) + if$ + } + if$ +} + +% 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. +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or + { "" } + { hrefform #1 = + { % special case -- add HyperTeX specials + urlintro "\url{" url * "}" * url make.href.hypertex * } + { urlintro "\url{" * url * "}" * } + if$ + } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiprefix doi * doiurl doi * make.href } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} + % Output a URL. We can't use the more normal idiom (something like % `format.url output'), because the `inbrackets' within % format.lastchecked applies to everything between calls to `output', @@ -628,6 +757,51 @@ FUNCTION {output.url} if$ } +FUNCTION {output.web.refs} +{ + new.block + output.url + addeprints eprint empty$ not and + { format.eprint output.nonnull } + 'skip$ + if$ + adddoiresolver doi empty$ not and + { format.doi output.nonnull } + 'skip$ + if$ + addpubmedresolver pubmed empty$ not and + { format.pubmed output.nonnull } + 'skip$ + if$ +} + +% Wrapper for output.bibitem.original. +% If the URL field is not empty, set makeinlinelink to be true, +% so that an inline link will be started at the next opportunity +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} + +% Wrapper for fin.entry.original +FUNCTION {fin.entry} +{ output.web.refs % urlbst + makeinlinelink % ooops, it appears we didn't have a title for inlinelink + { setup.inlinelink % add some artificial link text here, as a fallback + "[link]" output.nonnull } + 'skip$ + if$ + bracket.state close.brackets = % urlbst + { "]" * } + 'skip$ + if$ + fin.entry.original +} + % Webpage entry type. % Title and url fields required; % author, note, year, month, and lastchecked fields optional @@ -640,10 +814,19 @@ FUNCTION {output.url} FUNCTION {webpage} { output.bibitem author empty$ - 'skip$ - { format.authors output.nonnull } + { editor empty$ + 'skip$ % author and editor both optional + { format.editors output.nonnull } + if$ + } + { editor empty$ + { format.authors output.nonnull } + { "can't use both author and editor fields in " cite$ * warning$ } + if$ + } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ format.title "title" output.check inbrackets "online" output new.block @@ -651,23 +834,22 @@ FUNCTION {webpage} 'skip$ { format.date "year" output.check } if$ - lastchecked empty$ - 'skip$ - { format.lastchecked output } - if$ - new.block - format.url "url" output.check + % We don't need to output the URL details ('lastchecked' and 'url'), + % because fin.entry does that for us, using output.web.refs. The only + % reason we would want to put them here is if we were to decide that + % they should go in front of the rather miscellaneous information in 'note'. new.block note output fin.entry } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -680,8 +862,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -698,6 +878,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -714,8 +895,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -724,14 +903,13 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output address output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -748,6 +926,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -766,8 +945,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -776,6 +953,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -794,8 +972,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -804,6 +980,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -830,8 +1007,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -851,6 +1026,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -868,8 +1044,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -878,6 +1052,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -885,8 +1060,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -895,13 +1068,12 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry empty.misc.check @@ -911,6 +1083,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -918,8 +1091,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -931,6 +1102,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -955,8 +1127,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -965,6 +1135,7 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull @@ -972,8 +1143,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -982,6 +1151,7 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check @@ -1238,6 +1408,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} diff --git a/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst b/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst index d18332871bd..19ed512e504 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/alphaurl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/alpha.bst -%%% to add webpage entry type, and url and lastchecked fields -%%% Edits by urlbst.pl, version 0.1 -%%% (marked with % urlbst.pl) +%%% Modification of BibTeX style file /usr/local/texlive/2007/texmf-dist/bibtex/bst/base/alpha.bst +%%% ... by urlbst, version 0.6-1 (marked with "% urlbst") +%%% See <http://purl.org/nxg/dist/urlbst> +%%% Added webpage entry type, and url and lastchecked fields. +%%% Added eprint support. +%%% Added DOI support. +%%% Added PUBMED support. +%%% Added hyperref support. %%% Original headers follow... + % BibTeX standard bibliography style `alpha' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -36,22 +41,54 @@ ENTRY type volume year - url % urlbst.pl - lastchecked + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label extra.label sort.label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } -INTEGERS { bracket.state outside.brackets open.brackets within.brackets close.brackets } % urlbst.pl +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver } +% Following constants may be adjusted by hand, if desired +FUNCTION {init.urlbst.variables} +{ + "Available from: " 'urlintro := % prefix before URL + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref + "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "doi:" 'doiprefix := % text prefix printed before DOI ref + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref + #1 'addeprints := % 0=no eprints; 1=include eprints + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it + #2 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'outside.brackets := % urlbst.pl +{ #0 'outside.brackets := % urlbst #1 'open.brackets := #2 'within.brackets := #3 'close.brackets := - #0 'before.all := + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := @@ -59,7 +96,7 @@ FUNCTION {init.state.consts} STRINGS { s t } -% urlbst.pl +% urlbst FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = @@ -81,12 +118,50 @@ FUNCTION {output.nonnull.original} s } -% urlbst.pl... +% urlbst... +% The following three functions are for handling inlinelink. They wrap +% a block of text which is potentially output with write$ by multiple +% other functions, so we don't know the content a priori. +% They communicate between each other using the variables makeinlinelink +% (which is true if a link should be made), and closeinlinelink (which holds +% the string which should close any current link. They can be called +% at any time, but start.inlinelink will be a no-op unless something has +% previously set makeinlinelink true, and the two ...end.inlinelink functions +% will only do their stuff if start.inlinelink has previously set +% closeinlinelink to be non-empty. +FUNCTION {setup.inlinelink} +{ makeinlinelink + { hrefform #1 = % hypertex + { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink := + "\special {html:</a>}" 'closeinlinelink := + } + { hrefform #2 = % hyperref + { "\href{" url * "}{" * 'openinlinelink := + "}" 'closeinlinelink := + } + 'skip$ + if$ % hrefform #2 = + } + if$ % hrefform #1 = + #0 'makeinlinelink := + } + 'skip$ + if$ % makeinlinelink +} +FUNCTION {add.inlinelink} +{ openinlinelink empty$ + 'skip$ + { openinlinelink swap$ * closeinlinelink * + "" 'openinlinelink := + } + if$ +} FUNCTION {output.nonnull} { % Save the thing we've been asked to output 's := - % If the bracket-state is close.brackets, then add a close-bracket to what's - % currently at the top of the stack, and set bracket.state to outside.brackets + % If the bracket-state is close.brackets, then add a close-bracket to + % what is currently at the top of the stack, and set bracket.state + % to outside.brackets bracket.state close.brackets = { "]" * outside.brackets 'bracket.state := @@ -98,7 +173,8 @@ FUNCTION {output.nonnull} % Write out what's currently at the top of the stack, using the % original output.nonnull function. s - output.nonnull.original + add.inlinelink + output.nonnull.original % invoke the original output.nonnull } { % Still in brackets. Add open-bracket or (continuation) comma, add the % new text (in s) to the top of the stack, and move to the close-brackets @@ -123,20 +199,13 @@ FUNCTION {inbrackets} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { "Available from World Wide Web: \url{" url * "}" * } - if$ -} - FUNCTION {format.lastchecked} { lastchecked empty$ { "" } { inbrackets "cited " lastchecked * } if$ } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {output} { duplicate$ empty$ @@ -153,9 +222,8 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} -{ outside.brackets 'bracket.state := % urlbst.pl - newline$ +FUNCTION {output.bibitem.original} +{ newline$ "\bibitem[" write$ label write$ "]{" write$ @@ -166,13 +234,8 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {fin.entry} -{ - bracket.state close.brackets = % urlbst.pl - { "]" * } - 'skip$ - if$ - add.period$ +FUNCTION {fin.entry.original} +{ add.period$ write$ newline$ } @@ -614,7 +677,73 @@ FUNCTION {format.incoll.inproc.crossref} " \cite{" * crossref * "}" * } -% urlbst.pl... +% urlbst... +% Functions for making hypertext links. +% In all cases, the stack has (link-text href-url) +% +% make 'null' specials +FUNCTION {make.href.null} +{ + pop$ +} +% make hypertex specials +FUNCTION {make.href.hypertex} +{ + "\special {html:<a href=" quote$ * + swap$ * quote$ * "> }" * swap$ * + "\special {html:</a>}" * +} +% make hyperref specials +FUNCTION {make.href.hyperref} +{ + "\href {" swap$ * "} {\path{" * swap$ * "}}" * +} +FUNCTION {make.href} +{ hrefform #2 = + 'make.href.hyperref % hrefform = 2 + { hrefform #1 = + 'make.href.hypertex % hrefform = 1 + 'make.href.null % hrefform = 0 (or anything else) + if$ + } + if$ +} + +% 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. +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or + { "" } + { hrefform #1 = + { % special case -- add HyperTeX specials + urlintro "\url{" url * "}" * url make.href.hypertex * } + { urlintro "\url{" * url * "}" * } + if$ + } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiprefix doi * doiurl doi * make.href } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} + % Output a URL. We can't use the more normal idiom (something like % `format.url output'), because the `inbrackets' within % format.lastchecked applies to everything between calls to `output', @@ -630,6 +759,51 @@ FUNCTION {output.url} if$ } +FUNCTION {output.web.refs} +{ + new.block + output.url + addeprints eprint empty$ not and + { format.eprint output.nonnull } + 'skip$ + if$ + adddoiresolver doi empty$ not and + { format.doi output.nonnull } + 'skip$ + if$ + addpubmedresolver pubmed empty$ not and + { format.pubmed output.nonnull } + 'skip$ + if$ +} + +% Wrapper for output.bibitem.original. +% If the URL field is not empty, set makeinlinelink to be true, +% so that an inline link will be started at the next opportunity +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} + +% Wrapper for fin.entry.original +FUNCTION {fin.entry} +{ output.web.refs % urlbst + makeinlinelink % ooops, it appears we didn't have a title for inlinelink + { setup.inlinelink % add some artificial link text here, as a fallback + "[link]" output.nonnull } + 'skip$ + if$ + bracket.state close.brackets = % urlbst + { "]" * } + 'skip$ + if$ + fin.entry.original +} + % Webpage entry type. % Title and url fields required; % author, note, year, month, and lastchecked fields optional @@ -642,10 +816,19 @@ FUNCTION {output.url} FUNCTION {webpage} { output.bibitem author empty$ - 'skip$ - { format.authors output.nonnull } + { editor empty$ + 'skip$ % author and editor both optional + { format.editors output.nonnull } + if$ + } + { editor empty$ + { format.authors output.nonnull } + { "can't use both author and editor fields in " cite$ * warning$ } + if$ + } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ format.title "title" output.check inbrackets "online" output new.block @@ -653,23 +836,22 @@ FUNCTION {webpage} 'skip$ { format.date "year" output.check } if$ - lastchecked empty$ - 'skip$ - { format.lastchecked output } - if$ - new.block - format.url "url" output.check + % We don't need to output the URL details ('lastchecked' and 'url'), + % because fin.entry does that for us, using output.web.refs. The only + % reason we would want to put them here is if we were to decide that + % they should go in front of the rather miscellaneous information in 'note'. new.block note output fin.entry } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -682,8 +864,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -700,6 +880,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -716,8 +897,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -726,14 +905,13 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output address output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -750,6 +928,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -768,8 +947,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -778,6 +955,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -796,8 +974,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -806,6 +982,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -832,8 +1009,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -853,6 +1028,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -870,8 +1046,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -880,6 +1054,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -887,8 +1062,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -897,13 +1070,12 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry empty.misc.check @@ -913,6 +1085,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -920,8 +1093,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -933,6 +1104,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -957,8 +1129,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -967,6 +1137,7 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull @@ -974,8 +1145,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -984,6 +1153,7 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check @@ -1398,6 +1568,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} diff --git a/Master/texmf-dist/bibtex/bst/urlbst/plainurl.bst b/Master/texmf-dist/bibtex/bst/urlbst/plainurl.bst index 78fecde3486..5c0788e1398 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/plainurl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/plainurl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/plain.bst -%%% to add webpage entry type, and url and lastchecked fields -%%% Edits by urlbst.pl, version 0.1 -%%% (marked with % urlbst.pl) +%%% Modification of BibTeX style file /usr/local/texlive/2007/texmf-dist/bibtex/bst/base/plain.bst +%%% ... by urlbst, version 0.6-1 (marked with "% urlbst") +%%% See <http://purl.org/nxg/dist/urlbst> +%%% Added webpage entry type, and url and lastchecked fields. +%%% Added eprint support. +%%% Added DOI support. +%%% Added PUBMED support. +%%% Added hyperref support. %%% Original headers follow... + % BibTeX standard bibliography style `plain' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -36,22 +41,54 @@ ENTRY type volume year - url % urlbst.pl - lastchecked + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } -INTEGERS { bracket.state outside.brackets open.brackets within.brackets close.brackets } % urlbst.pl +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver } +% Following constants may be adjusted by hand, if desired +FUNCTION {init.urlbst.variables} +{ + "Available from: " 'urlintro := % prefix before URL + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref + "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "doi:" 'doiprefix := % text prefix printed before DOI ref + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref + #1 'addeprints := % 0=no eprints; 1=include eprints + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it + #2 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'outside.brackets := % urlbst.pl +{ #0 'outside.brackets := % urlbst #1 'open.brackets := #2 'within.brackets := #3 'close.brackets := - #0 'before.all := + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := @@ -59,7 +96,7 @@ FUNCTION {init.state.consts} STRINGS { s t } -% urlbst.pl +% urlbst FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = @@ -81,12 +118,50 @@ FUNCTION {output.nonnull.original} s } -% urlbst.pl... +% urlbst... +% The following three functions are for handling inlinelink. They wrap +% a block of text which is potentially output with write$ by multiple +% other functions, so we don't know the content a priori. +% They communicate between each other using the variables makeinlinelink +% (which is true if a link should be made), and closeinlinelink (which holds +% the string which should close any current link. They can be called +% at any time, but start.inlinelink will be a no-op unless something has +% previously set makeinlinelink true, and the two ...end.inlinelink functions +% will only do their stuff if start.inlinelink has previously set +% closeinlinelink to be non-empty. +FUNCTION {setup.inlinelink} +{ makeinlinelink + { hrefform #1 = % hypertex + { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink := + "\special {html:</a>}" 'closeinlinelink := + } + { hrefform #2 = % hyperref + { "\href{" url * "}{" * 'openinlinelink := + "}" 'closeinlinelink := + } + 'skip$ + if$ % hrefform #2 = + } + if$ % hrefform #1 = + #0 'makeinlinelink := + } + 'skip$ + if$ % makeinlinelink +} +FUNCTION {add.inlinelink} +{ openinlinelink empty$ + 'skip$ + { openinlinelink swap$ * closeinlinelink * + "" 'openinlinelink := + } + if$ +} FUNCTION {output.nonnull} { % Save the thing we've been asked to output 's := - % If the bracket-state is close.brackets, then add a close-bracket to what's - % currently at the top of the stack, and set bracket.state to outside.brackets + % If the bracket-state is close.brackets, then add a close-bracket to + % what is currently at the top of the stack, and set bracket.state + % to outside.brackets bracket.state close.brackets = { "]" * outside.brackets 'bracket.state := @@ -98,7 +173,8 @@ FUNCTION {output.nonnull} % Write out what's currently at the top of the stack, using the % original output.nonnull function. s - output.nonnull.original + add.inlinelink + output.nonnull.original % invoke the original output.nonnull } { % Still in brackets. Add open-bracket or (continuation) comma, add the % new text (in s) to the top of the stack, and move to the close-brackets @@ -123,20 +199,13 @@ FUNCTION {inbrackets} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { "Available from World Wide Web: \url{" url * "}" * } - if$ -} - FUNCTION {format.lastchecked} { lastchecked empty$ { "" } { inbrackets "cited " lastchecked * } if$ } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {output} { duplicate$ empty$ @@ -153,9 +222,8 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} -{ outside.brackets 'bracket.state := % urlbst.pl - newline$ +FUNCTION {output.bibitem.original} +{ newline$ "\bibitem{" write$ cite$ write$ "}" write$ @@ -164,13 +232,8 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {fin.entry} -{ - bracket.state close.brackets = % urlbst.pl - { "]" * } - 'skip$ - if$ - add.period$ +FUNCTION {fin.entry.original} +{ add.period$ write$ newline$ } @@ -612,7 +675,73 @@ FUNCTION {format.incoll.inproc.crossref} " \cite{" * crossref * "}" * } -% urlbst.pl... +% urlbst... +% Functions for making hypertext links. +% In all cases, the stack has (link-text href-url) +% +% make 'null' specials +FUNCTION {make.href.null} +{ + pop$ +} +% make hypertex specials +FUNCTION {make.href.hypertex} +{ + "\special {html:<a href=" quote$ * + swap$ * quote$ * "> }" * swap$ * + "\special {html:</a>}" * +} +% make hyperref specials +FUNCTION {make.href.hyperref} +{ + "\href {" swap$ * "} {\path{" * swap$ * "}}" * +} +FUNCTION {make.href} +{ hrefform #2 = + 'make.href.hyperref % hrefform = 2 + { hrefform #1 = + 'make.href.hypertex % hrefform = 1 + 'make.href.null % hrefform = 0 (or anything else) + if$ + } + if$ +} + +% 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. +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or + { "" } + { hrefform #1 = + { % special case -- add HyperTeX specials + urlintro "\url{" url * "}" * url make.href.hypertex * } + { urlintro "\url{" * url * "}" * } + if$ + } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiprefix doi * doiurl doi * make.href } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} + % Output a URL. We can't use the more normal idiom (something like % `format.url output'), because the `inbrackets' within % format.lastchecked applies to everything between calls to `output', @@ -628,6 +757,51 @@ FUNCTION {output.url} if$ } +FUNCTION {output.web.refs} +{ + new.block + output.url + addeprints eprint empty$ not and + { format.eprint output.nonnull } + 'skip$ + if$ + adddoiresolver doi empty$ not and + { format.doi output.nonnull } + 'skip$ + if$ + addpubmedresolver pubmed empty$ not and + { format.pubmed output.nonnull } + 'skip$ + if$ +} + +% Wrapper for output.bibitem.original. +% If the URL field is not empty, set makeinlinelink to be true, +% so that an inline link will be started at the next opportunity +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} + +% Wrapper for fin.entry.original +FUNCTION {fin.entry} +{ output.web.refs % urlbst + makeinlinelink % ooops, it appears we didn't have a title for inlinelink + { setup.inlinelink % add some artificial link text here, as a fallback + "[link]" output.nonnull } + 'skip$ + if$ + bracket.state close.brackets = % urlbst + { "]" * } + 'skip$ + if$ + fin.entry.original +} + % Webpage entry type. % Title and url fields required; % author, note, year, month, and lastchecked fields optional @@ -640,10 +814,19 @@ FUNCTION {output.url} FUNCTION {webpage} { output.bibitem author empty$ - 'skip$ - { format.authors output.nonnull } + { editor empty$ + 'skip$ % author and editor both optional + { format.editors output.nonnull } + if$ + } + { editor empty$ + { format.authors output.nonnull } + { "can't use both author and editor fields in " cite$ * warning$ } + if$ + } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ format.title "title" output.check inbrackets "online" output new.block @@ -651,23 +834,22 @@ FUNCTION {webpage} 'skip$ { format.date "year" output.check } if$ - lastchecked empty$ - 'skip$ - { format.lastchecked output } - if$ - new.block - format.url "url" output.check + % We don't need to output the URL details ('lastchecked' and 'url'), + % because fin.entry does that for us, using output.web.refs. The only + % reason we would want to put them here is if we were to decide that + % they should go in front of the rather miscellaneous information in 'note'. new.block note output fin.entry } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -680,8 +862,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -698,6 +878,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -714,8 +895,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -724,14 +903,13 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output address output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -748,6 +926,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -766,8 +945,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -776,6 +953,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -794,8 +972,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -804,6 +980,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -830,8 +1007,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -851,6 +1026,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -868,8 +1044,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -878,6 +1052,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -885,8 +1060,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -895,13 +1068,12 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry empty.misc.check @@ -911,6 +1083,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -918,8 +1091,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -931,6 +1102,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -955,8 +1127,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -965,6 +1135,7 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull @@ -972,8 +1143,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -982,6 +1151,7 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check @@ -1238,6 +1408,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} diff --git a/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst b/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst index 7c4426bd0dc..602c0f105c7 100644 --- a/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst +++ b/Master/texmf-dist/bibtex/bst/urlbst/unsrturl.bst @@ -1,8 +1,13 @@ -%%% Modification of BibTeX style file /local2/teTeX-1.0/share/texmf/bibtex/bst/base/unsrt.bst -%%% to add webpage entry type, and url and lastchecked fields -%%% Edits by urlbst.pl, version 0.1 -%%% (marked with % urlbst.pl) +%%% Modification of BibTeX style file /usr/local/texlive/2007/texmf-dist/bibtex/bst/base/unsrt.bst +%%% ... by urlbst, version 0.6-1 (marked with "% urlbst") +%%% See <http://purl.org/nxg/dist/urlbst> +%%% Added webpage entry type, and url and lastchecked fields. +%%% Added eprint support. +%%% Added DOI support. +%%% Added PUBMED support. +%%% Added hyperref support. %%% Original headers follow... + % BibTeX standard bibliography style `unsrt' % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09. % Copyright (C) 1985, all rights reserved. @@ -36,22 +41,54 @@ ENTRY type volume year - url % urlbst.pl - lastchecked + eprint % urlbst + doi % urlbst + pubmed % urlbst + url % urlbst + lastchecked % urlbst } {} { label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } -INTEGERS { bracket.state outside.brackets open.brackets within.brackets close.brackets } % urlbst.pl +STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst... +INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver } +% Following constants may be adjusted by hand, if desired +FUNCTION {init.urlbst.variables} +{ + "Available from: " 'urlintro := % prefix before URL + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref + "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI + "doi:" 'doiprefix := % text prefix printed before DOI ref + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref + #1 'addeprints := % 0=no eprints; 1=include eprints + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it + #2 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles + % the following are internal state variables, not config constants + #0 'makeinlinelink := % state variable managed by setup.inlinelink + "" 'openinlinelink := % ditto + "" 'closeinlinelink := % ditto +} +INTEGERS { + bracket.state + outside.brackets + open.brackets + within.brackets + close.brackets +} +% ...urlbst to here FUNCTION {init.state.consts} -{ #0 'outside.brackets := % urlbst.pl +{ #0 'outside.brackets := % urlbst #1 'open.brackets := #2 'within.brackets := #3 'close.brackets := - #0 'before.all := + #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := @@ -59,7 +96,7 @@ FUNCTION {init.state.consts} STRINGS { s t } -% urlbst.pl +% urlbst FUNCTION {output.nonnull.original} { 's := output.state mid.sentence = @@ -81,12 +118,50 @@ FUNCTION {output.nonnull.original} s } -% urlbst.pl... +% urlbst... +% The following three functions are for handling inlinelink. They wrap +% a block of text which is potentially output with write$ by multiple +% other functions, so we don't know the content a priori. +% They communicate between each other using the variables makeinlinelink +% (which is true if a link should be made), and closeinlinelink (which holds +% the string which should close any current link. They can be called +% at any time, but start.inlinelink will be a no-op unless something has +% previously set makeinlinelink true, and the two ...end.inlinelink functions +% will only do their stuff if start.inlinelink has previously set +% closeinlinelink to be non-empty. +FUNCTION {setup.inlinelink} +{ makeinlinelink + { hrefform #1 = % hypertex + { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink := + "\special {html:</a>}" 'closeinlinelink := + } + { hrefform #2 = % hyperref + { "\href{" url * "}{" * 'openinlinelink := + "}" 'closeinlinelink := + } + 'skip$ + if$ % hrefform #2 = + } + if$ % hrefform #1 = + #0 'makeinlinelink := + } + 'skip$ + if$ % makeinlinelink +} +FUNCTION {add.inlinelink} +{ openinlinelink empty$ + 'skip$ + { openinlinelink swap$ * closeinlinelink * + "" 'openinlinelink := + } + if$ +} FUNCTION {output.nonnull} { % Save the thing we've been asked to output 's := - % If the bracket-state is close.brackets, then add a close-bracket to what's - % currently at the top of the stack, and set bracket.state to outside.brackets + % If the bracket-state is close.brackets, then add a close-bracket to + % what is currently at the top of the stack, and set bracket.state + % to outside.brackets bracket.state close.brackets = { "]" * outside.brackets 'bracket.state := @@ -98,7 +173,8 @@ FUNCTION {output.nonnull} % Write out what's currently at the top of the stack, using the % original output.nonnull function. s - output.nonnull.original + add.inlinelink + output.nonnull.original % invoke the original output.nonnull } { % Still in brackets. Add open-bracket or (continuation) comma, add the % new text (in s) to the top of the stack, and move to the close-brackets @@ -123,20 +199,13 @@ FUNCTION {inbrackets} if$ } -FUNCTION {format.url} -{ url empty$ - { "" } - { "Available from World Wide Web: \url{" url * "}" * } - if$ -} - FUNCTION {format.lastchecked} { lastchecked empty$ { "" } { inbrackets "cited " lastchecked * } if$ } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {output} { duplicate$ empty$ @@ -153,9 +222,8 @@ FUNCTION {output.check} if$ } -FUNCTION {output.bibitem} -{ outside.brackets 'bracket.state := % urlbst.pl - newline$ +FUNCTION {output.bibitem.original} +{ newline$ "\bibitem{" write$ cite$ write$ "}" write$ @@ -164,13 +232,8 @@ FUNCTION {output.bibitem} before.all 'output.state := } -FUNCTION {fin.entry} -{ - bracket.state close.brackets = % urlbst.pl - { "]" * } - 'skip$ - if$ - add.period$ +FUNCTION {fin.entry.original} +{ add.period$ write$ newline$ } @@ -611,7 +674,73 @@ FUNCTION {format.incoll.inproc.crossref} " \cite{" * crossref * "}" * } -% urlbst.pl... +% urlbst... +% Functions for making hypertext links. +% In all cases, the stack has (link-text href-url) +% +% make 'null' specials +FUNCTION {make.href.null} +{ + pop$ +} +% make hypertex specials +FUNCTION {make.href.hypertex} +{ + "\special {html:<a href=" quote$ * + swap$ * quote$ * "> }" * swap$ * + "\special {html:</a>}" * +} +% make hyperref specials +FUNCTION {make.href.hyperref} +{ + "\href {" swap$ * "} {\path{" * swap$ * "}}" * +} +FUNCTION {make.href} +{ hrefform #2 = + 'make.href.hyperref % hrefform = 2 + { hrefform #1 = + 'make.href.hypertex % hrefform = 1 + 'make.href.null % hrefform = 0 (or anything else) + if$ + } + if$ +} + +% 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. +FUNCTION {format.url} +{ inlinelinks #1 = url empty$ or + { "" } + { hrefform #1 = + { % special case -- add HyperTeX specials + urlintro "\url{" url * "}" * url make.href.hypertex * } + { urlintro "\url{" * url * "}" * } + if$ + } + if$ +} + +FUNCTION {format.eprint} +{ eprint empty$ + { "" } + { eprintprefix eprint * eprinturl eprint * make.href } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ + { "" } + { doiprefix doi * doiurl doi * make.href } + if$ +} + +FUNCTION {format.pubmed} +{ pubmed empty$ + { "" } + { pubmedprefix pubmed * pubmedurl pubmed * make.href } + if$ +} + % Output a URL. We can't use the more normal idiom (something like % `format.url output'), because the `inbrackets' within % format.lastchecked applies to everything between calls to `output', @@ -627,6 +756,51 @@ FUNCTION {output.url} if$ } +FUNCTION {output.web.refs} +{ + new.block + output.url + addeprints eprint empty$ not and + { format.eprint output.nonnull } + 'skip$ + if$ + adddoiresolver doi empty$ not and + { format.doi output.nonnull } + 'skip$ + if$ + addpubmedresolver pubmed empty$ not and + { format.pubmed output.nonnull } + 'skip$ + if$ +} + +% Wrapper for output.bibitem.original. +% If the URL field is not empty, set makeinlinelink to be true, +% so that an inline link will be started at the next opportunity +FUNCTION {output.bibitem} +{ outside.brackets 'bracket.state := + output.bibitem.original + inlinelinks url empty$ not and + { #1 'makeinlinelink := } + { #0 'makeinlinelink := } + if$ +} + +% Wrapper for fin.entry.original +FUNCTION {fin.entry} +{ output.web.refs % urlbst + makeinlinelink % ooops, it appears we didn't have a title for inlinelink + { setup.inlinelink % add some artificial link text here, as a fallback + "[link]" output.nonnull } + 'skip$ + if$ + bracket.state close.brackets = % urlbst + { "]" * } + 'skip$ + if$ + fin.entry.original +} + % Webpage entry type. % Title and url fields required; % author, note, year, month, and lastchecked fields optional @@ -639,10 +813,19 @@ FUNCTION {output.url} FUNCTION {webpage} { output.bibitem author empty$ - 'skip$ - { format.authors output.nonnull } + { editor empty$ + 'skip$ % author and editor both optional + { format.editors output.nonnull } + if$ + } + { editor empty$ + { format.authors output.nonnull } + { "can't use both author and editor fields in " cite$ * warning$ } + if$ + } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ format.title "title" output.check inbrackets "online" output new.block @@ -650,23 +833,22 @@ FUNCTION {webpage} 'skip$ { format.date "year" output.check } if$ - lastchecked empty$ - 'skip$ - { format.lastchecked output } - if$ - new.block - format.url "url" output.check + % We don't need to output the URL details ('lastchecked' and 'url'), + % because fin.entry does that for us, using output.web.refs. The only + % reason we would want to put them here is if we were to decide that + % they should go in front of the rather miscellaneous information in 'note'. new.block note output fin.entry } -% ...% urlbst.pl +% ...urlbst to here FUNCTION {article} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -679,8 +861,6 @@ FUNCTION {article} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -697,6 +877,7 @@ FUNCTION {book} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -713,8 +894,6 @@ FUNCTION {book} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -723,14 +902,13 @@ FUNCTION {booklet} { output.bibitem format.authors output new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check howpublished address new.block.checkb howpublished output address output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -747,6 +925,7 @@ FUNCTION {inbook} } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check crossref missing$ { format.bvolume output @@ -765,8 +944,6 @@ FUNCTION {inbook} format.edition output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -775,6 +952,7 @@ FUNCTION {incollection} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -793,8 +971,6 @@ FUNCTION {incollection} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -803,6 +979,7 @@ FUNCTION {inproceedings} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block crossref missing$ @@ -829,8 +1006,6 @@ FUNCTION {inproceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -850,6 +1025,7 @@ FUNCTION {manual} { format.authors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check author empty$ { organization empty$ @@ -867,8 +1043,6 @@ FUNCTION {manual} format.edition output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -877,6 +1051,7 @@ FUNCTION {mastersthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block "Master's thesis" format.thesis.type output.nonnull @@ -884,8 +1059,6 @@ FUNCTION {mastersthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -894,13 +1067,12 @@ FUNCTION {misc} { output.bibitem format.authors output title howpublished new.block.checkb + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title output howpublished new.block.checka howpublished output format.date output new.block - output.url % urlbst.pl - new.block note output fin.entry empty.misc.check @@ -910,6 +1082,7 @@ FUNCTION {phdthesis} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check new.block "PhD thesis" format.thesis.type output.nonnull @@ -917,8 +1090,6 @@ FUNCTION {phdthesis} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -930,6 +1101,7 @@ FUNCTION {proceedings} { format.editors output.nonnull } if$ new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.btitle "title" output.check format.bvolume output format.number.series output @@ -954,8 +1126,6 @@ FUNCTION {proceedings} } if$ new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -964,6 +1134,7 @@ FUNCTION {techreport} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block format.tr.number output.nonnull @@ -971,8 +1142,6 @@ FUNCTION {techreport} address output format.date "year" output.check new.block - output.url % urlbst.pl - new.block note output fin.entry } @@ -981,6 +1150,7 @@ FUNCTION {unpublished} { output.bibitem format.authors "author" output.check new.block + title empty$ 'skip$ 'setup.inlinelink if$ % urlbst format.title "title" output.check new.block note "note" output.check @@ -1092,6 +1262,7 @@ FUNCTION {begin.bib} EXECUTE {begin.bib} +EXECUTE {init.urlbst.variables} EXECUTE {init.state.consts} ITERATE {call.type$} |