[Rd] Bundling MathJax

Jeroen Ooms jeroenoom@ @end|ng |rom gm@||@com
Sun Mar 13 15:25:37 CET 2022


On Sun, Mar 13, 2022 at 1:48 PM Ivan Krylov <krylov.r00t using gmail.com> wrote:
>
> Hello R-devel,
>
> I appreciate the efforts devoted towards improving equation typography
> in HTML manuals. Since MathML lost its status as the way to express
> mathematics on the web after its removal from Google Chrome in 2013,
> MathJax and KaTeX are probably the best options left: both TtH [1] and
> HeVeA [2] don't render math quite as well and likely don't do anything
> about accessibility of the resulting equations (which seems to be the
> reason to focus on the HTML documentation in the first place).
>
> Having seen r81881 [3], I would like to suggest bundling MathJax
> together with R instead of loading it from the Internet. Every now and
> then, I work from places with spotty Internet connection (e.g. mobile
> network on a train). If R defaults to downloading a file every time
> Rd2HTML is called, that would be very inconvenient to me, especially
> since the requests for external JavaScript could intermittently fail
> or take a long time to load, resulting in partially failed renders.

An alternative, more robust method is to render the math-to-html in R
using the katex R package. This way no JavaScript library needs to be
included in the html manual pages, merely a small katex css file with
some styling, which is much lighter and safer to load in manual pages
(and probably more feasible to bundle with R).

For an example, see: https://docs.ropensci.org/katex/reference/math_to_rd.html



More information about the R-devel mailing list