s-math-tweaks.mkxl /size: 15 Kb    last modification: 2024-01-16 10:22
1%D \module
2%D   [      file=s-math-atoms.mksl,
3%D        version=2022.02.13,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Show Math Atom Spacing,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D This is just a quick and dirty overview.
15
16\startmodule[math-tweaks]
17
18\unprotect
19
20\starttexdefinition protected showmathfonttweaks_text_accent #1
21    \bTR
22        \bTD[width=7em,align=flushleft,style=mono] #1 \eTD
23        \bTD \m {\showglyphs \getvalue{#1}{i}  } \eTD
24        \bTD \m {\showglyphs \getvalue{#1}{I}  } \eTD
25        \bTD \m {\showglyphs \getvalue{#1}{x}  } \eTD
26        \bTD \m {\showglyphs \getvalue{#1}{X}  } \eTD
27        \bTD \m {\showglyphs \getvalue{#1}{xx} } \eTD
28        \bTD \m {\showglyphs \getvalue{#1}{XX} } \eTD
29    \eTR
30\stoptexdefinition
31
32\starttexdefinition protected showmathfonttweaks_wide_accent #1
33    \bTR
34        \bTD[width=7em,align=flushleft,style=mono] #1 \eTD
35        \bTD \m {\showglyphs \getvalue{#1}{i}     } \eTD
36        \bTD \m {\showglyphs \getvalue{#1}{I}     } \eTD
37        \bTD \m {\showglyphs \getvalue{#1}{x}     } \eTD
38        \bTD \m {\showglyphs \getvalue{#1}{X}     } \eTD
39        \bTD \m {\showglyphs \getvalue{#1}{xx}    } \eTD
40        \bTD \m {\showglyphs \getvalue{#1}{XX}    } \eTD
41        \bTD \m {\showglyphs \getvalue{#1}{xxxxx} } \eTD
42        \bTD \m {\showglyphs \getvalue{#1}{XXXXX} } \eTD
43    \eTR
44\stoptexdefinition
45
46\starttexdefinition protected showmathfonttweaks_prime #1
47    \bTR
48        \bTD \type{#1} \eTD
49        \bTD \m {\showglyphs #1} \eTD
50    \eTR
51\stoptexdefinition
52
53\starttexdefinition protected showmathfonttweaks_bracer #1
54    \bTR
55        \bTD \type{#1} \eTD
56        \bTD \m {\showglyphs \getvalue{#1}{x}     } \eTD
57        \bTD \m {\showglyphs \getvalue{#1}{xxxxx} } \eTD
58        \bTD \m {\showglyphs \getvalue{#1}{X}     } \eTD
59        \bTD \m {\showglyphs \getvalue{#1}{XXXXX} } \eTD
60    \eTR
61\stoptexdefinition
62
63\starttexdefinition protected showmathfonttweaks
64
65    \startsubject[title=text accents]
66        \startlinecorrection
67            \bTABLE[align=middle,offset=1ex]
68                \showmathfonttweaks_text_accent{grave}
69                \showmathfonttweaks_text_accent{bar}
70                \showmathfonttweaks_text_accent{acute}
71                \showmathfonttweaks_text_accent{hat}
72                \showmathfonttweaks_text_accent{check}
73                \showmathfonttweaks_text_accent{breve}
74                \showmathfonttweaks_text_accent{dot}
75                \showmathfonttweaks_text_accent{ring}
76                \showmathfonttweaks_text_accent{tilde}
77                \showmathfonttweaks_text_accent{ddot}
78                \showmathfonttweaks_text_accent{dddot}
79            \eTABLE
80        \stoplinecorrection
81    \stopsubject
82
83    \startsubject[title=wide accents]
84        \startlinecorrection
85            \bTABLE[align=middle,offset=1ex]
86                \showmathfonttweaks_wide_accent{widegrave}
87                \showmathfonttweaks_wide_accent{widebar}
88                \showmathfonttweaks_wide_accent{wideacute}
89                \showmathfonttweaks_wide_accent{widehat}
90                \showmathfonttweaks_wide_accent{widecheck}
91                \showmathfonttweaks_wide_accent{widebreve}
92                \showmathfonttweaks_wide_accent{widedot}
93                \showmathfonttweaks_wide_accent{widering}
94                \showmathfonttweaks_wide_accent{widetilde}
95                \showmathfonttweaks_wide_accent{wideddot}
96                \showmathfonttweaks_wide_accent{widedddot}
97            \eTABLE
98        \stoplinecorrection
99    \stopsubject
100
101    \startsubject[title=primes]
102        \startlinecorrection
103            \bTABLE[align=flushleft,offset=1ex]
104                \showmathfonttweaks_prime{x'}
105                \showmathfonttweaks_prime{x''}
106                \showmathfonttweaks_prime{x'''}
107                \showmathfonttweaks_prime{X'}
108                \showmathfonttweaks_prime{X''}
109                \showmathfonttweaks_prime{X'''}
110                \showmathfonttweaks_prime{x'}
111                \showmathfonttweaks_prime{x'^2}
112                \showmathfonttweaks_prime{x'_2}
113                \showmathfonttweaks_prime{x'^2_2}
114                \showmathfonttweaks_prime{x'}
115                \showmathfonttweaks_prime{x^2'}
116                \showmathfonttweaks_prime{x_2'}
117                \showmathfonttweaks_prime{x^2_2'}
118            \eTABLE
119        \stoplinecorrection
120    \stopsubject
121
122    \startsubject[title=bracers]
123        \startlinecorrection
124            \bTABLE[align=flushleft,offset=1ex]
125                \showmathfonttweaks_bracer{overbrace}
126                \showmathfonttweaks_bracer{underbrace}
127                \showmathfonttweaks_bracer{overbracket}
128                \showmathfonttweaks_bracer{underbracket}
129                \showmathfonttweaks_bracer{overparent}
130                \showmathfonttweaks_bracer{underparent}
131                \showmathfonttweaks_bracer{overbar}
132                \showmathfonttweaks_bracer{underbar}
133                \showmathfonttweaks_bracer{overline}
134                \showmathfonttweaks_bracer{underline}
135            \eTABLE
136        \stoplinecorrection
137    \stopsubject
138
139    \startsubject[title=whatever]
140        \startlinecorrection
141            \bTABLE[align=flushleft,offset=1ex]
142                \bTR
143                    \bTD \m{\mfunction{máx}}\eTD
144                \eTR
145            \eTABLE
146        \stoplinecorrection
147    \stopsubject
148\stoptexdefinition
149
150\starttexdefinition protected showmathalphabettweaks_check_flush #1
151    \dontleavehmode
152    \hbox \bgroup
153        \smallinfofont
154        \setstrut
155        \lower \dimexpr\dp\scratchbox+\ht\strutbox\relax \hbox to \wd\scratchbox\bgroup
156            \hss
157            \strut
158            \hexnumber{#1}
159            \hss
160        \egroup
161        \hskip-\wd\scratchbox
162        \box\scratchbox
163    \egroup
164\stoptexdefinition
165
166\starttexdefinition protected showmathalphabettweaks_check_scripts
167    \subscript     1
168    \superscript   2
169    \subprescript  3
170    \superprescript4
171\stoptexdefinition
172
173\starttexdefinition protected showmathalphabettweaks_check_hat #1
174    \setbox\scratchbox\ruledhbox {
175        \im {
176            \resetmathattributes
177            \widehat{\tocharacter#1}
178            \showmathalphabettweaks_check_scripts
179       }
180    }
181    \showmathalphabettweaks_check_flush{#1}
182\stoptexdefinition
183
184\starttexdefinition protected showmathalphabettweaks_check_fences #1
185    \setbox\scratchbox\ruledhbox {
186        \im {
187            \resetmathattributes
188            \left(
189                \tocharacter#1\relax
190                \showmathalphabettweaks_check_scripts
191            \right)
192        }
193    }
194    \showmathalphabettweaks_check_flush{#1}
195\stoptexdefinition
196
197\starttexdefinition protected showmathalphabettweaks_check #1#2
198   \startsubsubsubject[title=#1]
199       \traverseblock {#1} {
200         \begingroup
201         \showglyphs
202         \showfontitalics
203         \showfontkerns
204         #2{##1}%
205         \endgroup
206         \space\space
207       }
208       \removeunwantedspaces
209   \stopsubsubsubject
210\stoptexdefinition
211
212\starttexdefinition protected showmathalphabettweaks_all #1
213    \startsubsubject[title={Numbers}]
214        \showmathalphabettweaks_check{digits normal}#1
215        \showmathalphabettweaks_check{digits bold}#1
216        \showmathalphabettweaks_check{digits sansserif normal}#1
217        \showmathalphabettweaks_check{digits sansserif bold}#1
218        \showmathalphabettweaks_check{digits monospace}#1
219        \showmathalphabettweaks_check{digits doublestruck}#1
220    \stopsubsubject
221    \startsubsubject[title={Lowercase}]
222        \showmathalphabettweaks_check{lowercase normal}#1
223        \showmathalphabettweaks_check{lowercase italic}#1
224        \showmathalphabettweaks_check{lowercase bold}#1
225        \showmathalphabettweaks_check{lowercase bold italic}#1
226        \showmathalphabettweaks_check{lowercase sansserif normal}#1
227        \showmathalphabettweaks_check{lowercase sansserif italic}#1
228        \showmathalphabettweaks_check{lowercase sansserif bold}#1
229        \showmathalphabettweaks_check{lowercase sansserif bolditalic}#1
230        \showmathalphabettweaks_check{lowercase monospace}#1
231        \showmathalphabettweaks_check{lowercase fraktur}#1
232        \showmathalphabettweaks_check{lowercase bold fraktur}#1
233        \showmathalphabettweaks_check{lowercase script}#1
234        \showmathalphabettweaks_check{lowercase bold script}#1
235        \showmathalphabettweaks_check{lowercase doublestruck}#1
236        \showmathalphabettweaks_check{lowercase greek normal}#1
237        \showmathalphabettweaks_check{lowercase greek italic}#1
238        \showmathalphabettweaks_check{lowercase greek bold}#1
239        \showmathalphabettweaks_check{lowercase greek bold italic}#1
240      % \showmathalphabettweaks_check{lowercase greek sansserif normal}#1
241      % \showmathalphabettweaks_check{lowercase greek sansserif italic}#1
242        \showmathalphabettweaks_check{lowercase greek sansserif bold}#1
243        \showmathalphabettweaks_check{lowercase greek sansserif bolditalic}#1
244    \stopsubsubject
245    \startsubsubject[title={Uppercase}]
246        \showmathalphabettweaks_check{uppercase normal}#1
247        \showmathalphabettweaks_check{uppercase italic}#1
248        \showmathalphabettweaks_check{uppercase bold}#1
249        \showmathalphabettweaks_check{uppercase bolditalic}#1
250        \showmathalphabettweaks_check{uppercase sansserif normal}#1
251        \showmathalphabettweaks_check{uppercase sansserif italic}#1
252        \showmathalphabettweaks_check{uppercase sansserif bold}#1
253        \showmathalphabettweaks_check{uppercase sansserif bolditalic}#1
254        \showmathalphabettweaks_check{uppercase monospace}#1
255        \showmathalphabettweaks_check{uppercase fraktur}#1
256        \showmathalphabettweaks_check{uppercase bold fraktur}#1
257        \showmathalphabettweaks_check{uppercase script}#1
258        \showmathalphabettweaks_check{uppercase bold script}#1
259        \showmathalphabettweaks_check{uppercase doublestruck}#1
260        \showmathalphabettweaks_check{uppercase greek normal}#1
261        \showmathalphabettweaks_check{uppercase greek italic}#1
262        \showmathalphabettweaks_check{uppercase greek bold}#1
263        \showmathalphabettweaks_check{uppercase greek bolditalic}#1
264        \showmathalphabettweaks_check{uppercase greek sansserif bold}#1
265        \showmathalphabettweaks_check{uppercase greek sansserif bolditalic}#1
266    \stopsubsubject
267\stoptexdefinition
268
269\starttexdefinition protected showmathaccenttweaks
270    \showmathalphabettweaks_all\showmathalphabettweaks_check_hat
271\stoptexdefinition
272
273\starttexdefinition protected showmathfencetweaks
274    \showmathalphabettweaks_all\showmathalphabettweaks_check_fences
275\stoptexdefinition
276
277\starttexdefinition protected showmathmiddletweaks
278    \dostepwiserecurse {5} {75} {1} {
279        $\left\{
280         \mathatom class \mathconstructcode \bgroup \vcenter \bgroup \hbox \bgroup
281          \blackrule
282            [\c!height=\dimexpr##1pt/2\relax,
283             \c!depth=\dimexpr##1pt/2\relax,
284             \c!width=\emwidth,
285             \c!color=darkblue]%
286        \egroup \egroup \egroup
287        \middle|
288      % \begingroup\darkblue\scriptscriptstyle\mathtt{##1}\endgroup
289        \right)$
290        \space
291    }
292    \removeunwantedspaces
293\stoptexdefinition
294
295\starttexdefinition protected showmathvarianttweaks
296\dm {
297    \dorecurse {\nofmathvariants "28} {
298        \char \getmathvariant ##1 "28
299        \char \getmathvariant ##1 "7B
300        \char \getmathvariant ##1 "7C
301        \char \getmathvariant ##1 "7D
302        \char \getmathvariant ##1 "29
303    }
304}
305\stoptexdefinition
306
307\protect
308
309\stopmodule
310
311\continueifinputfile{s-math-tweaks.mkxl}
312
313\setuplayout
314  [tight]
315
316\setuphead
317  [chapter]
318  [style=\bfd]
319
320\setuphead
321  [section]
322  [style=\bfc]
323
324\setuphead
325  [subsection]
326  [style=\bfb]
327
328\setuphead
329  [subsubsection]
330  [before=\blank,
331   style=\bfa]
332
333% \enabletrackers[math.tweaks]
334
335\starttext
336
337%     \definefontfeature[mathextra][compose=yes]
338
339    \doifelse {\getdocumentargument{bodyfont}} {} {
340
341%         \setupbodyfont[cambria,10pt]   \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
342%          \setupbodyfont[modern]         \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
343%         \setupbodyfont[pagella]        \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
344%         \setupbodyfont[termes]         \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
345%         \setupbodyfont[bonum]          \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
346%         \setupbodyfont[schola]         \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
347%         \setupbodyfont[lucidaot,10pt]  \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
348%         \setupbodyfont[ebgaramond]     \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
349%         \setupbodyfont[stixtwo]        \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
350
351%         \setupbodyfont[bonum]          \starttitle[title=\fontclass] \showmathaccenttweaks \stoptitle
352
353%         \setupbodyfont[bonum]          \starttitle[title=\fontclass] \showmathfencetweaks \stoptitle
354        \setupbodyfont[bonum]          \starttitle[title=\fontclass] \showmathmiddletweaks \stoptitle
355%         \setupbodyfont[modern]          \starttitle[title=\fontclass] \showmathfencetweaks \stoptitle
356
357    } {
358
359        \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]}
360        \showmathfonttweaks
361        \showmathaccenttweaks
362        \showmathfencetweaks
363        \showmathmiddletweaks
364        \showmathvarianttweaks
365    }
366
367\stoptext
368
369% \setupbodyfont[10pt]
370%
371% \starttext
372%
373% \setupmathematics[integral=limits]
374%
375% \mathlimitsmode 1
376%
377% \startTEXpage[offset=1ts] \showboxes \showglyphs
378% \dontleavehmode
379% \ruledhbox{\dm{\left|\integral^{!!!!!!!!!!!}\right|}}
380% \ruledhbox{\dm{\left|\integral^{!!!!!!!!!!} \right|}}
381% \ruledhbox{\dm{\left|\integral^{!!!!!!!!!}  \right|}}
382% \ruledhbox{\dm{\left|\integral^{!!!!!!!!}   \right|}}
383% \ruledhbox{\dm{\left|\integral^{!!!!!!!}    \right|}}
384% \ruledhbox{\dm{\left|\integral^{!!!!!!}     \right|}}
385% \ruledhbox{\dm{\left|\integral^{!!!!!}      \right|}}
386% \ruledhbox{\dm{\left|\integral^{!!!!}       \right|}}
387% \ruledhbox{\dm{\left|\integral^{!!!}        \right|}}
388% \ruledhbox{\dm{\left|\integral^{!!}         \right|}}
389% \ruledhbox{\dm{\left|\integral^{!}          \right|}}
390% \blank
391% \dontleavehmode
392% \ruledhbox{\dm{\left|\integral_{!!!!!!!!!!!}\right|}}
393% \ruledhbox{\dm{\left|\integral_{!!!!!!!!!!} \right|}}
394% \ruledhbox{\dm{\left|\integral_{!!!!!!!!!}  \right|}}
395% \ruledhbox{\dm{\left|\integral_{!!!!!!!!}   \right|}}
396% \ruledhbox{\dm{\left|\integral_{!!!!!!!}    \right|}}
397% \ruledhbox{\dm{\left|\integral_{!!!!!!}     \right|}}
398% \ruledhbox{\dm{\left|\integral_{!!!!!}      \right|}}
399% \ruledhbox{\dm{\left|\integral_{!!!!}       \right|}}
400% \ruledhbox{\dm{\left|\integral_{!!!}        \right|}}
401% \ruledhbox{\dm{\left|\integral_{!!}         \right|}}
402% \ruledhbox{\dm{\left|\integral_{!}          \right|}}
403% \blank
404% \dontleavehmode
405% \ruledhbox{\dm{\left|\integral_{!}      ^{!}              \right|}}
406% \ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!}              \right|}}
407% \ruledhbox{\dm{\left|\integral_{!}      ^{!!!!!!!}        \right|}}
408% \ruledhbox{\dm{\left|\integral_{!}      ^{!!!!!!!!!!}     \right|}}
409% \ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!!!!!!!!!}      \right|}}
410% \ruledhbox{\dm{\left|\integral_{!!!!!!!}^{!!!!!!!!!!!!!!!}\right|}}
411% \ruledhbox{\dm{\left|\integral^{\mtext{for demanding}}_{\mtext{integral freaks}}\right|}}
412% \stopTEXpage
413%
414% \stoptext
415