math-scr.mkxl /size: 2125 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=math-scr,
3%D        version=2007.07.19,
4%D          title=\CONTEXT\ Math Macros,
5%D       subtitle=Scripts,
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 / Scripts}
15
16\unprotect
17
18%D These macros were first needed by Frits (Gajes) Spijkers (of the Math4All project
19%D that we participate in), and used for typesetting the minus sign that is keyed
20%D into scientific calculators. We use the monospaced signs, that we also define as
21%D symbol, so that they can be overloaded. We can probably do it nicer now (in lmtx).
22
23\def\math_scripts_raised_symbol#1%
24  {\mathchoice
25     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
26     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
27     {\math_scripts_raised_symbol_indeed4\tx {#1}}%
28     {\math_scripts_raised_symbol_indeed3\txx{#1}}}
29
30\def\math_scripts_raised_symbol_indeed#1#2#3%
31  {\mathord{#2\raise.#1\exheight\hbox{#2\symbol[#3]}}} % redundant {} removed
32
33\def\math_scripts_raised_number#1%
34  {\mathchoice
35     {\math_scripts_raised_number_indeed\tf {#1}}%
36     {\math_scripts_raised_number_indeed\tf {#1}}%
37     {\math_scripts_raised_number_indeed\tx {#1}}%
38     {\math_scripts_raised_number_indeed\txx{#1}}}
39
40\def\math_scripts_raised_number_indeed#1#2%
41  {\setbox\scratchbox\hbox{0}%
42   \mathord{\hbox to \wd\scratchbox{\hss#1\symbol[#2]\hss}}}
43
44\definesymbol[positive]  [\getglyph{Mono}{+}]
45\definesymbol[negative]  [\getglyph{Mono}{-}]
46\definesymbol[zeroamount][\getglyph{Mono}{-}]
47
48\permanent\protected\def\negative  {\math_scripts_raised_symbol{negative}}
49\permanent\protected\def\positive  {\math_scripts_raised_symbol{positive}}
50\permanent\protected\def\zeroamount{\math_scripts_raised_number{zeroamount}}
51
52%D How negative such a symbol looks is demonstrated in: $\negative 10^{\negative
53%D 10^{\negative 10}}$.
54
55% \setuptextformulas % why here
56%   [\c!size=\v!normal]
57
58\protect \endinput
59