15

In this example xaringan presentation, why are both the ## blank page and the leaflet map on the same slide, given I've separated them by the new-slide separator --- ?

---
title: "map test"
output:
  xaringan::moon_reader:
    css: ["default"]
    nature:
      highlightLines: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


## blank page

content 

--- 

leaflet page

```{r}
library(leaflet)
leaflet() %>%
  addTiles()

```

---

enter image description here

SymbolixAU
  • 25,502
  • 4
  • 67
  • 139

2 Answers2

18

Looks like you've got an unintended space after the new slide separator after blank content as "--- ". Remove that space and it'll be recognized as real slide separator:

---
title: "map test"
output:
  xaringan::moon_reader:
    css: ["default"]
    nature:
      highlightLines: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


## blank page

content 

---

leaflet page

```{r}
library(leaflet)
leaflet() %>%
  addTiles()

```

---
Yue Jiang
  • 1,271
  • 10
  • 15
  • 3
    It's at times like these you just have to laugh... Thanks for spotting that. – SymbolixAU Jul 01 '18 at 05:58
  • 2
    @SymbolixAU I believe there's an RStudio option to strip trailing whitespace upon save? Anyway I've filed [this issue](https://github.com/yihui/xaringan/issues/151) – MichaelChirico Jul 02 '18 at 01:14
  • 7
    @MichaelChirico - so there is : Tools > Global Options > Code > Saving > 'strip trailing horizontal whitespace when saving' – SymbolixAU Jul 02 '18 at 01:18
  • This also applies to incremental slides - remove trailing spaces after `--` – leo Feb 13 '21 at 22:40
0

In my case I'm adding mathjax/latex equations and I had:

$$
\begin{aligned} P(Y= k)=\comb{k-1}{r-1} * p^r q^{k-r}, \qquad k= r,r+1
\end{aligned}\label{pascal}\tag{5}
$$

And I had to remove the breaklines

$$\begin{aligned} P(Y= k)=\comb{k-1}{r-1} * p^r q^{k-r}, \qquad k= r,r+1
\end{aligned}\label{pascal}\tag{5}$$

and then it worked. I've that it renders mathjax better if all the code is in a single line.

DaríoM
  • 11
  • 4