[R-pkgs] mathjaxr: Using 'Mathjax' in Rd Files

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Fri May 8 20:30:12 CEST 2020


Dear All,

I would like to announce the release of the 'mathjaxr' package: 

https://cran.r-project.org/package=mathjaxr

The package provides MathJax and a handful of macros to enable its use within Rd files for rendering equations in the HTML help files.

Package authors wanting to make use of the package and its functionality need to:

1. install the mathjaxr package,
2. add mathjaxr to 'Suggests' or 'Imports' in the DESCRIPTION file of their package,
3. add mathjaxr to 'RdMacros' in the DESCRIPTION file of their package (or add 'RdMacros: mathjaxr' if the DESCRIPTION file does not yet contain a 'RdMacros' entry),

One can then enable the use of MathJax by calling the \loadmathjax macro within the \description{} section of an .Rd file.

An inline equation can then be added with the \mjeqn{latex}{ascii} macro, with the LaTeX commands for the equation given between the first set of curly brackets (which will be rendered in the HTML and PDF help pages) and the plain-text version of the equation given between the second set of curly brackets (which will be shown in the plain text help). With the \mjdeqn{latex}{ascii} macro, one can add 'displayed equations' (as in LaTeX's displaymath environment). Single argument versions of these macros, namely \mjseqn{latexascii} and \mjsdeqn{latexascii}, are also available.

I hope package authors will find this useful for providing fully rendered equations not only in the PDF manual, but also in the HTML help files (which the vast majority of users are probably looking at).

Feedback, comments, suggestions more than welcome. For bug reports, please go to:

https://github.com/wviechtb/mathjaxr/issues

Best,
Wolfgang



More information about the R-packages mailing list