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
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\installcorenamespace{mathaccents}
106
107\installcommandhandler \??mathaccents {mathaccents} \??mathaccents
108
109\setupmathaccents
110 [\c!top=,
111 \c!bottom=,
112 \c!mathstyle=,
113 \c!color=,
114 \c!command=\v!yes]
115
116\definemathaccents
117 [\v!both]
118
119\definemathaccents
120 [\v!top]
121 [\v!both]
122
123\definemathaccents
124 [\v!bottom]
125 [\v!both]
126
127\unexpanded\def\definemathtopaccent {\dotripleempty \math_accents_define_top }
128\unexpanded\def\definemathbottomaccent{\dotripleempty \math_accents_define_bottom}
129\unexpanded\def\definemathdoubleaccent{\doquadrupleempty\math_accents_define_double}
130
131\def\math_accents_define_top[#1][#2][#3]
132 {\ifthirdargument
133 \setuevalue{#2}{\math_accents_make_double {#1}\plusone{\number#3}\zerocount}
134 \else
135 \setuevalue{#1}{\math_accents_make_double\noexpand\currentmathaccents\plusone{\number#2}\zerocount}
136 \fi}
137
138\def\math_accents_define_bottom[#1][#2][#3]
139 {\ifthirdargument
140 \setuevalue{#2}{\math_accents_make_double {#1}\plustwo\zerocount{\number#3}}
141 \else
142 \setuevalue{#1}{\math_accents_make_double\noexpand\currentmathaccents\plustwo\zerocount{\number#2}}
143 \fi}
144
145\def\math_accents_define_double[#1][#2][#3][#4]
146 {\iffourthargument
147 \setuevalue{#2}{\math_accents_make_double {#1}\plusthree{\number#3}{\number#4}}
148 \else
149 \setuevalue{#1}{\math_accents_make_double\noexpand\currentmathaccents\plusthree{\number#2}{\number#3}}
150 \fi}
151
152\def\math_accents_color_push_yes
153 {\pushcolor[\p_math_accent_color]
154 \let\math_accents_color_pop\popcolor}
155
156\def\math_accents_color_push_nop
157 {\let\math_accents_color_pop\donothing}
158
159\unexpanded\def\math_accents_make_double#class#kind#top#bottom#content
160 {\begingroup
161 \edef\currentmathaccents {#class}
162 \edef\p_math_accent_color{\mathaccentsparameter\c!color}
163 \startusemathstyleparameter\mathaccentsparameter
164 \ifx\p_math_accent_color\empty
165 \math_accents_color_push_nop
166 \else
167 \math_accents_color_push_yes
168 \fi
169 \ifcase#kind\or
170 \Umathaccent \fam\zerocount#top
171 \or
172 \Umathaccent bottom \fam\zerocount#bottom
173 \or
174 \Umathaccent both \fam\zerocount#top
175 \fam\zerocount#bottom
176 \fi
177 {\math_accents_color_pop#content}
178 \stopusemathstyleparameter
179 \endgroup}
180
181
182
183\newconditional\c_math_accents_auto_dotless \settrue\c_math_accents_auto_dotless
184
185\let\normalgrave \grave \unexpanded\def\dotlessgrave #1{\normalgrave {\mathdotless#1}}
186\let\normalddot \ddot \unexpanded\def\dotlessddot #1{\normalddot {\mathdotless#1}}
187\let\normalbar \bar \unexpanded\def\dotlessbar #1{\normalbar {\mathdotless#1}}
188\let\normalacute \acute \unexpanded\def\dotlessacute #1{\normalacute {\mathdotless#1}}
189\let\normalhat \hat \unexpanded\def\dotlesshat #1{\normalhat {\mathdotless#1}}
190\let\normalcheck \check \unexpanded\def\dotlesscheck #1{\normalcheck {\mathdotless#1}}
191\let\normalbreve \breve \unexpanded\def\dotlessbreve #1{\normalbreve {\mathdotless#1}}
192\let\normaldot \dot \unexpanded\def\dotlessdot #1{\normaldot {\mathdotless#1}}
193\let\normalring \ring \unexpanded\def\dotlessring #1{\normalring {\mathdotless#1}}
194\let\normaltilde \tilde \unexpanded\def\dotlesstilde #1{\normaltilde {\mathdotless#1}}
195\let\normaldddot \dddot \unexpanded\def\dotlessdddot #1{\normaldddot {\mathdotless#1}}
196
197\def\math_accents_auto_dotless#1#2
198 {\ifconditional\c_math_accents_auto_dotless\expandafter#2\else\expandafter#1\fi}
199
200\unexpanded\def\grave {\math_accents_auto_dotless\normalgrave \dotlessgrave }
201\unexpanded\def\ddot {\math_accents_auto_dotless\normalddot \dotlessddot }
202\unexpanded\def\bar {\math_accents_auto_dotless\normalbar \dotlessbar }
203\unexpanded\def\acute {\math_accents_auto_dotless\normalacute \dotlessacute }
204\unexpanded\def\hat {\math_accents_auto_dotless\normalhat \dotlesshat }
205\unexpanded\def\check {\math_accents_auto_dotless\normalcheck \dotlesscheck }
206\unexpanded\def\breve {\math_accents_auto_dotless\normalbreve \dotlessbreve }
207\unexpanded\def\dot {\math_accents_auto_dotless\normaldot \dotlessdot }
208\unexpanded\def\ring {\math_accents_auto_dotless\normalring \dotlessring }
209\unexpanded\def\tilde {\math_accents_auto_dotless\normaltilde \dotlesstilde }
210\unexpanded\def\dddot {\math_accents_auto_dotless\normaldddot \dotlessdddot }
211
212\let\mathring\ring
213
214\protect \endinput
215 |