s-math-atoms.mkxl /size: 4066 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [      file=s-math-atoms.mkxl,
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-atoms]
17
18\setvalue{atom:\number\mathordinarycode    }{ord}%inary}
19\setvalue{atom:\number\mathoperatorcode    }{ope}%rator}
20\setvalue{atom:\number\mathbinarycode      }{bin}%ary}
21\setvalue{atom:\number\mathrelationcode    }{rel}%ation}
22\setvalue{atom:\number\mathopencode        }{ope}%n}
23\setvalue{atom:\number\mathclosecode       }{clo}%se}
24\setvalue{atom:\number\mathpunctuationcode }{pun}%ctuation}
25%setvalue{atom:\number\mathinnercode       }{inn}%er}
26%setvalue{atom:\number\mathovercode        }{ove}%r}
27%setvalue{atom:\number\mathundercode       }{und}%er}
28\setvalue{atom:\number\mathfractioncode    }{fra}%ction}
29\setvalue{atom:\number\mathradicalcode     }{rad}%ical}
30\setvalue{atom:\number\mathmiddlecode      }{mid}%dle}
31%setvalue{atom:\number\mathaccentcode      }{acc}%ent}
32%setvalue{atom:\number\mathfencedcode      }{fen}%ced}
33%setvalue{atom:\number\mathvariablecode    }{var}%iable}
34%setvalue{atom:\number\mathactivecode      }{act}%ive}
35%setvalue{atom:\number\mathvcentercode     }{vce}%nter}
36%setvalue{atom:\number\mathreservedcode    }{res}%erved}
37%setvalue{atom:\number\mathimaginarycode   }{ima}%ginary}
38%setvalue{atom:\number\mathdifferentialcode}{dif}%ferential}
39%setvalue{atom:\number\mathexponentialcode }{exp}%onential}
40\setvalue{atom:\number\mathfunctioncode    }{fun}%ction}
41\setvalue{atom:\number\mathdigitcode       }{dig}%it}
42
43\dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {
44    \setmathatomrule \mathbegincode #1 \allmathstyles \mathbegincode #1
45    \setmathatomrule #1 \mathendcode \allmathstyles #1 \mathendcode
46    \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {
47        \setmathatomrule#1 ##1 \allmathstyles #1 ##1
48    }
49}
50
51\protected\def\showmathatomspacing#1{
52    \startTEXpage[offset=10pt]
53        \showmakeup[mathglue]
54        \bTABLE[align=middle,width=4em]
55            \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {%
56                \ifcsname atom:##1\endcsname
57                    \bTR
58                        \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {%
59                            \ifcsname atom:####1\endcsname
60                                \bTD
61                                    $ #1%
62                                      \mathatom class ##1   {\hpack to 1.5em{\infofont[\hss\getvalue{atom:##1}\hss]}}
63                                      \mathatom class ####1 {\hpack to 1.5em{\infofont[\hss\getvalue{atom:####1}\hss]}}
64                                    $
65                                \eTD
66                            \fi
67                        }
68                    \eTR
69                \fi
70            }
71            \bTR[frame=off]
72                \bTD[nx=12,height=6ex,align={middle,lohi}]
73                    \type{#1}
74                \eTD
75            \eTR
76            \bTR
77                \bTD[nx=12,align=middle]
78                    \infofont\hfill
79                    tiny  : \the\tinymuskip\hfill
80                    thin  : \the\thinmuskip\hfill
81                    med   : \the\medmuskip\hfill
82                    thick : \the\thickmuskip\hfill\strut
83                \eTD
84            \eTR
85        \eTABLE
86    \stopTEXpage
87}
88
89\stopmodule
90
91\continueifinputfile{s-math-atoms.mkxl}
92
93\starttext
94
95    \showmathatomspacing{\displaystyle}
96    \showmathatomspacing{\textstyle}
97    \showmathatomspacing{\scriptstyle}
98    \showmathatomspacing{\scriptscriptstyle}
99    \showmathatomspacing{\crampeddisplaystyle}
100    \showmathatomspacing{\crampedtextstyle}
101    \showmathatomspacing{\crampedscriptstyle}
102    \showmathatomspacing{\crampedscriptscriptstyle}
103
104\stoptext
105