R Bookdown到PDF环境副本

R Bookdown到PDF环境副本,r,latex,r-markdown,bookdown,R,Latex,R Markdown,Bookdown,我正在做一个簿记项目,遇到了定理环境的问题。当我编译到gitbook、epub_book或tufte_html_book时,它可以工作,但不能编译到pdf_book。下面是我在index.Rmd文件中的内容 --- title: "Blah Blah" author: "Me" date: "`r Sys.Date()`" site: bookdown::bookdown_site documentclass: krantz bibliography: [book.bib, packages.

我正在做一个簿记项目,遇到了定理环境的问题。当我编译到gitbook、epub_book或tufte_html_book时,它可以工作,但不能编译到pdf_book。下面是我在index.Rmd文件中的内容

--- 
title: "Blah Blah"
author: "Me"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: krantz
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
header-includes:
- \usepackage{amsthm}
- \newtheorem{definition}{Definition}
- \newtheorem{lemma}{Lemma}
- \newtheorem{theorem}{Theorem}
- \newtheorem{example}{Example}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

# First Chapter

The content of Preface. [@xie2015]

```{theorem, name="Infinite Group"}
A group having an infinite number of elements.
```

```{example}
The set $(\mathbb{Z}, +)$ is an infinite group.
```
这是我的_output.yml文件(相关部分)中的内容:

preamble.tex只是有
\usepackage{booktab}

这是我编译时得到的结果:

这个定理的名称和实际内容似乎被视为两个不同的定理和例子。这在定义和引理方面是相同的。即使我移除

header-includes:
    - \usepackage{amsthm}
    - \newtheorem{definition}{Definition}
    - \newtheorem{lemma}{Lemma}
    - \newtheorem{theorem}{Theorem}
    - \newtheorem{example}{Example}
从yaml标题,我仍然得到相同的问题。关于如何修复这个问题有什么想法吗?

这是一个已知的bug,在knitr的开发版本中。你可以尝试:

remotes::install_github('yihui/knitr'))
安装.packages('bookdown')#更新bookdown

亲爱的@YihuiXie,这并没有为我解决问题-我仍在解决问题。。我点击了你的链接,指向你的GitHub,如果我没有弄错的话,问题是我没有使用最新版本的Pandoc,对吗?我被老版本的潘多克困住的原因是。是否可以使您的解决方案对Pandoc 2.6友好?非常感谢,,thomas@tchevrier请看
header-includes:
    - \usepackage{amsthm}
    - \newtheorem{definition}{Definition}
    - \newtheorem{lemma}{Lemma}
    - \newtheorem{theorem}{Theorem}
    - \newtheorem{example}{Example}