Welcome to the UK List of
TeX Frequently Asked Questions
on the Web


The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:

Typesetting URLs

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 \hboxes, and their typeset representation is awful.

There are three packages that help solve this problem:

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.)

Note that neither \path (from package path) nor \url (from package url) is robust (in the LaTeX sense). If you need a URL to go in a moving argument, you need the command \urldef from the url package. So one might write:


after which, \faqhome is robust.

Documentation of both package path and package url is in the package files.

macros/latex/contrib/hyperref (or browse the directory); catalogue entry
Distributed as part of macros/plain/graphics (or browse the directory); catalogue entry
macros/generic/path (or browse the directory); catalogue entry
macros/latex/contrib/url (or browse the directory); catalogue entry

Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.27, released on 2013-06-07.