The url package
Author: Luc Maranget

B.17.6 | The `url` package

LATEX source.
This package in fact provides a enhanced `\verb` command that can appear inside other command arguments. This command is named ```\url`'', but it can be used for any verbatim text, including DOS-like path names. Hence, one can insert urls in one's document without worrying about LATEX active characters :

    This is a complicated url: \url{http://foo.com/~user#label%coucou}.

which gets typeset as: ``This is a complicated url: `http://foo.com/~user#label%coucou`.''
Main use for the `\url` command is to specify urls as arguments to HEVEA commands for hyperlinks (see section 8.1.1) :

    \hevea{} home page is
    \ahrefurl{\url{http://pauillac.inria.fr/~maranget/hevea/}}

It yields : ``HEVEA home page is `http://pauillac.inria.fr/~maranget/hevea/`''.
However the `\url` command is fragile, as a consequence it cannot be used inside `\footahref` first argument (This is a LATEX problem, not an HEVEA one). The `url` package solves this problem by providing the `\urldef` command for defining commands whose body is typeset by using `\url`:

    \urldef{\heveahome}{\url}{http://pauillac.inria.fr/~maranget/hevea/}

Such a source defines the robust command `\heveahome` as the intended url. Hence the following source works as expected :

    Have a look at \footurl{\heveahome}{\hevea{} home page}

It yields: ``Have a look at HEVEA home page''.
Using `\url` inside command definitions with a `#`i argument is a bad idea, since it gives ``verbatim'' a rather random meaning. Unfortunately, in some situations (e.g, no `%`, no `#`), it may work in LATEX. By contrast, it does not work in HEVEA. In such situations, `\urldef` should be used.
HEVEA implementation is somehow compatible at the ``programming level''. Thus, users can define new commands whose argument is understood verbatim. The `urlhref.hva` style file from the distribution takes advantage of this to define the `\url` command, so that it both typesets an url and inserts a link to it.

    \input{urlhref.hva}
    Have a look at \url{http://pauillac.inria.fr/~maranget/hevea/}

It yields ``Have a look at `http://pauillac.inria.fr/~maranget/hevea/`''. The `urlhref.hva` style file (which is an HEVEA style file and not a LATEX style file) can be adequate for bibliographic references, which often use `\url` for its typesetting power. Of course, loading `urlhref.hva` only makes sense when all arguments to `\url` are urls...