summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/meta-imp-mat.mkiv
blob: 8913845fd0e1ff668b0d09efdc8a959110f014b2 (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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
%D \module
%D   [       file=meta-mat,
%D        version=2013.07.19,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Math,
%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 is just an example library not meant for production.

% A few accents:

% / for cambria

\startMPextensions
    vardef math_stacker_overbracket_shape =
        image (
            draw
                (0,OverlayOffset) --
                (0,OverlayHeight-OverlayOffset) --
                (OverlayWidth,OverlayHeight-OverlayOffset) --
                (OverlayWidth,OverlayOffset)
            withcolor
                OverlayLineColor ;
            setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
        )
    enddef ;
    vardef math_stacker_underbracket_shape =
        math_stacker_overbracket_shape rotated 180
    enddef ;
    vardef math_stacker_overparent_shape =
        image (
            draw
                (0,OverlayOffset) ...
                (OverlayWidth/2,OverlayHeight-OverlayOffset) ...
                (OverlayWidth,OverlayOffset)
            withcolor
                OverlayLineColor ;
            setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
        )
    enddef ;
    vardef math_stacker_underparent_shape =
        math_stacker_overparent_shape rotated 180
    enddef ;
    vardef math_stacker_overbrace_shape =
        image (
            draw
                (0,OverlayOffset) ...
                (OverlayWidth/4-OverlayOffset,OverlayHeight-OverlayOffset) ...
                (OverlayWidth/2-OverlayOffset,OverlayHeight-OverlayOffset) ...
                (OverlayWidth/2,OverlayHeight) &
                (OverlayWidth/2,OverlayHeight) ...
                (OverlayWidth/2+OverlayOffset,OverlayHeight-OverlayOffset) ...
                (3OverlayWidth/4+OverlayOffset,OverlayHeight-OverlayOffset) ...
                (OverlayWidth,OverlayOffset)
            withcolor
                OverlayLineColor ;
            setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
        )
    enddef ;
    vardef math_stacker_underbrace_shape =
        math_stacker_overbrace_shape rotated 180
    enddef ;
    vardef math_stacker_overbar_shape =
        image (
            draw
                (0,OverlayOffset) -- (OverlayWidth,OverlayOffset)
            withcolor
                OverlayLineColor ;
            setbounds currentpicture to boundingbox currentpicture bottomenlarged OverlayOffset ;
        )
    enddef ;
    vardef math_stacker_underbar_shape =
        math_stacker_overbar_shape rotated 180
    enddef ;
    vardef math_stacker_arrow_shape =
        image (
            drawarrow
                (OverlayWidth,OverlayOffset) -- (0,OverlayOffset)
            withcolor
                OverlayLineColor ;
            setbounds currentpicture to boundingbox currentpicture bottomenlarged (OverlayOffset/2) topenlarged (OverlayOffset/2) ;
        )
    enddef ;
    vardef math_stacker_leftarrow_shape =
        math_stacker_arrow_shape
    enddef ;
    vardef math_stacker_rightarrow_shape =
        math_stacker_arrow_shape rotated 180
    enddef ;
    def math_stacker_draw(expr p) =
        draw
            p
        withpen
            pencircle
                xscaled (2OverlayLineWidth)
              % yscaled (3OverlayLineWidth/4)
                yscaled (3OverlayLineWidth)
              % rotated 30 ;
                rotated 45 ;
    enddef ;
\stopMPextensions

\startuniqueMPgraphic{math:stacker:\number"FE3B4}
    math_stacker_draw(math_stacker_overbracket_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE3B5}
    math_stacker_draw(math_stacker_underbracket_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE3DC}
    math_stacker_draw(math_stacker_overparent_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE3DD}
    math_stacker_draw(math_stacker_underparent_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE3DE}
    math_stacker_draw(math_stacker_overbrace_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE3DF}
    math_stacker_draw(math_stacker_underbrace_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE33E}
    math_stacker_draw(math_stacker_overbar_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"FE33F}
    math_stacker_draw(math_stacker_underbar_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"2190}
    math_stacker_draw(math_stacker_leftarrow_shape) ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{math:stacker:\number"2192}
    math_stacker_draw(math_stacker_rightarrow_shape) ;
\stopuniqueMPgraphic

%D Radicals:

\startMPextensions
    vardef math_radical_simple(expr w,h,d,o) =
        (-h/2-o,h/2-o) --
        (-h/4-o,-d-o)  --
        (-o,h+o)       --
        (w+o,h+o)      --
        (w+o,h-h/10+o)
    enddef ;
\stopMPextensions

\startuniqueMPgraphic{math:radical:default}%{...}
    draw
        math_radical_simple(OverlayWidth,OverlayHeight,OverlayDepth,OverlayOffset)
        withpen pencircle xscaled (2OverlayLineWidth) yscaled (3OverlayLineWidth/4) rotated 30
      % dashed evenly
        withcolor OverlayLineColor ;
\stopuniqueMPgraphic

% \setupmathstackers
%   [vfenced]
%   [color=darkred,
%    alternative=mp]

\endinput