Skip to content
Prev 5435 / 12125 Next

[R-pkg-devel] RES: RES: RES: MathJax for Rd files

I installed the 'devel' version of mathjaxr and tested preview_rd()
All seems to be working fine!
Thank you for the quick and useful implementation!
Best,
Olivoto

-----Mensagem original-----
De: Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer at maastrichtuniversity.nl> 
Enviada em: quarta-feira, 13 de maio de 2020 18:26
Para: tiagoolivoto at gmail.com; 'Duncan Murdoch' <murdoch.duncan at gmail.com>; r-package-devel at r-project.org
Assunto: RE: RES: [R-pkg-devel] RES: MathJax for Rd files

I've added a preview_rd() function to the 'devel' version of mathjaxr:

https://github.com/wviechtb/mathjaxr

If you want to give this a try:

remotes::install_github("wviechtb/mathjaxr")
library(mathjaxr)

Then set the working dir to the root of the package you are working on. Then use:

preview_rd(Rdfile)

with the name of the Rd file given as a character string (either with or without the .Rd/.rd extension).

By default, the browser (or a new tab in your browser) should open up. But if you then make further changes to the Rd file, opening up a new tab each time is inconvenient. Use:

preview_rd(Rdfile, view=FALSE)

to prevent that (then just refresh the page in the open tab in your browser to see the updates).

One limitation: As far as I can tell, it will not be possible to load MathJax from the mathjaxr package when using preview_rd(). So, it will be loaded via the CDN, which means that you need an internet connection for equations to render.

Best,
Wolfgang