# [R-pkg-devel] R package submission fails due to mathjaxr package

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Jun 21 10:29:17 CEST 2021

Hi Marc,

As far as I can tell, the problem has nothing to do with mathjaxr, but your use of LaTeX commands that are not supported in creating the pdf manual (which is not done by mathjaxr but R itself). See:

https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Mathematics

You can use AMS extensions for the HTML docs since those are supported by Mathjax, but not for the pdf manual.

So, for the pdf manual, you will have to write the equation without the use of AMS extensions (and indeed use \mjtdeqn).

Best,
Wolfgang

>-----Original Message-----
>From: Marc Scherstjanoi [mailto:marc.scherstjanoi using thuenen.de]
>Sent: Sunday, 20 June, 2021 23:16
>To: Viechtbauer, Wolfgang (SP)
>Cc: Tiago Olivoto; Max Turgeon; r-package-devel using r-project.org
>Subject: Re: R package submission fails due to mathjaxr package
>
>Hi Wolfgang, Tiago and Max
>
>thank you for your reply. Let me first apologize. "due to mathjaxr" sounds a bit
>I am very thankful for this nice package. It works really well for all of the
>equations I have, and the HTML it creates is just nice.
>The only problem is the PDF and I also found out that the align function (amsmath
>latex package) is the actual error source. Furthermore, "\cr" is also giving an
>error message.
>
>For example, having
>
>\mjdeqn{\begin{align} A_e(t) &= \left(A^T \cdot xi(t) \right)^T \cr &= A \cdot
>diag(xi(t)) \end{align}}{Ae(t) = (A^T * xi(t))^T = A * diag(xi(t))}
>
>in the \details section of the .Rd file leads to
>
>"LaTeX errors:
>! LaTeX Error: Environment align undefined."
>
>when building with "R CMD build /home/.../package"
>
>but passes with "R CMD build /home/.../package --no-manual".
>
>The aim of the align command is to set several equations in certain horizontal
>positions (mostly oriented on the "="s, indicated by the "&"s) one below the
>other.
>commands for the PDF and HTML pages differently.
>However, if the pdf necessarily needs to be created when submitting the package,
>it would be better to have the equations aligned there as well.
>For readability it would be a plus as I don't just have a couple of equations and
>equation systems.
>
>We are using the following setup:
>Added "mathjaxr" to Imports and RdMacros fields of the DESCRIPTION file.
>Added import(mathjaxr) to the NAMESPACE file.
>
>I would be grateful for any idea how to convince the pdfTeX of the align command
>or a similar solution.
>
>Marc
>
>----- Ursprüngliche Mail -----
>Von: "Viechtbauer, Wolfgang (SP)" <wolfgang.viechtbauer using maastrichtuniversity.nl>
>An: "Marc Scherstjanoi" <marc.scherstjanoi using thuenen.de>, r-package-devel using r-
>project.org
>Gesendet: Sonntag, 20. Juni 2021 11:08:56
>Betreff: RE: R package submission fails due to mathjaxr package
>
>Hi Marc,
>
>mathjaxr maintainer here. Can you provide a minimal reproducible example
>illustrating the problem? If this is another case where the LaTeX command for
>Mathjax does not work directly for creating the pdf (or vice-versa), then I would
>like to document this (and a possible workaround) as was done here:
>
>https://github.com/wviechtb/mathjaxr#issues
>
>Best,
>Wolfgang
>
>>-----Original Message-----
>>From: R-package-devel [mailto:r-package-devel-bounces using r-project.org] On Behalf Of
>>Marc Scherstjanoi
>>Sent: Friday, 18 June, 2021 22:22
>>To: r-package-devel using r-project.org
>>Subject: [R-pkg-devel] R package submission fails due to mathjaxr package
>>
>>Hi,
>>
>>I am about to sumbmit an R package.
>>
>>It passed the
>>"R CMD check /package... --as-cran --no-manual"
>>but not the
>>"R CMD check /package... --as-cran".
>>
>>Our way of presenting mathematical equations by using the mathjaxr package seems
>>to be not supported.
>>As a result, building pdf fails automatically.
>>
>>We have already been aware of that and would like to submit the
>>package manual pdf separately.
>>
>>How can this be done?
>>Can our submission work without the rd to pdf process?
>>Or is there a way to include the mathjaxr style for the texing?
>>