1
2
3\startenvironment examplesstylemath
4
5\def\ExampleLanguages{\currentmainlanguage}
6
7\setupframedtext
8 [result]
9 [align=flushleft]
10
11
12
13\definefontfeature[fixedwidth][fixedwidth=0.27]
14
15
16
17
18
19
20\definefontfallback
21 [MonoMathMath]
22 [cmuntt.otf*fixedwidth]
23 [0x04000x600]
24
25\definefontfallback
26 [MonoMathMath]
27 [concretemath.otf*fixedwidth]
28 [0x06000x1FFFF]
29
30\definefontsynonym
31 [MonoMathBase]
32 [lmmono10regular.otf*fixedwidth]
33 [fallbacks=MonoMathMath]
34
35
36
37
38
39
40\definefontfallback
41 [MonoTextMath]
42 [cmuntt.otf*fixedwidth]
43 [0x04000x600]
44
45\definefontfallback
46 [MonoTextMath]
47 [concretemath.otf]
48 [0x06000x1FFFF]
49
50\definefontsynonym
51 [MonoTextBase]
52 [lmmono10regular.otf]
53 [fallbacks=MonoTextMath]
54
55\definefontsynonym
56 [MonoMathBaseBold]
57 [lmmonolt10bold.otf*fixedwidth]
58 [fallbacks=MonoMathMath]
59
60\definefont[MyMathFont] [MonoMathBase]
61\definefont[MyMathFontBold][MonoMathBaseBold]
62\definefont[MyTextFont] [MonoTextBase]
63
64\setuptyping
65 [style=MyMathFont]
66
67
68
69\starttexdefinition protected ShowExampleMeaning #1
70 \begingroup
71 \ifcstok{#1}\currentmainlanguage
72 \darkblue
73 \orelse\ifcstok{#1}{debug}
74 \darkgray
75 \fi
76 \getmathtextblob{#1}\currentmathblob
77 \endgroup
78 \blank[medium]
79\stoptexdefinition
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\starttexdefinition protected StartExample
114 \begingroup
115 \begingroup
116 \obeylines
117 \doifnextcharelse[\StartExampleYES\StartExampleNOP
118\stoptexdefinition
119
120\starttexdefinition tolerant protected StartExampleYES[#1]
121 \endgroup
122 \doifelsemode {issues} {
123 \definecolor[issuecolor][darkred]
124 \doifelse {#1} {issue} {
125 \dostartbuffer[example][StartExample][StopExample]
126 } {
127 \gobbleuntil\StopExample
128 }
129 } {
130 \doif {#1} {issue} {
131 \definecolor[issuecolor][darkred]
132 }
133 \dostartbuffer[example][StartExample][StopExample]
134 }
135\stoptexdefinition
136
137\starttexdefinition tolerant protected StartExampleNOP
138 \endgroup
139 \doifelsemode {issues} {
140 \endgroup
141 \gobbleuntil\StopExample
142 } {
143 \dostartbuffer[example][StartExample][StopExample]
144 }
145\stoptexdefinition
146
147\starttexdefinition protected StopExample
148 \startresult[none][foregroundcolor=issuecolor]
149 \getbuffer[example]
150 \stopresult
151 \vskip5mm
152 \savemathexport[buffer=mmldata,xoption=ascii]
153 \begingroup
154 \MyTextFont \raggedright
155 \processcommacommand[\ExampleLanguages]\ShowExampleMeaning
156 \endgroup
157 \begingroup
158 \switchtobodyfont[6pt]
159
160
161 \def\slxbold{\MyMathFontBold}
162 \typebuffer[example][option=TEX]
163 \scratchcounterone\nofbufferlines{mmldata}
164 \ifnum\scratchcounterone>\zerocount
165 \scratchcountertwo\maxbufferwidth{mmldata}
166 \scratchcounterthree\ctxlua{context(
167 \number\textwidth//(\number\scratchcountertwo*\number\emwidth)
168 )}\relax
169 \scratchcounterfour\ctxlua{context(
170 \number\textheight//\number\pagetotal
171 )}\relax
172 \ifnum\scratchcounterthree=\zerocount
173 \typebuffer[mmldata][option=XML,n=\the\currentmathblob]
174 \orelse\ifnum\scratchcounterone>\scratchcounterfour
175 \startcolumns[n=\scratchcounterthree,balance=no]
176 \typebuffer[mmldata][option=XML,n=\the\currentmathblob]
177 \stopcolumns
178 \else
179 \typebuffer[mmldata][option=XML,n=\the\currentmathblob]
180 \fi
181 \fi
182 \endgroup
183 \endgroup
184 \page
185\stoptexdefinition
186
187
188
189
190
191
192\disabledirectives[structures.tags.shipout]
193\enabledirectives [structures.tags.math.standalone]
194
195
196\setuptagging
197 [state=start]
198
199\definemathgroupset
200 [demogroupset]
201 [every]
202
203\setmathgroupset
204 [demogroupset]
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239\stopenvironment
240 |