将 bookdown 移植到 distill::distill_article 不支持 theorem 环境
Porting bookdown to distill::distill_article doesn't support theorem environment
正在尝试对 R distill::article 实施定理环境。遵循 Rmarkdown 和 Bookdown 书籍的说明,以及 R Markdown Cookbook
我发现
的定理环境处理得很好
bookdown::html_document2:
base_format: rmarkdown::html_document
和
bookdown::html_document2:
base_format: pagedown::html_paged
但是,它不适用于 distill_article
。有人知道为什么它不起作用吗?
以下是一个最小的可重现示例。
---
title: "Port the bookdown features to Rmarkdown"
author: "Bookdown Rmarkdown"
output:
bookdown::html_document2:
base_format: distill::distill_article
---
# Theorems
```{theorem, name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2.$$
```
查看distll_article.R中的代码后,我想我明白了为什么不显示定理。默认情况下,在 distll_article 中,knitr_options$opts_chunk$echo
被赋值为 FALSE
,我认为这隐藏了定理环境,因为它在 bookdown 中被定义为代码块。要切换值,在 yaml header 之后添加以下代码块即可完成工作。
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
正在尝试对 R distill::article 实施定理环境。遵循 Rmarkdown 和 Bookdown 书籍的说明,以及 R Markdown Cookbook
我发现
的定理环境处理得很好bookdown::html_document2:
base_format: rmarkdown::html_document
和
bookdown::html_document2:
base_format: pagedown::html_paged
但是,它不适用于 distill_article
。有人知道为什么它不起作用吗?
以下是一个最小的可重现示例。
---
title: "Port the bookdown features to Rmarkdown"
author: "Bookdown Rmarkdown"
output:
bookdown::html_document2:
base_format: distill::distill_article
---
# Theorems
```{theorem, name="Pythagorean theorem"}
For a right triangle, if $c$ denotes the length of the hypotenuse
and $a$ and $b$ denote the lengths of the other two sides, we have
$$a^2 + b^2 = c^2.$$
```
查看distll_article.R中的代码后,我想我明白了为什么不显示定理。默认情况下,在 distll_article 中,knitr_options$opts_chunk$echo
被赋值为 FALSE
,我认为这隐藏了定理环境,因为它在 bookdown 中被定义为代码块。要切换值,在 yaml header 之后添加以下代码块即可完成工作。
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```