math-con.mkxl /size: 2126 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=math-dif,
3%D        version=2022.05.31, % moved code
4%D          title=\CONTEXT\ Math Macros,
5%D       subtitle=Differentials,
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\writestatus{loading}{ConTeXt Math Macros / Differentials}
15
16\unprotect
17
18%D The shapes are defined in \type {char-def.lua} where they get the right class
19%D too.
20%D
21%D \starttyping
22%D \setupmathematics
23%D   [differentiald=upright]
24%D \stoptyping
25
26%D Alternatively we can handle this by an attribute and do the remapping at the
27%D \LUA\ end but we're only talking of a few variables and we already had one
28%D done at the \TEX\ end.
29
30\def\math_upright_constant#1#2#3%
31  {\ifcstok{\mathematicsparameter#1}\s!upright
32     \begingroup
33       \attribute\mathalphabetattribute\attributeunsetvalue
34       \attribute\mathgreekattribute   \attributeunsetvalue
35       #2%
36     \endgroup
37   \else
38     #3%
39   \fi}
40
41\setupmathematics
42  [\s!differentiald=\mathematicsparameter\c!mathconstants,
43    \s!exponentiale=\mathematicsparameter\c!mathconstants,
44      \s!imaginaryi=\mathematicsparameter\c!mathconstants,
45      \s!imaginaryj=\mathematicsparameter\c!mathconstants,
46              \s!pi=\mathematicsparameter\c!mathconstants]
47
48% \setupmathematics
49%   [\c!mathconstants=\s!upright]
50
51\permanent\protected\def\dd{\math_upright_constant\s!differentiald\mathduprightshape \mathditalicshape }
52\permanent\protected\def\DD{\math_upright_constant\s!differentiald\mathDuprightshape \mathDitalicshape }
53\permanent\protected\def\ee{\math_upright_constant\s!exponentiale \matheuprightshape \matheitalicshape }
54\permanent\protected\def\ii{\math_upright_constant\s!imaginaryi   \mathiuprightshape \mathiitalicshape }
55\permanent\protected\def\ij{\math_upright_constant\s!imaginaryj   \mathjuprightshape \mathjitalicshape }
56\permanent\protected\def\pi{\math_upright_constant\s!pi           \mathpiuprightshape\mathpiitalicshape}
57
58\protect
59