summaryrefslogtreecommitdiff
path: root/tex/context/base/math-run.tex
blob: 3e1cdbf6a6555d7f952eb6df070e0b7462c3ec94 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%D \module
%D   [     file=math-run,
%D      version=2001.23.04, 
%D        title=\CONTEXT\ Math Macros,
%D     subtitle=Runtime Macros, 
%D       author=Hans Hagen,
%D         date=\currentdate,
%D    copyright=Hans Hagen \& Ton Otten]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 
%C details. 

\unprotect 

\gdef\showmathcharacters% nearly \showcharacters
  {\par
   \bgroup
   \setuptextrules[\c!korps=,\c!letter=]
   \starttextrule{math characters}
   \witruimte
   \dontcomplain
   \forgetall
   \def\startmathcollection[##1]{}
   \let\stopmathcollection\relax
   \dimen0=\!!zeropoint
   \dimen2=\!!zeropoint
   \def\definemathsymbol   {\dosixtupleempty\dodefinemathsymbol}
   \def\definemathcharacter{\dosixtupleempty\dodefinemathcharacter}
   \def\definemathcommand  {\dotripleempty  \dodefinemathcommand}
   %\newcounter\mathcolor
   \def\dodefinemathsymbol[##1][##2][##3][##4][##5][##6]%
     {%\doifcolorelse{math \purefamilyhex{##3}}{}
      %  {\increment\mathcolor
      %   \definecolor[math \purefamilyhex{##3}][\mathcolor]}%
      \setbox0=\hbox spread 1em 
        {$\getvalue{##1}{}$}%
      \ifdim\wd0>\dimen0 \dimen0=\wd0 \fi
      \setbox2=\hbox spread 1em
        {\hbox to 1em{\tttf\purefamilyhex{##3}\hss}\box0 ##1}
      \ifdim\wd2>\dimen2 \dimen2=\wd2 \fi}
   \def\dodefinemathcharacter[##1][##2][##3][##4][##5][##6]{}
   \def\dodefinemathcommand[##1][##2][##3]##4{}
   \readsysfile{\f!mathprefix tex}{}{}
   \edef\encwidth{\the\dimen0}
   \dimen0=\hsize
   \advance\dimen0 2em
   \advance\dimen2 2em
   \divide \dimen0 by \dimen2 \advance\dimen0 1sp 
   \edef\enccols{\number\dimen0}
   \startcolumns[\c!n=\enccols,\c!afstand=2em]
   \def\dodefinemathsymbol[##1][##2][##3][##4][##5][##6]%
     {%\localcolortrue
      %\color
      %  [math \purefamilyhex{##3}]
         {\hbox
            {\hbox to \encwidth{$\getvalue{##1}{}$\hss}%
             \hbox to 1em{\tttf\purefamilyhex{##3}\hss}##1}\par}}
   \readsysfile{\f!mathprefix tex}{}{}
%   \readsysfile{\f!mathprefix ams}{}{}
   \stopcolumns
   \stoptextrule
   \egroup}

% \definecolor[math \purefamilyhex{mr}] [darkred]
% \definecolor[math \purefamilyhex{mi}] [darkgreen]
% \definecolor[math \purefamilyhex{sy}] [darkblue]
% \definecolor[math \purefamilyhex{ex}] [darkmagenta]
% \definecolor[math \purefamilyhex{nn}] [darkyellow]
% \definecolor[math \purefamilyhex{ma}] [lightred]
% \definecolor[math \purefamilyhex{mb}] [lightgreen]
% \definecolor[math \purefamilyhex{mc}] [lightblue]
% \definecolor[math \purefamilyhex{md}] [lightmagenta]

\gdef\showmathtoken#1%
  {\starttabulate[|lT|lT|lT|l|]
   \NC token         \NC #1 \NC \NR 
   \NC collection    \NC \ifcsname\@mt@\mathcollection#1\endcsname 
                           \mathcollection 
                         \else\ifcsname\@mt@\nomathcollection#1\endcsname 
                           \nomathcollection
                         \else
                           ?%
                         \fi\fi \NC \NR 
   \NC visualization \NC \mathematics{\getvalue{#1}} \NC \NR
   \NC definition    \NC \tttf \@EA\convertcommand
                           \csname\@mt@\mathcollection#1\endcsname
                         \to \ascii \ascii \NC \NR 
   \stoptabulate}
 
\protect \endinput