summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xurl/xurl.sty
blob: 154cfd1b908f9d255c32c92651c52cfe19c29fea (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%% $Id: xurl.sty 1133 2020-01-14 12:10:03Z herbert $
%%
%% This is file `xurl.sty',
%%
%% IMPORTANT NOTICE:
%%
%% Package `xurl'
%%
%% Herbert Voss <hvoss _at_ tug.org>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% DESCRIPTION:
%%   `xurl' is a package for extended URL breaks
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xurl}[2020/01/14 v 0.08 modify URL breaks]

\newif\if@no@biblatex \@no@biblatexfalse
\DeclareOption{nobiblatex}{\@no@biblatextrue}

\DeclareOption*{\PassOptionsToPackage\CurrentOption{url}}
\ProcessOptions\relax
%
\RequirePackage{url}
%
\if@no@biblatex\else
  \@ifpackageloaded{biblatex}{%
    \typeout{xurl: Set penalties for biblatex}%
    \setcounter{biburllcpenalty}{100}%
    \setcounter{biburlucpenalty}{200}%
    \global\setcounter{biburlnumpenalty}{100}%
  }{}       % biblatex has it's own url handling
\fi
%
%\mathchardef\UrlBigBreakPenalty=100
%\mathchardef\UrlBreakPenalty=200

\def\UrlBreaks{%
  \do\/%
  \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l%
     \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
  \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L%
     \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
 \do\*\do\-\do\~\do\'\do\"\do\-%
 \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
}
%
\def\UrlSpecials{%
  \do\ {\Url@space}%
  \do\%{\Url@percent}%
  \do\^^M{\Url@space}%
  \Url@force@Tilde
}

\Urlmuskip=0mu plus 1mu
%
\def\useOriginalUrlSetting{%
\def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%
 \do\)\do\,\do\?\do\&\do\'\do+\do\=\do\#}%
\def\UrlSpecials{\do\ {\Url@space}\do\%{\Url@percent}\do\^^M{\Url@space}%
   \Url@force@Tilde}% package option may force faked text-ascii-tilde
}

\endinput

\def\UrlSpecials{%
  \do\ {\Url@space}%
  \do\%{\Url@percent}%
  \do\^^M{\Url@space}%
  \Url@force@Tilde
  \do\/{/\penalty\UrlBreakPenalty}%
  \do\a{a\penalty\UrlBreakPenalty}%
  \do\b{b\penalty\UrlBreakPenalty}%
  \do\c{c\penalty\UrlBreakPenalty}%
  \do\d{d\penalty\UrlBreakPenalty}%
  \do\e{e\penalty\UrlBreakPenalty}%
  \do\f{f\penalty\UrlBreakPenalty}%
  \do\g{g\penalty\UrlBreakPenalty}%
  \do\h{h\penalty\UrlBreakPenalty}%
  \do\i{i\penalty\UrlBreakPenalty}%
  \do\j{j\penalty\UrlBreakPenalty}%
  \do\k{k\penalty\UrlBreakPenalty}%
  \do\l{l\penalty\UrlBreakPenalty}%
  \do\m{m\penalty\UrlBreakPenalty}%
  \do\n{n\penalty\UrlBreakPenalty}%
  \do\o{o\penalty\UrlBreakPenalty}%
  \do\p{p\penalty\UrlBreakPenalty}%
  \do\q{q\penalty\UrlBreakPenalty}%
  \do\r{r\penalty\UrlBreakPenalty}%
  \do\s{s\penalty\UrlBreakPenalty}%
  \do\t{t\penalty\UrlBreakPenalty}%
  \do\u{u\penalty\UrlBreakPenalty}%
  \do\v{v\penalty\UrlBreakPenalty}%
  \do\w{w\penalty\UrlBreakPenalty}%
  \do\x{x\penalty\UrlBreakPenalty}%
  \do\y{y\penalty\UrlBreakPenalty}%
  \do\z{z\penalty\UrlBreakPenalty}%
  \do\A{A\penalty\UrlBreakPenalty}%
  \do\B{B\penalty\UrlBreakPenalty}%
  \do\C{C\penalty\UrlBreakPenalty}%
  \do\D{D\penalty\UrlBreakPenalty}%
  \do\E{E\penalty\UrlBreakPenalty}%
  \do\F{F\penalty\UrlBreakPenalty}%
  \do\G{G\penalty\UrlBreakPenalty}%
  \do\H{H\penalty\UrlBreakPenalty}%
  \do\I{I\penalty\UrlBreakPenalty}%
  \do\J{J\penalty\UrlBreakPenalty}%
  \do\K{K\penalty\UrlBreakPenalty}%
  \do\L{L\penalty\UrlBreakPenalty}%
  \do\M{M\penalty\UrlBreakPenalty}%
  \do\N{N\penalty\UrlBreakPenalty}%
  \do\O{O\penalty\UrlBreakPenalty}%
  \do\P{P\penalty\UrlBreakPenalty}%
  \do\Q{Q\penalty\UrlBreakPenalty}%
  \do\R{R\penalty\UrlBreakPenalty}%
  \do\S{S\penalty\UrlBreakPenalty}%
  \do\T{T\penalty\UrlBreakPenalty}%
  \do\U{U\penalty\UrlBreakPenalty}%
  \do\V{V\penalty\UrlBreakPenalty}%
  \do\W{W\penalty\UrlBreakPenalty}%
  \do\X{X\penalty\UrlBreakPenalty}%
  \do\Y{Y\penalty\UrlBreakPenalty}%
  \do\Z{Z\penalty\UrlBreakPenalty}%
%  \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:%
  \do\*{*\penalty\UrlBreakPenalty}%
  \do\-{-\penalty\UrlBreakPenalty}%
  \do\~{~\penalty\UrlBreakPenalty}%
  \do\'{'\penalty\UrlBreakPenalty}%
  \do\"{"\penalty\UrlBreakPenalty}%
  \do\0{/\penalty\UrlBreakPenalty}%
  \do\1{/\penalty\UrlBreakPenalty}%
  \do\2{/\penalty\UrlBreakPenalty}%
  \do\3{/\penalty\UrlBreakPenalty}%
  \do\4{/\penalty\UrlBreakPenalty}%
  \do\5{/\penalty\UrlBreakPenalty}%
  \do\6{/\penalty\UrlBreakPenalty}%
  \do\7{/\penalty\UrlBreakPenalty}%
  \do\8{/\penalty\UrlBreakPenalty}%
  \do\9{/\penalty\UrlBreakPenalty}%
  \do\={/\penalty\UrlBreakPenalty}%
  \do\/{/\penalty\UrlBreakPenalty}%
  \do\.{/\penalty\UrlBreakPenalty}%
  \do\:{/\penalty\UrlBreakPenalty}%
}
%