Creating a presentation with R + markdown + knitr + equations + pandoc + reveal.js

620 views Asked by At

I am stuck. I am trying to find the right combination of tools to achieve a presentation which would include mathematical equations, dynamically generated plots and which would be pleasing to the eye. I am stuck with equations. Here is what I have so far:

I create an .Rmd file:

---
title: "Test RMD"
author: Foofary Finer
date: "`r Sys.Date()`"
---

# First slide

$$2^{10} - 1$$

# Second slide

```{r plot1}
plot(1:10,1:10)
```

(How can I produce directly the html using rmarkdown::render? But that's another question)

Running knitr("test.Rmd") creates the following markdown code:

---
title: "Test RMD"
author: Foofary Finer
date: "2015-06-22"
---

# First slide

$$2^{10} - 1$$

# Second slide


```r
plot(1:10,1:10)
```

![plot of chunk plot1](figure/plot1-1.png)

So far, so good. Now I run pandoc:

pandoc   -s  -S -i -t revealjs  test.md -o test.html --mathjax

The maths does not get rendered. Inspection of the HTML code reveals the following line:

<script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

Apparently, the "https:" is missing; if I correct it manually, the math is displayed correctly. So what am I doing wrong? I tried the following, but to no avail:

pandoc -s  -S -i -t revealjs  test.md -o test.html --mathjax -V mathjax-url='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
0

There are 0 answers