显示相应列表项时如何显示代码块?

问题描述

在以下 RMarkdown MWE 中:

---
title: "Untitled"
output: 
 beamer_presentation:
   slide_level: 2
---

# Paragraph

## Slide

Hello

>- This is the first item
>- This is the second item

  ```{r}
  a <- 2+2
  ```

我希望代码块在第二个列表项显示生成的 PDF 文件中时显示,而不是在显示第一项时显示代码块。

解决方法

将代码包含在 > 块中。这行得通,

---
title: "Untitled"
output: 
 beamer_presentation:
   slide_level: 2
---

# Paragraph

## Slide

Hello

>- This is the first item

>- This is the second item
> 
>   ```{r}
>   a <- 2+2
>   ```

enter image description here

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...