Previous: inforef, Up: Cross References


8.9 @url, @uref{url[, text][, replacement]}

@uref produces a reference to a uniform resource locator (url). It takes one mandatory argument, the url, and two optional arguments which control the text that is displayed. In HTML output, @uref produces a link you can follow.

@url is a synonym for @uref. Originally, @url had the meaning of @indicateurl (see @indicateurl), but in actual practice it was misused the vast majority of the time. So we've changed the definitions.

The second argument, if specified, is the text to display (the default is the url itself); in Info and DVI output, but not in HTML output, the url is also output.

The third argument, if specified, is the text to display, but in this case the url is not output in any format. This is useful when the text is already sufficiently referential, as in a man page. If the third argument is given, the second argument is ignored.

If the url is long enough to cause problems with line breaking, you may find it useful to insert @/ at places where a line break would be acceptable (after `/' characters, for instance). This tells TeX to allow (but not force) a line break at those places. See Line Breaks.

Here is an example of the simple one argument form, where the url is both the target and the text of the link:

     The official GNU ftp site is @uref{ftp://ftp.gnu.org/gnu}.

produces:

     The official GNU ftp site is ftp://ftp.gnu.org/gnu.

An example of the two-argument form:

     The official @uref{ftp://ftp.gnu.org/gnu, GNU ftp site}
     holds programs and texts.

produces:

     The official GNU ftp site
     holds programs and texts.

that is, the Info output is this:

     The official GNU ftp site (ftp://ftp.gnu.org/gnu)
     holds programs and texts.

and the HTML output is this:

     The official <a href="ftp://ftp.gnu.org/gnu">GNU ftp site</a>
     holds programs and texts.

An example of the three-argument form:

     The @uref{/man.cgi/1/ls,,ls(1)} program ...

produces:

     The ls(1) program ...

but with HTML:

     The <a href="/man.cgi/1/ls">ls(1)</a> program ...

To merely indicate a url without creating a link people can follow, use @indicateurl (see @indicateurl).

Some people prefer to display url's in the unambiguous format:

     <URL:http://host/path>

You can use this form in the input file if you wish. We feel it's not necessary to include the `<URL:' and `>' in the output, since any software that tries to detect url's in text already has to detect them without the `<URL:' to be useful.