1
2
3
4
5
6
7
8
9\startcomponent ontargetmathml
10
11\environment ontargetstyle
12
13
14
15
16
17
18\definefontfeature[fixedwidth][fixedwidth=0.27]
19
20\definefontfallback
21 [MonoMathMath]
22 [concretemath.otf*fixedwidth]
23 [0x01000x1FFFF]
24
25\definefontsynonym
26 [MonoMathBase]
27 [lmmono10regular.otf*fixedwidth]
28 [fallbacks=MonoMathMath]
29
30\definefontfallback
31 [MonoTextMath]
32 [concretemath.otf]
33 [0x01000x1FFFF]
34
35\definefontsynonym
36 [MonoTextBase]
37 [lmmono10regular.otf]
38 [fallbacks=MonoTextMath]
39
40\definefontsynonym
41 [MonoMathBaseBold]
42 [lmmonolt10bold.otf*fixedwidth]
43 [fallbacks=MonoMathMath]
44
45\definefont[MyMathFont] [MonoMathBase]
46\definefont[MyMathFontBold][MonoMathBaseBold]
47\definefont[MyTextFont] [MonoTextBase]
48
49\setuptyping
50 [style=MyMathFont]
51
52\setupinteraction
53 [state=start,
54 color=,
55 contrastcolor=,
56 style=]
57
58\ifdefined\closure \else
59
60 \definemathtopaccent
61 [top:stretch]
62 [closure]
63 ["0305]
64
65\fi
66
67\startchapter[title=Meaningful math]
68
69\startlines
70Hans Hagen
71Mikael Sundqvist
72\stoplines
73
74\startsection[title={Introduction}]
75
76In this article were going to discuss math in the perspective of accessibility.
77Although \CONTEXT\ already supports tagging in \PDF\ for quite a while, that
78specific kind of accessibility never took off, if only because very few viewers
79did anything useful with it. However, with universities introducing (whatever)
80validating features for documents pushed into the systems used for teaching,
81there was no way around picking up this thread. We start with some reflections
82about how we got here and then move on to some examples of how we deal with this
83in \LMTX. This project is part of a larger effort to get even better typeset math
84out of \TEX\ so we could benefit from some new features in the engine, even if
85they were never added with accessibility in mind.
86
87\stopsection
88
89\startsection[title={How about \MATHML}]
90
91Hans still remembers one of the first \TEX\ conferences that he attended where
92some evangelist from a large, in the meantime extinct, hardware company tried to
93convince the audience that something great had surfaced: \XML. In its wake came
94\MATHML, as far as we understood endorsed by large mainstream scientific
95publishers, some of which also disappeared in the meantime.
96
97He also remembers a user group meeting where, when showing some \MATHML\
98processing, responses were of the kind \quotation {Why do you use \TEX\ at all if
99you want to use \MATHML\ (or \XML)} or even more curious \quotation {Why do you
100use \TEX\ if isnt for math?} Sometimes such comments are a way to put \CONTEXT\
101(users) in their own category. Remarks of a similar kind are \quotation {One
102should not use \CONTEXT\ because it depends on some scripts}. The fact that
103scripts are used to (for instance) sort an index, process a bibliography or just
104manage the multiple run process (also think of \METAPOST\ graphics and position
105tracking in \DVI\ in former times) was seen as bad. Of course in the meantime
106many such features have proven to be useful, which is illustrated by the fact
107that other macro packages also have to deal with \MATHML\ and seem to use
108scripts. We mention this because decades of writing \CONTEXT\ code has taught us
109not to bother too much about what is said or happens outside our scope.
110
111Because we were actually confronted by \XML\ (or its precursor \SGML) it is no
112surprise that in \CONTEXT\ already pretty soon the angle bracket dominated format
113was supported and then of course \MATHML\ support is kind of easy to add to the
114portfolio. Although the way we deal with \XML\ is more sophisticated in \MKIV,
115and therefore the same in \MKXL\ aka \LMTX, the kind of things we do are the
116same.
117
118\stopsection
119
120\startsection[title=Practical use]
121
122At \PRAGMA\ we were never that thrilled by presentation \MATHML\ but content
123\MATHML\ has a certain charm and was actually more reliable when it came to
124rendering, if only because soon the usage pattern of the presentation variant
125became a wildcard. Where dealing with content \MATHML\ is kind of fun, handling
126presentation \MATHML\ is less so. For decades weve been involved in a project
127where the whole spectrum of Dutch secondary math education is covered. The
128content is mostly developed on a voluntary basis so for us it was mainly a way to
129experiment with large scale rendering of \XML\ mixed with math. The target was
130\PDF\ as well as the web, but we were not responsible for that part
131(although we can generate a web site if needed). However, as we often found out,
132the (limitations of) the web (\HTML) influenced the \XML\ coding in a negative
133way but we leave that aside. It just makes the source code less attractive over
134time.
135
136If we use that project as example, we can only conclude that \MATHML\ often looks
137like it failed to mature. Were talking about 30.000 files with over 400.000 math
138formulas but it being secondary school math they differ in complexity. The books
139are generated on demand and can differ in content and detail. There are of course
140also lots of images involved. A single run can involve thousands of files that
141are loaded, combined, filtered and typeset and in spite of what one might expect
142processing speed is quite comfortable (not that much different from the average
143\CONTEXT\ run). Static and (screen optimized) interactive \PDF\ files, are path
144of the package. Some schools even generate their own variants, given that they
145are willing to install th e production system and invest some time in learning
146how to mess with the content and assembly files.
147
148The disappointment with \MATHML\ has a reason. We started very optimistic with
149content \MATHML\ but because that demanded transformations for the \HTML\
150variant we moved to presentation \MATHML. Then there was some involvement from
151\OPENMATH\ participants and all was moved to that format because a related output
152demanded it. At that time \CONTEXT\ was able to process all three variants so
153for book production that was not really a problem. Nevertheless another change
154was needed, this time because browser support was (to put it mildly) fragile and
155with again a flirt with presentation \MATHML\ we finally ended up with
156\ASCIIMATH\ which has its own peculiarities but at least was supported via
157\MATHJAX. So thats where we are now: of the over 400.000 formulas 52.000 are
158presentation \MATHML\ and 360.000 are \ASCIIMATH.
159
160\stopsection
161
162\startsection[title=It comes and goes]
163
164Quite often when it comes to typesetting, the typewriter approach is taken as
165reference. As a consequence plenty of simple source tagging methods and fast
166rendering tools have showed up but it is only a matter of time before one hits
167limitations and coding becomes more complex due to handling border cases and
168exceptions, and rendering becomes slower or maybe even cumbersome because a
169complex layout is well, just complex to realize due to conflicting demands. This
170is why \TEX\ macro packages are large and complex too. So, when discussing for
171instance \PDF\ documents (other than straightforward texts like novels or simple
172reports) in the perspective of the internet, one tends to forget that \HTML\ is
173(at least initially) meant for viewing in browsers where it can reflow and adapt.
174The more one tends to markup there, the less easy it becomes and one only has to
175look at the source and style sheets to see that in the end it all converges to the
176same level of complexity. What matters here is not so much the rendering backend,
177but more the availability of a clean source, one that could be used to satisfy
178different needs, but quite often that is not the case: there is no way to
179control users. If \quote {simple} is the starting point, then \quote {complex}
180can be pretty ugly. The same is true for math: the more complex it gets, the more
181likely it is that the source is a bit of a mess. It is for that reason that in
182\CONTEXT\ we paid a lot of attention to help users keep the source clean. It is
183also why we spent years on upgrading the core \TEX\ math engine.
184
185Anyway, in the meantime \MATHML\ went from version 1 to version 2 and 3 and is now
186a hybrid of presentation, content and \OPENMATH\ with version 4 around the
187corner. Then theres also a light version showing up: \MATHML\ core. We can
188probably safely conclude that in the meantime \MATHJAX\ is mostly used in
189browsers and its a combination of \JAVASCRIPT, \CSS, \TEX\ fonts that handles
190presentation \MATHML and \ASCIIMATH\ (or maybe even to some extent \LATEX\ math)
191either by element or by parsing the content of elements. One observation is that recent
192versions of \MATHML\ add lots of attributes to get things right. A with \SVG\ as soon
193as markup and styling enters the otherwise reasonable structured input it might get
194worse in the end. Since we delegate a lot to the engine we dont need that level of
195detail so for now we just ignore most of it.
196
197Some browsers did momentarily support \MATHML\ directly, just in order to drop it
198overnight or change the coverage. As were talking of decades it clearly shows
199that its a mess. It is therefore surprising (and impressive) that one can
200actually render math in web pages as for instance \WIKIPEDIA\ demonstrates. One
201can wonder what \MATHML\ core brings to this, especially as it expects browser
202support, while browser reputation is not that good. There is no reason to assume
203that the ever changing web landscape with a small number of implementations of
204supposedly generic formats will be better in the future. Maybe the problem is
205just complex. Anyway, it made me somewhat indifferent to the matter: we dealt with
206in the past, probably can deal with it in the future (if only by ignoring what
207never will be generally supported anyway). What is worrying, is that the existing
208already rather limited presentation \MATHML\ standard dropped (according to the
209Mozilla documentation) \type {mfenced}, \type {menclose} and some more, and on
210the other hand kept the redundant \type {sqrt}, didnt add some missing elements
211(theres more than operators, identifiers and numbers), introduced some weird
212replacements for the enclosed content (with school math as excuse well theres
213more to it than that).
214
215\stopsection
216
217\startsection[title=Messing up \PDF]
218
219A secondary element in this game is \PDF\ that has some \MATHML\ related tagging
220on board. There we have the fences so that can hardly be dropped from the
221standard. Then there is a reasonable addition in the sense that one can embed the
222whole formula instead. But all this is done in the perspective of accessibility
223and getting that from typeset text is a bit of a challenge unless one renders a
224dedicated version suitable for reading out loud, and there is no reason not to
225have two variants of the same document: it might even make more sense than
226cooking up methods to use the (always suboptimal) tagged content. Within
227reasonable bounds we always supported tagging but we have to admit that we never
228really got much feed back on that and the reason is obvious: there has hardly
229been any support from viewers. It is all one big gamble and likely older tagged
230documents are not that useable anyway because one had to gamble about how to tag
231best. Also, validating applications (part of school platforms) dont know that
232well how to check and report on it anyway. That leaves us with guesswork and just
233trying to do the best we can: using common sense works out best.
234
235One \quote {problem} is that \CONTEXT\ users have never been involved in \MATHML\
236discussions, \PDF\ tagging and (if there ever were) discussions about math in the
237\TEX\ engine, simply because early in \TEXs history \LATEX\ became the de facto
238standard of operating. In that perspective, looking from the \CONTEXT\ end, its
239not much different from looking at how \MICROSOFT\ word or other ways of coding
240documents influence these standards. We just need to either adapt or ignore what
241happens and the latter is often the best (given the mentioned instable situation).
242
243And so, we just focus on the rendering, not caring much if it can be resembled in
244for instance \MATHML\ or tags. Were pretty sure that hardly any user wants to
245cut and paste a formula from a \PDF\ document and accessibility can often be made
246better by better andor different rendering (maybe combine with some robust
247tagging). The best we can do is to produce a clean output and make sure that
248enough information is in the file to (maybe) help someone who doesnt have access
249to the source.
250
251\stopsection
252
253\startsection[title=What do we want?]
254
255When we talk about accessibility for visually disabled readers, there is not much
256we can say about it simply because we cannot experience the same. The closest we
257can come to it is by listening to a document being read in (say) a podcast. One
258doesnt see the rendered output and depends on some software reader. Now, if
259accessibility has been taken into account, of course a dedicated \PDF\ file with
260a layout that has no fancy rendering is best but what publisher is willing to
261provide two versions for that purpose? In some way we have a binary situation:
262if you can see the document, even when it has to be enlarged, there is little
263need for listening, and otherwise there is need for a nice layout. But in the end
264the single document demand will drive the curious mix of fancy layout and
265straightforward reading. But we fear that as long as big business, politics
266and money are involved were unlikely to get anywhere close to a nice solution.
267
268That said, the route weve chosen is serialization. When a user is forced to
269validate accessibility in some application and the verdict is negative, the first
270question is: \quotation {So, how should it be done then?} and of course there is
271seldom an answer to this. Adding tags to a \PDF\ document is often enough to get
272into the green, but as said that tells nothing about the useability. We can embed
273the \MATHML\ representation and that actually satisfies some checkers. If we then
274add the serialized (read: spoken) math as actual text property the score can
275become positive there too.
276
277Serialization started as a gimmick when we tried to satisfy demands and at first
278we actually produced a document where all formulas could be replaced by their
279\quote {spoken} variant. But then we realized that if someone has a visual
280handicap that might work out well but that it still is not much different from a
281typeset formula. Real accessibility would be better served with a more dedicated
282rendering of the whole document, not some partial serialization. We therefore
283decided to stick to the combination of embedded \MATHML\ and serialization in
284actual text annotations and just wait till viewers start supporting that. We do
285the best we can at our (rendering) end and leave it at that.
286
287It must be said that when we started with this side track it was actually kind of
288fun. Compared to all we did with math (fonts, engine, additional and upgraded
289macros) this was a relatively simple activity, given that \CONTEXT\ already had
290most on board and we could benefit from recently added features to the engine. It
291also made for a nice experiment with math dictionaries, something we had (and
292have) on the agenda anyway. Also, as with many mechanisms it might evolve over
293time, for instance because languages have different demands and currently we only
294cover English and Swedish. The tests are done with some real math books and the
295upcoming math manual. Were talking of thousands of inline and display formulas
296of different complexity here. For testing we have various tracing options which
297of course adds to the runtime, but generally speaking the overhead is quite
298acceptable, especially given the task at hand.
299
300We started with some reflections on \MATHML\ as input and ended with \MATHML\ as
301output. We already had that for quite a while and could even embed it for tracing
302but now embedding is more integrated. The serialization is a nice addition to
303that so lets now explain a bit more about that.
304
305\stopsection
306
307\startsection[title={What does it mean?}]
308
309In \TEX\ we often focus mainly on how to typeset math formulas and not so much
310about the meaning of those formulas. It should be clear that \im{\sqrt{x}} stands
311for the square root of \im{x}, but many other symbols are used with more than one
312meaning. When we see a formula, we can often guess the intended meaning from the
313context, in particular if the author has used standard notation, introduced new
314notation, not used the same notation to mean several things, and kept the
315notation as simple as possible. There are, however, ambiguous cases.
316
317We give one example where the situation might not be completely clear. If, in a
318manuscript on complex analysis, we meet the formula \im{\bar{z} \in \widebar{U}},
319we will likely interpret the first bar as the complex conjugate of the complex
320number \im{z}. But the meaning of \im{\widebar{U}} is perhaps less clear. The
321\im{\in} hints that it should be a set. One standard notation implies that it
322denotes the closure of the set \im{U}. But it could also, in principle, mean the
323set of complex conjugate of the elements in the set \im{U}. Even if the bars over
324these characters look the same in the pdf file, it would be good if it was
325possible also to carry the meaning somehow.
326
327If somebody copies the formula from the pdf they should get something sensible
328out of it when pasting it elsewhere. It is therefore important to work with the
329symbols predefined in Unicode math, and not to come up with their own weird symbols by
330clipping, rotating, or in other problematic ways combining symbols and perhaps
331also rules.
332
333Unicode math contains a lot of symbols. Many of them are described with a name
334that rather says something about the shape than about how they are supposed to be
335used. Given that we are free to use whatever symbol to denote anything, this is
336perhaps natural. But it is also problematic. Take \im{\char"2297} (its official
337name is CIRCLED TIMES), for example. It comes with two synonyms that tell a bit
338how it can be used as \quotation{tensor product} and as \quotation{vector pointing into
339page}. For the first usage the macro name \tex{otimes} has traditionally in \TEX\
340been attached to the symbol. But, as the synonym says, sometimes it also denotes
341a vector pointing into the page, and then one can question both the macro name
342and the binary operation class that is attached to it. If one wants to use this
343symbol in the latter meaning it is natural to define a new macro that typesets
344the symbol, with a matching class. Observe, however, that such a construct will
345not change the meaning for someone copying the symbol from the pdf. It will still
346be CIRCLED TIMES.
347
348
349
350
351
352
353
354
355
356
357
358\stopsection
359
360\startsection[title={Accessibility, tagging}]
361
362When it comes to accessibility, the situation becomes even more interesting. How
363shall a screen reader read the symbol \im{\char"2297}? As \quotation{CIRCLED
364TIMES}, as \quotation{tensor product} or as \quotation{points into the page}? Or
365perhaps as \quotation{otimes}? \CONTEXT\ has for a long time been able to tag
366documents that include mathematics and also export them to MathML. As of now, the
367formulas are transformed into some core MathML and included as attachments in the
368pdf file. Meaning easily gets lost in this conversion, so one can question how
369accessible the result actually is for a person who needs to have it read aloud.
370Moreover, the MathML itself, or the flavor of it, sometimes changes. For example,
371the \typ{mfenced} element recently got deprecated, leading to compatibility
372issues for a lot of existing documents. This lack of stability makes it both
373difficult and demotivating to support tagging.
374
375It can be useful to have the MathML if one wants to export and show the output on
376a web site. One shall remember, though, that the typeset math from \CONTEXT\ that
377one gets in a pdf file is not in general equivalent (features differ) to the
378MathML produced, so it will not be perfect.
379
380The example \im{\bar{z} \in \widebar{U}}, discussed in the introduction comes out
381like this (we have replaced the math italic z and U so that they show below since
382they are not present in the monotype font we use)
383
384\startbuffer
385<math>
386 <mrow>
387 <mover>
388 <mi>z<mi>
389 <mo>̅<mo>
390 <mover>
391 <mo>∈<mo>
392 <mover>
393 <mi>U<mi>
394 <mo>̅<mo>
395 <mover>
396 <mrow>
397<math>
398\stopbuffer
399
400\typebuffer
401
402Let us also mention that it is not easy to verify that the tagging actually
403works. At Lund university, where Mikael is working, the tool Ally (as a plugin to
404the Canvas LMS) is used to check the tagged pdf files, and it does usually mark
405tagged pdf files from \CONTEXT\ as being perfectly tagged. But even here, things
406do change. At some point it was changed so that formulas was seen as attached
407images, and then it complained about lacking alternative texts. It is also an
408interesting fact that exporting a \PDF\ file, verified as perfectly tagged, into sound
409(also possible in Canvas LMS), it does not read the formulas correctly, if at
410all.
411
412\stopsection
413
414\startsection[title={Dictionaries}]
415
416With the right mark up and choice of notation from the writer, it should be
417possible to have it read different things, depending on the context. We therefore
418came up with dictionaries. They make it possible for symbols to carry a meaning
419and context, in addition to the atom class. In fact, we shall think of it as
420something that is independent of the atom class. A Unicode character can thus
421have several instances, where different instances might belong to different
422groups. Of course the math class can also vary. Thus, for \im{\char"2297} it
423could be like this:
424
425\starttextdisplay
426 \setupalign[middle]\dontleavehmode
427 \starttabulate[]
428 \NC Symbol \NC Macro \NC Class \NC Group \NC Meaning \NC \NR
429 \NC \im{\char"2297} \NC \tex{tensorproduct} \NC binary operator \NC binary operator \NC tensor product \NC \NR
430 \NC \im{\char"2297} \NC \tex{pointsintopage} \NC ordinary \NC unary arithmetic \NC points into the page \NC \NR
431 \stoptabulate
432\stoptextdisplay
433
434The idea is then that the user can specify the groups used in a document. If one
435typesets a document on mathematical logic, one can load the groups that are
436attached to logic, and one will have these macros predefined, likely with the
437intended meaning. One can of course add or change the setup as well.
438
439\stopsection
440
441\startsection[title={Formulas converted into text}]
442
443One reason to introduce dictionaries with groups, in addition to atom classes, is
444that we can now use the label system in \CONTEXT\ to attach to each symbol also a
445label that tells how it could be read out. The same has been done for various
446macros, and as a result we can convert formulas into \quotation{spoken
447mathematics}, something that will be easily read by screen readers, since it is
448only text. Of course, given the amount of symbols and macros, we are not
449complete. In fact, we do not want to be complete either, and the reason is
450simple: We cannot know how various authors want their formulas to be spoken. So,
451what we have is merely a proof of concept, with a set of interpretations that
452covers many basic usages of commonly used symbols.
453
454\setuptagging[state=on] \enabletrackers[math.textblobs]
455
456\setupnote
457 [mathnote]
458 [location=margin]
459
460
461
462To get a hold of it, let us look at a few simple examples, where after each
463formula we show how it is interpreted in text.
464
465\startbuffer
466\startformula
467 1 2 = 3
468\stopformula
469\stopbuffer
470
471\typebuffer \getbuffer \placenotes[mathnote]
472
473\startbuffer
474\startformula
475 32 42 = 52
476\stopformula
477\stopbuffer
478
479\typebuffer \getbuffer \placenotes[mathnote]
480
481\startbuffer
482\startformula
483 \frac{3}{6} = \frac{1}{2} = 12
484\stopformula
485\stopbuffer
486
487\typebuffer \getbuffer \placenotes[mathnote]
488
489\startbuffer
490\startformula
491 \sqrt{9} = 3
492\stopformula
493\stopbuffer
494
495\typebuffer \getbuffer \placenotes[mathnote]
496
497\startbuffer
498\startformula
499 \sin \left(\frac{\pi}{6}\right) = \frac{1}{2}
500\stopformula
501\stopbuffer
502
503\typebuffer \getbuffer \placenotes[mathnote]
504
505\startbuffer
506\startformula
507 \conjugate{1 2\ii} = 1 2\ii
508\stopformula
509\stopbuffer
510
511\typebuffer \getbuffer \placenotes[mathnote]
512
513\startbuffer
514\startformula
515 \frac{1 2}{3 4} = \frac{3}{7}
516\stopformula
517\stopbuffer
518
519\typebuffer \getbuffer \placenotes[mathnote]
520
521\disabletrackers[math.textblobs] \setuptagging[state=off]
522
523\stopsection
524
525\startsection[title={Some difficulties}]
526
527The process has really been trial and error. for sure there is space for
528improvements and variations, but we believe that the main structure is there.
529Different areas of mathematics come with different notations and different ways to
530interpret. So, if for example a logician wants to take this up, there is for sure
531some basic tuning needed before it works as expected.
532
533One of the difficulties we encountered along the way was how to work with
534parentheses. When we write \m {a(b c)} we likely read it as \quotation {\m {a}
535times \m {b} plus \m {c}}. But we cannot read it like that, since that could
536equally well be interpreted as \m {ab c}. We need the parentheses to be
537interpreted as some group:
538
539\setuptagging[state=on] \enabletrackers[math.textblobs]
540
541\startbuffer
542\startformula
543 a(b c)
544\stopformula
545\stopbuffer
546
547\typebuffer \getbuffer \placenotes[mathnote]
548
549\disabletrackers[math.textblobs] \setuptagging[state=off]
550
551On the other hand, when we write \m {f(x)} it is likely that it shall be
552interpreted as \quotation{\m{f} of \m {x}} rather than \quotation {\m {f} times
553\m {x}}.
554
555\setuptagging[state=on] \enabletrackers[math.textblobs]
556
557\startbuffer
558\startformula
559 f(x) \neq f\of(x)
560\stopformula
561\stopbuffer
562
563\typebuffer \getbuffer \placenotes[mathnote]
564
565In addition to the \tex {of} to handle this case, we also introduced the
566possibility to declare glyphs as being functions. So, it is possible to do
567
568\starttyping
569 \registermathfunction[𝑓]
570\stoptyping
571
572and then leave out the \tex {of}. In fact, one of the main difficulties has been
573to control when the explicit \quotation {times} shall be there and when it shall
574not. There are several special cases; we have likely missed a few.
575
576It is also possible to declare whole alphabets as being for example vectors or
577matrices. We can do
578
579\startbuffer
580 \registermathsymbol[default][en][lowercasebold][the vector]
581\stopbuffer
582
583\typebuffer \getbuffer
584
585and then use them as follows:
586
587\startbuffer
588\startformula
589 (\alpha \beta) \mathbf{u} = \alpha \mathbf{u} \beta \mathbf{u}
590\stopformula
591\stopbuffer
592
593\typebuffer \getbuffer \placenotes[mathnote]
594
595\stopsection
596
597\startsection[title={A few more examples}]
598
599We give a few more examples for you to ponder.
600
601\startbuffer
602\startformula
603 a1(1 x) (1 y)b1 a2(1 z) (1 u)b2
604\stopformula
605\stopbuffer
606
607\typebuffer \getbuffer \placenotes[mathnote]
608
609\startbuffer
610\startformula
611 a{0}.a{1}\notimes a{2} \ldots a{n} \ldots
612\stopformula
613\stopbuffer
614
615\typebuffer \getbuffer \placenotes[mathnote]
616
617\startbuffer
618\startformula
619 h\of(x) \neq h(x)
620\stopformula
621\stopbuffer
622
623\typebuffer \getbuffer \placenotes[mathnote]
624
625\startbuffer
626\startformula
627 s\of(1) = s\of(\set{0}) = \set{0} \cup \set{\set{0}}
628\stopformula
629\stopbuffer
630
631\typebuffer \getbuffer \placenotes[mathnote]
632
633\startbuffer
634\startformula
635 a\sqrt{x} = ax{12} \neq ax{13} = a\root[3]{x}
636\stopformula
637\stopbuffer
638
639\typebuffer \getbuffer \placenotes[mathnote]
640
641\startbuffer
642\startformula
643 \rationals = \set{\frac{p}{q} \fence p,q \in \integers \land q \neq 0}
644\stopformula
645\stopbuffer
646
647\typebuffer \getbuffer \placenotes[mathnote]
648
649\startbuffer
650\startformula
651 f \mapsas x \mapsto x \exp(x)
652\stopformula
653\stopbuffer
654
655\typebuffer \getbuffer \placenotes[mathnote]
656
657\startbuffer
658\startformula
659 \lim_{k \tendsto \infty} \frac{Ak}{Bk}
660\stopformula
661\stopbuffer
662
663\typebuffer \getbuffer \placenotes[mathnote]
664
665\startbuffer
666\startformula
667 \Gamma__1234 \neq \Gamma__12{}34
668\stopformula
669\stopbuffer
670
671\typebuffer \getbuffer \placenotes[mathnote]
672
673\startbuffer
674\startformula
675 \int_{a}{b} f(x) \dd x = f(b) f(a)
676\stopformula
677\stopbuffer
678
679\typebuffer \getbuffer \placenotes[mathnote]
680
681\startbuffer
682\startformula
683 \int_{\Omega} f \dd \mu = 0
684\stopformula
685\stopbuffer
686
687\typebuffer \getbuffer \placenotes[mathnote]
688
689\startbuffer
690\startformula
691 \sigma \of (A \transpose{A}) \setminus \set{0}
692 =
693 \sigma \of (\transpose{A} A) \setminus \set{0}
694\stopformula
695\stopbuffer
696
697\typebuffer \getbuffer \placenotes[mathnote]
698
699\startbuffer
700\startformula
701 \frac{\partial3 u}{\partial x2 \partial y}
702\stopformula
703\stopbuffer
704
705\typebuffer \getbuffer \placenotes[mathnote]
706
707\disabletrackers[math.textblobs] \setuptagging[state=off]
708
709\stopsection
710
711\startsection[title=Development]
712
713Getting all these meanings right was sort of trivial with all the already present
714tools in \CONTEXT. We will not go into details but it basically boils down to the
715following:
716
717\startitemize
718\startitem
719 A user keys in a formula, preferably using the proper, structure related
720 commands, but this comes natural.
721\stopitem
722\startitem
723 A raw formula (noad list) enters a chain of \LUA\ processing, this has always
724 been the approach in \MKIV, so nothing new here.
725\stopitem
726\startitem
727 Although there is some tagging happening at the \TEX\ end, we also intercept some
728 (yet) missing cases in \LUA, again that already happened.
729\stopitem
730\startitem
731 When a formula is typeset, the result is turned into an \MATHML\ representation,
732 and here we just use the existing export facilities of \CONTEXT.
733\stopitem
734\startitem
735 The now \XML\ encoded formula is then used for generating the meaning, which is
736 the new thing in \LMTX.
737\stopitem
738\stopitemize
739
740If tagging is also needed we embed the \MATHML\ as well as the meaning, so contrary
741to \MKIV, we no longer tag the individual components but treat the formula as
742a whole. After all, this sequential tagging made little sense anyway.
743
744When we go from \MATHML\ to meaning, we use information about characters that is
745part of a dictionary subsystem: we put symbols into categories which permits us
746to render with different spacing etc.\ based on the domain were dealing with but
747it also permits assigning s different meaning. This math subproject gave us a
748good reason to finally add this dictionary information to the character database
749(which of course gave us some good laughs about how weird math sometimes get
750coded, also in the perspective of \UNICODE).
751
752Right from the start we decided that for real useful accessibility we needed to
753support multiple languages, which is why we started with simultaneous English and
754Swedish. We will add support for Dutch and depending on needs and input other
755languages. Such additions are relatively easy and fit well into the way \CONTEXT\
756is set up. In \in {figure} [fig:meaningexamples:42] \in {and}
757[fig:meaningexamples:10] you see a few pages from a large document with examples
758that we used for development. This document will be in the \CONTEXT\ distribution
759and will be extended when there is need for more. It can also help translators.
760The document can show more details, like dictionary information, if needed.
761
762\startplacefigure[title={The file with examples that we test.},reference=fig:meaningexamples:42]
763 \externalfigure[ontargetmathmlmeanings][page=42,width=\textwidth]
764\stopplacefigure
765
766\startplacefigure[title={The file with examples that we test.},reference=fig:meaningexamples:10]
767 \externalfigure[ontargetmathmlmeanings][page=10,width=\textwidth]
768\stopplacefigure
769
770\startsection[title={A longer example, revisited}]
771
772We show below again the example from the introduction, this time with the math
773interpretations written out. We show this on separate pages in because here we
774have a somewhat complex mixed tracing situation (here we use the \STIX\ font).
775
776\bgroup \page[yes]
777
778\setuptagging[state=on] \enabletrackers[math.textblobs]
779
780
781
782\setupnote
783 [mathnote]
784 [location=page]
785
786\registermathfunction[𝑓]
787\registermathfunction[𝑔]
788\registermathfunction[φ]
789
790\switchtobodyfont[stixtwo,9pt]
791\samplefile{ontargetmathmlexample.tex}
792
793\page[yes] \egroup
794
795
796
797\disabletrackers[math.textblobs] \setuptagging[state=off]
798
799\stopsection
800
801\stopchapter
802
803\stopcomponent
804
805 |