英文:
rmarkdown includes don't work when in_header files in subdir
问题
将yaml
内容中的in_header: pre.sty
添加到文件时,只有当pre.sty
存在于与rmarkdown文件相同的目录中时,文件才会按预期包含。然而,当将pre.sty
移动到子目录并使用in_header: etc\pre.sty
时,会出现错误:
在资源路径中找不到文件 etc\pre.sty
错误:pandoc文档转换失败,错误代码99
执行已停止
是否有一种方法可以包含存储在子目录中的标头文件,或者是否这似乎是一个错误?我尝试了不同的方法,但没有成功。
最小示例:
---
output:
bookdown::pdf_document2:
# will be generated by includes s
toc: no
fig_align: center
fig_height: 4
fig_width: 6
latex_engine: xelatex
keep_tex: true
includes:
in_header: pre.sty
fontsize: 11pt
---
最小示例1 - 当`pre.sty`存储在与rmarkdown文件相同的目录中时,此示例有效。
最小示例:
---
output:
bookdown::pdf_document2:
# will be generated by includes s
toc: no
fig_align: center
fig_height: 4
fig_width: 6
latex_engine: xelatex
keep_tex: true
includes:
in_header: etc\pre.sty
fontsize: 11pt
---
最小示例2 - 当`pre.sty`存储在`etc`子目录中时,此示例无效。
pre.sty
文件的内容:
\usepackage{booktabs}
英文:
Adding in_header: pre.sty
to the yaml
content includes the file as expected when pre.sty exists in the same directory as the rmarkdown file. However, using in_header: etc\pre.sty
along with moving pre.sty
to a subdirectory fails with error:
File etc\pre.sty not found in resource path
Error: pandoc document conversion failed with error 99
Execution halted
is there a way to incorporate header files stored in subdirectories or does this appear to be a bug? I have attempted variations on the approach, but none have been successful.
Minimal example:
---
output:
bookdown::pdf_document2:
# will be generated by includes s
toc: no
fig_align: center
fig_height: 4
fig_width: 6
latex_engine: xelatex
keep_tex: true
includes:
in_header: pre.sty
fontsize: 11pt
---
Min example 1 - this works when pre.sty is stored in same dir as rmarkdown.
Minimal example:
---
output:
bookdown::pdf_document2:
# will be generated by includes s
toc: no
fig_align: center
fig_height: 4
fig_width: 6
latex_engine: xelatex
keep_tex: true
includes:
in_header: etc\pre.sty
fontsize: 11pt
---
Min example 2 - this does not work when pre.sty is stored in the etc subdir.
Contents of pre.sty
\usepackage{booktabs}
答案1
得分: 1
使用斜杠:etc/pre.sty
。
英文:
Use the forward slash: etc/pre.sty
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论