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.viechtba...@maastrichtuniversity.nl> Enviada em: quarta-feira, 13 de maio de 2020 18:26 Para: tiagooliv...@gmail.com; 'Duncan Murdoch' <murdoch.dun...@gmail.com>; r-package-devel@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 >-----Original Message----- >From: Tiago Olivoto [mailto:tiagooliv...@gmail.com] >Sent: Wednesday, 13 May, 2020 21:25 >To: 'Duncan Murdoch'; Viechtbauer, Wolfgang (SP); r-package-devel@r- >project.org >Subject: RES: RES: [R-pkg-devel] RES: MathJax for Rd files > >Definitively this is a better way to find the macros. >I think a function like 'preview_rd()' could be useful in mathjaxr > >Thanks for all support >Olivoto > >-----Mensagem original----- >De: Duncan Murdoch <murdoch.dun...@gmail.com> Enviada em: quarta-feira, >13 de maio de 2020 16:16 >Para: tiagooliv...@gmail.com; 'Viechtbauer, Wolfgang (SP)' ><wolfgang.viechtba...@maastrichtuniversity.nl>; r-package-devel@r- >project.org >Assunto: Re: RES: [R-pkg-devel] RES: MathJax for Rd files > >On 13/05/2020 2:30 p.m., Tiago Olivoto wrote: >> Thank you so much! It works! >> In my example, I've created a simple helper function, preview_rd() >> >> preview_rd <- function(rdfile){ # without '.rd' >> Rd <- file.path(paste("man/", rdfile, ".rd", sep = "")) # specify the >> .Rd file you want to preview outfile <- tempfile(fileext = ".html") >> browseURL(tools::Rd2HTML(Rd, outfile, >> macros="D:/Documents/R/win-library/4.0/mathjaxr/help/macros/mathjax.R >> d >> ")) >> } > >Good to hear. I'd suggest this way to find the macros: > > browseURL(tools::Rd2HTML(Rd, outfile, macros = >system.file("help/macros/mathjax.Rd", package = "mathjaxr"))) > >so that it works if you use it on a different system that puts the >library somewhere else. > >Duncan Murdoch ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel