gpt4 book ai didi

r - Bookdown to PDF Theorem Environment Duplicate

转载 作者:行者123 更新时间:2023-12-04 09:56:07 25 4
gpt4 key购买 nike

我正在做一个 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}
这是我编译时得到的:
enter image description here

似乎定理的名称和实际内容被视为两个不同的定理,以及示例。在定义和引理方面也是如此。即使我删除
header-includes:
- \usepackage{amsthm}
- \newtheorem{definition}{Definition}
- \newtheorem{lemma}{Lemma}
- \newtheorem{theorem}{Theorem}
- \newtheorem{example}{Example}

从 yaml header ,我仍然遇到同样的问题。有想法该怎么解决这个吗?

最佳答案

这是一个已知的错误,和 has been fixed的开发版中针织 .你可以试试:

remotes::install_github('yihui/knitr')
install.packages('bookdown') # update bookdown

关于r - Bookdown to PDF Theorem Environment Duplicate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61922964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com