Tomasz Wojtas
Tomasz Wojtas

Reputation: 796

R markdown - how to switch font to Times New Roman?

I gave up. I can't find any working solution to change font type in my R Markdown document. I tried a lot of stuff, for example:

---
output: word_document    
sansfont: Calibri Light
---

But RStudio just ignores it. Can you help me? I need Times New Roman font in my pdf/word document.

Regards

Upvotes: 11

Views: 21582

Answers (2)

Nova
Nova

Reputation: 5891

Another option: for a pdf document, I used:

output: pdf_document
fontfamily: arev

In my YAML header.

Upvotes: 7

Nishant Panicker
Nishant Panicker

Reputation: 131

This worked for me. Try using mainfont instead of sansfont, and set latex_engine to either xelatex or lualatex.

---
output: 
  pdf_document:
    latex_engine: xelatex
mainfont: Times New Roman
---

Upvotes: 13

Related Questions