Bookdown 到 PDF 定理环境复制
Bookdown to PDF Theorem Environment Duplicate
我正在做一个 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.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 文件(相关部分):
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
pandoc_args: --top-level-division=chapter
preamble.tex只是有\usepackage{booktabs}
这是我编译时得到的:
好像把定理的名字和实际的内容当作两个不同的定理来对待,例子也是如此。这在定义和引理方面是一样的。即使我删除
header-includes:
- \usepackage{amsthm}
- \newtheorem{definition}{Definition}
- \newtheorem{lemma}{Lemma}
- \newtheorem{theorem}{Theorem}
- \newtheorem{example}{Example}
从 yaml header,我仍然遇到同样的问题。关于如何解决这个问题有什么想法吗?
这是一个已知错误,has been fixed 在 knitr 的开发版本中。你可以试试:
remotes::install_github('yihui/knitr')
install.packages('bookdown') # update bookdown
我正在做一个 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.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 文件(相关部分):
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
pandoc_args: --top-level-division=chapter
preamble.tex只是有\usepackage{booktabs}
这是我编译时得到的:
好像把定理的名字和实际的内容当作两个不同的定理来对待,例子也是如此。这在定义和引理方面是一样的。即使我删除
header-includes:
- \usepackage{amsthm}
- \newtheorem{definition}{Definition}
- \newtheorem{lemma}{Lemma}
- \newtheorem{theorem}{Theorem}
- \newtheorem{example}{Example}
从 yaml header,我仍然遇到同样的问题。关于如何解决这个问题有什么想法吗?
这是一个已知错误,has been fixed 在 knitr 的开发版本中。你可以试试:
remotes::install_github('yihui/knitr')
install.packages('bookdown') # update bookdown