pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

[WARNING] Could not convert TeX math z = s\sqrt{n}, rendering as TeX

Open cthombor opened this issue 2 years ago • 4 comments

Hi, I have been trying to add a couple of inline equations to a github-hosted website using RStudio. It's my first such project -- and I'm unfamiliar with the workflow features in github and RStudio, so my localisation may be incorrect ... but I think it's most likely to be an issue with pkgdown or its setup on my RStudio client. If that's not a likely root cause please aim me elsewhere for assistance.

I have a few inline math callouts in my README.Rmd. The single-variable callouts (e.g. $s$) don't throw warnings when I invoke the "Build pkgdown" affordance in the AddIns of my project; but warnings are issued for $\sqrt{n}$. Screenshot below:

Screenshot_20221229_113347

The README.md looks fine to me, e.g. at $z = s\sqrt{n}$.

I believe docs/index.html exhibits a defect at <span class="math inline">$z = \sqrt{n}$</span>, due to the dollar signs -- which I imagine should be suppressed, as in the subsequent <span class="math inline"><em>s</em></span>.

Screenshot_20221229_082446

I have tried usethis::use_pkgdown_github_pages(); but I get the same defective rendering of $\sqrt{n}$. I don't see any warning messages on the bot-triggered Action, screenshots below.

Please advise.

image

image

cthombor avatar Dec 29 '22 07:12 cthombor

Locally I get the error too for https://github.com/maelle/tex, interesting. It's an error from Pandoc, I wonder whether that happens for only certain versions of Pandoc.

maelle avatar Jan 06 '23 08:01 maelle

The problem does not happen if the same math is used in a vignette.

maelle avatar Jan 06 '23 08:01 maelle

@maelle thanks for looking into this. I'm grateful that R has volunteers like you who are doing the hard yards of maintenance! I pushed my current version just now to github, with a workflow on readme.md (rather than on readme.Rmd as before) -- but https://cthombor.github.io/SafeVote/ still has the defective index.html:

image

Curiously -- and perhaps this is an important clue -- the sqrt callouts in https://github.com/cthombor/SafeVote are rendered correctly:

Screenshot_20230107_082340

cthombor avatar Jan 07 '23 07:01 cthombor

@cthombor I opened a PR #2263 with a possible fix (emphasis on possible) :-)

maelle avatar Jan 09 '23 06:01 maelle