Debian Codegraph @

texmf-dist/doc/bibtex/urlbst/urlbst.html

raw
1 <?xml version="1.0"?>
2
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Urlbst</title>
6 <link href="https://nxg.me.uk/" rev="author"/>
7 <link type="text/css" rel="stylesheet" href="/style/base.css"/>
8 </head>
9
10 <body>
11 <h1>Urlbst</h1>
12 <div class="abstract">
13 <p>A script to add a <code>webpage</code> BibTeX entry type, and add
14 support for general <code>url</code> and <code>lastchecked</code>
15 fields, to (most) BibTeX <code>.bst</code> files. Optionally adds
16 basic support for <code>eprint</code>, <code>doi</code> and <code>pubmed</code> fields, and
17 hypertex/hyperref support.</p>
18
19 <p>The Persistent URL for this page is
20 <code>https://purl.org/nxg/dist/urlbst</code>
21 – <strong>please quote this rather than the URL it redirects to</strong>.
22 It is on CTAN at
23 <a href='https://ctan.org/pkg/urlbst'><code>https://ctan.org/pkg/urlbst</code></a>.
24 The code (and bugparade) is
25 <a href='https://heptapod.host/nxg/urlbst'>online</a>.</p>
26
27 <p>Version 0.9.1, 2023 January 30.</p>
28 </div>
29
30 <p>Contents</p>
31 <ul>
32 <li><a href='#usage'>Usage</a></li>
33 <li><a href='#example'>For example...</a></li>
34 <li><a href='#download'>Download and installation</a></li>
35 <li><a href='#licences'>Licences</a></li>
36 <li><a href='#information'>Further Information</a></li>
37 <li><a href='#history'>Version history, and release notes</a></li>
38 </ul>
39
40 <p>The standard BibTeX styles have no explicit support for the web, in
41 that they include no `webpage' type, and have no support for adding
42 URLs to references. There are rumours that such support might appear
43 in BibTeX 1.0, but there is no estimate of when that is likely to arrive.</p>
44
45 <p>The Perl script <code>urlbst</code> can be used to add this support to an
46 arbitrary <code>.bst</code> file which has a reasonably `conventional'
47 structure. The result is meant to be robust rather than pretty.</p>
48
49 <p>It has a different goal from Patrick Daly's `custom-bib' package --
50 that is intended to create a BibTeX style .bst file from scratch, and
51 supports `url' and `eprint' fields. This package, on the other hand,
52 is intended for the case where you already have a style file that
53 works (or at least, which you cannot or will not change), and edits it
54 to add the new webpage entry type, plus the url, lastchecked and
55 eprint fields. Fuller details are in the <a href="urlbst.pdf"
56 >manual</a>.</p>
57
58 <h2><a name='usage'>Usage</a></h2>
59 <pre>
60 urlbst [--literal key=value] [--setting key=value]
61 [input-file [output-file]]
62 </pre>
63 <p>If either the input-file or the output-file is omitted, they
64 default to stdin and stdout respectively. If the input file already
65 has a URL entry type, then the script objects.
66 By default (in the current version), the output
67 includes support for eprint, doi and pubmed.</p>
68
69 <p>The support in the generated <code>.bst</code> file can be adjusted
70 with the options <code>--setting</code> and <code>--literal</code>;
71 see <code>--setting help</code> and <code>--literal help</code> for
72 the available switches. The options <code>--[no]eprint</code>,
73 <code>--[no]doi</code>, <code>--[no]pubmed</code>,
74 <code>--inlinelinks</code>, <code>--nohyperlinks</code>,
75 <code>--hypertex</code> and <code>--hyperref</code> are shortcuts for
76 some of these settings.
77
78 <p>The added fields are:</p>
79 <ul>
80 <li><code>url</code> and <code>lastchecked</code>, to associate a URL with
81 a reference, along with the date at which the URL was last checked
82 to exist;</li>
83 <li><code>doi</code>, for a reference's <a href='https://doi.org'>DOI</a>;</li>
84 <li><code>eprint</code>, for an <a href='http://arxiv.org'>arXiv</a> eprint reference; and</li>
85 <li><code>pubmed</code> for a reference's
86 <a href='http://pubmed.gov'>PubMed</a> identifier (PMID).</li>
87 </ul>
88
89 <p>If setting <code>hrefform</code> is 1 or 2, then the generated
90 <code>.bst</code> file includes
91 support for hyperlinks in the generated eprint entries in the
92 bibliography, with the format being either HyperTeX (see <a
93 href="http://arxiv.org/hypertex/#implementation" >arXiv, again</a>),
94 supported by xdvi, dvips and others, or using the support available
95 from the hyperref package. When
96 URLs are included in the bibliography, they are written out using the
97 <code>\url{...}</code> command, and hyperref automatically processes
98 that in the correct way to include a hyperlink.</p>
99
100 <p>The setting <code>inlinelinks</code> (option
101 <code>--inlinelinks</code>) tells urlbst not to write out the URL as
102 text within the bibliography entry. Instead, urlbst will produce a
103 more conventional-looking and compact bibliography entry, but the
104 entry's title will now be a hyperlink to that URL. This hyperlink may
105 be useful to anyone who reads your document online (this option can
106 only be used with <code>hrefform</code> 1 or 2. Any DOI or eprint
107 text which would be produced as a result of the appropriate option
108 will still appear in this mode.</p>
109
110 <p>You may adjust various literal strings, either for the purposes of
111 internationalisation, or simply because you prefer different text. To
112 do this, give the <code>--literal</code> option, followed by a
113 <code>key=value</code> pair, for example <code>--literal online="on
114 th'intert00bs"</code>, to replace the default <code>URL:</code> text.
115 The possible values, and their defaults, are below (say
116 <code>--literal help</code> to get this list printed out):</p>
117 <table>
118 <tr><th>literal</th><th>description</th><th>default</th></tr>
119 <tr><td>urlintro</td><td>prefix before URL; typically "Available from:" or "URL:"</td><td>URL: </td></tr>
120 <tr><td>pubmedprefix</td><td>text prefix printed before PUBMED ref</td><td>PMID:</td></tr>
121 <tr><td>pubmedurl</td><td>prefix to make URL from PUBMED</td><td>http://www.ncbi.nlm.nih.gov/pubmed/</td></tr>
122 <tr><td>eprintprefix</td><td>text prefix printed before eprint ref</td><td>arXiv:</td></tr>
123 <tr><td>linktextstring</td><td>anonymous link text</td><td>[link]</td></tr>
124 <tr><td>citedstring</td><td>label that something is cited by something else</td><td>cited </td></tr>
125 <tr><td>eprinturl</td><td>prefix to make URL from eprint ref</td><td>http://arxiv.org/abs/</td></tr>
126 <tr><td>doiurl</td><td>prefix to make URL from DOI</td><td>https://doi.org/</td></tr>
127 <tr><td>doiprefix</td><td>printed text to introduce DOI</td><td>doi:</td></tr>
128 <tr><td>onlinestring</td><td>label that a resource is online</td><td>online</td></tr>
129 </table>
130
131 <p>The list of settings (<code>--setting help</code>) is:</p>
132 <table>
133 <tr><th>setting</th><th>description</th><th>default</th></tr>
134 <tr><td>inlinelinks</td><td>0=URLs explicit; 1=URLs attached to titles</td><td>0</td></tr>
135 <tr><td>addpubmed</td><td>0=no PUBMED resolver; 1=include it</td><td>1</td></tr>
136 <tr><td>addeprints</td><td>0=no eprints; 1=include eprints</td><td>1</td></tr>
137 <tr><td>hrefform</td><td>0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs</td><td>0</td></tr>
138 <tr><td>adddoi</td><td>0=no DOI resolver; 1=include it</td><td>1</td></tr>
139 <tr><td>doiform</td><td>0=with href; 1=with \doi{}</td><td>0</td></tr>
140 </table>
141
142 <p>The distribution includes preconverted versions of the four
143 standard BibTeX .bst style files.</p>
144
145 <p>Only the style files which result from conversion of the standard
146 styles are checked in the regression tests. Other style files which
147 are known to work include</p>
148 <blockquote>
149 acm.bst, amsalpha.bst, amsplain.bst, apalike.bst, gerabbrv.bst,
150 geralpha.bst, gerapali.bst, gerplain.bst, gerunsrt.bst, ieeetr.bst,
151 siam.bst, mla.bst
152 </blockquote>
153
154 <p>Style files which are known to fail:</p>
155 <ul>
156 <li>Currently (as of at least v0.5), there exists a style <code>achicago.bst</code>
157 which seems to fox <code>urlbst</code>; it turns out that there's a
158 simpler but almost equivalent style <code>chicago.bst</code> which
159 works.</li>
160
161 <li>Some APA-like styles, including at least <code>apager.bst</code>,
162 seem to be sufficiently different from the most common styles, that
163 they confuse <code>urlbst</code> completely.</li>
164
165 <li>The <em>koma-script</em> styles and the <em>refer</em> styles are
166 not designed to produce conventional <code>.bbl</code> files, and
167 <code>urlbst</code> does not aim to produce anything useful from these.</li>
168 </ul>
169 <p>This might be a good time for me to revisit the rather
170 convoluted logic within the script, to make it a little more robust in
171 the face of variants like these, but don't hold your breath. The
172 logic within the script is pretty hideous (it essentially works by
173 spotting patterns in the input style file, and replacing or extending
174 bits of BibTeX style-file code. This is a fragile technique, and is
175 probably at the limits of its usefulness, therefore I'd take some
176 persuading to add significant extra functionality to the script.</p>
177
178 <p>The natbib and revtex style files already have URL fields. If you have a
179 BibTeX style file which you think ought to work, but with which the
180 script fails, send it to me, and I'll try to work out what I've
181 missed (no promises, though).</p>
182
183 <p>Note that the command to invoke the script changed from `urlbst.pl'
184 to plain `urlbst' between versions 0.3 and 0.4.</p>
185
186 <h2><a name='example'>For example...</a></h2>
187 <p>To add URL support to the standard <code>siam.bst</code> file, you
188 can give the command</p>
189 <pre>
190 % urlbst /path/to/original/siam.bst siamurl.bst
191 </pre>
192 <p>Your TeX installation will likely have some way of helping you find where
193 the original <code>.bst</code> files are. On teTeX-based systems, for
194 example, the command <code>kpsewhich siam.bst</code> returns the full
195 path of the <code>siam.bst</code> file which BibTeX would find.</p>
196
197 <p>The distributed files <code>abbrvurl.bst</code>,
198 <code>alphaurl.bst</code>, <code>plainurl.bst</code> and
199 <code>unsrturl.bst</code> are versions of the standard style files
200 which have been pre-converted.</p>
201
202 <p>There is more general discussion of including URLs in
203 bibliographies in the <a
204 href="https://texfaq.org/FAQ-citeURL" >TeX FAQ</a>.</p>
205
206 <h2><a name='download'>Download and installation</a></h2>
207
208 <p>Download the file as a
209 <a href="urlbst-0.9.1.tar.gz" >tarball</a>
210 or
211 <a href="urlbst-0.9.1.zip" >zip file</a>
212 and unpack it. Or you can clone the source repository
213 <a href='https://heptapod.host/nxg/urlbst'>online</a>.</p>
214
215 <p>To install, you should simply copy the distributed
216 <code>urlbst</code> script to someplace on the path (such as
217 <code>/usr/local/bin</code>, or <code>~/local/bin</code>, depending on
218 your privileges and tastes).</p>
219
220 <p>If you (might) want to use the pre-converted standard
221 <code>.bst</code> files, then you'll need to copy these to somewhere
222 in the BibTeX search path. Type <kbd>kpsepath bst</kbd> on Unix to
223 find out the list of places BibTeX searches, and pick either one of
224 the user-local locations, or a system-wide one. If you're installing
225 in a system-wide location, you'll need admin privileges, obviously,
226 and you will probably need to use <code>texhash</code>,
227 <code>mktexlsr</code> or its equivalent, to update LaTeX's filename
228 cache. For further hints here, see
229 the TeX FAQ entries on <a
230 href='https://texfaq.org/#installing'
231 >installing a package</a> and <a
232 href='https://texfaq.org/FAQ-inst-wlcf'
233 >where LaTeX puts files</a>.</p>
234
235 <p>That should be all you have to do.</p>
236
237 <p>The urlbst script is distributed with a path which should just work,
238 as long as the Perl binary is in your path, but if you have problems
239 here, then you might want to change the first line to something like</p>
240 <pre>
241 #! /usr/local/bin/perl
242 </pre>
243 <p>if that's where your Perl binary is.</p>
244
245 <p>You can also use the conventional <code>./configure; make; make
246 install</code> to configure and install the package (as root, or using
247 <code>sudo</code> if you're installing it in a system location),
248 though you still have to install the <code>.bst</code> files by hand.
249 This is rather heavyweight for the trivial amount of configuration
250 required, so it's almost always simpler just to do things by hand.</p>
251
252 <p>If you need to change some of the <code>urlbst</code> defaults,
253 however, or if your fingers type <code>./configure</code>
254 spontaneously, then you can be reassured that the configure script
255 supports the standard <code>--prefix</code> option, plus the following
256 options setting defaults:</p>
257 <dl>
258
259 <dt><code>--with-eprints=url</code>, <code>--without-eprints</code></dt>
260
261 <dd>This makes the <code>--eprints</code> option to urlbst available
262 by default, and allows you to optionally specify a prefix for creating
263 URLs from eprint numbers. The default for this URL is
264 <code>http://arxiv.org/abs/</code> -- this is appropriate for arXiv,
265 obviously, but there are now a variety of other preprint archives
266 appearing, for which this might be inappropriate. If you have
267 comments on this default, or alternatives, please let me know. This
268 option is enabled by default; if you have some reason for disabling
269 the <code>--eprints</code> option for urlbst, the give the configure
270 option <code>--without-eprints</code></dd>
271
272 <dt><code>--with-doi=url</code>, <code>--without-doi</code></dt>
273
274 <dd>This makes available the <code>--doi</code> option to urlbst and,
275 as with the <code>--with-eprints</code> option, allows you to
276 customise the DOI resolver URL. The <code>--doi</code> option to
277 urlbst is on by default.</dd>
278
279 <dt><code>--with-href=0/1/2</code></dt>
280
281 <dd>This allows you to specify the type of hyperlinks which are
282 inserted in the bibliography. Values 0, 1 and 2, indicating no
283 hyperlinks, hypertex-style links, and hyperref-style links,
284 respectively. The default is <code>--with-href=0</code>. The
285 <code>hyperref</code>-style option is intended to complement the
286 increasingly standard <code>hyperref</code> package.</dd>
287
288 </dl>
289
290 <p>The first two options simply change defaults, and if you never use
291 the new <code>eprints</code> or <code>doi</code> fields, then the
292 defaults don't matter to you. </p>
293
294 <p>Since the modified style generates URLs wrapped in the
295 <code>\url{}</code> macro, it is useful to use the resulting
296 bibliography style alongside the <code>url</code> package. Since this
297 tends to work with <code>hyperref</code> anyway, where possible, you
298 don't get any extra goodness by changing the <code>--with-href</code>
299 default at configuration time.</p>
300
301 <h3>Documentation</h3>
302
303 <p>Basic documentation is in the file <code>urlbst.tex</code>. This
304 is distributed as a PDF file, but if you want to regenerate it, use</p>
305 <pre>
306 % latex urlbst
307 % bibtex urlbst
308 % latex urlbst
309 % latex urlbst
310 </pre>
311
312 <h2><a name='licences'>Licences</a></h2>
313
314 <!-- this text copied from the README.md -->
315 <p>The copyright and licence position for the modified <code>.bst</code> files seems
316 slightly muddy to me. On the grounds that any licence is better than
317 no licence, I therefore assert that the <em>modifications</em> which the
318 <code>urlbst</code> program makes to these files are copyright 2002–23,
319 Norman Gray, and that these modifications are available for
320 distribution under the terms of the LaTeX Project Public Licence.</p>
321
322 <p>The original <code>.bst</code> files are copyright Howard Trickey and Oren
323 Patashnik, with a set of permissions, in text at the top of the files,
324 which state that "Unlimited copying and redistribution of this file
325 are permitted as long as it is unmodified" (see the files for the
326 complete text). The distribution terms above therefore appear to be
327 compatible with -- in the sense of being morally equivalent to --
328 these terms in the <code>.bst</code> file. If anyone disagrees with
329 the logic here, I'd be very happy to discuss that.</p>
330
331 <p>The <code>urlbst</code> script itself is distributed under the GPL, version 2.0.</p>
332
333 <p>See the files <code>LICENCE-lppl.txt</code> and <code>LICENCE-gpl-2.0.txt</code> in the
334 distribution, for the relevant licence text.</p>
335
336
337 <h2><a name='information'>Further Information and acknowledgements</a></h2>
338
339 <p><code>urlbst</code> is archived <a href='https://ctan.org/pkg/urlbst' >on CTAN</a>,
340 and discussed in the
341 <a href="https://texfaq.org/FAQ-citeURL" >TeX FAQ</a>.</p>
342
343 <p>The source code for the package is maintained
344 <a href='https://heptapod.host/nxg/urlbst'>online</a>.
345 <!--
346 which also includes an issue tracker, where you can report bugs (or
347 just mail me).--></p>
348
349 <p>The <a href="https://purl.org/nxg/dist/urlbst"
350 >home page of urlbst</a> might possibly have more recent versions than the
351 one you're looking at now.</p>
352
353
354 <h2><a name='history'>Acknowledgements, and release notes</a></h2>
355
356 <!-- include:release-notes.html -->
357 <div xmlns='http://www.w3.org/1999/xhtml'>
358
359 <p>Thanks are due to many people for suggestions and requests:
360 to Jason Eisner for suggesting the <code>--inlinelinks</code> option;
361 to ‘ijvm’ for code contributions in the <code>urlbst</code> script;
362 to Paweł Widera for the suggestion to use <code>\path</code> when formatting DOIs;
363 to Michael Giffin for the suggestion to include PubMed URLs;
364 to Katrin Leinweber for the pull request which fixed the format of DOI
365 references.</p>
366
367 <dl>
368 <dt><strong>0.9.1, 2023 January 30</strong></dt>
369 <dd>
370 Added code to spot and wrangle the <code>https://doi.org/</code> URL
371 prefix – the code now behaves correctly whether this is present or not.
372 </dd>
373
374 <dt><strong>0.9, 2022 December 1</strong></dt>
375 <dd><ul>
376 <li>Changed repository location to <a href='https://heptapod.host/nxg/urlbst'>heptapod</a>
377 (when Bitbucket dropped support for Mercurial).
378 The issue links below, pointing to Bitbucket, will therefore no
379 longer work.</li>
380 <li>Refactoring of the mechanism for configuring the generated
381 <code>.bst</code> file, specifically adding the
382 <code>--setting</code> option.</li>
383 <li>Added the <code>doiform</code> setting to generate DOIs wrapped
384 in <code>\doi{...}</code>.</li>
385 </ul>
386 </dd>
387
388 <dt>0.8, 2019 July 1</dt>
389 <dd><ul>
390 <li>The presence of a preexisting <code>format.doi</code>,
391 <code>format.eprint</code> or <code>format.pubmed</code> function is
392 now detected, and warned about. The resulting <code>.bst</code> file
393 might still require some manual editing.
394 Resolves <a href='https://bitbucket.org/nxg/urlbst/issue/8'>issue 8</a>.</li>
395 <li>Clarified licences (I hope).</li>
396 <li>Adjust format of DOI resolver.
397 Resolves <a href='https://bitbucket.org/nxg/urlbst/issue/11'>issue 11</a>,
398 thanks to
399 <a href='https://bitbucket.org/nxg/urlbst/pull-requests/1/'
400 >code contributed by Katrin Leinweber</a>.</li>
401 </ul>
402 </dd>
403
404 <dt>0.7, 2011 July 20</dt>
405 <dd>Add <code>--nodoi</code>, <code>--noeprints</code> and
406 <code>--nopubmed</code> options (which defaulted on, and couldn't
407 otherwise be turned off)</dd>
408
409 <dt>0.7b1, 2011 March 17</dt>
410 <dd>Allow parameterisation of literal strings, with option <code>--literal</code>.</dd>
411
412 <dt>0.6-5, 2011 March 8</dt>
413 <dd>Adjust support for inline links (should now work for arXiv, DOI and Pubmed)</dd>
414
415 <dt>0.6-4, 2009 April 28</dt>
416 <dd>Work around BibTeX linebreaking bug (thanks to Andras Salamon for the bug report).</dd>
417
418 <dt>0.6-3, 2009 April 19</dt>
419 <dd>Fix inline link generation (thanks to Eric Chamberland for the bug report).</dd>
420
421 <dt>0.6-2, 2008 November 17</dt>
422 <dd>We now turn on inlinelinks when we spot format.vol.num.pages,
423 which means we include links for those styles which don't include a
424 title in the citation (common for articles in physical science styles,
425 such as aip.sty).</dd>
426
427 <dt>0.6-1, 2008 June 16</dt>
428 <dd>Fixed some broken links to the various citation standards
429 (I think in this context this should probably <em>not</em> be happening, yes?).
430 The distributed <code>*url.bst</code> no longer have the
431 <code>--inlinelinks</code> option turned on by default.</dd>
432
433 <dt><strong>0.6, 2007 March 26</strong></dt>
434 <dd><ul>
435 <li>Added the option <code>--inlinelinks</code>, which adds inline hyperlinks
436 to any bibliography entries which have URLs, but does so inline, rather
437 than printing the URL explicitly in the bibliography. This is (primarily)
438 useful if you're preparing a version of a document which will be read
439 on-screen. Thanks to Jason Eisner for the suggestion, and much testing.</li>
440
441 <li>Incorporate hyperref bugfixes from Paweł Widera.</li>
442
443 <li>Further reworkings of the inlinelinks support, so that it's now
444 fired by a <code>format.title</code> (or <code>format.btitle</code>) line, with a fallback in
445 <code>fin.entry</code>. This should be more robust, and allows me to delete some
446 of the previous version's gymnastics.</li>
447
448 <li>Reworked <code>inlinelinks</code> support; should now be more
449 robust. Incorporate hyperref bugfixes from Paweł Widera.</li>
450
451 <li>Added the option <code>inlinelinks</code>, which adds inline hyperlinks
452 to any bibliography entries which have URLs, but does so inline, rather
453 than printing the URL explicitly in the bibliography. This is (only)
454 useful if you're preparing a version of a document which will be read
455 on-screen.</li>
456 </ul>
457 </dd>
458
459 <dt>0.5.2, 2006 September 6</dt>
460 <dd>Another set of documentation-only changes, hopefully clarifying
461 installation.</dd>
462
463 <dt>0.5.1, 2006 January 10</dt>
464 <dd>No functionality changes. Documentation and webpage changes only,
465 hopefully clarifying usage and configuration</dd>
466
467 <dt><strong>0.5, 2005 June 3</strong></dt>
468 <dd>Added support for Digital Object Identifiers (DOI) fields in
469 bibliographies.</dd>
470
471 <dt>0.4-1, 2005 April 12</dt>
472 <dd>Documentation improvements -- there are now examples in the help text!</dd>
473
474 <dt><strong>0.4, 2004 December 1</strong></dt>
475 <dd>Bug fixes: now compatible with mla.bst and friends.
476 Now uses <code>./configure</code> (optionally). Assorted reorganisation.</dd>
477
478 <dt><strong>0.3, 2003 June 4</strong></dt>
479 <dd>Added <code>--eprint</code>, <code>--hypertex</code> and <code>--hyperref</code> options.</dd>
480
481 <dt><strong>0.2, 2002 October 23</strong></dt>
482 <dd>The `editor' field is now supported in the webpage entry type. Basic
483 documentation added.</dd>
484
485 <dt><strong>0.1, 2002 April</strong></dt>
486 <dd>Initial version</dd>
487 </dl>
488 </div>
489
490 <p>Copyright 2002–23, Norman Gray. Released under the terms of the GNU
491 General Public Licence.</p>
492
493 <div class="signature">
494 <a href="https://nxg.me.uk"
495 >Norman Gray</a><br/>
496 2023 January 30
497 </div>
498
499 </body>
500 </html>