1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus { loading }{ ConTeXt Typesetting Macros Scripts }
15
16\unprotect
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39\installcorenamespace { low }
40\installcorenamespace { high }
41
42\installcommandhandler \??low { low } \??low
43\installcommandhandler \??high { high } \??high
44
45\setuplow [ \c!style = \tx , \c!distance = \zeropoint , \c!down = . 4 8 \exheight ]
46\setuphigh [ \c!style = \tx , \c!distance = \zeropoint , \c!up = . 8 6 \exheight ]
47
48\appendtoks \setuevalue \currentlow { \typo_scripts_low { \currentlow }} \to \everydefinelow
49\appendtoks \setuevalue \currenthigh { \typo_scripts_high { \currenthigh }} \to \everydefinehigh
50
51\unexpanded \def \typo_scripts_low # 1 # 2
52 { \dontleavehmode
53 \begingroup
54 \edef \currentlow { # 1 }
55 \kern \lowparameter \c!distance \relax
56 \setbox \scratchbox \runninghbox \bgroup
57 \lower \lowparameter \c!down \hbox \bgroup
58 \ifx \fontsize \empty
59 \ifmmode
60 \mr
61 \else
62 \uselowstyleandcolor \c!style\c!color
63 \fi
64 \else
65 \uselowstyleandcolor \c!style\c!color
66 \fi
67 \dostarttagged \t!sub \currentlow
68 # 2
69 \dostoptagged
70 \egroup
71 \egroup
72 \ht \scratchbox\strutht
73 \dp \scratchbox\strutdp
74 \box \scratchbox
75 \endgroup }
76
77\unexpanded \def \typo_scripts_high # 1 # 2
78 { \dontleavehmode
79 \begingroup
80 \edef \currenthigh { # 1 }
81 \kern \highparameter \c!distance \relax
82 \setbox \scratchbox \runninghbox \bgroup
83 \raise \highparameter \c!up \hbox \bgroup
84 \ifx \fontsize \empty
85 \ifmmode
86 \mr
87 \else
88 \usehighstyleandcolor \c!style\c!color
89 \fi
90 \else
91 \usehighstyleandcolor \c!style\c!color
92 \fi
93 \dostarttagged \t!sup \currenthigh
94 # 2
95 \dostoptagged
96 \egroup
97 \egroup
98 \ht \scratchbox\strutht
99 \dp \scratchbox\strutdp
100 \box \scratchbox
101 \endgroup }
102
103\unexpanded \def \low { \typo_scripts_low \empty }
104\unexpanded \def \high { \typo_scripts_high \empty }
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123\installcorenamespace { lowhigh }
124
125\installcommandhandler \??lowhigh { lowhigh } \??lowhigh
126
127\setuplowhigh
128 [ \c!style = \tx ,
129 \c!distance = . 1 \exheight ,
130 \c!up = . 9 6 \exheight ,
131 \c!down = . 5 8 \exheight ]
132
133\appendtoks
134 \setuevalue \currentlowhigh { \typo_scripts_lowhigh { \currentlowhigh } \typo_scripts_lowhigh_indeed }
135\to \everydefinelowhigh
136
137\unexpanded \def \typo_scripts_lowhigh # 1
138 { \dontleavehmode
139 \runninghbox \bgroup
140 \edef \currentlowhigh { # 1 }
141 \dosingleempty }
142
143\unexpanded \def \typo_scripts_lowhigh_indeed [# 1 ]# 2 # 3
144 { \dostarttagged \t!subsup \currentlowhigh
145 \scratchdimen \lowhighparameter \c!distance \relax
146 \setbox \plusfour \hpack { \typo_scripts_lowhigh_low_high \lower \c!down\t!sub { # 2 }}
147 \setbox \plussix \hpack { \typo_scripts_lowhigh_low_high \raise \c!up \t!sup { # 3 }}
148 \edef \p_align { # 1 }
149 \ifx \p_align \v!left
150 \ifdim \wd \plusfour < \wd \plussix
151 \setbox \plusfour \hpack to \wd \plussix { \hss\box \plusfour }
152 \else
153 \setbox \plussix \hpack to \wd \plusfour { \hss\box \plussix }
154 \fi
155 \fi
156 \ifdim \wd \plusfour < \wd \plussix
157 \wd \plusfour\zeropoint
158 \box \plusfour
159 \box \plussix
160 \else
161 \wd \plussix\zeropoint
162 \box \plussix
163 \box \plusfour
164 \fi
165 \dostoptagged
166 \egroup }
167
168\def \typo_scripts_lowhigh_low_high # 1 # 2 # 3 # 4
169 { \kern \scratchdimen
170 \setbox \scratchbox \hpack \bgroup
171 # 1 \lowhighparameter # 2 \hbox \bgroup
172 \ifx \fontsize \empty
173 \ifmmode
174 \mr
175 \else
176 \uselowhighstyleandcolor \c!style\c!color
177 \fi
178 \else
179 \uselowhighstyleandcolor \c!style\c!color
180 \fi
181 \dostarttagged # 3 \empty
182 # 4
183 \dostoptagged
184 \egroup
185 \egroup
186 \ht \scratchbox\strutht
187 \dp \scratchbox\strutdp
188 \box \scratchbox }
189
190\unexpanded \def \typo_scripts_highlow_indeed [# 1 ]# 2 # 3
191 { \typo_scripts_lowhigh_indeed [# 1 ] { # 3 }{ # 2 }}
192
193\unexpanded \def \lohi { \typo_scripts_lowhigh \empty \typo_scripts_lowhigh_indeed }
194\unexpanded \def \hilo { \typo_scripts_lowhigh \empty \typo_scripts_highlow_indeed }
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217\installcorenamespace { lowmidhigh }
218
219\installcommandhandler \??lowmidhigh { lowmidhigh } \??lowmidhigh
220
221\setuplowmidhigh
222 [ \c!style = \tx ,
223 \c!up = . 8 \struthtdp ,
224 \c!down = . 8 \struthtdp ]
225
226\appendtoks
227 \setuevalue \currentlowmidhigh { \typo_scripts_lowmidhigh { \currentlowmidhigh }}
228\to \everydefinelowmidhigh
229
230\unexpanded \def \typo_scripts_lowmidhigh # 1 # 2 # 3 # 4
231 { \dontleavehmode
232 \runninghbox \bgroup
233 \edef \currentlowmidhigh { # 1 }
234 \dostarttagged \t!subsup \currentlowmidhigh
235 \uselowmidhighstyleandcolor \c!style\c!color
236 \setstrut
237 \setbox \plustwo \hbox { \strut \dostarttagged \t!sub \empty # 2 \dostoptagged }
238 \setbox \plusfour \hbox { \strut \dostarttagged \t!mid \empty # 3 \dostoptagged }
239 \setbox \plussix \hbox { \strut \dostarttagged \t!sup \empty # 4 \dostoptagged }
240 \scratchdimen \wd
241 \ifdim \wd \plustwo > \wd \plusfour
242 \ifdim \wd \plustwo > \wd \plussix
243 \plustwo
244 \else
245 \plussix
246 \fi
247 \else
248 \ifdim \wd \plusfour > \wd \plussix
249 \plusfour
250 \else
251 \plussix
252 \fi
253 \fi
254 \relax
255 \setbox \plustwo \hpack to \scratchdimen { \hss\lower \lowmidhighparameter \c!down \box \plustwo \hss }
256 \setbox \plusfour \hpack to \scratchdimen { \hss \box \plusfour \hss }
257 \setbox \plussix \hpack to \scratchdimen { \hss\raise \lowmidhighparameter \c!up \box \plussix \hss }
258 \wd \plustwo \zeropoint
259 \wd \plusfour\zeropoint
260 \box \plusfour
261 \box \plustwo
262 \box \plussix
263 \dostoptagged
264 \egroup }
265
266\unexpanded \def \lomihi { \typo_scripts_lowmidhigh \empty }
267\unexpanded \def \himilo # 1 # 2 # 3 { \typo_scripts_lowmidhigh \empty { # 3 }{ # 2 }{ # 1 }}
268
269\protect \endinput
270 |