1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18\writestatus{loading}{ConTeXt Math Macros Arrows}
19
20\unprotect
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\installcorenamespace{matharrowsettings}
56
57\def\m_math_arrows_factor{1}
58\def\m_math_arrows_extra {0}
59
60\setvalue{\??matharrowsettings\v!none }{\def\m_math_arrows_factor{0}}
61\setvalue{\??matharrowsettings\v!small }{\def\m_math_arrows_extra{10}}
62\setvalue{\??matharrowsettings\v!medium }{\def\m_math_arrows_extra{15}}
63\setvalue{\??matharrowsettings\v!big }{\def\m_math_arrows_extra{20}}
64\setvalue{\??matharrowsettings\v!normal }{}
65\setvalue{\??matharrowsettings }{}
66\setvalue{\??matharrowsettings\s!unknown}{\doifelsenumber\p_math_spacing{\let\m_math_arrows_extra\p_math_spacing}\donothing}
67
68\def\math_arrows_construct#1#2#3#4#5
69 {\begingroup
70 \let\m_math_arrows_factor\!!plusone
71 \let\m_math_arrows_extra \!!zerocount
72 \edef\p_math_spacing{#1}
73 \csname\??matharrowsettings
74 \ifcsname\??matharrowsettings\p_math_spacing\endcsname\p_math_spacing\else\s!unknown\fi
75 \endcsname
76 \mathsurround\zeropoint
77 \scratchmuskipone\muexpr\m_math_arrows_factor\muexpr\thirdoffourarguments #2\onemuskip\relax\m_math_arrows_extra\onemuskip\firstoffourarguments #2\onemuskip\relax
78 \scratchmuskiptwo\muexpr\m_math_arrows_factor\muexpr\fourthoffourarguments#2\onemuskip\relax\m_math_arrows_extra\onemuskip\secondoffourarguments#2\onemuskip\relax
79 \setbox\scratchboxone\hbox
80 {\normalstartimath
81 \scriptstyle
82 \mkern\scratchmuskipone\relax
83 #5\relax
84 \mkern\scratchmuskiptwo\relax
85 \normalstopimath}
86 \setbox\scratchboxtwo\hbox
87 {\normalstartimath
88 \scriptstyle
89 \mkern\scratchmuskipone\relax
90 #4\relax
91 \mkern\scratchmuskiptwo\relax
92 \normalstopimath}
93 \setbox\scratchboxthree\hbox{#3\displaystyle}
94 \scratchdimenone\wd\scratchboxone\relax
95 \ifdim\wd\scratchboxtwo>\scratchdimenone
96 \scratchdimenone\wd\scratchboxtwo\relax
97 \fi
98 \ifdim\wd\scratchboxthree>\scratchdimenone
99 \scratchdimenone\wd\scratchboxthree\relax
100 \fi
101 \ifdim\wd\scratchboxthree=\scratchdimenone\else
102 \setbox\scratchboxthree\hbox to \scratchdimenone{#3\displaystyle}
103 \fi
104 \mathrel
105 {\mathop
106 {\hpack to \scratchdimenone{\hss\box\scratchboxthree\hss}}
107 \limits
108 \normalsuperscript{\box\scratchboxone}
109 \normalsubscript {\box\scratchboxtwo}}
110 \endgroup}
111
112\let\math_arrows_construct_single\math_arrows_construct
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127\def\math_arrows_construct_double#1#2#3#4#5#6#7
128 {\mathrel
129 {\scratchdimen.32\exheight\relax
130 \setbox\scratchboxone\hbox{\normalstartimath\math_arrows_construct{#1}{#2}{#4}{\phantom{#6}}{#7}\normalstopimath}
131 \setbox\scratchboxtwo\hbox{\normalstartimath\math_arrows_construct{#1}{#3}{#5}{#6}{\phantom{#7}}\normalstopimath}
132 \raise\scratchdimen\box\scratchboxone
133 \kern\wd\scratchboxtwo
134 \lower\scratchdimen\box\scratchboxtwo}}
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\unexpanded\def\definematharrow
208 {\doquadrupleargument\math_arrows_define}
209
210\def\math_arrows_define[#1][#2][#3][#4]
211 {\iffourthargument
212 \executeifdefined{matharrowsdefine#2}\gobblethreearguments{#1}{#3}{#4}
213 \else\ifthirdargument
214 \math_arrows_define_both{#1}{#2}{#3}
215 \else\ifsecondargument
216 \math_arrows_define_both_again{#1}{#2}{#3}
217 \fi\fi\fi}
218
219\def\math_arrows_define_both_again#1#2#3
220 {\ifcsname#1\endcsname
221 \pushmacro\math_arrows_do
222 \def\math_arrows_do[##1][##2]{\setuvalue{#1}{\math_arrows_do[#2][##2]}}
223 \csname#1\endcsname
224 \popmacro\math_arrows_do
225 \fi}
226
227\def\math_arrows_define_both#1#2#3
228 {\setuvalue{#1}{\math_arrows_do[#2][#3]}}
229
230\unexpanded\def\math_arrows_do
231 {\doquadrupleempty\math_arrows_handle}
232
233\def\math_arrows_handle[#1][#2][#3][#4]
234 {\def\math_arrows_handle_indeed{\math_arrows_handle_finalize[#1,\empty,\empty][#2,\empty,\empty][#3]}
235 \dodoublegroupempty\math_arrows_handle_indeed}
236
237\def\math_arrows_handle_finalize[#1,#2,#3][#4,#5,#6][#7]#8#9
238 {\edef\!!stringa{#2}
239 \ifx\!!stringa\empty
240 \ifsecondargument
241 \mathrel{\math_arrows_construct_single{#7}{#1}{#4}{#8}{#9}}
242 \else
243 \mathrel{\math_arrows_construct_single{#7}{#1}{#4}{}{#8}}
244 \fi
245 \else
246 \ifsecondargument
247 \mathrel{\math_arrows_construct_double{#7}{#1}{#2}{#4}{#5}{#8}{#9}}
248 \else
249 \mathrel{\math_arrows_construct_double{#7}{#1}{#2}{#4}{#5}{}{#8}}
250 \fi
251 \fi}
252
253
254
255
256
257
258
259
260
261
262
263
264
265\def\mtharrowfill#1#2#3#4#5#6#7#8
266 {\normalstartimath
267 \mathsurround\zeropoint
268 \thickmuskip\zeromuskip\medmuskip\thickmuskip\thinmuskip\thickmuskip
269 \relax#8#5
270 \mkern#1\onemuskip
271 \cleaders\hbox{\normalstartimath#8\mkern#2\onemuskip#6\mkern#3\onemuskip\normalstopimath}\hfill
272 \mkern#4\onemuskip#7
273 \normalstopimath}
274
275\def\defaultmtharrowfill{\mtharrowfill 7227}
276
277
278
279
280
281
282
283
284
285
286\unexpanded\def\specrightarrowfill {\defaultmtharrowfill \relbar \relbar \rightarrow}
287\unexpanded\def\specleftarrowfill {\defaultmtharrowfill \leftarrow \relbar \relbar}
288
289\unexpanded\def\rightarrowfill {\specrightarrowfill\textstyle}
290\unexpanded\def\leftarrowfill {\specleftarrowfill \textstyle}
291
292\unexpanded\def\equalfill {\defaultmtharrowfill \Relbar \Relbar \Relbar}
293\unexpanded\def\Rightarrowfill {\defaultmtharrowfill \Relbar \Relbar \Rightarrow}
294\unexpanded\def\Leftarrowfill {\defaultmtharrowfill \Leftarrow \Relbar \Relbar}
295\unexpanded\def\Leftrightarrowfill {\defaultmtharrowfill \Leftarrow \Relbar \Rightarrow}
296\unexpanded\def\leftrightarrowfill {\defaultmtharrowfill \leftarrow \relbar \rightarrow}
297\unexpanded\def\mapstofill {\defaultmtharrowfill{\mapstochar\relbar} \relbar \rightarrow}
298\unexpanded\def\twoheadrightarrowfill{\defaultmtharrowfill \relbar \relbar \twoheadrightarrow}
299\unexpanded\def\twoheadleftarrowfill {\defaultmtharrowfill \twoheadleftarrow \relbar \relbar}
300\unexpanded\def\rightharpoondownfill {\defaultmtharrowfill \relbar \relbar \rightharpoondown}
301\unexpanded\def\rightharpoonupfill {\defaultmtharrowfill \relbar \relbar \rightharpoonup}
302\unexpanded\def\leftharpoondownfill {\defaultmtharrowfill \leftharpoondown \relbar \relbar}
303\unexpanded\def\leftharpoonupfill {\defaultmtharrowfill \leftharpoonup \relbar \relbar}
304\unexpanded\def\hookleftfill {\defaultmtharrowfill \leftarrow \relbar{\relbar\joinrel\rhook}}
305\unexpanded\def\hookrightfill {\defaultmtharrowfill{\lhook\joinrel\relbar}\relbar \rightarrow}
306\unexpanded\def\relfill {\defaultmtharrowfill \relbar \relbar \relbar}
307
308\unexpanded\def\triplerelbar {\mathrel\equiv}
309\unexpanded\def\triplerelfill{\defaultmtharrowfill\triplerelbar\triplerelbar\triplerelbar}
310
311\unexpanded\def\singlebond{{\xrel}}
312\unexpanded\def\doublebond{{\xequal}}
313\unexpanded\def\triplebond{{\xtriplerel}}
314
315
316
317
318
319
320
321
322
323\unexpanded\def\rightoverleftarrowfill
324 {\specrightoverleftarrowfill}
325
326\unexpanded\def\specrightoverleftarrowfill
327 {\defaultmtharrowfill
328 \ctxdoublearrowfillleftend
329 \ctxdoublearrowfillmiddlepart
330 \ctxdoublearrowfillrightend
331 \textstyle}
332
333
334
335
336
337\definematharrow [xrightarrow] [0359] [\specrightarrowfill]
338\definematharrow [xleftarrow] [3095] [\specleftarrowfill]
339\definematharrow [xequal] [0099] [\equalfill]
340\definematharrow [xRightarrow] [0359] [\Rightarrowfill]
341\definematharrow [xLeftarrow] [3095] [\Leftarrowfill]
342\definematharrow [xLeftrightarrow] [0099] [\Leftrightarrowfill]
343\definematharrow [xleftrightarrow] [0099] [\leftrightarrowfill]
344\definematharrow [xmapsto] [3599] [\mapstofill]
345\definematharrow [xtwoheadrightarrow] [5009] [\twoheadrightarrowfill]
346\definematharrow [xtwoheadleftarrow] [0590] [\twoheadleftarrowfill]
347\definematharrow [xrightharpoondown] [0359] [\rightharpoondownfill]
348\definematharrow [xrightharpoonup] [0359] [\rightharpoonupfill]
349\definematharrow [xleftharpoondown] [3095] [\leftharpoondownfill]
350\definematharrow [xleftharpoonup] [3095] [\leftharpoonupfill]
351\definematharrow [xhookleftarrow] [3095] [\hookleftfill]
352\definematharrow [xhookrightarrow] [0395] [\hookrightfill]
353\definematharrow [xrel] [0099] [\relfill]
354\definematharrow [xtriplerel] [0099] [\triplerelfill]
355\definematharrow [xrightoverleftarrow] [0359,3095] [\specrightarrowfill,\specleftarrowfill]
356\definematharrow [xleftrightharpoons] [3399,3399] [\leftharpoonupfill,\rightharpoondownfill]
357\definematharrow [xrightleftharpoons] [3399,3399] [\rightharpoonupfill,\leftharpoondownfill]
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379\unexpanded\def\definemathoverarrow
380 {\dotripleargument\math_arrows_define_over}
381
382\def\math_arrows_define_over[#1][#2][#3]
383 {\ifthirdargument
384 \setuvalue{#1}{\math_arrows_over_handle[#2][#3]}
385 \else
386 \setuvalue{#1}{\math_arrows_over_handle[\zeropoint][#2]}
387 \fi}
388
389\def\math_arrows_over_handle[#1][#2]
390 {\mathpalette{\math_arrows_over_handle_indeed{#1}{#2}}}
391
392
393
394
395
396\def\math_arrows_over_handle_indeed#1#2#3#4
397 {\vbox{\ialign{
398 \alignmark\alignmark
399 \crcr
400 #2#3
401 \crcr
402 \noalign{\kern#1\nointerlineskip}
403 \normalstartimath
404 \mathsurround\zeropoint\hfil#3#4\hfil
405 \normalstopimath
406 \crcr
407 }}}
408
409
410
411\unexpanded\def\definemathunderarrow
412 {\dotripleargument\math_arrows_define_under}
413
414
415
416\def\math_arrows_define_under[#1][#2][#3]
417 {\ifthirdargument
418 \setuvalue{#1}{\math_arrows_under_handle[#2][#3]}
419 \else
420 \setuvalue{#1}{\math_arrows_under_handle[0.3ex][#2]}
421 \fi}
422
423\def\math_arrows_under_handle[#1][#2]
424 {\mathpalette{\math_arrows_under_handle_indeed{#1}{#2}}}
425
426\def\math_arrows_under_handle_indeed#1#2#3#4
427 {\vtop{\ialign{
428 \alignmark\alignmark
429 \crcr
430 \normalstartimath\mathsurround\zeropoint\hfil#3#4\hfil\normalstopimath
431 \crcr
432 \noalign{\nointerlineskip\kern#1}
433 #2#3
434 \crcr
435 }}}
436
437
438
439\definemathoverarrow [overleftarrow] [\specleftarrowfill]
440\definemathoverarrow [overrightarrow] [\specrightarrowfill]
441\definemathoverarrow [overleftrightarrow] [\leftrightarrowfill]
442\definemathoverarrow [overtwoheadrightarrow] [\twoheadrightarrowfill]
443\definemathoverarrow [overtwoheadleftarrow] [\twoheadleftarrowfill]
444\definemathoverarrow [overrightharpoondown] [1pt] [\rightharpoondownfill]
445\definemathoverarrow [overrightharpoonup] [\rightharpoonupfill]
446\definemathoverarrow [overleftharpoondown] [1pt] [\leftharpoondownfill]
447\definemathoverarrow [overleftharpoonup] [\leftharpoonupfill]
448
449\definemathunderarrow [underleftarrow] [\specleftarrowfill]
450\definemathunderarrow [underrightarrow] [\specrightarrowfill]
451\definemathunderarrow [underleftrightarrow] [\leftrightarrowfill]
452\definemathunderarrow [undertwoheadrightarrow][\twoheadrightarrowfill]
453\definemathunderarrow [undertwoheadleftarrow] [\twoheadleftarrowfill]
454\definemathunderarrow [underrightharpoondown] [\rightharpoondownfill]
455\definemathunderarrow [underrightharpoonup] [\rightharpoonupfill]
456\definemathunderarrow [underleftharpoondown] [\leftharpoondownfill]
457\definemathunderarrow [underleftharpoonup] [\leftharpoonupfill]
458
459
460
461
462
463
464
465
466
467
468
469\protect \endinput
470 |