math-scr.mkiv /size: 2029 b    last modification: 2020-07-01 14:35
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) Spijker
19%D (of the Math4All project that we participate in), and used
20%D for typesetting the minus sign that is keyed into scientific
21%D calculators. We use the monospaced signs, that we also define
22%D as symbol, so that they can be overloaded.
23
24\def\math_scripts_raised_symbol#1%
25  {\mathchoice
26     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
27     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
28     {\math_scripts_raised_symbol_indeed4\tx {#1}}%
29     {\math_scripts_raised_symbol_indeed3\txx{#1}}}
30
31\def\math_scripts_raised_symbol_indeed#1#2#3%
32  {\mathord{{#2\raise.#1ex\hbox{#2\symbol[#3]}}}}
33
34\def\math_scripts_raised_number#1%
35  {\mathchoice
36     {\math_scripts_raised_number_indeed\tf {#1}}%
37     {\math_scripts_raised_number_indeed\tf {#1}}%
38     {\math_scripts_raised_number_indeed\tx {#1}}%
39     {\math_scripts_raised_number_indeed\txx{#1}}}
40
41\def\math_scripts_raised_number_indeed#1#2%
42  {\setbox\scratchbox\hbox{0}%
43   \mathord{\hbox to \wd\scratchbox{\hss#1\symbol[#2]\hss}}}
44
45\definesymbol[positive]  [\getglyph{Mono}{+}]
46\definesymbol[negative]  [\getglyph{Mono}{-}]
47\definesymbol[zeroamount][\getglyph{Mono}{-}]
48
49\unexpanded\def\negative  {\math_scripts_raised_symbol{negative}}
50\unexpanded\def\positive  {\math_scripts_raised_symbol{positive}}
51\unexpanded\def\zeroamount{\math_scripts_raised_number{zeroamount}}
52
53%D How negative such a symbol looks is demonstrated in:
54%D $\negative 10^{\negative 10^{\negative 10}}$.
55
56% \setuptextformulas % why here
57%   [\c!size=\v!normal]
58
59\protect \endinput
60