UK TeX FAQ -- question 102

### URLs in BibTeX bibliographies

There is no citation type for URLs, per se, in the standard BibTeX styles, though Oren Patashnik (the author of BibTeX) is considering developing one such for use with the long-awaited BibTeX version 1.0.

The actual information that need be available in a citation of an URL is discussed at some length in the publicly available on-line extracts of ISO 690-2; the techniques below do not satisfy all the requirements of ISO 690-2, but they offer a solution that is at least available to users of today's tools.

Until the new version arrives, the simplest technique is to use the `howpublished` field of the standard styles' `@misc` function. Of course, the strictures about typesetting URLs still apply, so the entry will look like:

      @misc{...,
        ...,
        howpublished = "\url{http://...}"
      }

Another possibility is that some conventionally-published paper, technical report (or even book) is also available on the Web. In such cases, a useful technique is something like:

      @techreport{...,
        ...,
        note = "Also available as \url{http://...}"
      }

There is good reason to use the url or hyperref packages in this context, since (by default) the `\url` command ignores spaces in its argument. BibTeX has a habit of splitting lines it considers excessively long, and if there are no space characters for it to use as 'natural' breakpoints, BibTeX will insert a comment ('`%`') character ... which is an acceptable character in an URL, so that `\url` will typeset it. If you're using url, the way around the problem is to insert odd spaces inside the URL itself in the `.bib` file, to enable BibTeX to make reasonable decisions about breaking the line. Note that the version of `\url` that comes with recent versions of the hyperref package doesn't suffer from the '`%`-end of line' problem: hyperref spots the problem, and suppresses the unwanted characters.

A possible alternative approach is to use the harvard package (if its citation styles are otherwise satisfactory for you). Harvard bibliography styles all include a "`url`" field in their specification; however, the typesetting offered is somewhat feeble (though it does recognise and use LaTeX2HTML macros if they are available, to create hyperlinks).

`harvard`
  macros/latex/contrib/supported/harvard.tar.gz
`hyperref`
  macros/latex/contrib/supported/hyperref.tar.gz
`url`
  macros/latex/contrib/other/misc/url.sty