knitting to pdf
November 10, 2021
I’ve never really liked the default font that is used when Rmd knits to pdf. When knitting to pdf, R uses LaTex (which is why you often need to install the tinytex
package) and the default in LaTex is called Computer Modern.
You can customise fonts, size, and line spacing in the yaml. To change the font style you need to use a LaTex engine like xelatex and specify the mainfont (your main text) and monofont (code chunks and output).
Adjust linespacing with the linestretch parameter and use fontsize to change the sizing. Note- LaTex will only do 10 pt, 11 pt, or 12 pt font.
Then your knitted pdf will look like this!
- Posted on:
- November 10, 2021
- Length:
- 1 minute read, 114 words