将书本移植到distill :: distill_article不支持定理环境

问题描述 投票:1回答:1

试图将定理环境实现到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.$$
```

r r-markdown bookdown
1个回答
0
投票

检查了distll_article.R中的代码后,我认为我知道了为什么不显示该定理的原因。默认情况下,在distll_article中,knitr_options$opts_chunk$echo被分配了值FALSE,我认为它隐藏了定理环境,因为它在书本中被定义为代码块。要切换该值,请在yaml标头之后添加以下代码块即可完成工作。

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
© www.soinside.com 2019 - 2024. All rights reserved.