Is there any straightforward solution to get a sans serif font in rmarkdown PDF tables? The font in normal text, code, and equations should stay unchanged. I'm demanding on xtables
.
Example:
---
title: ''
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=TRUE)
```
```{r ranking tradeoff, results='asis', message=FALSE, echo=FALSE}
library(xtable)
print(xtable(mtcars[1:2, ])
, include.rownames=TRUE
, comment=FALSE
)
```
The text in the table should appear in sans serif.
I tried this solution but it didn't work for me. The fonts were not found, albeit the powershell font check turned out differently. However the fonts are named e.g. "Liberation Sans" and not "LiberationSans". Hence I tried to specify sansfont: "Liberation Sans"
without success. Also there appears to be a package clash asmath
vs mathtools
when using xelatex
.