Hi, list. When MathJax and KaTeX output formulas in SVG, they attach data,
e.g. Unicode info, math classes, etc. For instance, KaTeX outputs something
like that for $1 + 1$:

<span class="katex"><span class="katex-mathml"><math xmlns="
http://www.w3.org/1998/Math/MathML";
display="block"><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn></mrow><annotation
encoding="application/x-tex">1 +
1</annotation></semantics></math></span><span class="katex-html"
aria-hidden="true"><span class="base"><span class="strut" style="height:
0.7278em; vertical-align: -0.0833em;"></span><span
class="mord">1</span><span class="mspace" style="margin-right:
0.2222em;"></span><span class="mbin">+</span><span class="mspace"
style="margin-right: 0.2222em;"></span></span><span class="base"><span
class="strut" style="height: 0.6444em;"></span><span
class="mord">1</span></span></span></span>

AFAIK LaTeX and ConTeXt don't export to SVG natively and tools like dvisvgm
don't know about this information when converting .dvi or .pdf files to
SVG. But info is somehow available via tracing macros. In ConTeXt, I get
the following log from this file:

\startTEXpage
%\tracingmacros etc.
\tracingcommands\plusone
\tracingonline\plusone
$1 + 1$
\tracingcommands\zerocount
\stopTEXpage

Log:

(a lot of info...)
7:7: {\Umathfractiondelsize}
7:7: {\Umathfractiondelsize}
7:7: {\Umathfractiondelsize}
7:7: {\Umathfractiondelsize}
7:6: {\Umathskeweddelimitertolerance}
(a lot of info...)
7:4: {the character U+0031 1}
7:3: {blank space character U+0020 'space'}
7:3: {the character U+002B 'plus sign'}
7:3: {blank space character U+0020 'space'}
7:3: {the character U+0031 1}
...

Also, MathJax and KaTeX can export glyph outlines, which I know ConTeXt
already handles with via Metapost and Lua. So, I wonder if such structure
(paths + data) can be saved/exported as a Lua table, a SVG file or any
other format which keeps the semantic information of math formulas. Thank
you very much

Jairo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to