URLs tend to be very long, and contain characters that would
naturally prevent them being hyphenated even if they weren't typically
set in \ttfamily
, verbatim. Therefore, without special treatment,
they often produce wildly overfull \hbox
es, and their typeset
representation is awful.
There are two approaches to this problem:
\path
command. The command
defines each potential break character as a \discretionary
, and
offers the user the opportunity of specifying a personal list of
potential break characters. Its chief disadvantage is fragility in
the LaTeX context.
\url
command (among others,
including its own \path
command). The command gives each
potential break character a maths-mode `personality', and then sets
the URL itself in the user's choice of font, in maths mode.
It can produce (LaTeX-style) `robust' commands
(use of \protect
) for use
within moving arguments. Note that, because the operation is
conducted in maths mode, spaces within the URL argument are
ignored unless special steps are taken.
The author of this answer prefers the (rather newer) url.sty; both packages work equally well with plain TeX (though of course, the fancy LaTeX facilities of url.sty don't have much place there).