【问题标题】:How to install the Courier font in RStudio for ggplot2如何在 RStudio 中为 ggplot2 安装 Courier 字体
【发布时间】:2019-12-23 10:33:10
【问题描述】:

我的操作系统更新后,我的 Rstudio 中的字体消失了,特别是 Courier 我需要 ggolot2。

解决我安装的问题:

library(extrafont)

然后:

font_import()

现在我有几种字体,但它们大多不受欢迎。例如:

fonts()
"aakar" "Abyssinica SIL"  "Ani" "AnjaliOldLipi" "Chilanka"  "DejaVu Sans"            
"DejaVu Sans Mono" "DejaVu Serif" "Droid Sans Fallback" "Dyuthi" 

如何安装我需要的Courier字体??

我跑:

  • Ubuntu 18.04
  • R 版本 3.4.4
  • RStudio 版本 1.2.5033

【问题讨论】:

  • 我使用R 3.6.2RStudio 1.2.5.001。在font_import()之后,fonts()显示包括“Courier New”在内的199种字体。

标签: r rstudio


【解决方案1】:

只需将样式添加到 .Rmd 文件中的 yaml 定义中,如下所示:

---
title: "R Notebook"
output:
  html_document:
    css: style.css
---

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.

然后在同一文件夹中创建一个style.css 文件并粘贴此代码:

body{
  font-family: "Courier New", Courier, monospace;
  font-size: 16pt;
}

然后重新编织它,它会起作用。

如果您的 Ubuntu 系统中没有 Courier 字体,您可以通过 here 安装它

【讨论】:

    猜你喜欢
    • 2014-10-20
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 2019-01-10
    • 2021-06-15
    • 1970-01-01
    • 2016-07-10
    相关资源
    最近更新 更多