summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-setURL.html
blob: 2afdad9e733ac4ac22c2e5d7569bbec08d4aaaf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<head>
<title>UK TeX FAQ -- question label setURL</title>
</head><body>
<h3>Typesetting URLs</h3>
<p>URLs tend to be very long, and contain characters that would
naturally prevent them being hyphenated even if they weren't typically
set in <code>\</code><code>ttfamily</code>, verbatim.  Therefore, without special treatment,
they often produce wildly overfull <code>\</code><code>hbox</code>es, and their typeset
representation is awful.
<p>There are three packages that help solve this problem:
<ul>
<li> The <i>path</i> package, which defines a <code>\</code><code>path</code> command.
  The command defines each potential break character as a
  <code>\</code><code>discretionary</code>, and offers the user the opportunity of
  specifying a personal list of potential break characters.  Its chief
  disadvantage is fragility in LaTeX moving arguments.  The

  <a href="FAQ-eplain.html">Eplain macros</a> - define a similar <code>\</code><code>path</code> command.
<p>  <i>Path</i>, though it works in simple situations, makes no
  attempt to work with LaTeX (it is irremediably fragile).  Despite
  its long and honourable history, it is no longer recommended for
  LaTeX use.
<li> The <i>url</i> package, which defines an <code>\</code><code>url</code> command
  (among others, including its own <code>\</code><code>path</code> 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 <a href="FAQ-protect.html">use of <code>\</code><code>protect</code></a>) 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.
<p>  It is possible to use the <i>url</i> package in Plain TeX,
  with the assistance of the <i>miniltx</i> package (which was
  originally developed for using the LaTeX graphics package in
  Plain TeX).  A small patch is also necessary: the required
  sequence is therefore:

<pre>
\input miniltx
\expandafter\def\expandafter\+\expandafter{\+}
\input url.sty
</pre>
<li> The <i>hyperref</i> package, which uses the typesetting code
  of <i>url</i>, in a context where the typeset text forms the
  anchor of a link.
</ul>
<p>The author of this answer prefers the (rather newer) <i>url</i>
package (directly or indirectly); both <i>path</i> and
<i>url</i> work well with Plain TeX (though of course, the fancy
LaTeX facilities of <i>url</i> don't have much place there).
(<i>hyperref</i> isn't available in a version for use with Plain
TeX.)
<p>Documentation of both <i>path</i> and <i>url</i> is in the
package files.
<dl>
<dt><tt><i>hyperref.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/hyperref.zip">macros/latex/contrib/hyperref</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/hyperref.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/hyperref/">browse</a>)
<dt><tt><i>miniltx.tex</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/plain/graphics.zip">macros/plain/graphics</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/plain/graphics.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/plain/graphics/">browse</a>)
<dt><tt><i>path.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/misc/path.sty">macros/latex/contrib/misc/path.sty</a>
<dt><tt><i>url.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/misc/url.sty">macros/latex/contrib/misc/url.sty</a>
</dl>
<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=setURL</a>
</body>