Subject: bug#73641: 30.0.90; Math in EWW/shr

From: Eli Zaretskii <[email-masked]>
Date: Thu, 10 Oct 2024 10:43:53 +0300

> From: Augusto Stoffel <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 10 Oct 2024 08:41:32 +0200
> 
> On Sat,  5 Oct 2024 at 18:24, Eli Zaretskii wrote:
> 
> >> From: Augusto Stoffel <[email-masked]>
> >> Date: Sat, 05 Oct 2024 16:01:36 +0200
> >> 
> >> It is possible for the <math> element to include a SVG rendition of the
> >> formula.  We could consider displaying that if available (not sure how
> >> common it is, though).  Also, we might consider including infrastructure
> >> to render MathML, but this would require external programs (there is no
> >> reason to reinvent MathJax).  I've done that in one of my packages, see
> >> this commit for the relevant code:
> >> 
> >> https://github.com/astoff/devdocs.el/commit/04a8793072f1fc7c23f115e2c7ee83ce669b6fa4
> >> 
> >> (Actually, I added a version of the above to two of my packages already,
> >> so I think it's pretty clear Emacs should have some general
> >> math-rendering infrastructure.)
> >
> > I agree that it would be good for Emacs to support math rendering, but
> > we need to find the best way of doing that, and then look for a
> > library or a program that implements that.  Maybe the first step would
> > be to conduct a survey of available methods and tools.
> 
> Sure, but my suggestion above for a "baseline" implementation of the
> math tag in shr makes sense anyway IMO.  Should I prepare a patch?

I don't think I understand what you are proposing.  What is the
"baseline" implementation for math tags? what will it entail and what
will it allow/enable?

> Now, about your question, I think there aren't too many options:
> 
> - Good old TeX: widely available among (and only among) scientific
>   people, gigantic and bloated and slow, no MathML support, excellent at
>   rendering TeX, has "shell escape" to worry about.
> 
> - LuaTeX: like TeX, but probably can do MathML as well.
> 
> - MathJax: needs JavaScript, otherwise can be bundled with Emacs (takes
>   just 2MB), supports MathML, supports TeX notation but not arbitrary
>   TeX packages, safe by default.

The basic question is what these produce as output, and how can Emacs
display what they produce?  The best alternative for Emacs is to have
a tool that can generate characters, which could then be rendered
using a suitable font.  The (distant) second best is a tool that
generates an image.

Thanks.