在烹饪本之后(以及这里的一些帖子),我尝试在我的R文件的YAML头中插入一个LaTeX包的集合。
当我从该网站复制/粘贴标题到我的文件中时:
output:
pdf_document:
extra_dependencies:
caption: ["labelfont={bf}"]
hyperref: ["unicode=true", "breaklinks=true"]
lmodern: null
我得到了错误:只有当我将选项包含在方括号中时才会发生这种情况--如果我删除了它们,一切都会按照预期进行。
在类似的例子中,我尝试以同样的方式添加babel
包。当我像这样把它包括在内时:
extra_dependencies:
babel: ["hebrew", "english"]
我得到错误:! You can't use
结束-组字符}‘后面\.’
我甚至更加困惑(如果可能的话),因为当我包含threeparttable
包的选项时,一切都没有问题。
下面是要测试的文件:
---
title: "R Notebook"
author:
- Me
date: "Last compiled on `r format(Sys.time(), '%d %B %Y')`"
output:
pdf_document:
highlight: tango
keep_tex: yes
number_sections: yes
toc: yes
fig_caption: yes
extra_dependencies:
cjhebrew: null
babel: ["hebrew", "english"]
---
# Section 1
Test
当我将它编成PDF时,我会得到错误:
好了!后不能使用“结束-组字符}”。\o@每一种类型{\rl@每种类型#1}
日志文件位于这个回购。
发布于 2022-03-10 21:50:28
rmarkdown自动加载hyperref包。您不能用冲突的选项再次加载它。
您可以使用\hypersetup{...}
更改其设置。
---
output:
pdf_document:
keep_tex: true
header-includes:
- \hypersetup{breaklinks=true}
---
test
但是,您确实需要所有的选项和包吗?
unicode
选项,所以不需要第二次添加它lmodern
包,不需要再加载它。另一个问题是babel和微型化包之间的交互,默认情况下,微型化包会重新加载。使用真正的乳胶,您可以避免加载每个包,但厨房水槽,您不会遇到这个问题,或者至少您可以直接添加nopatch
选项到microtype
(如果您真的需要的话).但降价使这一问题变得不必要的复杂。
这里是一个肮脏的黑客,希望没有其他包也使用这个名称作为选项:
---
title: "R Notebook"
author:
- Me
date: "Last compiled on `r format(Sys.time(), '%d %B %Y')`"
output:
pdf_document:
highlight: tango
keep_tex: yes
number_sections: yes
toc: yes
fig_caption: yes
extra_dependencies:
cjhebrew: null
babel: ["hebrew", "english"]
classoption: "nopatch"
---
# Section 1
Test
https://stackoverflow.com/questions/71430416
复制相似问题