'Custom html template in Rstudio using Rmarkdown without having to create a package?

I'm trying to create a few custom templates (one for html and one for pdfs) which use specific structures and fonts, with the aim of using these in Rstudio:

enter image description here

The reason I want to do this is that there doesn't seem to be a consistent way in which to change some parameters across pdf/html such as changing font in the document, and thus I'm having to do this differently across those two file types.

I've poured over the endless blogs/pdf articles about how to do this, with the most pertinent probably being this: https://bookdown.org/yihui/rmarkdown/document-templates.html

However, from what I've seen you need to create a package in order to add a template to this list. Is that the case?, or can I simply create a template and add it to some folder somewhere (i.e. inst/rmarkdown/templates)?

Thank you



Solution 1:[1]

You can do this by creating a package. And it is not as difficult as you think it would be. Create a package in RStudio. Then in the console, write

usethis::use_rmarkdown_template

This will create the folder structure required for the template to work. You will just have to edit the skeleton.rmd file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eva