【发布时间】:2018-11-06 01:53:29
【问题描述】:
这是一个代表:
---
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).
我只想要文档中的一种字体,即。文本的默认字体。为此,我添加了 monofont: "Computer Modern" 行(通过此我试图告诉软件以与文本相同的字体创建代码输出)。当我尝试从上述 Rmarkdown 文件创建 PDF 时出现以下错误。我有一个 Ubuntu 系统。 我怎样才能解决这个问题 ?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! 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>.
!...............................................
这是对此处发布的原始查询的后续查询:[原始查询]Fonts for Rmarkdown document
【问题讨论】:
-
你为什么要这样做?我发现在源代码中使用可变宽度字体非常不寻常。
-
我被要求创建一个看起来像 SINGLE 文档的文档。我的具体指示之一是使代码的输出看起来像文档中的文本。
标签: r pdf yaml r-markdown