s-math-show.mkxl /size: 4660 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=math-run,
3%D        version=2023.05.18,
4%D          title=\CONTEXT\ Math Macros,
5%D       subtitle=Runtime loaded commands,
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\unprotect
15
16\permanent\tolerant\protected\gdef\showmathmargins[#1]%
17  {\bgroup
18     \par
19     \c_attr_visual\attributeunsetvalue
20     \c_attr_tagged\zerocount
21     \ruledhbox to \hsize \bgroup
22       \setbox\scratchbox\hbox to \hsize\bgroup
23         \scratchheight2\lineheight
24         \scratchwidth \onepoint
25         \infofont
26         \ifcstok{#1}\v!all
27           \llap\bgroup
28             \setupinterlinespace
29             \vbox yoffset -\lineheight\bgroup
30               \forgetall
31               \setstrut
32             % \llap{\the      \c_strc_math_n_of_lines \enspace \#l}\par
33               \llap{\withoutpt\d_strc_math_first_left \enspace fl}\par
34               \llap{\withoutpt\d_strc_math_last_left  \enspace ll}\par
35               \llap{\withoutpt\d_strc_math_max_left   \enspace ml}\par
36               \llap{\withoutpt\d_strc_formulas_number \enspace wd}\par
37             \egroup
38             \quad
39           \egroup
40         \fi
41         \ifzeropt\s_strc_formulas_margin_left\else
42           \bgroup\darkred
43             \srule \s!width \scratchwidth \s!height \scratchheight
44             \kern-\scratchwidth
45             \vrule \s!width \s_strc_formulas_margin_left
46             \kern-\scratchwidth
47             \srule \s!width \scratchwidth \s!height \scratchheight
48           \egroup
49         \fi
50         \ifdim\d_math_strc_hangindent>\zeropoint
51           \bgroup\darkred
52             \vrule \s!width \d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
53             \kern-\d_math_strc_hangindent
54           \egroup
55         \fi
56         \bgroup\darkgray
57           \leaders\vrule\hfill
58         \egroup
59         \bgroup\darkgreen
60           \srule \s!width \scratchwidth \s!height \scratchheight
61         \egroup
62         \bgroup\darkgray
63           \leaders\vrule\hfill
64         \egroup
65         \ifdim\d_math_strc_hangindent<\zeropoint
66           \bgroup\darkblue
67             \kern\d_math_strc_hangindent
68             \vrule \s!width -\d_math_strc_hangindent \s!depth 2\exheight \s!height-\exheight
69           \egroup
70         \fi
71         \ifzeropt\s_strc_formulas_margin_right\else
72           \bgroup\darkblue
73             \srule \s!width \scratchwidth \s!height \scratchheight
74             \kern-\scratchwidth
75             \vrule \s!width \s_strc_formulas_margin_right
76             \kern-\scratchwidth
77             \srule \s!width \scratchwidth \s!height \scratchheight
78           \egroup
79         \fi
80         \ifcstok{#1}\v!all
81           \rlap\bgroup
82             \setupinterlinespace
83             \quad
84             \vbox yoffset -\lineheight\bgroup
85               \forgetall
86               \setstrut
87               \rlap{fr\enspace\withoutpt\d_strc_math_first_right}\par
88               \rlap{lr\enspace\withoutpt\d_strc_math_last_right }\par
89               \rlap{mr\enspace\withoutpt\d_strc_math_max_right  }\par
90               \rlap
91                 {\formulaparameter\c!location:\enspace
92                  p=\the\c_strc_math_positioning\enspace
93                  a=\the\c_strc_math_ragged_status\enspace
94                  l=\the\c_strc_math_number_location\enspace
95                  v=\the\c_strc_math_number_variant}\par
96             \egroup
97           \egroup
98         \fi
99         \global\c_strc_math_positioning\zerocount
100       \egroup
101       \ht\scratchbox1.2\exheight
102       \dp\scratchbox0.4\exheight
103       \strut
104       \box\scratchbox
105       \kern-\hsize
106       \hbox to \hsize \bgroup
107         \white
108         \infofont
109         \kern\s_strc_formulas_margin_left
110         \quad
111         [\the\s_strc_formulas_margin_left]%
112         \hss
113         [\c!split=\iftok{\formulaparameter\c!split}\emptytoks\v!yes   \else\formulaparameter\c!split\fi]%
114         \quad
115         [\c!align=\iftok{\formulaparameter\c!align}\emptytoks\v!middle\else\formulaparameter\c!align\fi]%
116         \ifcstok{#1}\v!all\else
117           \quad
118           [\c!location=\formulaparameter\c!location]%
119         \fi
120         \hss
121         [\the\s_strc_formulas_margin_right]%
122         \quad
123         \kern\s_strc_formulas_margin_right
124       \egroup
125     \egroup
126   \par
127   \egroup}
128
129\protect
130
131\continueifinputfile{s-math-show.mkxl}
132
133\showmathmargins[all]
134
135\starttext
136
137\startformula
138    a + b = c
139\stopformula
140
141\stoptext
142