Bookdown PDF Book Font Change

Viewed 255

I'm using Bookdown to generate an ePub and a PDF of a book I'm writing. The book is generating fine, but I am trying to make a change to the font for the PDF from a serif font to a sans serif font. I tried what was listed in this StackOverflow post but it didn't work for me. Here are the contents of my preamble.tex file:

\usepackage{fontspec}
\setmainfont{Arial} # also have tried sansfont and arial, which I've seen in other places

and the contents of the _output.yml file:

bookdown::pdf_book:
  pandoc_args: --listings
  includes:
    in_header: preamble.tex
  latex_engine: xelatex # with this line, I get an error that the font can't be found; if I remove it, then the error doesn't show up and the font is still the default one

As far as I can tell, this should work, but it hasn't so far. Any suggestions on what to do to change the font?

0 Answers
Related