Booking to PDF Theorem Environment Duplicate

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

我正在做一个书本项目,在定理环境中遇到了问题。当我编译为gitbook,epub_book或tufte_html_book但对pdf_book not编译时,它可以工作。以下是我的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}

这是我在编译时得到的:enter image description here

似乎定理的名称和实际内容以及示例都被视为两个不同的定理。关于定义和引理,这是相同的。即使我删除

header-includes:
    - \usepackage{amsthm}
    - \newtheorem{definition}{Definition}
    - \newtheorem{lemma}{Lemma}
    - \newtheorem{theorem}{Theorem}
    - \newtheorem{example}{Example}

从yaml标头中,我仍然遇到相同的问题。有关如何解决此问题的任何想法?

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

这是一个已知的错误,在knitr的开发版本中为has been fixed。您可以尝试:

remotes::install_github('yihui/knitr')
install.packages('bookdown')  # update bookdown
© www.soinside.com 2019 - 2024. All rights reserved.