问题
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"])
回答1:
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
回答2:
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
来源:https://stackoverflow.com/questions/37770348/how-to-interrupt-an-incremental-list-of-items-in-rmarkdown-then-retake-it-after