Set alternate fonts in r markdown using fontspec


I'm trying to format a report with 2 different fonts: 1 for the title and headings, another for the main body of text. I've used setmainfont and setsansfont but no idea how to select the sans for the body. The whole text comes up in the main font.
Any help very much appreciated.

latex_engine: xelatex
toc: true
toc_depth: 2
number_sections: true
df_print: kable
fig_width: 7
fig_height: 6
fig_caption: true
geometry: margin=1in

  • \usepackage[utf8]{inputenc}
  • \usepackage{booktabs}
  • \usepackage{fontspec}
  • \setmainfont{GFS Didot}
  • \setsansfont{Raleway}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.