math-pln.mkxl /size: 4571 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=math-pln,
3%D        version=2001.11.16,
4%D          title=\CONTEXT\ Math Macros,
5%D       subtitle=Plain Helpers,
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 Here we collect some Plain \TEX\ leftovers.
15
16\writestatus{loading}{ConTeXt Math Macros / Plain Helpers}
17
18\unprotect
19
20% We need proper unicode:
21
22\def\relbar{\mathrel{\smash-}} % - has the same height as + .. no clue what this refers to
23
24%D This might change:
25
26\permanent\protected\def\hrulefill{\leaders\hrule\hfill}
27%permanent\protected\def\dotfill  {\cleaders\hbox{\normalstartimath\mathsurround\zeropoint\mkern1.5mu.\mkern1.5mu\normalstopimath}\hfill}
28
29%D These need an update:
30
31\permanent\protected\def\bmod
32  {\nonscript
33   \mskip-\medmuskip
34   \mkern5mu
35   \mfunction{mod}%
36   \penalty900
37   \mkern5mu
38   \nonscript
39   \mskip-\medmuskip}
40
41\permanent\protected\def\pmod#1%
42  {\allowbreak
43   \mkern18mu
44   (\mfunction{mod}\mskip\medmuskip#1)}
45
46%D For the moment we use this in mathml:
47
48\protected\def\matrix#1% not permanent so we can overload
49  {\emptyhbox
50   \mskip\thinmuskip
51   \vcenter
52     {\normalbaselines
53      \mathsurround\zeropoint
54      \everycr\emptytoks
55      \tabskip\zeroskip
56      \halign{%
57        \hfil\normalstartimath\alignmark\alignmark\normalstopimath\hfil
58        \aligntab
59        \aligntab
60        \quad\hfil\normalstartimath\alignmark\alignmark\normalstopimath\hfil
61        \crcr
62        \mathstrut
63        \crcr
64        \noalign{\kern-\baselineskip}
65        #1\crcr
66        \mathstrut
67        \crcr
68        \noalign{\kern-\baselineskip}}}%
69   \mskip\thinmuskip}
70
71\permanent\aliased\let\plainmatrix\matrix
72
73%D This comes from plain but I gave it a \CONTEXT\ touch. When Mikael and I are in
74%D the mood we will redo them in a more modern way.
75
76\permanent\def\math_border_NC_indeed
77  {\enforced\global\def\math_border_NC{\aligntab}}
78
79\aliased\let\math_border_NC\math_border_NC_indeed
80
81\permanent\def\math_border_NR
82  {\enforced\global\let\math_border_NC\math_border_NC_indeed
83   \cr}
84
85\protected\def\math_border_matrix#1#2#3% adapted plain
86  {\begingroup
87   %
88   \setbox\scratchbox\hbox\bgroup
89     \mr B%
90   \egroup
91   \scratchdimenone\wd\scratchbox
92   %
93   \scratchdimentwo.2\bodyfontsize
94   %
95   \mathsurround\zeropoint
96   %
97   \enforced\def\NC{\math_border_NC}%
98   \enforced\def\NR{\math_border_NR}%
99   %
100   \gdef\m_math_border_matrix
101     {\kern\scratchdimentwo
102      \glet\m_math_border_matrix\relax}%
103   %
104   \setbox\scratchboxone\vbox\bgroup
105     \everycr{\noalign\bgroup\m_math_border_matrix\egroup}%
106     \tabskip \zeroskip
107     \halign{% \ialign resets everycr
108       \startimath\alignmark\alignmark\stopimath
109       \hfil
110       \kern{\scratchdimentwo+\scratchdimenone}%
111       \aligntab
112       \thinspace
113       \hfil
114       \startimath\alignmark\alignmark\stopimath
115       \hfil
116       \aligntab
117       \aligntab
118       \quad
119       \hfil
120       \startimath\alignmark\alignmark\stopimath
121       \hfil
122       \crcr
123       \omit
124       \strut
125       \hfil
126       \crcr
127       \noalign{\kern-\baselineskip}%
128       #3\crcr
129       \omit
130       \strut
131       \cr}%
132   \egroup
133   \setbox\scratchboxtwo\vbox\bgroup
134     \unvcopy\scratchboxone
135     \global\setbox\globalscratchbox\lastbox
136   \egroup
137   \setbox\scratchboxtwo\hbox\bgroup
138     \unhbox\globalscratchbox
139     \unskip
140     \global\setbox\globalscratchbox\lastbox
141   \egroup
142   \setbox\scratchboxtwo\hbox\bgroup
143     \startimath
144     \kern{\wd\globalscratchbox-\scratchdimenone}%
145     \left#1\relax
146     \kern-\wd\globalscratchbox
147     \global\setbox\globalscratchbox\vbox\bgroup
148       \box\globalscratchbox
149       \kern\scratchdimentwo
150     \egroup
151     \vcenter\bgroup
152       \kern-\ht\globalscratchbox
153       \unvbox\scratchboxone
154       \kern-\baselineskip
155     \egroup
156     \thinspace
157     \right#2\relax
158     \stopimath
159   \egroup
160   \null
161   \thickspace
162   \vbox\bgroup
163     \kern\ht\globalscratchbox
164     \box\scratchboxtwo
165   \egroup
166   %
167   \endgroup}
168
169\permanent\protected\def\bordermatrix {\math_border_matrix()}
170\permanent\protected\def\bbordermatrix{\math_border_matrix[]}
171
172\permanent\protected\def\startbordermatrix #1\stopbordermatrix {\math_border_matrix(){#1}}
173\permanent\protected\def\startbbordermatrix#1\stopbbordermatrix{\math_border_matrix[]{#1}}
174
175\permanent\let\stopbordermatrix \relax
176\permanent\let\stopbbordermatrix\relax
177
178\protect \endinput
179