I am producing reports using rmarkdown. When knitting a PDF
---
title: "Untitled"
output: pdf_document
---
I would like to specify the font to be used in creating the PDF. The official documentation (see section "LaTeX Options) says I can do this.
However, I've never used LaTeX and fail to understand how such selection can be made in YAML options at the top of the .Rmd document used by rmarkdown
package.
Question: How do I change the font in the PDF produced by rmarkdown?
sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_1.0.0 RODBC_1.3-10 knitr_1.6 dplyr_0.2
I've never used LaTeX and don't want to get into it at this very mom
geometry
in the YAML header (it sets it tomargin=1in
), so might lead you to try the other arguments in the same manner. I'm guessing you have MiKTeX installed which does includexelatex
, so you allegedly can setmainfont
in a similar fashion. I don't have it accessible at the moment, but try:output:\n pdf_document:\n mainfont: Times New Roman
(\n implies CR and indentation) and see what that does. You probably needlatex_engine: xelatex
too. – Racquelracquet