R Markdown – changing font size and font type in html output

I think fontsize: command in YAML only works for LaTeX / pdf. Apart, in standard latex classes (article, book, and report) only three font sizes are accepted (10pt, 11pt, and 12pt).

Regarding appearance (different font types and colors), you can specify a theme:. See Appearance and Style.

I guess, what you are looking for is your own css. Make a file called style.css, save it in the same folder as your .Rmd and include it in the YAML header:

    css: style.css

In the css-file you define your font-type and size:

/* Whole document: */
  font-family: Helvetica;
  font-size: 16pt;
/* Headers */
  font-size: 24pt;

Leave a Comment