summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-scr.mkiv
blob: 2decaa81fc539785f3ba43671799a80e45a3a40d (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
%D \module
%D   [       file=math-scr,
%D        version=2007.07.19,
%D          title=\CONTEXT\ Math Macros,
%D       subtitle=Scripts,
%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.

\writestatus{loading}{ConTeXt Math Macros / Scripts}

\unprotect

%D These macros were first needed by Frits (Gajes) Spijker
%D (of the Math4All project that we participate in), and used
%D for typesetting the minus sign that is keyed into scientific
%D calculators. We use the monospaced signs, that we also define
%D as symbol, so that they can be overloaded.

\def\math_scripts_raised_symbol#1%
  {\mathchoice
     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
     {\math_scripts_raised_symbol_indeed5\tf {#1}}%
     {\math_scripts_raised_symbol_indeed4\tx {#1}}%
     {\math_scripts_raised_symbol_indeed3\txx{#1}}}

\def\math_scripts_raised_symbol_indeed#1#2#3%
  {\mathord{{#2\raise.#1ex\hbox{#2\symbol[#3]}}}}

\def\math_scripts_raised_number#1%
  {\mathchoice
     {\math_scripts_raised_number_indeed\tf {#1}}%
     {\math_scripts_raised_number_indeed\tf {#1}}%
     {\math_scripts_raised_number_indeed\tx {#1}}%
     {\math_scripts_raised_number_indeed\txx{#1}}}

\def\math_scripts_raised_number_indeed#1#2%
  {\setbox\scratchbox\hbox{0}%
   \mathord{\hbox to \wd\scratchbox{\hss#1\symbol[#2]\hss}}}

\definesymbol[positive]  [\getglyph{Mono}{+}]
\definesymbol[negative]  [\getglyph{Mono}{-}]
\definesymbol[zeroamount][\getglyph{Mono}{-}]

\unexpanded\def\negative  {\math_scripts_raised_symbol{negative}}
\unexpanded\def\positive  {\math_scripts_raised_symbol{positive}}
\unexpanded\def\zeroamount{\math_scripts_raised_number{zeroamount}}

%D How negative such a symbol looks is demonstrated in:
%D $\negative 10^{\negative 10^{\negative 10}}$.

% \setuptextformulas % why here
%   [\c!size=\v!normal]

\protect \endinput