In Rstudio rmarkdown, how to add new html themes from Bootswatch?




I'm building a rmarkdown file and trying to do the following

title: "test"
author: "test" 
        toc: true
        toc_float: true
        theme: solar

And i got the following error:

rror in match.arg(theme, themes()) : 
  'arg' should be one of "default", "cerulean", "journal", "flatly", "readable", "spacelab", "united", "cosmo", "lumen", "paper", "sandstone", "simplex", "yeti"
Calls: <Anonymous> -> <Anonymous> -> base -> match.arg

How could i add new themes?


Right now themes for rmarkdown is still using bootstrap 3.3.7. You may consider using this bootswatch 3 page for references.


I think i found the solution

  1. Download bootstrap.css file from
  2. Put the bootstrap.css file in the same folder with your rmd file.
  3. Change rmd code to this
title: "test"
author: "test" 
        css: bootstrap.css


Hi there! If your question's been answered (even by yourself!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here's how to do it.


Thanks for the reminder.