1
votes

I've got an R Markdown document that I can successfully render with knitr on R Studio 1.1.423 and R version 3.4.3 under Linux. It has a bunch of LaTeX equations that render without issue. I use the knit button on R Studio to accomplish this task.

I've got the exact same versions of R Studio/R on Windows 10 and I can't get the LaTeX equations to render at all. Instead of the equation I get (=) where the equation ought to be on the rendered HTML webpage. This happens on both the R Studio preview pane, and if I open the generated HTML file in Chrome same issue. Oddly enough the equations do showup in the R Studio source pane when I hover the mouse over them on Windows 10.

[Edit] I've got the latest versions of knitr and rmarkdown installed in R. I've got Tex Live on both Linux and Windows 10. The equation that won't render on Windows is \( $Yummy = \frac{Effective Mass}{Avacados Constant} \).

1
MathJax is a JavaScript library for displaying Latex equations in browsers. I'm not sure if lack of MathJax is the cause of your issue, but here are instructions for installing it, in case you need to.eipi10
Do you have a version of LaTeX installed? Pandoc doesn't convert markdown to PDF, it converts to LaTeX source, and the LaTeX processor converts the result to images.user2554330
I've got Tex Live on both the Linux and Windows machines. I remember reading somewhere it's better to have MikTex on Windows machines but that probably doesn't matter in this case.stackinator
Why don't you provide a minimal reproducible example of your code?jay.sf
What does $Yummy represent? You should rather use \( \$Yummy ... \) or $ \$Yummy ... $.Werner

1 Answers

2
votes

I ended up removing the spaces in the equation transforming it from this:

\( $Yummy = \frac{Effective Mass}{Avacados Constant} \)

into this:

\($Yummy = \frac{Effective Mass}{Avacados Constant}\)

Now it properly renders in Windows 10. Strangely enough both examples render fine on Linux, and I can also get the centered version - with spaces - to render properly in Windows 10. It's just the inline version that breaks. This does work:

\[ $Yummy = \frac{Effective Mass}{Avacados Constant} \]