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

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Wed May 13 19:40:39 CEST 2020

Thanks, Duncan. I was about to respond to suggest the same thing.

One way of getting this to work:

Rd <- file.path("<path>/<file>.Rd") # specify the .Rd file you want to preview
outfile <- tempfile(fileext = ".html")
browseURL(tools::Rd2HTML(Rd, outfile, macros="<path to library where mathjaxr is installed>/mathjaxr/help/macros/mathjax.Rd"))


>-----Original Message-----
>From: Duncan Murdoch [mailto:murdoch.duncan using gmail.com]
>Sent: Wednesday, 13 May, 2020 19:30
>To: tiagoolivoto using gmail.com; Viechtbauer, Wolfgang (SP); 'Helmut Schütz'; r-
>package-devel using r-project.org
>Subject: Re: [R-pkg-devel] RES: MathJax for Rd files
>On 13/05/2020 12:35 p.m., Tiago Olivoto wrote:
>> Thanks, Wolfgang and Helmut for the explanations.
>> When I was trying to use
>> #'\if{html}{\out{'<script id="MathJax-script" async
>> #''src="https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-chtml-full.js
>> #'</script> }}
>> #'
>> #'And then typing
>> #' \ifelse{html}{\out{\[\sqrt{a^2}\]}}{\deqn{\sqrt{a^2}}}
>> My mgidi.Rd file was produced with devtools::document();
>> then, I just used ?mgidi, and the html page was rendered nicely.
>> If I could do the same with mathjaxr, It would be nice, because I wouldn't
>need to install the package to see if the equations are as I expect
>> Anyway, mathjaxr is a very useful package.
>> Congratulations on the efforts for developing it.
>Sounds like it's a devtools issue.  I don't know how they are simulating
>the install, but it needs to say to use the mathjaxr macros when
>converting the Rd pages.
>Duncan Murdoch
>> Best
>> Olivoto
>> -----Mensagem original-----
>> De: Viechtbauer, Wolfgang (SP)
><wolfgang.viechtbauer using maastrichtuniversity.nl>
>> Enviada em: quarta-feira, 13 de maio de 2020 13:14
>> Para: Helmut Schütz <helmut.schuetz using bebac.at>; tiagoolivoto using gmail.com; r-
>package-devel using r-project.org
>> Assunto: RE: [R-pkg-devel] MathJax for Rd files
>> Thanks for the info! Can confirm now that I tried this (I don't usually
>use RStudio). That's an RStudio issue then. My guess is that 'Preview' uses
>tools::Rd2HTML() and that indeed won't automatically understand macros
>coming from mathjaxr (or any add-on package for that matter). This would be
>an issue to raise with the RStudio folks then.
>> But once a package is installed, the equations are nicely rendered also in
>the RStudio help browser, so that part works.
>> Best,
>> Wolfgang
>>> -----Original Message-----
>>> From: Helmut Schütz [mailto:helmut.schuetz using bebac.at]
>>> Sent: Wednesday, 13 May, 2020 17:01
>>> To: Viechtbauer, Wolfgang (SP); tiagoolivoto using gmail.com;
>>> r-package-devel using r- project.org
>>> Subject: Re: [R-pkg-devel] MathJax for Rd files
>>> Hi Wolfgang,
>>> Viechtbauer, Wolfgang (SP) wrote on 2020-05-13 16:53:
>>>> Seems like you are using roxygen2. I have little experience with
>>>> that, as
>>> all my Rd files are 'handcrafted' (plus 100% organic and biodegradable).
>>> As are mine. ;-)
>>> In the HTML-preview of RStudio the LaTeX is indeed not parsed. I get it
>>> only (in the HTML man-page and the PDF) if I build the package.
>>> Helmut
>>> --
>>> Ing. Helmut Schütz
>>> BEBAC – Consultancy Services for
>>> Bioequivalence and Bioavailability Studies Neubaugasse 36/11
>>> 1070 Vienna, Austria
>>> E helmut.schuetz using bebac.at
>>> W https://bebac.at/
>>> F https://forum.bebac.at/

More information about the R-package-devel mailing list