【发布时间】:2020-05-20 21:10:21
【问题描述】:
我正在做一个 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 标头中,我仍然遇到同样的问题。有关如何解决此问题的任何想法?
【问题讨论】:
标签: r latex r-markdown bookdown