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=.48\exheight]
46\setuphigh[\c!style=\tx,\c!distance=\zeropoint,\c!up =.86\exheight]
47
48\appendtoks \frozen\protected\edefcsname\currentlow \endcsname{\typo_scripts_low [\currentlow ]}\to \everydefinelow
49\appendtoks \frozen\protected\edefcsname\currenthigh\endcsname{\typo_scripts_high[\currenthigh]}\to \everydefinehigh
50
51\def\typo_scripts_distance#1
52 {\edef\p_distance{#1\c!distance}
53 \ifx\p_distance\v!tight
54 \tightfitboundary
55 \else
56 \kern\p_distance\relax
57 \fi}
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76\protected\def\typo_scripts_low[#1]#2
77 {\dontleavehmode
78 \begingroup
79 \cdef\currentlow{#1}
80 \typo_scripts_distance\lowparameter
81 \setbox\scratchbox\runninghbox\bgroup
82 \lower\lowparameter\c!down\hbox\bgroup
83 \ifempty\fontsize
84 \ifmmode
85 \mr
86 \else
87 \uselowstyleandcolor\c!style\c!color
88 \fi
89 \else
90 \uselowstyleandcolor\c!style\c!color
91 \fi
92 \dostarttagged\t!sub\currentlow
93 #2
94 \dostoptagged
95 \egroup
96 \egroup
97 \ht\scratchbox\strutht
98 \dp\scratchbox\strutdp
99 \box\scratchbox
100 \endgroup}
101
102\protected\def\typo_scripts_high[#1]#2
103 {\dontleavehmode
104 \begingroup
105 \cdef\currenthigh{#1}
106 \typo_scripts_distance\highparameter
107 \setbox\scratchbox\runninghbox\bgroup
108 \raise\highparameter\c!up\hbox\bgroup
109 \ifempty\fontsize
110 \ifmmode
111 \mr
112 \else
113 \usehighstyleandcolor\c!style\c!color
114 \fi
115 \else
116 \usehighstyleandcolor\c!style\c!color
117 \fi
118 \dostarttagged\t!sup\currenthigh
119 #2
120 \dostoptagged
121 \egroup
122 \egroup
123 \ht\scratchbox\strutht
124 \dp\scratchbox\strutdp
125 \box\scratchbox
126 \endgroup}
127
128\permanent\protected\def\low {\typo_scripts_low []}
129\permanent\protected\def\high{\typo_scripts_high[]}
130
131\setuplow [\c!distance=\v!tight]
132\setuphigh[\c!distance=\v!tight]
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151\installcorenamespace {lowhigh}
152
153\installcommandhandler \??lowhigh {lowhigh} \??lowhigh
154
155\setuplowhigh
156 [\c!style=\tx,
157 \c!distance=.1\exheight,
158 \c!up=.96\exheight,
159 \c!down=.58\exheight]
160
161\appendtoks
162 \frozen\edefcsname\currentlowhigh\endcsname{\typo_scripts_lowhigh[\currentlowhigh]}
163\to \everydefinelowhigh
164
165\tolerant\protected\def\typo_scripts_lowhigh[#1]#*[#2]#:#3#4
166 {\dontleavehmode
167 \runninghbox\bgroup
168 \cdef\currentlowhigh{#1}
169 \typo_scripts_distance\lowhighparameter
170 \dostarttagged\t!subsup\currentlowhigh
171 \setbox\plusfour\hpack{\typo_scripts_lowhigh_low_high\lower\c!down\t!sub{#3}}
172 \setbox\plussix \hpack{\typo_scripts_lowhigh_low_high\raise\c!up \t!sup{#4}}
173 \edef\p_align{#2}
174 \ifx\p_align\v!left
175 \ifdim\wd\plusfour<\wd\plussix
176 \setbox\plusfour\hpack to \wd\plussix {\hss\box\plusfour}
177 \else
178 \setbox\plussix \hpack to \wd\plusfour{\hss\box\plussix }
179 \fi
180 \fi
181 \ifdim\wd\plusfour<\wd\plussix
182 \wd\plusfour\zeropoint
183 \box\plusfour
184 \box\plussix
185 \else
186 \wd\plussix\zeropoint
187 \box\plussix
188 \box\plusfour
189 \fi
190 \dostoptagged
191 \egroup}
192
193\def\typo_scripts_lowhigh_low_high#1#2#3#4
194 {\setbox\scratchbox\hpack\bgroup
195 #1\lowhighparameter#2\hbox\bgroup
196 \ifempty\fontsize
197 \ifmmode
198 \mr
199 \else
200 \uselowhighstyleandcolor\c!style\c!color
201 \fi
202 \else
203 \uselowhighstyleandcolor\c!style\c!color
204 \fi
205 \dostarttaggednodetail#3
206 #4
207 \dostoptagged
208 \egroup
209 \egroup
210 \ht\scratchbox\strutht
211 \dp\scratchbox\strutdp
212 \box\scratchbox}
213
214\permanent\tolerant\protected\def\typo_scripts_highlow[#1]#*[#2]#:#3#4
215 {\typo_scripts_lowhigh[#1][#2]{#4}{#3}}
216
217\permanent\protected\def\lohi{\typo_scripts_lowhigh[]}
218\permanent\protected\def\hilo{\typo_scripts_highlow[]}
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241\installcorenamespace {lowmidhigh}
242
243\installcommandhandler \??lowmidhigh {lowmidhigh} \??lowmidhigh
244
245\setuplowmidhigh
246 [\c!style=\tx,
247 \c!up=.8\struthtdp,
248 \c!down=.8\struthtdp]
249
250\appendtoks
251 \frozen\edefcsname\currentlowmidhigh\endcsname{\typo_scripts_lowmidhigh[\currentlowmidhigh]}
252\to \everydefinelowmidhigh
253
254\protected\def\typo_scripts_lowmidhigh[#1]#2#3#4
255 {\dontleavehmode
256 \runninghbox\bgroup
257 \cdef\currentlowmidhigh{#1}
258 \dostarttagged\t!subsup\currentlowmidhigh
259 \uselowmidhighstyleandcolor\c!style\c!color
260 \setstrut
261 \setbox\plustwo \hbox{\strut\dostarttaggednodetail\t!sub#2\dostoptagged}
262 \setbox\plusfour\hbox{\strut\dostarttaggednodetail\t!mid#3\dostoptagged}
263 \setbox\plussix \hbox{\strut\dostarttaggednodetail\t!sup#4\dostoptagged}
264 \scratchdimen \wd
265 \ifdim\wd\plustwo>\wd\plusfour
266 \ifdim\wd\plustwo>\wd\plussix
267 \plustwo
268 \else
269 \plussix
270 \fi
271 \else
272 \ifdim\wd\plusfour>\wd\plussix
273 \plusfour
274 \else
275 \plussix
276 \fi
277 \fi
278 \relax
279 \setbox\plustwo \hpack to \scratchdimen{\hss\lower\lowmidhighparameter\c!down\box\plustwo \hss}
280 \setbox\plusfour\hpack to \scratchdimen{\hss \box\plusfour\hss}
281 \setbox\plussix \hpack to \scratchdimen{\hss\raise\lowmidhighparameter\c!up \box\plussix \hss}
282 \wd\plustwo \zeropoint
283 \wd\plusfour\zeropoint
284 \box\plusfour
285 \box\plustwo
286 \box\plussix
287 \dostoptagged
288 \egroup}
289
290\permanent\protected\def\lomihi {\typo_scripts_lowmidhigh[]}
291\permanent\protected\def\himilo#1#2#3{\typo_scripts_lowmidhigh[]{#3}{#2}{#1}}
292
293\protect \endinput
294 |