R Studio change pandoc .tex template

北城以北 提交于 2019-12-06 08:20:46

问题


I want to use a different latex template for rendering R markdown version 2.

I found the following suggestions:

a) location of template

system.file("rmd/latex/default.tex", package="rmarkdown)

b) change of YAML front matter

---
...
output:
   pdf_document:
      template: mytemplate.tex
---

However, his does not seem to be the correct template location for R Studio/ Pandoc, as I get the following error message:

pandoc.exe: Could not find data file templates\mytemplate.tex

回答1:


Ok, I think I have the answer, the default directory for Pandoc can be found here:

system("pandoc -v")

If the folder does not exist, create it as well as a subfolder called templates and copy your tex template here.

You can see the original template here:

system("pandoc -D latex")



回答2:


Not sure if you figured it out or not but this may be a useful link. http://rmarkdown.rstudio.com/developer_document_templates.html I am finding myself in the same boat as you wanting to create a custom template to output to PDF.




回答3:


Just put the style.tex file in the same folder as the markdown file does now works for me.



来源:https://stackoverflow.com/questions/26604138/r-studio-change-pandoc-tex-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!