更新时间:2023-12-03 21:09:46
我设法通过某种变通方法做到了这一点:
I managed to do this with kind of a workaround:
我使用R函数在yaml头文件中导出资源文件夹的绝对路径:
I derive the absolute path of the resource folder in the yaml header with an R function:
---
output:
myPackage::myCustomFunction
resource-folder: '`r system.file("rmarkdown/templates/myPackage/resources/", package="myPackage")`'
---
在我使用的 tex 模板中:
Inside my tex tamplate I use:
\includegraphics[]{$resource-folder$myImage.png}
这样我就可以将我的图像与 tex 模板一起放在资源文件夹中,而不必将它们与文档的每个新实例一起复制.
This way I can place my images in the resource folder along with the tex template and don't have to copy them along with each new instance of the document.