使用“ rticles”包时如何在RMarkdown中更改字体?

问题描述 投票:2回答:1

我最近在R中安装了“ rticles”软件包,以在RMarkdown中自动设置期刊文章模板。到目前为止,我一直对它印象深刻,但是我希望能够更改字体。当然可以这样做,但是我一直找不到任何在线资源来说明如何做到这一点。

我有兴趣编织成PDF。

这是我的RMarkdown脚本顶部的YAML:

---
title: This title
author:
  - name: This author
    email: [email protected]
    affiliation: This institute
address:
  - code: This institute
    address: Street, City, State, etc.
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: "fun, happiness"
journal: "This Elsevier Journal"
date: "`r Sys.Date()`"
output: rticles::elsevier_article
---

我通过在R中运行以下代码行生成了此代码:

rmarkdown::draft("Test.Rmd", template = "elsevier_article", package = "rticles")

所以我可以在所有这些位置控制字体?在使用“ rticles”之前,我曾经通过更改乳胶引擎然后按如下所示指定字体来更改字体:

---
title: This title
author: "This author"
date: "`r Sys.Date()`"
output:
  pdf_document:
    toc: yes
    toc_depth: 4
    fig_caption: TRUE
    df_print: kable
    latex_engine: xelatex
mainfont: Calibri Light
---

是否有可能在“文章”中做类似的事情?

r latex yaml r-markdown
1个回答
0
投票

控制字体的方式类似于您之前所做的操作:

---
title: This title
author:
  - name: This author
    email: [email protected]
    affiliation: This institute
address:
  - code: This institute
    address: Street, City, State, etc.
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: "fun, happiness"
journal: "This Elsevier Journal"
date: "`r Sys.Date()`"
output:
  rticles::elsevier_article:
    latex_engine: xelatex
mainfont: Calibri Light        
---
© www.soinside.com 2019 - 2024. All rights reserved.