s-math-extensibles.mkiv /size: 4584 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-math-extensibles.mkiv,
3%D        version=2013.02.03,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Math Stackers Checking,
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 module provides a macro that will typeset a table of (horizontal)
15%D extensibles including some tracing. You can set up the \type {demo}
16%D stacker category to tweak things.
17%D
18%D \starttyping
19%D \showmathextensibles[alternative=a|b]
20%D \stoptyping
21
22\startmodule[math-extensibles]
23
24\unprotect
25
26\definemathstackers
27  [demo]
28  [math]
29  [\c!offset=\v!max]
30
31\installcorenamespace{modulemathextensibles}
32\installcorenamespace{modulemathextensiblesalternative}
33
34\installdirectsetuphandler \??modulemathextensibles {modulemathextensibles}
35
36\setupmodulemathextensibles
37  [\c!alternative=\v!a]
38
39\unexpanded\def\showmathextensibles
40  {\dosingleempty\module_math_extensibles_show_all}
41
42\def\module_math_extensibles_show_all[#1]%
43  {\begingroup
44   \setupcurrentmodulemathextensibles[#1]%
45   \expandnamespacevalue\??modulemathextensiblesalternative\c!alternative\v!a
46   \endgroup}
47
48\def\modulemathextensiblesalternativea#1#2#3%
49  {\NC U+#1
50   \NC \filledhboxm{\math{\char"#1}}
51   \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{bottom}}}
52   \NC \hbox{\math{\mathstacker[demo]{"#1}{}{bottom}}}
53   \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{}}}
54   \NC \nohyphens \veryraggedright #2
55   \NC\NR}
56
57\setvalue{\??modulemathextensiblesalternative\v!a}%
58  {\enabletrackers[math.stackers.texts]
59   \starttabulate[|Tl|l|l|l|l|Tp|]
60   \ctxlua { moduledata.math.extensibles.show {
61        command = "modulemathextensiblesalternativea",
62   } }
63   \stoptabulate
64   \disabletrackers[math.stackers.texts]}
65
66\def\modulemathextensiblesalternativeb#1#2#3%
67  {\NC U+#1
68   \NC \math{\char"#1}
69   \NC \nohyphens \veryraggedright #3
70   \NC \NR}
71
72\setvalue{\??modulemathextensiblesalternative\v!b}%
73  {\enabletrackers[math.stackers.texts]
74   \starttabulate[|Tl|l|Tp|]
75   \ctxlua { moduledata.math.extensibles.show {
76        command = "modulemathextensiblesalternativeb",
77        sparse  = true,
78   } }
79   \stoptabulate
80   \disabletrackers[math.stackers.texts]}
81
82\startluacode
83    moduledata.math             = moduledata.math             or { }
84    moduledata.math.extensibles = moduledata.math.extensibles or { }
85
86    function moduledata.math.extensibles.show(settings)
87        local command = settings.command
88        local sparse  = settings.sparse
89        for k, v in table.sortedhash(characters.data) do
90            local mathextensible = v.mathextensible
91            if mathextensible == "r" or mathextensible == "l" or mathextensible == "h" then
92                local names = { }
93                local mathname = v.mathname
94                if mathname then
95                    names[#names+1] = v.mathclass .. ":"  .. mathname
96                end
97                local mathspec = v.mathspec
98                if mathspec then
99                    for i=1,#mathspec do
100                        local v = mathspec[i]
101                        names[#names+1] = v.class .. ":"  .. v.name
102                    end
103                end
104                local mathfiller = v.mathfiller
105                if mathfiller then
106                    names[#names+1] = "filler:" .. mathfiller
107                end
108                if not sparse or #names > 0 then
109                    context[command](string.format("%04X",k),v.description,table.concat(names," "))
110                end
111            end
112        end
113    end
114\stopluacode
115
116\protect
117
118\stopmodule
119
120\continueifinputfile{s-math-extensibles.mkiv}
121
122\setuplayout
123  [width=middle,
124   height=middle,
125   footer=0cm,
126   backspace=1.5cm,
127   topspace=1.5cm]
128
129\setuphead[chapter][style=\bfc]
130\setuphead[section][style=\bfa]
131
132\starttext
133
134    \dowith {a,b} {
135
136        \page                          \title {Latin Modern} \showmathextensibles[alternative=#1]
137        \page \setupbodyfont[pagella]  \title {Pagella}      \showmathextensibles[alternative=#1]
138        \page \setupbodyfont[termes]   \title {Termes}       \showmathextensibles[alternative=#1]
139        \page \setupbodyfont[dejavu]   \title {Xits}         \showmathextensibles[alternative=#1]
140        \page \setupbodyfont[cambria]  \title {Cambria}      \showmathextensibles[alternative=#1]
141        \page \setupbodyfont[lucidaot] \title {Lucida}       \showmathextensibles[alternative=#1]
142
143    }
144
145\stoptext
146