微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Rmarkdown中一组特定行的Calibri字体

如何解决Rmarkdown中一组特定行的Calibri字体

这是PDF Rmarkdown的可复制示例:

---
title: "Untitled"
output: pdf_document
---

```{r setup,include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting Syntax for authoring HTML,PDF,and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

我需要 ”这是R Markdown文档。Markdown是用于编写HTML,PDF和MS Word文档的简单格式语法。有关使用R Markdown的更多详细信息,请参见http://rmarkdown.rstudio.com。 “

使用Calibri字体,而不是认字体。

解决方法

如果可以将乳胶引擎设置为xelatex,则可以使用\fontspec{Calibri}将字体设置为Calibri,然后使用\normalfont返回默认字体。

---
title: "Untitled"
output: 
  pdf_document: 
    latex_engine: xelatex
---

## R Markdown

\fontspec{Calibri} 

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML,PDF,and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

\normalfont

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

knitted pdf

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。