summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkxl/s-math-show.mkxl
blob: 456ecc60b72d1b4d748b370152c25e120f99521c (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
%D \module
%D   [       file=math-run,
%D        version=2023.05.18,
%D          title=\CONTEXT\ Math Macros,
%D       subtitle=Runtime loaded commands,
%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.

\unprotect

\permanent\tolerant\protected\gdef\showmathmargins[#1]%
  {\bgroup
     \par
     \c_attr_visual\attributeunsetvalue
     \ruledhbox to \hsize \bgroup
       \setbox\scratchbox\hbox to \hsize\bgroup
         \scratchheight2\lineheight
         \scratchwidth \onepoint
         \infofont
         \ifcstok{#1}\v!all
           \llap\bgroup
             \setupinterlinespace
             \vbox yoffset -\lineheight\bgroup
               \forgetall
               \setstrut
             % \llap{\the      \c_strc_math_n_of_lines \enspace \#l}\par
               \llap{\withoutpt\d_strc_math_first_left \enspace fl}\par
               \llap{\withoutpt\d_strc_math_last_left  \enspace ll}\par
               \llap{\withoutpt\d_strc_math_max_left   \enspace ml}\par
               \llap{\withoutpt\d_strc_formulas_number \enspace wd}\par
             \egroup
             \quad
           \egroup
         \fi
         \ifzeropt\s_strc_formulas_margin_left\else
           \bgroup\darkred
             \srule \s!width \scratchwidth \s!height \scratchheight
             \kern-\scratchwidth
             \vrule \s!width \s_strc_formulas_margin_left
             \kern-\scratchwidth
             \srule \s!width \scratchwidth \s!height \scratchheight
           \egroup
         \fi
         \ifdim\d_math_strc_hangindent>\zeropoint
           \bgroup\darkred
             \vrule \s!width \d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
             \kern-\d_math_strc_hangindent
           \egroup
         \fi
         \bgroup\darkgray
           \leaders\vrule\hfill
         \egroup
         \bgroup\darkgreen
           \srule \s!width \scratchwidth \s!height \scratchheight
         \egroup
         \bgroup\darkgray
           \leaders\vrule\hfill
         \egroup
         \ifdim\d_math_strc_hangindent<\zeropoint
           \bgroup\darkblue
             \kern\d_math_strc_hangindent
             \vrule \s!width -\d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
           \egroup
         \fi
         \ifzeropt\s_strc_formulas_margin_right\else
           \bgroup\darkblue
             \srule \s!width \scratchwidth \s!height \scratchheight
             \kern-\scratchwidth
             \vrule \s!width \s_strc_formulas_margin_right
             \kern-\scratchwidth
             \srule \s!width \scratchwidth \s!height \scratchheight
           \egroup
         \fi
         \ifcstok{#1}\v!all
           \rlap\bgroup
             \setupinterlinespace
             \quad
             \vbox yoffset -\lineheight\bgroup
               \forgetall
               \setstrut
               \rlap{fr\enspace\withoutpt\d_strc_math_first_right}\par
               \rlap{lr\enspace\withoutpt\d_strc_math_last_right }\par
               \rlap{mr\enspace\withoutpt\d_strc_math_max_right  }\par
               \rlap
                 {\formulaparameter\c!location:\enspace
                  p=\the\c_strc_math_positioning\enspace
                  a=\the\c_strc_math_ragged_status\enspace
                  l=\the\c_strc_math_number_location\enspace
                  v=\the\c_strc_math_number_variant}\par
             \egroup
           \egroup
         \fi
         \global\c_strc_math_positioning\zerocount
       \egroup
       \ht\scratchbox1.2\exheight
       \dp\scratchbox0.4\exheight
       \strut
       \box\scratchbox
       \kern-\hsize
       \hbox to \hsize \bgroup
         \white
         \infofont
         \kern\s_strc_formulas_margin_left
         \quad
         [\the\s_strc_formulas_margin_left]%
         \hss
         [\c!split=\iftok{\formulaparameter\c!split}\emptytoks\v!yes   \else\formulaparameter\c!split\fi]%
         \quad
         [\c!align=\iftok{\formulaparameter\c!align}\emptytoks\v!middle\else\formulaparameter\c!align\fi]%
         \ifcstok{#1}\v!all\else
           \quad
           [\c!location=\formulaparameter\c!location]%
         \fi
         \hss
         [\the\s_strc_formulas_margin_right]%
         \quad
         \kern\s_strc_formulas_margin_right
       \egroup
     \egroup
   \par
   \egroup}

\protect

\continueifinputfile{s-math-show.mkxl}

\starttext

\startformula
    a + b = c
\stopformula

\stoptext