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 three packages that help solve 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 LaTeX moving arguments.
\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
(see 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 package (directly or indirectly); both path and url work well with Plain TeX (though of course, the fancy LaTeX facilities of url don't have much place there). (hyperref isn't available in a version for use with Plain TeX.)