Here is a reprex :
---
date : 2018-May-27
output:
pdf_document:
latex_engine: xelatex
monofont: "Computer Modern"
title: "Testing Rmarkdown"
---
```{r,comment = NA}
Gender <- gl(2,1000,labels = c("Men","Women"))
SmokerM <- sample(c("Y","N"),1000,replace = T , prob = c(.3,.7))
SmokerW <- sample(c("Y","N"),1000,replace = T , prob = c(.5,.5))
Smoker <- c(SmokerM,SmokerW)
mydata <- data.frame(Gender,Smoker)
table(mydata$Gender,mydata$Smoker)
```
This is some running text(in the Computer Modern font).
I want only ONE font in the document, ie. the default font for the text. To do this I have added the line monofont: "Computer Modern" (by this I am trying to tell the software to create the output of code in the same font as the text). I get the following error when I try to create a PDF from the above Rmarkdown file. I have a Ubuntu system. How can I fix this ?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "Computer Modern" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
This is a follow up query to the original query posted here: [Original Query] Fonts for Rmarkdown document