summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/modules/mkiv/s-math-extensibles.mkiv
blob: cc6fd1b00de13787d519f360d2f9f8d28f10aafe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
%D \module
%D   [      file=s-math-extensibles.mkiv,
%D        version=2013.02.03,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Math Stackers Checking,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This module provides a macro that will typeset a table of (horizontal)
%D extensibles including some tracing. You can set up the \type {demo}
%D stacker category to tweak things.
%D
%D \starttyping
%D \showmathextensibles[alternative=a|b]
%D \stoptyping

\startmodule[math-extensibles]

\unprotect

\definemathstackers
  [demo]
  [math]
  [\c!offset=\v!max]

\installcorenamespace{modulemathextensibles}
\installcorenamespace{modulemathextensiblesalternative}

\installdirectsetuphandler \??modulemathextensibles {modulemathextensibles}

\setupmodulemathextensibles
  [\c!alternative=\v!a]

\unexpanded\def\showmathextensibles
  {\dosingleempty\module_math_extensibles_show_all}

\def\module_math_extensibles_show_all[#1]%
  {\begingroup
   \setupcurrentmodulemathextensibles[#1]%
   \expandnamespacevalue\??modulemathextensiblesalternative\c!alternative\v!a
   \endgroup}

\def\modulemathextensiblesalternativea#1#2#3%
  {\NC U+#1
   \NC \filledhboxm{\math{\char"#1}}
   \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{bottom}}}
   \NC \hbox{\math{\mathstacker[demo]{"#1}{}{bottom}}}
   \NC \hbox{\math{\mathstacker[demo]{"#1}{top}{}}}
   \NC \nohyphens \veryraggedright #2
   \NC\NR}

\setvalue{\??modulemathextensiblesalternative\v!a}%
  {\enabletrackers[math.stackers.texts]
   \starttabulate[|Tl|l|l|l|l|Tp|]
   \ctxlua { moduledata.math.extensibles.show {
        command = "modulemathextensiblesalternativea",
   } }
   \stoptabulate
   \disabletrackers[math.stackers.texts]}

\def\modulemathextensiblesalternativeb#1#2#3%
  {\NC U+#1
   \NC \math{\char"#1}
   \NC \nohyphens \veryraggedright #3
   \NC \NR}

\setvalue{\??modulemathextensiblesalternative\v!b}%
  {\enabletrackers[math.stackers.texts]
   \starttabulate[|Tl|l|Tp|]
   \ctxlua { moduledata.math.extensibles.show {
        command = "modulemathextensiblesalternativeb",
        sparse  = true,
   } }
   \stoptabulate
   \disabletrackers[math.stackers.texts]}

\startluacode
    moduledata.math             = moduledata.math             or { }
    moduledata.math.extensibles = moduledata.math.extensibles or { }

    function moduledata.math.extensibles.show(settings)
        local command = settings.command
        local sparse  = settings.sparse
        for k, v in table.sortedhash(characters.data) do
            local mathextensible = v.mathextensible
            if mathextensible == "r" or mathextensible == "l" or mathextensible == "h" then
                local names = { }
                local mathname = v.mathname
                if mathname then
                    names[#names+1] = v.mathclass .. ":"  .. mathname
                end
                local mathspec = v.mathspec
                if mathspec then
                    for i=1,#mathspec do
                        local v = mathspec[i]
                        names[#names+1] = v.class .. ":"  .. v.name
                    end
                end
                local mathfiller = v.mathfiller
                if mathfiller then
                    names[#names+1] = "filler:" .. mathfiller
                end
                if not sparse or #names > 0 then
                    context[command](string.format("%04X",k),v.description,table.concat(names," "))
                end
            end
        end
    end
\stopluacode

\protect

\stopmodule

\continueifinputfile{s-math-extensibles.mkiv}

\setuplayout
  [width=middle,
   height=middle,
   footer=0cm,
   backspace=1.5cm,
   topspace=1.5cm]

\setuphead[chapter][style=\bfc]
\setuphead[section][style=\bfa]

\starttext

    \dowith {a,b} {

        \page                          \title {Latin Modern} \showmathextensibles[alternative=#1]
        \page \setupbodyfont[pagella]  \title {Pagella}      \showmathextensibles[alternative=#1]
        \page \setupbodyfont[termes]   \title {Termes}       \showmathextensibles[alternative=#1]
        \page \setupbodyfont[dejavu]   \title {Xits}         \showmathextensibles[alternative=#1]
        \page \setupbodyfont[cambria]  \title {Cambria}      \showmathextensibles[alternative=#1]
        \page \setupbodyfont[lucidaot] \title {Lucida}       \showmathextensibles[alternative=#1]

    }

\stoptext