doc-src/url.sty
author wenzelm
Sat, 29 May 2004 14:57:39 +0200
changeset 14818 ad83019a66a4
parent 6619 010dfaf75064
permissions -rw-r--r--
Output.output;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6619
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     1
% url.sty  ver 1.1    6-Feb-1996   Donald Arseneau   asnd@triumf.ca
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     2
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     3
% A form of \verb that allows linebreaks at certain characters or 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     4
% combinations of characters, accepts reconfiguration, and can usually
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     5
% be used in the argument to another command.  It is intended for email
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     6
% addresses, hypertext links, directories/paths, etc., which normally 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     7
% have no spaces.  The font may be selected using the \urlstyle command, 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     8
% and new url-like commands can be defined using \urldef.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
     9
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    10
% Usage:    Conditions:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    11
% \url{ }   If the argument contains any "%", "#", or "^^", or ends with
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    12
%           "\", it can't be used in the argument to another command.  
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    13
%           The argument must not contain unbalanced braces.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    14
% \url|  |  ...where "|" is any character not used in the argument and not 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    15
%           "{".  The same restrictions as above except that the argument
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    16
%           may contain unbalanced braces.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    17
% \xyz      for "\xyz" a defined-url;  this can be used anywhere, no matter
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    18
%           what characters it contains.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    19
% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    20
% See further instructions after "\endinput"
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    21
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    22
\def\url@ttstyle{%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    23
\@ifundefined{selectfont}{\def\UrlFont{\tt}}{\def\UrlFont{\ttfamily}}% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    24
\def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\%\do\;\do\>\do\]%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    25
 \do\)\do\,\do\?\do\'\do\+\do\=\do@url@hyp}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    26
\def\UrlBigBreaks{\do\:}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    27
\def\UrlNoBreaks{\do\(\do\[\do\{\do\<}% (unnecessary)
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    28
\def\UrlSpecials{\do\ {\ }}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    29
\def\UrlOrds{\do\*\do\-}% any ordinary characters that aren't usually
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    30
}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    31
\def\url@rmstyle{%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    32
\@ifundefined{selectfont}{\def\UrlFont{\rm}}{\def\UrlFont{\rmfamily}}% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    33
\def\UrlBreaks{\do\.\do\@\do\/\do\!\do\%\do\;\do\]\do\)\do\,\do\?\do@url@hyp
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    34
  \do\+\do\=}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    35
\def\UrlBigBreaks{\do\:}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    36
\def\UrlNoBreaks{\do\(\do\[\do\{}% prevents breaks after *next* character
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    37
\def\UrlSpecials{\do\<{\langle}\do\>{\rangle\penalty\relpenalty}\do\_{\_%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    38
 \penalty\@m}\do\|{\mid}\do\{{\lbrace}\do\}{\rbrace\penalty\relpenalty}\do
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    39
 \\{\mathbin{\backslash}}\do\~{\mathord{{}^{\textstyle\sim}}}\do\ {\ }}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    40
\def\UrlOrds{\do\'\do\"\do\-}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    41
}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    42
\def\url@sfstyle{\url@rmstyle 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    43
\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\sffamily}}% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    44
}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    45
\def\url@samestyle{\ifdim\fontdimen\thr@@\font=\z@ \url@ttstyle \else
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    46
  \url@rmstyle \fi \def\UrlFont{}}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    47
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    48
\def\do@url@hyp{}% by default, no breaks after hyphens
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    49
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    50
\@ifundefined{strip@prefix}{\def\strip@prefix#1>{}}{}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    51
\@ifundefined{verbatim@nolig@list}{\def\verbatim@nolig@list{\do\`}}{}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    52
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    53
\def\Url{\relax\ifmmode\@nomatherr$\fi 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    54
 \UrlFont $\fam\z@ \textfont\z@\font 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    55
 \let\do\@makeother \dospecials % verbatim catcodes
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    56
 \catcode`{\@ne \catcode`}\tw@ % except braces 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    57
 \medmuskip0mu \thickmuskip\medmuskip \thinmuskip\medmuskip
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    58
 \@tempcnta\fam\multiply\@tempcnta\@cclvi 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    59
 \let\do\set@mathcode \UrlOrds % ordinary characters that were special
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    60
 \advance\@tempcnta 8192 \UrlBreaks % bin
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    61
 \advance\@tempcnta 4096 \UrlBigBreaks % rel
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    62
 \advance\@tempcnta 4096 \UrlNoBreaks % open
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    63
 \let\do\set@mathact \UrlSpecials % active
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    64
 \let\do\set@mathnolig \verbatim@nolig@list % prevent ligatures 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    65
 \@ifnextchar\bgroup\Url@z\Url@y}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    66
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    67
\def\Url@y#1{\catcode`{11 \catcode`}11
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    68
  \def\@tempa##1#1{\Url@z{##1}}\@tempa}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    69
\def\Url@z#1{\def\@tempa{#1}\expandafter\expandafter\expandafter\Url@use
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    70
  \expandafter\strip@prefix\meaning\@tempa\, \relax\m@th$\endgroup}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    71
\let\Url@use\@empty
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    72
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    73
\def\set@mathcode#1{\count@`#1\advance\count@\@tempcnta\mathcode`#1\count@}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    74
\def\set@mathact#1#2{\mathcode`#132768 \lccode`\~`#1\lowercase{\def~{#2}}}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    75
\def\set@mathnolig#1{\ifnum\mathcode`#1<32768
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    76
   \lccode`\~`#1\lowercase{\edef~{\mathchar\number\mathcode`#1_{\/}}}%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    77
   \mathcode`#132768 \fi}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    78
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    79
\def\urldef#1#2{\begingroup \setbox\z@\hbox\bgroup
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    80
  \def\Url@z{\Url@def{#1}{#2}}#2}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    81
\expandafter\ifx\csname DeclareRobustCommand\endcsname\relax
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    82
  \def\Url@def#1#2#3{\m@th$\endgroup\egroup\endgroup
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    83
    \def#1{#2{#3}}}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    84
\else
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    85
  \def\Url@def#1#2#3{\m@th$\endgroup\egroup\endgroup
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    86
    \DeclareRobustCommand{#1}{#2{#3}}}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    87
\fi
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    88
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    89
\def\urlstyle#1{\csname url@#1style\endcsname}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    90
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    91
% Sample (and default) configuration:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    92
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    93
\newcommand\url{\begingroup \Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    94
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    95
\newcommand\path{\begingroup \urlstyle{tt}\Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    96
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    97
% too many styles define \email like \address, so I will not define it.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    98
% \newcommand\email{\begingroup \urlstyle{rm}\Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
    99
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   100
% Process LaTeX \package options
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   101
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   102
\urlstyle{tt}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   103
\@ifundefined{ProvidesPackage}{}{
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   104
  \ProvidesPackage{url}[1996/02/06 \space ver 1.1 \space 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   105
       Verb mode for urls, email addresses, and file names]
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   106
  \DeclareOption{hyphens}{\def\do@url@hyp{\do\-}}% allow breaks after hyphens
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   107
  \DeclareOption{obeyspaces}{\let\Url@use\relax}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   108
  \ProcessOptions
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   109
\ifx\Url@use\relax \def\Url@use#1 #2{#1\ifx\relax#2\@empty\else
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   110
  \penalty\relpenalty\ #2\expandafter\Url@use\fi}\fi
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   111
}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   112
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   113
\endinput
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   114
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   115
% url.sty  ver 1.1    6-Feb-1996   Donald Arseneau   asnd@reg.triumf.ca
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   116
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   117
% This package defines "\url", a form of "\verb" that allows linebreaks,
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   118
% and can often be used in the argument to another command.  It can be
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   119
% configured to print in different formats, and is particularly useful for 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   120
% hypertext links, email addresses, directories/paths, etc.  The font may 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   121
% be selected using the "\urlstyle" command and pre-defined text can be 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   122
% stored with the "\urldef" command. New url-like commands can be defined, 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   123
% and a "\path" command is provided this way. 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   124
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   125
% Usage:    Conditions:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   126
% \url{ }   If the argument contains any "%", "#", or "^^", or ends with 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   127
%           "\", it can't be used in the argument to another command.  
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   128
%           The argument must not contain unbalanced braces.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   129
% \url|  |  ...where "|" is any character not used in the argument and not 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   130
%           "{".  The same restrictions as above except that the argument
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   131
%           may contain unbalanced braces.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   132
% \xyz      for "\xyz" a defined-url;  this can be used anywhere, no matter
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   133
%           what characters it contains.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   134
% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   135
% The "\url" command is fragile, and its argument is likely to be very
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   136
% fragile, but a defined-url is robust.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   137
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   138
% Package Option:  obeyspaces
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   139
% Ordinarily, all spaces are ignored in the url-text.  The "[obeyspaces]" 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   140
% option allows spaces, but may introduce spurious spaces when a url
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   141
% containing "\" characters is given in the argument to another command.  
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   142
% So if you need to obey spaces should say "\usepackage[obeyspaces]{url}",
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   143
% and if you need both spaces and backslashes, use a `defined-url' for 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   144
% anything with "\".
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   145
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   146
% Package Option:  hyphens
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   147
% Ordinarily, breaks are not allowed after "-" characters because this 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   148
% leads to confusion. (Is the "-" part of the address or just a hyphen?)  
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   149
% The package option "[hyphens]" allows breaks after explicit hyphen 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   150
% characters.  The "\url" command will *never ever* hyphenate words.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   151
% 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   152
% Defining a defined-url:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   153
% Take for example the email address "myself%node@gateway.net" which could
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   154
% not be given (using "\url" or "\verb") in a caption or parbox due to the
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   155
% percent sign.  This address can be predefined with 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   156
%    \urldef{\myself}\url{myself%node@gateway.net}   or
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   157
%    \urldef{\myself}\url|myself%node@gateway.net|
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   158
% and then you may use "\myself" instead of "\url{myself%node@gateway.net}"
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   159
% in an argument, and even in a moving argument like a caption because a
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   160
% defined-url is robust.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   161
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   162
% Style: 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   163
% You can switch the style of printing using "\urlstyle{tt}", where "tt"
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   164
% can be any defined style.  The pre-defined styles are "tt", "rm", "sf", 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   165
% and "same" which all allow the same linebreaks but different fonts -- 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   166
% the first three select a specific font and the "same" style uses the
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   167
% current text font.  You can define your own styles with different fonts 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   168
% and/or line-breaking by following the explanations below.  The "\url" 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   169
% command follows whatever the currently-set style dictates.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   170
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   171
% Alternate commands:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   172
% It may be desireable to have different things treated differently, each
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   173
% in a predefined style; e.g., if you want directory paths to always be 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   174
% in tt and email addresses to be rm, then you would define new url-like
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   175
% commands as follows:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   176
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   177
%    \newcommand\email{\begingroup \urlstyle{rm}\Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   178
%    \newcommand\directory{\begingroup \urlstyle{tt}\Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   179
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   180
% You must follow this format closely, and NOTE that the final command is 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   181
% "\Url", not "\url".  In fact, the "\directory" example is exactly the 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   182
% "\path" definition which is pre-defined in the package.  If you look 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   183
% above, you will see that "\url" is defined with
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   184
%    \newcommand\url{\begingroup \Url}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   185
% I.e., using whatever url-style has been selected.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   186
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   187
% You can make a defined-url for these other styles, using the usual 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   188
% "\urldef" command as in this example:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   189
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   190
%    \urldef{\myself}{\email}{myself%node.domain@gateway.net}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   191
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   192
% which makes "\myself" act like "\email{myself%node.domain@gateway.net}",
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   193
% if the "\email" command is defined as above.  The "\myself" command is
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   194
% robust.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   195
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   196
% Defining styles:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   197
% Before describing how to customize the printing style, it is best to 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   198
% mention something about the unusual implementation of "\url".  Although
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   199
% the material is textual in nature, and the font specification required
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   200
% is a text-font command, the text is actually typeset in *math* mode.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   201
% This allows the context-sensitive linebreaking, but also accounts for
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   202
% the default behavior of ignoring spaces.  Now on to defining styles.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   203
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   204
% To change the font or the list of characters that allow linebreaks, you
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   205
% could redefine the commands "\UrlFont", "\UrlBreaks", "\UrlSpecials" etc.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   206
% directly in the document, but it is better to define a new `url-style' 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   207
% (following the example of "\url@ttstyle" and "\url@rmstyle") which defines 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   208
% all of "\UrlBigbreaks", "\UrlNoBreaks", "\UrlBreaks", "\UrlSpecials", and 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   209
% "\UrlFont".
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   210
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   211
% Changing font:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   212
% The "\UrlFont" command selects the font.  The definition of "\UrlFont"
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   213
% done by the pre-defined styles varies to cope with a variety of LaTeX
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   214
% font selection schemes, but it could be as simple as "\def\UrlFont{\tt}".
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   215
% In addition to setting "\UrlFont", some characters will probably need 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   216
% to be defined in the "\UrlSpecials" list because most fonts don't have 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   217
% all the standard input characters.  See the definition of "\url@rmstyle", 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   218
% which implements "\urlstyle{rm}".  Or even better, follow the definition
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   219
% of "\url@sfstyle", which executes "\url@rmstyle" and then redefines
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   220
% just "\UrlFont".  The nominal format for each special character "c" 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   221
% in the "\UrlSpecials" list is: "\do\c{<definition>}", but you can 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   222
% include other definitions too.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   223
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   224
% Changing linebreaks:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   225
% The list of characters that allow line-breaks is given by "\UrlBreaks" 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   226
% and "\UrlBigBreaks", which have the format "\do\c" for character "c". 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   227
% The differences are that `BigBreaks' have a lower penalty and have 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   228
% different breakpoints when in sequence (as in "http://"): `BigBreaks' 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   229
% are treated as mathrels while `Breaks' are mathbins (see The TeXbook, 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   230
% p.170). In particular, a series of `BigBreak' characters will break at 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   231
% the end and only at the end; a series of `Break' characters will break 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   232
% after the first and after every following *pair*; there will be no 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   233
% break after a `Break' character if a `BigBreak' follows.  In the case 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   234
% of "http://" it doesn't matter whether ":" is a `Break' or `BigBreak' --
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   235
% the breaks are the same in either case; but for DECnet nodes with "::"
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   236
% it is important to prevent breaks *between* the colons, and that is why 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   237
% colons are `BigBreaks'.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   238
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   239
% It is possible for characters to prevent breaks after the next following 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   240
% character (I use this for parentheses).  Specify these in "\UrlNoBreaks". 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   241
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   242
% You can do arbitrarily complex things with characters by making them 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   243
% active in math mode (mathcode hex-8000) and specifying the definition(s)
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   244
% in "\UrlSpecials".  This is used in the rm and sf styles to handle 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   245
% several characters that are not present in fonts.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   246
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   247
% If all this sounds confusing ... well, it is!  But I hope you won't need 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   248
% to redefine breakpoints -- the default assignments seem to work well for 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   249
% a wide variety of applications.  If you do need to make changes, you can 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   250
% test for breakpoints using regular math mode and the characters "+=(a".
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   251
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   252
% Yet more flexibility:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   253
% You can also set up url.sty to do multiple things with the verbatim text
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   254
% by defining "\Url@use", but the format of the definition is special:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   255
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   256
%    \def\Url@use#1\,{ ... do things with #1 ... }
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   257
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   258
% Yes, that is "#1" followed by "\," then the definition.  For example, 
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   259
% to put a hypertext link in the DVI file:
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   260
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   261
%    \def\Url@use#1\,{\special{html:<a href="#1">}#1\special{html:</a>}}
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   262
%
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   263
% The End
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   264
% ver 1.1 6-Feb-1996:  
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   265
% Fix hyphens that wouldn't break and ligatures that weren't suppressed.
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   266
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   267
Test file integrity:  ASCII 32-57, 58-126:  !"#$%&'()*+,-./0123456789
010dfaf75064 fixed URLs;
wenzelm
parents:
diff changeset
   268
:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~