How to interrupt an incremental list of items in Rmarkdown, then retake it after a plot or figure?
Asked Answered
R

2

1

I'm really interested in interrupting incremental lists of items created in Rmarkdown with RStudio, to show plots and figures, then retake the list highlighting. This is quite straightforward in Latex, but I couldn't figure out how to achieve the same result using Rmarkdown. Below is some beamer example.

---
title: "Sample Document"
author: "Author"
output:
 beamer_presentation:
  fonttheme: structurebold
  highlight: pygments
  incremental: yes
  keep_tex: yes
  theme: AnnArbor
  toc: true
  slide_level: 3
---

# Some stuff 1
### Some very important stuff

- More detail on stuff 1 
- More detail on stuff 1
- More detail on stuff 1

# The following chart should appear between the first and second item above

```{r, prompt=TRUE}
summary(iris[, "Sepal.Length"])

# Stuff 2
### There are other kinds of stuff?

```{r, prompt=TRUE}
summary(mtcars[, "cyl"])

enter image description here enter image description here enter image description here enter image description here

Radiobroadcast answered 12/6, 2016 at 3:6 Comment(2)
just start a new list... or do you mean retake the numbering? can you post a screenshot or latex equivalent?Salpa
Yes, retaking the numbering or alerting. The idea is to pause a list, insert new stuff, then retake the list from the last position you were.Radiobroadcast
S
0

You're asking about the behaviour of pandoc's incremental option that makes "list items in slide shows display incrementally (one by one)." The option causes pandoc to generate the following LaTeX (which in turn generates the PDF):

\\begin{itemize}[<+->]

I'm not sure of the exact LaTeX behaviour, but what about the following?

- More detail on stuff 1
- ```{r, prompt=TRUE}
  summary(iris[, "Sepal.Length"])
  ``` 
- More detail on stuff 1
- More detail on stuff 1
Salpa answered 13/6, 2016 at 9:4 Comment(1)
Nice try, but it doesn't work, nor - ![Markdown Call](myplot.jpg) does. I'm giving up, I don't thing pandoc will understand it via rmarkdown.Radiobroadcast
M
0

You can insert slides in between the items like this:

---
title: "Sample Document"
author: "Author"
output:
 beamer_presentation:
  fonttheme: structurebold
  highlight: pygments
  incremental: yes
  keep_tex: yes
  theme: AnnArbor
  toc: true
  slide_level: 3
---

# Some stuff 1
``` {=latex}
\end{frame}
\begin{frame}<1>[label=foo]
\frametitle{some very important stuff}
```


- More detail on stuff 1 
- More detail on stuff 1
- More detail on stuff 1

``` {=latex}
\end{frame}
```

### Some chart

insert chart here

``` {=latex}
\end{frame}
\againframe<2->{foo}
```

### other stuff
Maguire answered 31/10, 2019 at 17:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.