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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
%%
%% \iffalse ^^A we skip the debug setting
\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
%% \fi
%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $
%% This is file “gmurl.sty” generated with the DocStrip utility.
%%
%%
%% The original source files were:
%%
%% gmutils/gmutils.gmd (with options: `url')
%%
%%
%% Copyright ©
%% by Grzegorz ‘Natror’ Murzynowski
%% natror (at) gmail (dot) com
%%
%% This program is subject to the LaTeX Project Public License.
%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
%% for the details of that license.
%%
%% LPPL status: "author-maintained".
%%
%%
%%
%% For documentation please refer to the file(s)
%% gmutils.{gmd,pdf}.
%%
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmurl}
[2011/10/12 v0.996 modifications to the url package (GM)]
%%
%%
%% ^^A\typeout{\unexpanded{#4}}%%
\RequirePackage{gmcommand}
\def\urladdstar{%
\AtBeginDocument{%
\@ifpackageloaded{hyperref}{%
\Store@Macro\url
\pdef\url{\gmu@ifstar{\nolinkurl}{\storedcsname{url}}}%
}{}}}
\@onlypreamble\urladdstar
\@ifXeTeX{%
\pdef\UrlFix{\AtBeginDocument{%
\@ifpackageloaded{url}{\gmu@UrlFix}{}}%
\relaxen\UrlFix}%
%
\AtBeginDocument{%
\pdef\UrlFix{%
\@ifpackageloaded{url}{\gmu@UrlFix}{}%
\relaxen\UrlFix}}%
}
{%
\pdef\UrlFix{\PackageWarning{gmutils}{!!! The \string\UrlFix\space
declaration works only with XeTeX}}%
}
\@ifXeTeX{}{%
\edef\gmu@restoreUpUpUp{\catcode`\@nx\^^^=\the\catcode`\^^^}%
\AtEndOfPackage\gmu@restoreUpUpUp
\catcode`\^^^=9 }
\def\gmu@UrlFix{%
% \stanza
% default style assignments
\def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\]%
\do\)\do\,\do\?\do\'\do\"\do\+\do\=\do\#\do\%\do\~\do\_\do\|%
\do\{\do\}\do\$}%
\def\UrlBigBreaks{\do\:}%
\def\UrlNoBreaks{\do\(\do\[\do\{}%
\def\UrlSpecials{%
\do\ {\hbox{\visiblespace}}\do\^^M{\hbox{\visiblespace}}}%
% \stanza
%
% \stanza
\def\Url@Format##1{%
\UrlFont
\ifdefined\verbatim@specials
\catcode`\>\active
\verbatim@specials
\verbatim@mathhack
\fi % setting of
% the escape char, begin and end group and optionally math shift,
% defined in \pk{gmverb}.
\gmu@UrlSetup
\UrlLeft
\edef\gmu@theendlinechar{\the\endlinechar}%
\endlinechar\m@ne
\kern\z@% to forbid hyphenating the first word if the \ac{URL}
% begins with a~word
\hyphenchar\font=\UrlHyphenchar\relax
\let\-\gmu@discretionaryhyphen
\scantokens{##1}%
\endlinechar\gmu@theendlinechar\relax
\UrlRight
}% of |\Url@Format|.
% \stanza
\edef\UrlHyphenchar{%
\ifdefined\gmv@hyphenchar\gmv@hyphenchar
\else"A6 \fi}% \label{UrlHyphenchar} broken bar, |¦| or the same as
% provided in \pk{gmverb} for verbatims. You
% can redefine it as you please. This char is used as the
% hyphenation char in \ac{URL}s and therefore should be different
% from |-| (hyphen), which is often a part of an \ac{URL}. The
% broken bar seems to be quite unlikely in \ac{URL}s and/or file
% names.
% \stanza
\def\verbatim@mathhack{%
\ifdefined\verbatim@specials@list
\@xa\verbatim@mathhack@\verbatim@specials@list
\fi
}%
% \stanza
\def\verbatim@mathhack@##1##2##3##4##5##6{%
\gmuIfValueT{##4}{%
\edef\gmu@thinmuskip{\the\thinmuskip}%
\edef\gmu@medmuskip{\the\medmuskip}%
\edef\gmu@thickmuskip{\the\thickmuskip}%
\begingroup
\lccode`\~=`##4\lowercase{%
\endgroup\def~####1~}%
{$\thinmuskip\gmu@thinmuskip\relax
\medmuskip\gmu@medmuskip\relax
\thickmuskip\gmu@thickmuskip\relax
####1%
$}%
\catcode`##4\active
}%
}%
%\stanza
\def\gmu@UrlSetup{%
\medmuskip\Urlmuskip \thickmuskip\medmuskip \thinmuskip0mu%
\relpenalty\UrlBigBreakPenalty \binoppenalty\UrlBreakPenalty
\def\do{\gmu@doUrlMath\UrlBreakPenalty}\UrlBreaks % bin
% (\incs{hyphenpenalty} anyway)
\def\do{\gmu@doUrlMath\UrlBigBreakPenalty}\UrlBigBreaks % rel
% (\incs{hyphenpenalty} anyway)
\def\do{\gmu@doUrlMath\@M}\UrlNoBreaks % open (no break)
\def\do{\gmu@doUrlMathAc\UrlBreakPenalty}% (\incs{hyphenpenalty})
\UrlSpecials
\if \iffontchar\font"2329 1\else0\fi\iffontchar\font"232A 1\else2\fi
% \nostanza we check whether the font provides both left and right
% angle brackets. \nostanza
\gmu@measurewd{^^^^2329}%
\edef\gmu@tempa{%
\@nx\gmu@doUrlMathAc\@M\@nx\<{%
\hbox to\gmu@tempb{\unexpanded{\hss\char"2329 \hss}}}%
}\gmu@tempa
\gmu@measurewd{^^^^232a}%
\edef\gmu@tempa{%
\@nx\do\@nx\>{%
\hbox to\gmu@tempb{\unexpanded{\hss\char"232A \hss}}}%
}\gmu@tempa
\else
\gmu@doUrlMathAc\@M\<{\langle}\do\>{\rangle}%
\fi
\iffontchar\font"22C6 % low star
\do\*{\hbox{\char"22C6 }}%
\else \do\**%
\fi
\ifx\do@url@hyp\@empty
\gmu@measurewd{-}% this macro is defined in line \ref{@measurewd}.
\edef\gmu@tempa{%
\unexpanded{\gmu@doUrlMathAc\@M\-}%
{\hbox to \gmu@tempb{\unexpanded{\hss-\hss}}%
\@nx\-}% hyphen is a
% good point for hyphenation, but the hyphenation char should
% be sth. else, and it is indeed: |¦| (broken bar,
% |\char"A6|). See also line \ref{UrlHyphenchar}
}\gmu@tempa
\fi
\addfontfeature{Ligatures=NoCommon, Mapping=none}% instead of
% ‘doing’ \incs{ver\+bat\+im\+@\+no\+lig\+@\+list}.
}% of |\gmu@UrlSetup|.
% \stanza
%
% \stanza
\def\gmu@doUrlMath##1##2{%\
% \begin{enumargs}
% \item value of the penalty (used as a~Boolean: if $<$
% \thous 10000, \nlperc\cs{hyphenpenalty} will be used anyway, if $\ge$
% \thous10000, there will be no \incs{discretionary}),
% \item the char, given as |\⁄<char>|.
% \end{enumargs}
\begingroup
\lccode`\~=`##2\lowercase{%
\endgroup\def~{\@ifnextchar~}%
\@xa\addtomacro\@xa~}% of |\lowercase|.
\ifnum##1<\@M
{%
{\char`##2\csname gmu@dbl\string##2kern\endcsname}% if next is the same char
{\ifmmode\char`##2% else
\else\gmu@urlbreakable{##1}{##2}%
\fi}%
}% of |\addtomacro|'s argument |\ifnum| true.
\else
{%
{\char`##2\csname gmu@dbl\string##2kern\endcsname}{\char`##2}%
}% of |\addtomacro|'s argument |\ifnum| false.
\fi
\catcode`##2=\active
}% of |\gmu@doUrlMath|.
% \stanza
\def\gmu@doUrlMathAc##1##2##3{%\
% \begin{enumargs}
% \item (value of) a~penalty (see the remark to \inverb|##1| of
% the previous macro),
% \item the char (as |\⁄<char>|),
% \item the definition.
% \end{enumargs}
\begingroup
\lccode`\~=`##2\lowercase{%
\endgroup\def~{\@ifnextchar~}%
\@xa\addtomacro\@xa~}% of |\lowercase|.
\ifnum ##1<\@M
{%
{\ifmmode\char`##2\else$##3\m@th$\fi}%
{\ifmmode\char`##2%
\else\discretionary{\hbox{$##3\m@th$}}{}{\hbox{$##3\m@th$}}%
\fi}%
}% of |\addtomacro|'s argument if num true.
\else
{%
{\ifmmode\char`##2\else$##3\m@th$\fi}{\ifmmode\char`##2\else$##3\m@th$\fi}%
}% of |\addtomacro|'s argument if num false.
\fi
\catcode`##2=\active
}% of |\gmu@doUrlMathAc|.
% \stanza
\pdef\gmu@url@rigidbreak##1##2{\discretionary{\char`##2}{}{\char`##2}}%
% \stanza
\pdef\gmu@url@flexbreak##1##2{\penalty\@M \hskip\z@ plus0,03em
\char`##2\penalty##1\hskip\z@ plus0,03em\relax}%
% \stanza
\let\gmu@urlbreakable\gmu@url@flexbreak
% \stanza
\def\Url@z##1{%
% Do any hyper referencing due to hyperref (or perform a url-def)
\Url@HyperHook
% Now do the formatting in a group (can also have \incs{Url@HyperHook} take
% this as an argument). \nostanza
{\Url@Format{##1}}%
\endgroup}%
% \stanza
\DeclareUrlCommand\file{\urlstyle{sf}}%
% \stanza
\emptify\Url@moving% with our settings |\url| is pretty allowed in
% moving arguments, I~hope.
}% of |\gmu@UrlFix|.
\DeclareCommand\UrlSlashKern{O{tt}m}%
{\AtBeginDocument{%
\@nameedef{url@#1style}{\def\@nx\UrlFont{%
\@xanxcs{#1family}%
\def\@xanxcs{gmu@dbl\string\/kern}%
{\kern#2\relax}%
}% of |\UrlFont|
}% of |\url#1style|
\urlstyle{#1}%
}% of |\AtBeginDocument|
}% of |\UrlSlashKern|
\def\DeclareUrlCommand#1#2{\pdef#1{\leavevmode\begingroup #2\Url}}
\foolc ~ : {%
\@ifXeTeX{%
\def\metaat~{%
\penalty\@M \hskip\z@skip
\meta{аt}% it's a Cyrillic »a«!
\penalty\exhyphenpenalty
\hskip\z@skip
}%
%
\def\metadot~{%
\penalty\@M \hskip\z@skip
\meta{dоt}% it's a Cyrillic »o«!
\penalty\exhyphenpenalty
\hskip\z@skip
}%
}% of if \XeTeX
{%
\def\metaat~{\PackageError{gmurl}{Command \bslash metaat
works only in XeTeX}@}%
%
\def\metadot~{\PackageError{gmurl}{Command \bslash metaat
works only in XeTeX}.}%
}% of if not XeTeX
}% of |\foolc|
\endinput
%%
%% End of file `gmurl.sty'.
|