[Rd] Bundling MathJax

Deepayan Sarkar deep@y@n@@@rk@r @end|ng |rom gm@||@com
Wed Mar 16 17:20:00 CET 2022


Just a status update:

Thanks to Jeroen and others for pointing out KaTeX, which I had not
used before but indeed seems preferable in many respects. I don't
think build-time rendering is a feasible choice given the dependency
implications, but I have now added KaTeX as another (and the default)
alternative for client-side rendering.

Currently, KaTeX is served from a CDN. The plan is to ship a copy of
KaTeX with R by the time R 4.2.0 is released, but we have not yet
decided on the best way to do that.

If you want MathJax, set

Sys.setenv("_R_HELP_ENABLE_ENHANCED_HTML_" = TRUE)
options(help.htmlmath = "mathjax")

This will use the local copy from mathjaxr if it is installed, and a
CDN otherwise.

Best,
-Deepayan

On Tue, Mar 15, 2022 at 5:12 PM Jan Netík <netikja using gmail.com> wrote:
>
> Hello everyone,
>
> glad to see the progress on this! It would be a major advancement in the
> user experience of using our beloved _statistical_ language and
> environment. I have brought the topic a year ago or so here and Simon
> Urbanek offered a "hack" which I have implemented in the package many use
> today (https://github.com/netique/documath). However, it is a customized
> Rd2HTML injection, which is generally a really bad idea... (OT: check out
> the {mvbutils} package, which I think does a bunch of "illegal" things,
> such as rewriting base functions on the fly.)
>
> As far as I know, I would certainly vote for KaTeX, as it is _perceivably_
> faster and, as many of you mentioned, is capable of server-side rendering
> which I deem promising.
>
> Keep up the good work!
>
> Best,
> Jan
>
> út 15. 3. 2022 v 11:44 odesílatel Viechtbauer, Wolfgang (SP) <
> wolfgang.viechtbauer using maastrichtuniversity.nl> napsal:
>
> > Hi Ivan,
> >
> > I would say the biggest impact is in terms of the size of the installed
> > package (~4MB versus ~2.9MB). Of course, these days this is a trivial
> > difference in terms of storage. The decrease in load and execution time is
> > probably negligible (esp. when MathJax is served locally), but I haven't
> > done any proper benchmarks on this.
> >
> > Note that mathjaxr only minifies when the (suggested) 'js' package is
> > installed, so this step is completely optional.
> >
> > Best,
> > Wolfgang
> >
> > >-----Original Message-----
> > >From: R-devel [mailto:r-devel-bounces using r-project.org] On Behalf Of Ivan
> > Krylov
> > >Sent: Monday, 14 March, 2022 22:03
> > >To: Duncan Murdoch
> > >Cc: r-devel using r-project.org
> > >Subject: Re: [Rd] Bundling MathJax
> > >
> > >On Sun, 13 Mar 2022 10:05:18 -0400
> > >Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> > >
> > >> The file used for display is usually a minified version of the
> > >> MathJax source, and Debian didn't consider it close enough to source
> > >> code to want to distribute it as FOSS.  So if the minified file is
> > >> included with R, the original source should also be included.
> > >
> > >Pardon my ignorance, but how much does it matter whether the file is
> > >minified when the documentation is served over a local network? Does
> > >JavaScript minification speed up parsing or involve other
> > >transformations without which it would be hard or impossible to run the
> > >code in the browser?
> > >
> > >--
> > >Best regards,
> > >Ivan
> >
> > ______________________________________________
> > R-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list