bookdown 中的定理和证明环境在 .pdf 输出中呈现为 "code"

Theorem and proof environment in bookdown rendering as "code" in .pdf output

我正在使用 bookdown 从我的一些数学课程中输入我的笔记。我想使用 here 中描述的定理和证明,但是当我实际编织 .pdf 文件时我遇到了渲染问题。基本上,.pdf 呈现的似乎是代码,实际上没有正确格式化,因为我可以在 LaTeX 中做到 "manually"。

我试过在输出之间切换(HTML 和 .pdf knits 都有同样的问题),我用 devtools::install_github('rstudio/bookdown') 安装了 bookdown 的开发版本,我也跟着以下链接无济于事:here, and .

这是我的 header:

--- 
title: "title"
author: author
date: '`r format(Sys.Date(), format="%B %d, %Y")`'
output:
  pdf_document:
    fig_caption: yes
    toc: yes
  html_document:
    toc: yes
 description: description
 documentclass: book
 header-includes:
- \usepackage{amssymb}
- \usepackage{amsmath}
- \usepackage{amsthm}
- \usepackage{tikz}
- \usepackage{hyperref}
- \usepackage{float}
- \usepackage{multirow}
link-citations: yes
numbersections: yes
bibliography: book.bib
site: bookdown::bookdown_site
biblio-style: apalike
---

这是我试过的方法

```{proposition}

If $X$ is a random variable and $X = c$, where $c \in [-\infty, \infty]$, then $\mathbb{E}[X] = c$.
```

```{proof}

Define a function $f(x)$ s.t. $f(x) = \begin{cases} 1 &\mbox{if } x = c \ 0 &\mbox{otherwise} \end{cases}.$

```

编辑:我也试过直接粘贴示例 here 但没有成功。

如前所述,我期待像 Theorem 2.1 on this page, but instead it prints what appears to look like code. I've uploaded an example here 这样的东西,如果我切换到 HTML.

,也会发生同样的事情

正如@Yihui Xie 所指出的,我使用了不正确的输出格式。 link 实际上帮助我弄清楚了我一开始并不想要一个冗长的单一文档,并找出了适当的书籍格式,但我按照该页面上的说明检查了输出,并通过创建正确的格式,现在都可以使用。谢谢!