Reputation: 1019
I need to change the font of a PDF Markdown document. This question suggests that when changing the font in a PDF Markdown you need to change the Latex engine by updating the YAML to include:
---
output:
pdf_document:
latex_engine: xelatex
sansfont: Calibri Light
---
However, is it possible to change the Latex engine when using bookdown
? I have tried to change the YAML to the following:
---
output:
pdf_document: bookdown::pdf_document2:
latex_engine: xelatex
sansfont: Calibri Light
---
but get the error:
Error in yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: mapping values are not allowed in this context at line 4, column 40
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>
Execution halted
I have also looked at the bookdown
documentation but couldn't find any reference to the Latex engine. Does anyone know if it's possible to change the Latex engine with bookdown
, or if there is another way to change the font when knitting to PDF?
Upvotes: 0
Views: 2762
Reputation: 26823
The correct syntax for the YAML header is
---
output:
bookdown::pdf_document2:
latex_engine: xelatex
sansfont: Calibri Light
---
Note that pdf_document
, which is short for rmarkdown::pdf_document
, is fully replaced by bookdown::pdf_document2
.
Upvotes: 3