1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Math Macros Accents}
15
16
17
18
19\unprotect
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\installcorenamespace{mathaccents}
79
80\installcommandhandler \??mathaccents {mathaccent} \??mathaccents
81
82\aliased\let\setupmathaccents\setupmathaccent
83
84\setupmathaccents
85 [\c!top=,
86 \c!bottom=,
87 \c!mathstyle=,
88 \c!color=,
89 \c!symbolcolor=\mathaccentparameter\c!color,
90 \c!textcolor=\mathaccentparameter\c!color,
91 \c!scale=\v!no,
92 \c!alignsymbol=\v!yes,
93
94
95 \c!define=\v!yes,
96 \c!snap=\mathematicsparameter\c!snap]
97
98\definemathaccent
99 [\v!both]
100
101\definemathaccent
102 [\v!top]
103 [\v!both]
104
105\definemathaccent
106 [\v!bottom]
107 [\v!both]
108
109\setupmathaccents
110 [\v!top]
111 [i=\v!auto]
112
113\setupmathaccents
114 [\v!both]
115 [i=\v!auto]
116
117\setupmathaccents
118 [\v!bottom]
119 [i=]
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\permanent\tolerant\protected\def\definemathtopaccent[#1]#*[#2]#*[#3]
145 {\ifparameter#3\or
146 \definemathaccent[#2][#1]
147 \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_common {#1}{#2}\plusone{\number#3}\zerocount}
148 \else
149 \definemathaccent[#1]
150 \frozen\protected\instance\edefcsname#1\endcsname{\math_accent_common\noexpand\currentmathaccent{#1}\plusone{\number#2}\zerocount}
151 \fi}
152
153\permanent\tolerant\protected\def\definemathbottomaccent[#1]#*[#2]#*[#3]
154 {\ifparameter#3\or
155 \definemathaccent[#2][#1]
156 \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_common {#1}{#2}\plustwo\zerocount{\number#3}}
157 \else
158 \definemathaccent[#1]
159 \frozen\protected\instance\edefcsname#1\endcsname{\math_accent_common\noexpand\currentmathaccent{#1}\plustwo\zerocount{\number#2}}
160 \fi}
161
162\permanent\tolerant\protected\def\definemathdoubleaccent[#1]#*[#2]#*[#3]#*[#4]
163 {\ifparameter#4\or
164 \definemathaccent[#2][#1]
165 \frozen\protected\instance\edefcsname#2\endcsname{\math_accent_common {#1}{#2}\plusthree{\number#3}{\number#4}}
166 \else
167 \definemathaccent[#1]
168 \frozen\protected\instance\edefcsname#1\endcsname{\math_accent_common\noexpand\currentmathaccent{#1}\plusthree{\number#2}{\number#3}}
169 \fi}
170
171
172
173
174
175
176
177
178
179
180\tolerant\protected\def\math_accent_common#class#name#kind#top#bottom#*[#settings]#:#content
181 {\beginmathgroup
182
183 \cdef\currentmathaccent{#name}
184 \setupcurrentmathaccent[#settings]
185 \edef\p_scale{\mathaccentparameter\c!scale}
186 \ifx\p_scale\v!keep
187 \lettonothing\m_fixed
188 \orelse\ifx\p_scale\v!yes
189 \lettonothing\m_fixed
190 \else
191 \let\m_fixed\s!fixed
192 \fi
193 \ifcstok{\mathaccentparameter\c!plugin}\v!mp
194 \edef\p_mp{\mathaccentparameter\c!mp}
195 \ifempty\p_mp\else
196 \clf_set_extensible_data
197 mp {\p_mp}
198 left \scratchcounterthree
199 right \scratchcounterthree
200 middle \scratchcounterthree
201 \relax
202 \fi
203 \else
204 \lettonothing\p_mp
205 \fi
206 \math_tags_mfunctionlab\plustwo{#name}{\ifcase#kind\or\v!top\or\v!bottom\else\v!both\fi}
207 \Umathaccent
208 \usedsymbolcolorparameterattributes{\mathaccentparameter\c!symbolcolor}
209
210 \ifcstok{\mathaccentparameter\c!align}\v!middle
211 \s!center\relaxedspace
212 \fi
213 \ifcstok{\mathaccentparameter\c!stretch}\v!yes
214 \s!stretch\relaxedspace
215 \fi
216 \ifcstok{\mathaccentparameter\c!shrink}\v!yes
217 \s!shrink\relaxedspace
218 \fi
219 \ifcstok{\mathaccentparameter\c!snap}\v!yes
220 \s!single\relaxedspace
221 \fi
222 \ifempty\p_mp\else
223 \s!usecallback\relaxedspace
224 \fi
225 \ifx\p_scale\v!keep
226 \s!keepbase\relaxedspace
227 \fi
228 \ifcstok{\mathaccentparameter\c!alignsymbol}\v!yes
229 \s!nooverflow\relaxedspace
230 \fi
231 \ifcstok{\mathaccentparameter\c!offset}\v!auto
232 \s!base\relaxedspace
233 \fi
234 \ifcase#kind\or
235 \s!top\relaxedspace
236 \m_fixed
237 \fam\zerocount#top
238
239 \or
240 \s!bottom\relaxedspace
241 \m_fixed
242 \fam\zerocount#bottom
243
244 \or
245 \s!both\relaxedspace
246 \m_fixed
247 \fam\zerocount#bottom
248 \fam\zerocount#top
249
250
251 \fi
252 {\usemathaccentcolorparameter\c!textcolor
253 \startusemathstyleparameter\mathaccentparameter\c!mathstyle
254 \ifcstok{\mathaccentparameter{i}}\v!auto\mathdotless\fi
255 #content
256 \stopusemathstyleparameter}
257 \endmathgroup}
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275\pushoverloadmode
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294\definemathtopaccent[\v!top][grave] ["0300]
295\definemathtopaccent[\v!top][acute] ["0301]
296\definemathtopaccent[\v!top][hat] ["0302]
297\definemathtopaccent[\v!top][tilde] ["0303]
298\definemathtopaccent[\v!top][bar] ["0305]
299
300\definemathtopaccent[\v!top][breve] ["0306]
301\definemathtopaccent[\v!top][dot] ["0307]
302\definemathtopaccent[\v!top][ddot] ["0308]
303\definemathtopaccent[\v!top][overhook]["0309]
304\definemathtopaccent[\v!top][ring] ["030A]
305\definemathtopaccent[\v!top][check] ["030C]
306
307
308
309
310
311
312
313\definemathtopaccent[\v!top][overleftharpoon] ["20D0]
314\definemathtopaccent[\v!top][overrightharpoon] ["20D1]
315
316
317\definemathtopaccent[\v!top][dddot] ["20DB]
318\definemathtopaccent[\v!top][ddddot] ["20DC]
319
320
321
322
323
324
325
326
327
328
329\definemathaccent
330 [\v!top:\v!stretch]
331 [\v!top]
332 [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
333
334\definemathaccent
335 [\v!bottom:\v!stretch]
336 [\v!bottom]
337 [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
338
339\definemathaccent
340 [\v!both:\v!stretch]
341 [\v!both]
342 [\c!scale=\v!keep,\c!stretch=\v!yes,\c!shrink=\v!yes]
343
344\definemathaccent
345 [\v!top:\v!dot]
346 [\v!top:\v!stretch]
347 [i=]
348
349
350
351
352\definemathtopaccent[\v!top:\v!stretch][widegrave]["0300]
353\definemathtopaccent[\v!top:\v!stretch][wideacute]["0301]
354\definemathtopaccent[\v!top:\v!stretch][widehat] ["0302]
355\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303]
356\definemathtopaccent[\v!top:\v!stretch][widebar] ["0305]
357\definemathtopaccent[\v!top:\v!stretch][widebreve]["0306]
358\definemathtopaccent[\v!top:\v!stretch][widedot] ["0307]
359\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308]
360\definemathtopaccent[\v!top:\v!stretch][widering] ["030A]
361\definemathtopaccent[\v!top:\v!stretch][widecheck]["030C]
362\definemathtopaccent[\v!top:\v!stretch][widedddot]["20DB]
363
364\definemathtopaccent[\v!top:\v!stretch][vec]["20D7]
365
366\definemathtopaccent[\v!top:\v!stretch][wideoverleftharpoon] ["20D0]
367\definemathtopaccent[\v!top:\v!stretch][wideoverrightharpoon] ["20D1]
368\definemathtopaccent[\v!top:\v!stretch][wideoverleftarrow] ["20D6]
369\definemathtopaccent[\v!top:\v!stretch][wideoverrightarrow] ["20D7]
370\definemathtopaccent[\v!top:\v!stretch][wideoverleftrightarrow]["20E1]
371
372\definemathbottomaccent[\v!bottom:\v!stretch][wideundertilde] ["0330]
373\definemathbottomaccent[\v!bottom:\v!stretch][wideunderbar] ["0332]
374\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftrightarrow]["034D]
375\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightharpoon] ["20EC]
376\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftharpoon] ["20ED]
377\definemathbottomaccent[\v!bottom:\v!stretch][wideunderleftarrow] ["20EE]
378\definemathbottomaccent[\v!bottom:\v!stretch][wideunderrightarrow] ["20EF]
379
380
381
382
383
384
385\definemathtopaccent[\v!top:\v!dot][conjugate]["0305]
386\definemathtopaccent[\v!top:\v!dot][closure] ["0305]
387\definemathtopaccent[\v!top:\v!dot][conjugate]["0305]
388
389\aliased\let\mathring\ring
390
391
392
393
394
395
396
397
398\permanent\tolerant\protected\def\slashed[#1]#:#2
399 {\Umathaccent
400 \usedcolorparameterattributes{\mathaccentparameter\c!symbolcolor}
401 \s!class \mathcodechecked{#1}
402 \s!center \relaxedspace
403 \s!overlay\relaxedspace
404 \zerocount \zerocount \forwardslashasciicode
405 {\usemathaccentcolorparameter\c!textcolor
406 #2}}
407
408
409
410
411\popoverloadmode
412
413\protect \endinput
414 |